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.
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
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.
Set Section Data Sequence (this is main section)
Set proper Level Break. This is important to build structure of target table F4106
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
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
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)
(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
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
For this driver section set Data Sequence to arrange it as P4106 shows data
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)
(Optionally) Rename Level Break Header Section as LvHdr_Lot for easier read/maintenance
(Continue) Create level break footer and (optionally) rename it
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.)
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)
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
Implement increment at the event of After Last Object Printed
17. Update it whenever a new row gets read
(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.
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,
* F4106.ACRD: to store PO Receipt Unit Cost (F43121.PRRC)
* F4106.URAT: to store current row numbers (e.g., 1, 2, 3, ... n)
* F4106.URAB: to store total count (e.g., n)
* F4106.URDT: to store PO Receipt date (F43121.RCDJ) by doing this, we do not need to read F43121 again in update section below,
Create a section to update new records if the value is different from exiting value and (optionally) rename it
Set Data Selection (the values stored in F4106 through driver section is to be restored at the end of update)
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,
Do not handle when Current row number is not max row number
If needed, compute a new Unit Price (with/without markup)
Compare it with as-is value from F4106
Only when newly computed value is different from current unit price take action