Skip to Content
0
Mar 19, 2009 at 11:51 AM

Function Module for Unpacking a shipment

33 Views

Hi Experts,

I have to pack an HU for a material.

Follow the code:

ls_huid = '00000000001000102236'.
APPEND ls_huid TO lt_huid.
ls_venum = '00000000001000102236'.
APPEND ls_venum TO lt_venum.

CALL FUNCTION 'HU_GET_HUS'
 EXPORTING
*   IF_OBJECT                =
*   IF_NO_DB_SELECT          = ' '
   if_lock_hus              = 'X'
*   IF_WITH_TEXT             = ' '
*   IF_NO_LOOP               = 'X'
   if_more_hus              = 'X'
*   IS_OBJECTS               =
*   IT_OBJECTS               =
   it_hus                   = lt_huid
   it_venum                 = lt_venum
*   IT_HANDLE                =
*   IF_MARA_PACKMITTEL       = ' '
 IMPORTING
   et_header                = lt_header
   et_items                 = lt_items
*   ET_ITEM_SERIALNO         =
*   ET_HISTORY               =
*   ET_HIGHEST_LEVELS        =
*   ET_MESSAGES              =
 EXCEPTIONS
   hus_locked               = 1
   no_hu_found              = 2
   fatal_error              = 3
   OTHERS                   = 4          .

IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

ls_p_req-venum = '0000101938'.
ls_p_req-exidv = '00000000001000102236'.
ls_p_req-belnr = '1050000440'.
ls_p_req-posnr = '000020'.
ls_p_req-quantity = '1.000'.
ls_p_req-altme    = 'ST'.
ls_p_req-meins    = 'ST'.
ls_p_req-werks    = 'DE20'.
ls_p_req-velin    = '1'.
ls_p_req-matnr = 'LD0000000100000095'.
ls_p_req-gewei = 'KG'.
ls_p_req-magrv = 'PM'.

CALL FUNCTION 'HU_PACKING_AND_UNPACKING'
  EXPORTING
*   if_repack                = 'X'
    is_packing_request       = ls_p_req
 IMPORTING
   ef_rcode                 = lf_subrc
   es_p_request             = ls_p_req
*   ES_ITEM                  =
* CHANGING
*   CS_HEADER                = ls_p_req
 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 <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

CALL FUNCTION 'HU_POST'
 EXPORTING
   if_synchron          = 'X'
   if_commit            = 'X'
*   IF_NO_RENAME         = ' '
*   IF_NO_MESSAGES       = ' '
*   IF_NO_REFRESH        = ' '
*   IF_WM_TA_CONF        = ' '
*   IS_OBJECT            =
*   IS_VBUK              =
*   IT_VBPA              =
 IMPORTING
   ef_number            = lv_number
*   ES_EMKPF             =
*   ET_EMSEG             =
*   ET_MESSAGES          =
*   ET_HEADER            =
*   ET_ITEMS             =
          .

The result of last FM is

 sy-subrc = 8 

FATAL ERROR.

I'm follow the standard code and I didn't understand because the FM fail.

Please, how can I resolve this critical error?

Best Regards,

Stefania