SAP Function Modules

GET_UNPACK_MAT SAP Function module - Validation of material in specified HU for unpacking







GET_UNPACK_MAT is a standard SAP function module available within R/3 SAP systems depending on your version and release level. Below is the pattern details for this FM showing its interface including any import and export parameters, exceptions etc as well as any documentation contributions (Comments) specific to the object.

See here to view full function module documentation and code listing, simply by entering the name GET_UNPACK_MAT into the relevant SAP transaction such as SE37 or SE80.

Associated Function Group: LMGT
Released Date: Not Released
Processing type: Normal fucntion module
Normal function module settings


Pattern for FM GET_UNPACK_MAT - GET UNPACK MAT





CALL FUNCTION 'GET_UNPACK_MAT' "Validation of material in specified HU for unpacking
  EXPORTING
    i_mat_id =                  " vepo-matnr    material ID
    i_quantity =                " vepo-vemng
    i_uom =                     " vepo-vemeh
    i_charg =                   " vepo-charg
    i_bestq =                   " vepo-bestq
    i_sobkz =                   " vepo-sobkz
    i_sonum =                   " vepo-sonum
    i_mlvs =                    " mlvs
  TABLES
    t_hu_items =                "               VEPO + desc of material from MAKT
  EXCEPTIONS
    MAT_NOT_FOUND = 1           "               Handling unit not found
    UOM_NOT_ALLOWED = 2         "
    CONVERSION_NOT_ALLOWED = 3  "
    WRONG_STOCK_CATEGORY = 4    "
    WRONG_STOCK_INDICATOR = 5   "
    WRONG_STOCK_NUMBER = 6      "
    WRONG_QTY = 7               "
    WRONG_BATCH = 8             "
    INTERNAL_ERROR = 9          "
    .  "  GET_UNPACK_MAT

ABAP code example for Function Module GET_UNPACK_MAT





The ABAP code below is a full code listing to execute function module GET_UNPACK_MAT including all data declarations. The code uses 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 original method of declaring data variables up front. 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).

DATA:
it_t_hu_items  TYPE STANDARD TABLE OF STRING,"TABLES PARAM
wa_t_hu_items  LIKE LINE OF it_t_hu_items .


SELECT single MATNR
FROM VEPO
INTO @DATA(ld_i_mat_id).


SELECT single VEMNG
FROM VEPO
INTO @DATA(ld_i_quantity).


SELECT single VEMEH
FROM VEPO
INTO @DATA(ld_i_uom).


SELECT single CHARG
FROM VEPO
INTO @DATA(ld_i_charg).


SELECT single BESTQ
FROM VEPO
INTO @DATA(ld_i_bestq).


SELECT single SOBKZ
FROM VEPO
INTO @DATA(ld_i_sobkz).


SELECT single SONUM
FROM VEPO
INTO @DATA(ld_i_sonum).

DATA(ld_i_mlvs) = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_t_hu_items to it_t_hu_items. . CALL FUNCTION 'GET_UNPACK_MAT' EXPORTING i_mat_id = ld_i_mat_id i_quantity = ld_i_quantity i_uom = ld_i_uom i_charg = ld_i_charg i_bestq = ld_i_bestq i_sobkz = ld_i_sobkz i_sonum = ld_i_sonum i_mlvs = ld_i_mlvs TABLES t_hu_items = it_t_hu_items EXCEPTIONS MAT_NOT_FOUND = 1 UOM_NOT_ALLOWED = 2 CONVERSION_NOT_ALLOWED = 3 WRONG_STOCK_CATEGORY = 4 WRONG_STOCK_INDICATOR = 5 WRONG_STOCK_NUMBER = 6 WRONG_QTY = 7 WRONG_BATCH = 8 INTERNAL_ERROR = 9 . " GET_UNPACK_MAT
IF SY-SUBRC EQ 0. "All OK ELSEIF SY-SUBRC EQ 1. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 2. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 3. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 4. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 5. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 6. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 7. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 8. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 9. "Exception "Add code for exception here ENDIF.







ABAP code to compare 7.40 inline data declaration with original syntax

The below ABAP code uses the older none in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. It may also be useful if you are using an older version of SAP as some of the newer syntax above, such as the @DATA is not available until 4.70 EHP 8.

DATA:
ld_i_mat_id  TYPE VEPO-MATNR ,
it_t_hu_items  TYPE STANDARD TABLE OF STRING ,
wa_t_hu_items  LIKE LINE OF it_t_hu_items,
ld_i_quantity  TYPE VEPO-VEMNG ,
ld_i_uom  TYPE VEPO-VEMEH ,
ld_i_charg  TYPE VEPO-CHARG ,
ld_i_bestq  TYPE VEPO-BESTQ ,
ld_i_sobkz  TYPE VEPO-SOBKZ ,
ld_i_sonum  TYPE VEPO-SONUM ,
ld_i_mlvs  TYPE MLVS .


SELECT single MATNR
FROM VEPO
INTO ld_i_mat_id.


"populate fields of struture and append to itab
append wa_t_hu_items to it_t_hu_items.

SELECT single VEMNG
FROM VEPO
INTO ld_i_quantity.


SELECT single VEMEH
FROM VEPO
INTO ld_i_uom.


SELECT single CHARG
FROM VEPO
INTO ld_i_charg.


SELECT single BESTQ
FROM VEPO
INTO ld_i_bestq.


SELECT single SOBKZ
FROM VEPO
INTO ld_i_sobkz.


SELECT single SONUM
FROM VEPO
INTO ld_i_sonum.

ld_i_mlvs = 'Check type of data required'.

SAP Documentation for FM GET_UNPACK_MAT


This function checks if the material for the specific handling unit exists. Only one nested level is considered. ...See here for full SAP fm documentation








Contribute (Add Comments)

Please help keep this info upto date and use the comments section below to add useful hints, tips and information specific to this SAP function. This will then be available for you and other users to easily find by simply searching on the object name GET_UNPACK_MAT or its description.