Thursday 31 August 2017

Delivery and Shipment handling units

Business Requirement:


1. Creation of Delivery Handling unit for over packing and master cartons even if over packing is not required.
2. Creation of Shipment Handling Unit for boxes packed in Deliveries to allow receipt by HU# in the receiving plants.

Challenges: While creating shipment handling unit, all the delivery handling units are automatically attached to the shipment handling unit and they are deleted from deliveries when the BAPI (BAPI_HU_CREATE) is used. BAPI_HU_CREATE has the parameter LOWER_LEVEL_EXID is present in tables parameter (BAPIHUITEM), however after using this parameter to attach the delivery handling units to Shipment, these handling units are deleted from delivery.

Solution – In order to avoid above issue we had gone ahead of different approach and able to attach the delivery handling units to shipment with correct hierarchy. we need to call the below bapi’s in sequence to achieve the above functionality

head_proposal-hu_status_init = Pass 'A' ."Planned.
head_proposal-pack_mat = Pass Packaging Material
"Call the below function module to create an Unassigned HU object.
CALL FUNCTION 'BAPI_HU_CREATE'
EXPORTING
headerproposal = _head_proposal
IMPORTING
huheader = hu_header
hukey = hu_key
TABLES
return = return.
IF hu_key IS NOT INITIAL.
"Call the below function module to Commit the data
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'
IMPORTING
return = return.
" Assign to a Shipment
hu_header-pack_mat_object = '04'. "04-HU Type for Shipment
hu_header-pack_mat_obj_key = Shipment number "Shipment #
hu_header-lenght = Pass Pallet length
hu_header-width = Pass Pallet Width
hu_header-height = Pass Pallet Height
hu_header-total_wght = Pass Pallet weight
hu_header-unit_dim = Pass Pallet Uom for dimensions
hu_header-unit_of_wt = Pallet Uom
hu_header-max_unit_of_wght = Pallet Uom.
ENDIF.
"Call the below function module to assign the handling unit to shipment
CALL FUNCTION 'BAPI_HU_CHANGE_HEADER'
EXPORTING
hukey = hu_key
huchanged = hu_header
TABLES
return = change_return.
IF change_return[] IS INITIAL.
"Call the below function module to commit the data by assigning Shipment to Handling Unit
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'
IMPORTING
return = return.
" Get the Internal Handling unit based on external handling unit and prepare the handling unit numbers (Box_pallet_venum) which needsto be passed to below function module.
" The below function module is called for filling the global memory
CALL FUNCTION 'HU_GET_HUS'
EXPORTING
if_lock_hus = co_x
if_no_loop = co_x
it_venum = box_pallet_venum
EXCEPTIONS
hus_locked = 1
no_hu_found = 2
fatal_error = 3
OTHERS = 4.
"Each and every Internal handling unit (Boxes) to be attached to shipment and the below function module should be called in a loop.
packing_request-venum = Hu_header-hu_id.
packing_request-exidv = hu_key.
packing_request-velin = '3'.
packing_request-sub_hu_venum = vekp-venum.
packing_request-quantity = '1'.
Packing_request-veanz = '1'.
" The below function module is called to Repack the deliveries in the shipment which is required for hierarchy in shipment
CALL FUNCTION 'HU_PACKING_AND_UNPACKING'
EXPORTING
if_repack = 'X'
is_packing_request = packing_request
IMPORTING
ef_rcode = return_code
CHANGING
cs_header = cs_header
EXCEPTIONS
missing_data = 1
hu_not_changeable = 2
not_possible = 3
customizing = 4
weight = 5
volume = 6
serial_nr = 7
fatal_error = 8
OTHERS = 9.
IF sy-subrc EQ 0.
" Call the below function module to commit the data by assigning Shipment to Handling Unit
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'
"If the Pallet packing is successful then only call the below function module
" The below function module commits the data to database.
CALL FUNCTION 'HU_POST'
EXPORTING
if_commit = 'X'
ENDIF.

