Skip to Content
Technical Articles
Author's profile photo Harshita Garg

Quantity Adjustment in SAP EWM using Process Codes

Objective: To adjust delivery quantity of Inbound Delivery using ABAP programming

Context:

To create/change/delete a delivery, concept of “Aspects” is used. Each logical section in a delivery is classified as a different aspect. For example, Header Partners, Item Reference Documents, Item Quantity and so on. In SAP EWM, we need to use service provider classes provided by SAP to modify the functionality of deliveries.

Most commonly used class for Inbound Delivery: /SCWM/CL_SP_PRD_INB

Steps:

  1. Set warehouse number for the transaction using /SCWM/CL_TM=>SET_LGNUM. This is used in entire transaction that you’re going to perform next.
  2. Instantiate the class /SCWM/CL_SP_PRD_INB by passing IO_MESSAGE_BOX. This stores the messages generated during the process.
  3. Call method /SCDL/IF_SP1_ASPECT~SELECT as described in below screenshot. Here the aspect selected is “Item Quantity” and pass DOCID and ITEMID in INKEYS.
  4. Quantity should be added or subtracted to quantity selected in OUTRECORDS. Final quantity is passed using /SCDL/IF_SP1_ASPECT~UPDATE method.
  5. Record should be locked before update using /SCDL/IF_SP1_LOCKING~LOCK method.
  6. After UPDATE method is called, /SCDL/IF_SP1_ACTION~EXECUTE method is used to trigger process codes. This step is essential to trigger process code to perform delivery adjustment. Sample code is given below.

7. Point to Note: Everything is saved until /SCDL/IF_SP1_TRANSACTION~SAVE is called. This method can be used to save the transactions in update task also.

8. In the end, it is important to clear the memory by calling /SCWM/CL_TM=>CLEANUP. If we’re running multiple transactions, not clearing the memory may interfere with the processes and cause dumps.

Similarly, /SCWM/CL_SP_PRD_OUT is used for outbound deliveries. Similar methods are provided in this class for Outbound Delivery functionalities.

Summary:

EWM classes are built on business objects framework and hence, above mentioned coding steps need to be used. All the processes are carried out in similar way. You can create / change/ delete any aspect of a delivery using same steps.

Please feel free to provide any feedback or clarifications if needed. Please visit the link https://answers.sap.com/tags/674879738150278190016884561790060 for submitting further questions.

Assigned tags

      1 Comment
      You must be Logged on to comment or reply to a post.
      Author's profile photo Harshita Garg
      Harshita Garg
      Blog Post Author

      Correction: Nothing is saved until SAVE TRANSACTION is called.