Symptom
After assigning handling units to the delivery items, the total weight of the delivery does not include the weight of the assigned handling units.
Environment
SAP S/4HANA Cloud Public Edition
Reproducing the Issue
- Create a delivery and assign handling units to the delivery items.
- Check the total weight of the delivery in LE side, but the weight of the assigned handling units is not included.
Cause
It is the SAP standard behavior.
Resolution
Use the class CL_LOHUM_HU_READER in the Business Add-In (BAdI) Modify Standard and Custom Fields for Delivery Header and Items (LE_SHP_SAVE_DOCUMENT_PREPARE) to read handling units and update the weight data in the delivery.
Sample Code:
" Step 1: Assign in to out parameters
MOVE-CORRESPONDING delivery_document_in TO delivery_document_out.
delivery_document_items_out = delivery_document_items_in.
" Step 2: Get HUs for delivery
DATA: lo_hu_reader TYPE REF TO cl_lohum_hu_reader,
lt_hu_header TYPE cl_lohum_hu_reader=>tt_handling_unit_header,
lt_hu_item TYPE cl_lohum_hu_reader=>tt_handling_unit_item.
lo_hu_reader = cl_lohum_hu_reader=>get_instance( ).
lo_hu_reader->read_hu(
EXPORTING
iv_delivery_document = delivery_document_in-deliverydocument
iv_handling_unit_object_type = '01' "Outbound Delivery
IMPORTING
et_handling_unit_header = lt_hu_header
et_handling_unit_item = lt_hu_item
).
" Step 3: Loop HU weights and update delivery weights
delivery_document_out-headergrossweight = 0.
LOOP AT lt_hu_header assigning field-symbol(<ls_hu_header>).
delivery_document_out-headergrossweight = delivery_document_out-headergrossweight + <ls_hu_header>-grossweight.
ENDLOOP.
See Also
SAP Help Portal - Reading Handling Units Using Class CL_LOHUM_HU_READER
SAP Help Portal - Business Add-Ins (BAdIs) for Delivery Management
Keywords
total weight, SAP S/4HANA Cloud Public Edition, CL_LOHUM_HU_READER, LE_SHP_SAVE_DOCUMENT_PREPARE, handling units , KBA , LE-SHP-DL-2CL , Delivery Processing (Public Cloud) , LO-HU-2CL , Handling Unit Management (Public Cloud) , LE-SHP-EXT-2CL , Delivery Documents Extensibility (Public Cloud) , Problem
SAP Knowledge Base Article - Public