Negative  results – ( when the Bapi  Function module (BAPI_HU_CREATE) is used and passing the parameter  LOWER_LEVEL_EXID), the output as follows

1. Delivery handling units are correctly packed and the hierarchy is correct

SAP ABAP Development, SAP Guides, SAP Learning, SAP Module, SAP All Modules, SAP Certifications List

2. However when we pack the  delivery boxes to shipment the hierarchy is off as shown below. The hierarchy should be ‘0’ for Shipment  handling unit,’1′ for delivery handling unit  and ‘2’ for material.

SAP ABAP Development, SAP Guides, SAP Learning, SAP Module, SAP All Modules, SAP Certifications List

Positive results – ( when the Function modules are called in sequence as suggested in the blog)

1.The handling units for delivery are shown below which was successfully attached to delivery

SAP ABAP Development, SAP Guides, SAP Learning, SAP Module, SAP All Modules, SAP Certifications List

2. HUPAST tcode for handling units with respect to delivery.

SAP ABAP Development, SAP Guides, SAP Learning, SAP Module, SAP All Modules, SAP Certifications List

3. Handling units with respect to delivery shown below and the important element is the hierarchy (Shipment handling unit comes first , then delivery handling unit and then the packaging materials.

SAP ABAP Development, SAP Guides, SAP Learning, SAP Module, SAP All Modules, SAP Certifications List

------------------------------------------------------------------------------------------------
Note : The above usage of FM’S and Bapi’s needs to be called sequentially as shown above to achieve the functionality. The high level code is provided as solution.
------------------------------------------------------------------------------------------------
Follow: Facebook, Google+, Twitter, Pinterest, Linkedin
SAP Online Guides, Tutorials, Materials and Certifications.

Related Posts

12 comments:

  1. Hey There. I found your blog using msn. This is a very well written article. I will make sure to bookmark it and come back to read more of your useful info. Thanks for the post. I’ll definitely comeback.
    interstate freight transport

    ReplyDelete
  2. I love visiting sites in my free time. I have visited many sites but did not find any site more efficient than yours. Thanks for the nudge! material equipements for handling

    ReplyDelete
  3. Took me time to read all the comments, but I really enjoyed the article. It proved to be Very helpful to me and I am sure to all the commenters here! It’s always nice when you can not only be informed, but also entertained! china post tracking delivery to US

    ReplyDelete
  4. If your customers require their deliveries to arrive in a smart van with a uniformed driver, Europa-Road check that you choose a parcel delivery service which requires its courier drivers to be turned out appropriately.

    ReplyDelete
  5. Thanks for the blog filled with so many information. Stopping by your blog helped me to get what I was looking for. Now my task has become as easy as ABC. Europa-Road targonca szállítás Debrecen

    ReplyDelete
  6. I think this is an informative post and it is very useful and knowledgeable. therefore, I would like to thank you for the efforts you have made in writing this article. Bts merchandise buying and forwarding

    ReplyDelete
  7. This is a great inspiring article.I am pretty much pleased with your good work.You put really very helpful information. Keep it up. Keep blogging. Looking to reading your next post. order fulfillment

    ReplyDelete
  8. That would seem wholly great. Every one compact info are designed coupled with number of track record comprehension. Everyone loves the following a lot. Europa-Road targonca szállítás Debrecen

    ReplyDelete
  9. You delivered such an impressive piece to read, giving every subject enlightenment for us to gain information. Thanks for sharing such information with us due to which my several concepts have been cleared. local food delivery service

    ReplyDelete
  10. Very informative and impressive post you have written, this is quite interesting and i have went through it completely, an upgraded information is shared, keep sharing such valuable information. Interstate Freight Transport

    ReplyDelete
  11. This comment has been removed by the author.

    ReplyDelete
  12. Thank you for providing this information with us. checktop shipping companies list

    ReplyDelete