- 1. Pre-validate the input data, check GMID/Plant/storage location validation (material code is exist under plant/storage location level). Check table MARA, MARC and MARD. If not exist, return an error "GMID under plant/storage location" is invalid.
- 2. Check the movement type is supportable movement type. Only the following movement type supported at this movement. Otherwise, return an error "MVT XXX is not support"
- 261/262. Goods issue to Order (CO order/ REM order) or reversal
- 301/302. Goods transfer from one plant to another plant (under same company code)
- 311. Goods transfer from Storage location to Storage location (under same plant code)
- 309. Material reclassify between two GMIDs.
- 929.Bulk TR mat.to mat
- 201/202: Goods issue to Cost center or reversal
- 901/902. Inventory taking increase/reduce
- X21/X22: GI/GR Virtual Plant Net
- 325: Transfer of storage location to storage location – blocked stock
- 343/344: Transfer of Unrestricted to Blocked/TR Blocked to Unrestricted ( TR - Transfer Return)
- 907/908: GR phys.inv.:blocked/GI phys.inv.:blocked
- 531/532: Goods receipt of by-products from order/ Reversal by-products
3. In case of netting goods movement type X21/X22, then call AUTHORITY-CHECK to perform user have the authorization on BWART’ for movement type’X21’ or ‘X22’ whether or not. In case of no access on that, then return an error “ You are not authorized to post transaction for goods movement type X21 or X22”
- 4. Check the batch fields (Batch 1 and Batch 2), if batch field is blank or "------------", go to system table MARA and to find the related batch. Logic as following
- First check the MARA-XCHPF, if field value is "X", go to next step. Else, keep the batch field value as blank.
- First use the material, plant code and storage location code to find the generic batch in table , if can't find, go to next step
- Use material, plant code to find the generic batch code in table . if still can't the generic batch, return an error "can't find the generic batch for plant XXXX material XXXXXXXXXXX"
- 5. If the value of batch field (only for source batch number GOODSMVT_ITEM-BATCH) exists, check whether the batch number exists for the source plant code (GOODSMVT_ITEM-PLANT) and material number (GOODSMVT_ITEM- MATERIAL) in the MCHA. If not exist, return an error "the batch XXX for plant XXXX & material XXXXXXXXXXX not exist in the system, please check".
- 6. Proposal the document date as today, and if the input goods movement posting date is empty, raise error message.
- 7. If the input quantity field is equal to zero, return error msg. "Input quantity of plant XXXX material XXXXXXXXXX MVT XXX is zero, please check ".
- 8. If the input ISO unit field is empty, return error msg. "ISO unit is missing."
- 9. In case any validation is failing or any error is returned from standard BAPI BAPI_GOODSMVT_CREATE, related error message should be append to the custom BAPI's return table.