SAP BAPI_HANDLING_UNITS_MIGRATE Function Module for Create handling unit with items
BAPI_HANDLING_UNITS_MIGRATE is a standard bapi handling units migrate 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 handling unit with items 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 bapi handling units migrate FM, simply by entering the name BAPI_HANDLING_UNITS_MIGRATE into the relevant SAP transaction such as SE37 or SE38.
Function Group: HU_BASIC_BAPIS
Program Name: SAPLHU_BASIC_BAPIS
Main Program: SAPLHU_BASIC_BAPIS
Appliation area:
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:

Function BAPI_HANDLING_UNITS_MIGRATE 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 'BAPI_HANDLING_UNITS_MIGRATE'"Create handling unit with items.
EXPORTING
IS_HEADER = "Default Data for Creating a Handling Unit
* IF_COMMIT = ' ' "Data element for domain BOOLE: TRUE (='X') and FALSE (=' ')
* IT_ITEMS = "Handling Unit Items Migration
* IT_SERIAL_NUMBERS = "Handling Unit Header Migration
IMPORTING
HUHEADER = "Handling Unit Header Data
HUKEY = "External Handling Unit Identification
TABLES
RETURN = "Return parameter
IMPORTING Parameters details for BAPI_HANDLING_UNITS_MIGRATE
IS_HEADER - Default Data for Creating a Handling Unit
Data type: BAPIHUHDRPROPOSALOptional: No
Call by Reference: No ( called with pass by value option)
IF_COMMIT - Data element for domain BOOLE: TRUE (='X') and FALSE (=' ')
Data type: BOOLE_DDefault: ' '
Optional: Yes
Call by Reference: No ( called with pass by value option)
IT_ITEMS - Handling Unit Items Migration
Data type: LOHU_ITEM_MIGRATE_TOptional: Yes
Call by Reference: Yes
IT_SERIAL_NUMBERS - Handling Unit Header Migration
Data type: LOHU_SERIAL_NUMBERS_MIGRATE_TOptional: Yes
Call by Reference: Yes
EXPORTING Parameters details for BAPI_HANDLING_UNITS_MIGRATE
HUHEADER - Handling Unit Header Data
Data type: BAPIHUHEADEROptional: No
Call by Reference: No ( called with pass by value option)
HUKEY - External Handling Unit Identification
Data type: BAPIHUKEY-HU_EXIDOptional: No
Call by Reference: No ( called with pass by value option)
TABLES Parameters details for BAPI_HANDLING_UNITS_MIGRATE
RETURN - Return parameter
Data type: BAPIRET2Optional: No
Call by Reference: Yes
Copy and paste ABAP code example for BAPI_HANDLING_UNITS_MIGRATE 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: | ||||
| lt_return | TYPE STANDARD TABLE OF BAPIRET2, " | |||
| lv_huheader | TYPE BAPIHUHEADER, " | |||
| lv_is_header | TYPE BAPIHUHDRPROPOSAL, " | |||
| lv_hukey | TYPE BAPIHUKEY-HU_EXID, " | |||
| lv_if_commit | TYPE BOOLE_D, " ' ' | |||
| lv_it_items | TYPE LOHU_ITEM_MIGRATE_T, " | |||
| lv_it_serial_numbers | TYPE LOHU_SERIAL_NUMBERS_MIGRATE_T. " |
|   CALL FUNCTION 'BAPI_HANDLING_UNITS_MIGRATE' "Create handling unit with items |
| EXPORTING | ||
| IS_HEADER | = lv_is_header | |
| IF_COMMIT | = lv_if_commit | |
| IT_ITEMS | = lv_it_items | |
| IT_SERIAL_NUMBERS | = lv_it_serial_numbers | |
| IMPORTING | ||
| HUHEADER | = lv_huheader | |
| HUKEY | = lv_hukey | |
| TABLES | ||
| RETURN | = lt_return | |
| . " BAPI_HANDLING_UNITS_MIGRATE | ||
ABAP code using 7.40 inline data declarations to call FM BAPI_HANDLING_UNITS_MIGRATE
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 HU_EXID FROM BAPIHUKEY INTO @DATA(ld_hukey). | ||||
| DATA(ld_if_commit) | = ' '. | |||
Search for further information about these or an SAP related objects