Case Study on Batch Item Base Price Creation (F4106)

Purpose of Document

This note is to explain possible implementation of Batch Item Base Price File. Currently F4106.EXDJ (Expiry Date) is primary key so it does not allow user to update. To fulfill this, 1st Insert a new record and Delete current row then Insert a brand new record.


Table of Contents

One of possible way to implement this is,

Business Requirement:


Based on PO Receipt (or during PO receipt) item price has to be computed as below,
* If record does not exist from F4106 create a record: This data is to be created on the fly through F4111EndDocument routine by calling BSFN X4106C - CopyWritePriceRecords.
* If record does exist then update the last row and insert a new row with latest unit price

Supposed that there are 3 exiting rows from F4106 as below,

Row Number Max Row Action Detail Action
1 3 Do not handle this row
2 3 Do not handle this row
3 3 Handle this row 1. Insert a new row with a new EXDJ (= Input Date - 1)
2. Delete Current Row (to avoid primary key error)
3. Insert a new row where EXDJ = The last date of CENTCHG Year


Result is to be,

Row Number Max Row Unit Price Expirary Date
1 4
2 4
3 4 As-is Unit Price EXDJ = Input Date - 1
4 4 New Unit Price EXDJ = Last Date of CENTCHG


Back To Top

Technical Specification:


Back To Top

Possible Implementation:


Possibly,
Report Design Aid Layout

  1. To create triggering section (F4111), choose suitable business view (e.g., V4312E) or any business view which has basic information for item cost/price
    : Select/choose columns you want to show on PDF (in real environment this section can be hidden because this section is just driver section before update). For this example, ITM, MCU, LOCN, LOTN, RCDJ and PRRC is selected.
  2. Set Section Data Sequence (this is main section)
  3. Set proper Level Break. This is important to build structure of target table F4106
  4. Since this report is to be called from other routine, report data structure is created based on header information (one batch). Create Report Data Structure based on DOCO, DCTO and KCOO this is most basic unit of transaction. Now this report is able to take/give above three parameters
  5. Create Sub-section based on F4106 (this is to create driver section). Through this section, we are going to update some columns in F4106 to enable to update it conditionally. This sction updates Current row number and Max Row Number because the number of row from F4106 can be vary. The reason for this driver section is that only the last row (where Current Row = Max Row) as above table reads
  6. Set all the columns we have chosen in F43121 as Global variable which can be referenced by other sections if needed. For this example, some crucial fields (e.g., PRRC and RCDJ are going to use in updating F4106 to determine whether to update or not)
  7. (Continue) Create Sub-section join using F4106 based on F43121: For this example, business view V4106B is used because this business view is able to get all the columns in F41061
  8. Subsection join is defined based on target table (itm, mcu, locn, lotn) so data selection for this section is to be inherited by calling routine F43121: So do not set any data selection for this Driver Section and Name it as Driver F4106 for easier maintenance of UBE
  9. For this driver section set Data Sequence to arrange it as P4106 shows data
  10. Create level break header section based on this (sub-section) Driver Section to initialize any variable which need to be set whenever the change made in Lot (in case you need to populate data up to UOM the last level break has to be UOM)
  11. (Optionally) Rename Level Break Header Section as LvHdr_Lot for easier read/maintenance
  12. (Continue) Create level break footer and (optionally) rename it
  13. Get total number of rows using Define Aggregations: This is to update F4106.URAB (User Reserved Number) to indicate total number of rows in a certain combination (e.g., ITM, MCU, LOCN, LOTN etc.)
  14. Add one report variable using numeric value to get/set current row to handle and set it as Global Variable (because we are going to initialize this in level break header and increase this value after update is performed)
  15. Initialize the Global Variable created above at Do Section of Level Break Header, so whenever the last level break take place the value will be set 1
  16. Implement increment at the event of After Last Object Printed
  17. 17. Update it whenever a new row gets read
  18. (Important) this update sets F4106.URAT (current row), URDT (=F43121.RCDJ) and ACRD (F43121.PRRC) all these temp value are to be used to determine which value to update and whether we need to update it or not.
  19. Update Total Count at Level Break Footer Section (F4106.URAB): PC Variable is used to update a certain column (PC value in level break is equivalent to BC value in main section because level break is handled before main section started to call) Now Driver Section is able to update some columns as below,
  20. Create a section to update new records if the value is different from exiting value and (optionally) rename it
  21. Set Data Selection (the values stored in F4106 through driver section is to be restored at the end of update)
  22. Get Audit information to indicate this routine is custom routine at Initialize Section. By doing this, we can call this only once and UPMJ and UPMT is primary key for this example. So this routine should not create more than 1 rows at a time.Important: F4106.EXDJ is primary key so you are not able to update. So though it appears to be updated in actual fact, it inserts a new record and deletes it. Possible code to modify the last row, possibly,
  23. Run it and verify output

Back To top


Summary:

  1. Based table (e.g., F43121, F4111 etc.)
  2. Driver Section based on F4106 this section is to update a certain columns in F4106
  3. Level break Header to initialize global variables whenever level break take place
  4. Level Break Footer to update total number or rows per level break
  5. Update Section based on F4106 to the target set by Driver Section
  6. Level Break Footer: to restore back value updated in Driver Section