This document is to guide possible way to implement partial reversal based on workaround suggested for below bugs:
Currently P43250 allows user to reverse partial quantity however this action corrupts data from F43121/F4111/F0911 when Landed cost is attached to receipt by reversing full amount for Landed cost lines. And same problem occurs in computing standard cost. So this document is to show example to work around this issue because this cause huge impact on integrity (quantity vs. value) when there is frequent transaction.
Additionally, this document is to explain basic flow of routing and landed cost which may help you to debug issue.
This document is to explain possible way to implement this not to take workaround (Reverse full quantity and move to stock for balance quantity). So the implmentation mentioned here is same with this workaround in terms of logic.
Table of Contents:
Business Scenario:
A. F43121 (Purchase Order Receiver File)
[As - Is]
F4312 | ActionTaken | M T |
No of Lines | 2nd Item Number | Remark | L C | Cost Rule | Level Cost | Received Not Vouch Account | Quantity Ordered | Quantity Open | Quantity Received | Quantity Stocked | Unit Cost | Extended Cost | Amount Open | Amount Received | Program ID |
1. Full Receipt | 1 | 1 | KOPI-C | DML | 30.4111 | 10 | 10 | 10 | 150 | 1,500.00 | 1,500.00 | EP4312 | ||||||
2. Move to Stock | 1 | 1 | KOPI-C | 1 | DML | 30.4111 | 10 | 10 | 10 | 10 | 150 | 1,500.00 | 1,500.00 | EP43250 | ||||
1 | 2 | KOPI-C | Harbor Fee | 2 | 3 | 30.4184 | 10 | 10 | 50 | 500 | 500 | 500 | EP4312 | |||||
1 | 3 | KOPI-C | Brokerage Fees | 2 | 5 | 30.4184 | 10 | 10 | 30 | 300 | 300 | 300 | EP4312 | |||||
3. Return to DOCK | 1 | 1 | KOPI-C | DML | 30.4111 | 10 | 10 | 10 | 8 | 150 | 1,500.00 | 1,500.00 | EP43250 | |||||
4 | 2 | KOPI-C | Harbor Fee | 2 | 3 | 30.4184 | 10 | 10 | 50 | 500 | 500 | 500 | EP43250 | |||||
4 | 3 | KOPI-C | Brokerage Fees | 2 | 5 | 30.4184 | 10 | 10 | 30 | 300 | 300 | 300 | EP43250 |
Full Quantity/Amount is reversed though only 80% are reversed through P43250
[To - Be]
F4312 | ActionTaken | M T | No of Lines | 2nd Item Number | Remark | L C | Cost Rule | Level Cost | Received Not Vouch Account | Quantity Ordered | Quantity Open | Quantity Received | Quantity Stocked | Unit Cost | Extended Cost | Amount Open | Amount Received | Program ID |
1. Full Receipt | 1 | 1 | KOPI-C | DML | 30.4111 | 10 | 10 | 10 | 150 | 1,500.00 | 1,500.00 | EP4312 | ||||||
2. Move to Stock | 1 | 1 | KOPI-C | 1 | DML | 30.4111 | 10 | 10 | 10 | 10 | 150 | 1,500.00 | 1,500.00 | EP43250 | ||||
1 | 2 | KOPI-C | Harbor Fee | 2 | 3 | 30.4184 | 10 | 10 | 50 | 500 | 500 | 500 | EP4312 | |||||
1 | 3 | KOPI-C | Brokerage Fees | 2 | 5 | 30.4184 | 10 | 10 | 30 | 300 | 300 | 300 | EP4312 | |||||
3. Return to DOCK | 1 | 1 | KOPI-C | DML | 30.4111 | 10 | 10 | 10 | 10 | 150 | 1,500.00 | 1,500.00 | EP43250 | |||||
1 | 2 | KOPI-C | Harbor Fee | 2 | 3 | 30.4184 | 8 | 8 | 50 | 400 | 400 | 400 | ER43092Z1I | |||||
1 | 3 | KOPI-C | Brokerage Fees | 2 | 5 | 30.4184 | 8 | 8 | 30 | 240 | 240 | 240 | ER43092Z1I | |||||
4 | 2 | KOPI-C | Harbor Fee | 2 | 3 | 30.4184 | 10 | 10 | 50 | 500 | 500 | 500 | EP43250 | |||||
4 | 3 | KOPI-C | Brokerage Fees | 2 | 5 | 30.4184 | 10 | 10 | 30 | 300 | 300 | 300 | EP43250 |
Reversed full quantity/amount than move to stock balance 80%
B. F4111 (Item Ledger File)
[As - Is]
F4111 | 2nd Item Number | Line Number | JE Line Number | Transaction Explanation | Trans QTY | Unit Cost | Extended Cost/Price | Program ID | |
2. Move to Stock | KOPI-C | 1 | Inventory Receipt | 10 | 150 | 1,500.00 | EP43250 | ||
KOPI-C | 1 | 3 | Landed Cost | 80 | 800 | EP43291 | |||
3. Return to DOCK | KOPI-C | 1 | Inventory Receipt | 10 | 150 | 1,500.00 | EP43250 | ||
KOPI-C | 1 | 3 | Landed Cost | 80 | 800 | EP43291 | |||
KOPI-C | 1 | Inventory Receipt | -2 | 150 | -300 | EP43250 | |||
KOPI-C | 1 | Landed Cost | 80 | -800 | EP43291 |
Full amount is reversed for Landed Cost
[To - Be]
F4111 | 2nd Item Number | Line Number | JE Line Number | Transaction Explanation | Trans QTY | Unit Cost | Extended Cost/Price | Program ID | |
2. Move to Stock | KOPI-C | 1 | Inventory Receipt | 10 | 150 | 1,500.00 | EP43250 | ||
KOPI-C | 1 | 3 | Landed Cost | 80 | 800 | EP43291 | |||
3. Return to DOCK | KOPI-C | 1 | Inventory Receipt | 10 | 150 | 1,500.00 | EP43250 | ||
KOPI-C | 1 | 3 | Landed Cost | 80 | 800 | EP43291 | |||
KOPI-C | 1 | Inventory Receipt | -10 | 150 | -1,500.00 | EP43250 | |||
KOPI-C | 1 | Landed Cost | 80 | -800 | EP43291 | ||||
KOPI-C | 1 | Inventory Receipt | 8 | 150 | 1200 | ER43092Z1I | |||
KOPI-C | 1 | Landed Cost | 80 | 640 | ER43092Z1I |
Full Amount is reverted then balance 80% is moved to stock (Harbor Fee: 400 and Brokerage: 240 which are 80% of 500 and 300 respectively)
Simplified routine for this work around:
1. when partial reversal is tried, then reverse full quantity (and save off balance quantity)
2. move balance off quantity to stock
Application interface:
1. when partial reversal is tried, reverse full quantity (and save off balance quantity): through P43250
2. move balance off quantity to stock: through R43092Z1I (Receipt Routing Unedited Transactions Inbound Processor).
The reason for this implementation is that we can't call Edit Line routine twice because P43250 shall create only one Cache Job Number for Routing, Inventory and G/L. So we need to wait for full reversal through interactive application then we move balance quantity to stock through another routine (for this example R43092Z1I).
Detail Implementation:
1. Create hidden GC column: This is to check whether partial reversal is entered or not (DD item used EV01). In case multiple lines are entered for this screen, this can handle row by row basis.
Example:
GC Partial Rev (Hidden).
2. Save off EDI Batch Number: This value is to be used in populating F43092Z1. Report Interconnection in calling R43092Z1I at the end of Post OK button clicked. This is possible because P43250 does not have transaction processing in calling End Doc routine. But R43092Z1I must be fired.
Example:
Application : Receipt Routing Movement and Disposition (P43250)
FORM: Receipt Routing Movement [HEADERLESS DETAIL] (W43250L)
EVENT: Post Dialog is Initialized
// This value is to be used in inserting data into F43082Z1 at Row is Exited/changed - Asynch event && RI (Report Interconnection)
EDI Batch Number, Get Next Number (EDBTGetNextNumber - N4700060)
VA frm_CUSTOM_EdiBatchNo_EDBT <- BF szEdiBatchNumber
3. Check whether partial reversal is tried or not: We put this into GC hidden column because this is to be used in writing F43092Z1
Application : Receipt Routing Movement and Disposition (P43250)
FORM: Receipt Routing Movement [HEADERLESS DETAIL] (W43250L)
CONTROL: GRIDCOL Move Quantity
EVENT: Col Exited & Changed - Inline
If GC Move Quantity is greater than GC Quantity at Operation
Set Grid Cell Error(FC Grid, <Currently Selected Row>, GC Move Quantity, "2717")
Disable Grid(FC Grid, <Currently Selected Row>, GC O P)
Else
Enable Grid(FC Grid, <Currently Selected Row>, GC O P)
If GC Oper Code is equal to "STK"
And GC Move Quantity is not equal to GC Quantity at Operation
GC Partial Rev (Hidden) = "Y"
Else
GC Partial Rev (Hidden) = "N"
End If
End If
4. Call F43092 Edit Line conditionally: Edit Line gets called to cancel off full quantity
Application : Receipt Routing Movement and Disposition (P43250)
FORM: Receipt Routing Movement [HEADERLESS DETAIL] (W43250L)
EVENT: Row Exit & Changed - Asynch
evt_CUSTOM_UserId
evt_CUSTOM_DateUpdated
evt_CUSTOM_TimeLastUpdated
evt_CUSTOM_WorkStationId
evt_CUSTOM_EdiTransactNumber
evt_CUSTOM_TypeTrans_TYTN
evt_CUSTOM_DirIndicator_DRIN
evt_CUSTOM_TransAction_TNAC
evt_CUSTOM_QtyBal_QTYO
evt_CUSTOM_ProgramId_PID
evt_CUSTOM_EdiLineN_EDLN
evt_CUSTOM_OperSeq_OPRS
If VA frm_cRowExitFlag_EV01 is not equal to "Y"
If VA grd_cEditLineHasRunFlag_EV01 is not equal to "O"
// Check partial reversing Scenario
// Through P43250 we are going to reversal full quantity
If GC Partial Rev (Hidden) is equal to "Y"
// Balance quantity will be written to F43092Z1 to handle DOCK --> STK after reversing is performed fully by calling R43092Z1I Set QTYO = Full Quantity
F43092 Edit Line
// below parameters are modified
GC Oper Code -> BF szOperationCodeFrom
GC Move Oper -> BF szOperationCodeTo
GC Quantity at Operation -> BF mnQuantityAtOperation
GC Quantity at Operation -> BF mnQuantityToMove
// Check whether Edit Line contains any error (No error then write F43092Z1) Currently F43092Z1 is written only for Disposition so this option appears to be safe!
// 1. Get Audit Information for insert of data into Interop Inbound table
Get Audit Information
VA evt_CUSTOM_UserId <- BF szUserName
VA evt_CUSTOM_DateUpdated <- BF jdDate
VA evt_CUSTOM_TimeLastUpdated <- BF mnTime
VA evt_CUSTOM_WorkStationId <- BF szWorkstation_UserId
// 2. Get EDI Batch Number (Part of primary key)
// In case multiple rows are handled, EDI batch has to be called only once from From Level Event (move to Post Dialog is Initialized event) This value will be use for RI variable per transaction
// 3. Convert Order Number to String because EDI Document Number is String Data type
Convert Math_Numeric To String
GC Order Number -> BF mnMathNumeric01
VA evt_CUSTOM_EdiTransactNumber <- BF szString
// 4. Assign basic values to make use of default Interop option JDERR (Receipt Routing)
VA evt_CUSTOM_TypeTrans_TYTN = "JDERR"
VA evt_CUSTOM_DirIndicator_DRIN = "1"
VA evt_CUSTOM_TransAction_TNAC = "A"
// 5. Set Quantity Operation: GC Quantity at Operation - GC Move Quantity
VA evt_CUSTOM_QtyBal_QTYO = [GC Quantity at Operation]-[GC Move Quantity]
// 6. Indicate this code is written through custom routine CUSTOM
VA evt_CUSTOM_ProgramId_PID = "CUSTOM"
// 7. Set OPRS = GC Opers - 1
VA evt_CUSTOM_OperSeq_OPRS = [GC Opr Seq]-1
// 7. Check whether same data does exit on primary key of F43092Z1
F43092Z1.Fetch Single
VA evt_CUSTOM_UserId = TK EDI - User ID
VA frm_CUSTOM_EdiBatchNo_EDBT = TK EDI - Batch Number
VA evt_CUSTOM_EdiTransactNumber = TK EDI - Transaction Number
GC Line Number = TK EDI - Line Number
If SV File_IO_Status is equal to CO SUCCESS
VA evt_CUSTOM_EdiLineN_EDLN = [GC Line Number]+1
Else
VA evt_CUSTOM_EdiLineN_EDLN = GC Line Number
End If
F43092Z1.Insert
VA evt_CUSTOM_UserId -> TK EDI - User ID
VA frm_CUSTOM_EdiBatchNo_EDBT -> TK EDI - Batch Number
VA evt_CUSTOM_EdiTransactNumber -> TK EDI - Transaction Number
VA evt_CUSTOM_EdiLineN_EDLN -> TK EDI - Line Number
VA evt_CUSTOM_TypeTrans_TYTN -> TK Type - Transaction
VA evt_CUSTOM_DirIndicator_DRIN -> TK Direction Indicator
VA evt_CUSTOM_TransAction_TNAC -> TK Transaction Action
GC Order Co -> TK Order Company (Order Number)
GC Order Number -> TK Document (Order No, Invoice, etc.)
GC Or Ty -> TK Order Type
GC Ord Suf -> TK Order Suffix
GC Line Number -> TK Line Number
GC No of Lines -> TK Number of Lines
GC Branch/ Plant -> TK Business Unit
VA evt_CUSTOM_OperSeq_OPRS -> TK Sequence Number - Operations
GC Move Oper -> TK Code - Operation
GC UM -> TK Unit of Measure as Input
GC Quantity at Operation -> TK Units - At Operation
GC Location -> TK Location
GC Short Item No -> TK Item Number - Short
GC Address Number -> TK Address Number
FC GL Date -> TK Date - For G/L (and Voucher)
VA evt_CUSTOM_QtyBal_QTYO -> TK Units - Moved
GC Lot/Serial -> TK Lot/Serial Number
FC Receipt Date -> TK Date - Order/Transaction
GC Oper Code -> TK Code - To Operation
VA evt_CUSTOM_UserId -> TK Transaction Originator
VA evt_CUSTOM_UserId -> TK User ID
VA evt_CUSTOM_ProgramId_PID -> TK Program ID
VA evt_CUSTOM_WorkStationId -> TK Work Station ID
VA evt_CUSTOM_DateUpdated -> TK Date - Updated
VA evt_CUSTOM_TimeLastUpdated -> TK Time of Day
// Set Error if it fails to insert F43092Z1 because it won't move balance quantity to stock
If SV File_IO_Status is not equal to CO SUCCESS
Set Grid Cell Error(FC Grid, <Currently Selected Row>, GC Move Quantity, "0001")
Else
End If
Else
// usual routing - in calling F43092EditLine no parameters are modified
F43092 Edit Line
End If
End If
Analyze standard routine for this implemenation as below,
F43092EditLine - NXT43092 (F43092 Edit Line) is handling data based on Grid column value in P43250 as below,
Partial Return | Full Return | Partially move to Stock |
---|---|---|
… | ||
IN->[ 10] szOperationCodeFrom [STK] | IN->[ 10] szOperationCodeFrom [STK] | IN->[ 10] szOperationCodeFrom [DOCK] |
IN->[ 11] szOperationCodeTo [DOCK] | IN->[ 11] szOperationCodeTo [DOCK] | IN->[ 11] szOperationCodeTo [STK] |
IN->[ 12] szUnitOfMeasureFrom [KG] | IN->[ 12] szUnitOfMeasureFrom [KG] | IN->[ 12] szUnitOfMeasureFrom [KG] |
IN->[ 13] szP43250Version [ORCL0001] | IN->[ 13] szP43250Version [ORCL0001] | IN->[ 13] szP43250Version [ORCL0001] |
IN->[ 14] cReverseDispositionFlag [ ] | IN->[ 14] cReverseDispositionFlag [ ] | IN->[ 14] cReverseDispositionFlag [ ] |
IN->[ 15] mnQuantityAtOperation [10.0000] | IN->[ 15] mnQuantityAtOperation [10.0000] | IN->[ 15] mnQuantityAtOperation [10.0000] |
IN->[ 16] mnQuantityToMove [2.0000] | IN->[ 16] mnQuantityToMove [10.0000] | IN->[ 16] mnQuantityToMove [8.0000] |
… | ||
IN->[ 41] mnF43092Jobnumber [0] | IN->[ 41] mnF43092Jobnumber [0] | IN->[ 41] mnF43092Jobnumber [0] |
IN->[ 42] mnF43121JobNumber [0] | IN->[ 42] mnF43121JobNumber [0] | IN->[ 42] mnF43121JobNumber [0] |
… |
Note:
5. Create a version for report interconnection
6. Call R43092Z1I after End Doc gets called. This is possible because we do not have Transaction Processing for P43250: Call this asynchronously because this job shall take a minute to handle all related transaction.
Application : Receipt Routing Movement and Disposition (P43250)
FORM: Receipt Routing Movement [HEADERLESS DETAIL] (W43250L)
CONTROL: HYPITEM &OK
EVENT: Post Button Clicked
Press Button(FC Clear Caches)
If GC Partial Rev (Hidden) is equal to "Y"
Call( UBE:R43092Z1I , Ver: ORCL0005 )
VA frm_CUSTOM_EdiBatchNo_EDBT -> RI szEdiBatchNumber
Else
End If