SAP HU_PACKING_CREATE Function Module for Creation of Handling Unit (General)
HU_PACKING_CREATE is a standard hu packing create SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Creation of Handling Unit (General) 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 hu packing create FM, simply by entering the name HU_PACKING_CREATE into the relevant SAP transaction such as SE37 or SE38.
Function Group: V51E
Program Name: SAPLV51E
Main Program: SAPLV51E
Appliation area: V
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:

Function HU_PACKING_CREATE 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 'HU_PACKING_CREATE'"Creation of Handling Unit (General).
EXPORTING
* IF_DB_UPDATE = ' ' "With database update
* IT_ITEMS = "Items to be Created
* IT_SERIAL_NR = "Serial Number Table
* IT_SERNR_NEW = "Table with Serial Numbers for each HU Line
* IF_CREATE_HU = ' ' "Create HUs with Stock
* IF_COMMIT = ' ' "Function Module should Transmit a Commit
* IS_OBJECT = "Object that is to be Packed
* IS_MM_DATA = "Header Data for HU Creation
* IT_HEADER_PROPOSAL = "Basic Data for Header Creation
* IT_HEADER_CAPACITY = "Capacity Data for Headers
* IT_HEADER_ADD = "Additional Data for Headers
* IT_HEADER_TRANSPORT = "Header Data that is Relevant for Shipments
IMPORTING
EF_PACKEVENT = "Packing Operation Number
ET_HEADERS = "Table of HU Headers that were Created
ET_ITEMS = "Table of HU Items that were Created
ET_MESSAGES = "Table with Error Messages
EXCEPTIONS
INPUT_MISSING = 1 NOT_POSSIBLE = 2 FATAL_ERROR = 3
IMPORTING Parameters details for HU_PACKING_CREATE
IF_DB_UPDATE - With database update
Data type: XFELDDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
IT_ITEMS - Items to be Created
Data type: HUITM_PROPOptional: Yes
Call by Reference: No ( called with pass by value option)
IT_SERIAL_NR - Serial Number Table
Data type: HUITEM_SERNROptional: Yes
Call by Reference: No ( called with pass by value option)
IT_SERNR_NEW - Table with Serial Numbers for each HU Line
Data type: HUM_REP_SERNR_TOptional: Yes
Call by Reference: Yes
IF_CREATE_HU - Create HUs with Stock
Data type: XFELDDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
IF_COMMIT - Function Module should Transmit a Commit
Data type: XFELDDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
IS_OBJECT - Object that is to be Packed
Data type: HUM_OBJECTOptional: Yes
Call by Reference: No ( called with pass by value option)
IS_MM_DATA - Header Data for HU Creation
Data type: HUM_PLANT_STLOCOptional: Yes
Call by Reference: No ( called with pass by value option)
IT_HEADER_PROPOSAL - Basic Data for Header Creation
Data type: HUHDR_PROPOptional: Yes
Call by Reference: No ( called with pass by value option)
IT_HEADER_CAPACITY - Capacity Data for Headers
Data type: HUHDR_CAPOptional: Yes
Call by Reference: No ( called with pass by value option)
IT_HEADER_ADD - Additional Data for Headers
Data type: HUHDR_ADDOptional: Yes
Call by Reference: No ( called with pass by value option)
IT_HEADER_TRANSPORT - Header Data that is Relevant for Shipments
Data type: HUHDR_TRAOptional: Yes
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for HU_PACKING_CREATE
EF_PACKEVENT - Packing Operation Number
Data type: VPOBJKEYOptional: No
Call by Reference: No ( called with pass by value option)
ET_HEADERS - Table of HU Headers that were Created
Data type: HUM_HU_HEADER_TOptional: No
Call by Reference: No ( called with pass by value option)
ET_ITEMS - Table of HU Items that were Created
Data type: HUM_HU_ITEM_TOptional: No
Call by Reference: No ( called with pass by value option)
ET_MESSAGES - Table with Error Messages
Data type: HUITEM_MESSAGES_TOptional: No
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
INPUT_MISSING - Input Data are Either Missing or Incomplete
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
NOT_POSSIBLE - HU Creation Not Possible
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
FATAL_ERROR - Internal Error
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for HU_PACKING_CREATE 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_ef_packevent | TYPE VPOBJKEY, " | |||
| lv_if_db_update | TYPE XFELD, " SPACE | |||
| lv_input_missing | TYPE XFELD, " | |||
| lv_it_items | TYPE HUITM_PROP, " | |||
| lv_it_serial_nr | TYPE HUITEM_SERNR, " | |||
| lv_it_sernr_new | TYPE HUM_REP_SERNR_T, " | |||
| lv_et_headers | TYPE HUM_HU_HEADER_T, " | |||
| lv_if_create_hu | TYPE XFELD, " SPACE | |||
| lv_not_possible | TYPE XFELD, " | |||
| lv_et_items | TYPE HUM_HU_ITEM_T, " | |||
| lv_if_commit | TYPE XFELD, " SPACE | |||
| lv_fatal_error | TYPE XFELD, " | |||
| lv_is_object | TYPE HUM_OBJECT, " | |||
| lv_et_messages | TYPE HUITEM_MESSAGES_T, " | |||
| lv_is_mm_data | TYPE HUM_PLANT_STLOC, " | |||
| lv_it_header_proposal | TYPE HUHDR_PROP, " | |||
| lv_it_header_capacity | TYPE HUHDR_CAP, " | |||
| lv_it_header_add | TYPE HUHDR_ADD, " | |||
| lv_it_header_transport | TYPE HUHDR_TRA. " |
|   CALL FUNCTION 'HU_PACKING_CREATE' "Creation of Handling Unit (General) |
| EXPORTING | ||
| IF_DB_UPDATE | = lv_if_db_update | |
| IT_ITEMS | = lv_it_items | |
| IT_SERIAL_NR | = lv_it_serial_nr | |
| IT_SERNR_NEW | = lv_it_sernr_new | |
| IF_CREATE_HU | = lv_if_create_hu | |
| IF_COMMIT | = lv_if_commit | |
| IS_OBJECT | = lv_is_object | |
| IS_MM_DATA | = lv_is_mm_data | |
| IT_HEADER_PROPOSAL | = lv_it_header_proposal | |
| IT_HEADER_CAPACITY | = lv_it_header_capacity | |
| IT_HEADER_ADD | = lv_it_header_add | |
| IT_HEADER_TRANSPORT | = lv_it_header_transport | |
| IMPORTING | ||
| EF_PACKEVENT | = lv_ef_packevent | |
| ET_HEADERS | = lv_et_headers | |
| ET_ITEMS | = lv_et_items | |
| ET_MESSAGES | = lv_et_messages | |
| EXCEPTIONS | ||
| INPUT_MISSING = 1 | ||
| NOT_POSSIBLE = 2 | ||
| FATAL_ERROR = 3 | ||
| . " HU_PACKING_CREATE | ||
ABAP code using 7.40 inline data declarations to call FM HU_PACKING_CREATE
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.| DATA(ld_if_db_update) | = ' '. | |||
| DATA(ld_if_create_hu) | = ' '. | |||
| DATA(ld_if_commit) | = ' '. | |||
Search for further information about these or an SAP related objects