SAP PACK_HANDLING_UNIT Function Module for Create new handling unit or add items to existing HU
PACK_HANDLING_UNIT is a standard pack handling unit SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Create new handling unit or add items to existing HU processing and below is the pattern details for this FM, showing its interface including any import and export parameters, exceptions etc. there is also a full "cut and paste" ABAP pattern code example, along with implementation ABAP coding, documentation and contribution comments specific to this or related objects.
See here to view full function module documentation and code listing for pack handling unit FM, simply by entering the name PACK_HANDLING_UNIT into the relevant SAP transaction such as SE37 or SE38.
Function Group: LMGT
Program Name: SAPLLMGT
Main Program: SAPLLMGT
Appliation area: L
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:

Function PACK_HANDLING_UNIT pattern details
In-order to call this FM within your sap programs, simply using the below ABAP pattern details to trigger the function call...or see the full ABAP code listing at the end of this article. You can simply cut and paste this code into your ABAP progrom as it is, including variable declarations.CALL FUNCTION 'PACK_HANDLING_UNIT'"Create new handling unit or add items to existing HU.
EXPORTING
I_HU_ID = "Handling unit ID
* I_HU_HEADER_TRANSPORT = "
* I_HU_ITEMS = "
* I_HU_SERIAL_NR = "
I_SAVE_STEP = "
I_PACK_ACTIVITY = "
* I_HU_EXTERNAL = "
* I_HU_INTERNAL = "
I_NEW_HU = "New HU indicator
* I_UPDATE_DB = "Checkbox
* I_CREATE_HU = "Checkbox
* I_REFERENCE_OBJECT = "
* I_MM_DATA = "HU: Header Data for Creating HUs
* I_HU_HEADER_MAIN = "
* I_HU_HEADER_CAPACITY = "
* I_HU_HEADER_ADDITIONAL = "
IMPORTING
O_HU_REF_ID = "
O_HU_HEADER = "
O_HU_ITEMS = "
O_HU_MESSAGES = "
EXCEPTIONS
INPUT_MISSING = 1 NOT_POSSIBLE = 2 FATAL_ERROR = 3 OPERATION_FAILED = 4
Customer Function user exits
Below is a list of CUSTOMER FUNCTION exit user exits that are available within this program and maybe relevant for this FM.EXIT_SAPLLMGT_001 Extension for barcode translation
EXIT_SAPLLMGT_083 User exit for print
IMPORTING Parameters details for PACK_HANDLING_UNIT
I_HU_ID - Handling unit ID
Data type: RLMOB-CLENUMOptional: No
Call by Reference: Yes
I_HU_HEADER_TRANSPORT -
Data type: HUHDR_TRAOptional: Yes
Call by Reference: Yes
I_HU_ITEMS -
Data type: HUITM_PROPOptional: Yes
Call by Reference: Yes
I_HU_SERIAL_NR -
Data type: HUITEM_SERNROptional: Yes
Call by Reference: Yes
I_SAVE_STEP -
Data type: COptional: No
Call by Reference: Yes
I_PACK_ACTIVITY -
Data type: COptional: No
Call by Reference: Yes
I_HU_EXTERNAL -
Data type: HUM_EXIDV_TOptional: Yes
Call by Reference: Yes
I_HU_INTERNAL -
Data type: HUM_VENUM_TOptional: Yes
Call by Reference: Yes
I_NEW_HU - New HU indicator
Data type: COptional: No
Call by Reference: Yes
I_UPDATE_DB - Checkbox
Data type: XFELDOptional: Yes
Call by Reference: Yes
I_CREATE_HU - Checkbox
Data type: XFELDOptional: Yes
Call by Reference: Yes
I_REFERENCE_OBJECT -
Data type: HUM_OBJECTOptional: Yes
Call by Reference: Yes
I_MM_DATA - HU: Header Data for Creating HUs
Data type: HUM_PLANT_STLOCOptional: Yes
Call by Reference: Yes
I_HU_HEADER_MAIN -
Data type: HUHDR_PROPOptional: Yes
Call by Reference: Yes
I_HU_HEADER_CAPACITY -
Data type: HUHDR_CAPOptional: Yes
Call by Reference: Yes
I_HU_HEADER_ADDITIONAL -
Data type: HUHDR_ADDOptional: Yes
Call by Reference: Yes
EXPORTING Parameters details for PACK_HANDLING_UNIT
O_HU_REF_ID -
Data type: VPOBJKEYOptional: No
Call by Reference: Yes
O_HU_HEADER -
Data type: HUM_HU_HEADER_TOptional: No
Call by Reference: Yes
O_HU_ITEMS -
Data type: HUM_HU_ITEM_TOptional: No
Call by Reference: Yes
O_HU_MESSAGES -
Data type: HUITEM_MESSAGES_TOptional: No
Call by Reference: Yes
EXCEPTIONS details
INPUT_MISSING -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
NOT_POSSIBLE -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
FATAL_ERROR -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
OPERATION_FAILED -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for PACK_HANDLING_UNIT Function Module
The ABAP code below is a full code listing to execute function module POPUP_TO_CONFIRM including all data declarations. The code uses the original data declarations rather than the latest in-line data DECLARATION SYNTAX but I have included an ABAP code snippet at the end to show how declarations would look using the newer method of declaring data variables on the fly. This will allow you to compare and fully understand the new inline method. Please note some of the newer syntax such as the @DATA is not available until a later 4.70 service pack (SP8), which i why i have stuck to the origianl for this example.| DATA: | ||||
| lv_i_hu_id | TYPE RLMOB-CLENUM, " | |||
| lv_o_hu_ref_id | TYPE VPOBJKEY, " | |||
| lv_input_missing | TYPE VPOBJKEY, " | |||
| lv_i_hu_header_transport | TYPE HUHDR_TRA, " | |||
| lv_i_hu_items | TYPE HUITM_PROP, " | |||
| lv_i_hu_serial_nr | TYPE HUITEM_SERNR, " | |||
| lv_i_save_step | TYPE C, " | |||
| lv_i_pack_activity | TYPE C, " | |||
| lv_i_hu_external | TYPE HUM_EXIDV_T, " | |||
| lv_i_hu_internal | TYPE HUM_VENUM_T, " | |||
| lv_i_new_hu | TYPE C, " | |||
| lv_o_hu_header | TYPE HUM_HU_HEADER_T, " | |||
| lv_not_possible | TYPE HUM_HU_HEADER_T, " | |||
| lv_o_hu_items | TYPE HUM_HU_ITEM_T, " | |||
| lv_fatal_error | TYPE HUM_HU_ITEM_T, " | |||
| lv_i_update_db | TYPE XFELD, " | |||
| lv_i_create_hu | TYPE XFELD, " | |||
| lv_o_hu_messages | TYPE HUITEM_MESSAGES_T, " | |||
| lv_operation_failed | TYPE HUITEM_MESSAGES_T, " | |||
| lv_i_reference_object | TYPE HUM_OBJECT, " | |||
| lv_i_mm_data | TYPE HUM_PLANT_STLOC, " | |||
| lv_i_hu_header_main | TYPE HUHDR_PROP, " | |||
| lv_i_hu_header_capacity | TYPE HUHDR_CAP, " | |||
| lv_i_hu_header_additional | TYPE HUHDR_ADD. " |
|   CALL FUNCTION 'PACK_HANDLING_UNIT' "Create new handling unit or add items to existing HU |
| EXPORTING | ||
| I_HU_ID | = lv_i_hu_id | |
| I_HU_HEADER_TRANSPORT | = lv_i_hu_header_transport | |
| I_HU_ITEMS | = lv_i_hu_items | |
| I_HU_SERIAL_NR | = lv_i_hu_serial_nr | |
| I_SAVE_STEP | = lv_i_save_step | |
| I_PACK_ACTIVITY | = lv_i_pack_activity | |
| I_HU_EXTERNAL | = lv_i_hu_external | |
| I_HU_INTERNAL | = lv_i_hu_internal | |
| I_NEW_HU | = lv_i_new_hu | |
| I_UPDATE_DB | = lv_i_update_db | |
| I_CREATE_HU | = lv_i_create_hu | |
| I_REFERENCE_OBJECT | = lv_i_reference_object | |
| I_MM_DATA | = lv_i_mm_data | |
| I_HU_HEADER_MAIN | = lv_i_hu_header_main | |
| I_HU_HEADER_CAPACITY | = lv_i_hu_header_capacity | |
| I_HU_HEADER_ADDITIONAL | = lv_i_hu_header_additional | |
| IMPORTING | ||
| O_HU_REF_ID | = lv_o_hu_ref_id | |
| O_HU_HEADER | = lv_o_hu_header | |
| O_HU_ITEMS | = lv_o_hu_items | |
| O_HU_MESSAGES | = lv_o_hu_messages | |
| EXCEPTIONS | ||
| INPUT_MISSING = 1 | ||
| NOT_POSSIBLE = 2 | ||
| FATAL_ERROR = 3 | ||
| OPERATION_FAILED = 4 | ||
| . " PACK_HANDLING_UNIT | ||
ABAP code using 7.40 inline data declarations to call FM PACK_HANDLING_UNIT
The below ABAP code uses the newer in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. Please note some of the newer syntax below, such as the @DATA is not available until 4.70 EHP 8.| "SELECT single CLENUM FROM RLMOB INTO @DATA(ld_i_hu_id). | ||||
Search for further information about these or an SAP related objects