cancel
Showing results for 
Search instead for 
Did you mean: 

Function Module / Class EWM - Inbound delivery order / Create Hu , Pack Hu , GR

former_member183155
Active Contributor
16,532

Hi all ,

I will need to use function modules or class to develop a program.

We give production confirmation in MM location then Z* program will transfer to EWM with 311 movement type . Inbound delivery order is created.

After that, we need to use FM/Class to create HU , Packing , Good receipt referance to inbound delivery order.

Could you share related FM /Class ?

I try some of them but it is not working now.

CLASSES :

CL_PACK , CL_WM_PACK , /SCWM/CL_DLV_PACK_IBDL

METHODS :

CREATE_HU , PACK_STOCK

Brgds

M.Ozgur Unal

Accepted Solutions (1)

Accepted Solutions (1)

former_member183155
Active Contributor

Hello Juergen Pitz , Hendrik Schulte-Bahrenberg , Ajit Routray ,

Any idea ? I hope that someone creates a blog or wiki page for FM /CLASS for EWM Developers 🙂

We found a solution with a class CL_HU_PACKING.

DATA: lv_lgnum TYPE /scwm/lgnum VALUE 'W001',

      lv_matid TYPE /scwm/de_matid,

      lv_pmat  TYPE  sysuuid-c,

      ls_huhdr TYPE /scwm/s_huhdr_int.


DATA lo_pack    TYPE REF TO   /SCWM/CL_HU_PACKING       .

DATA: ls_material TYPE /scwm/s_pack_stock.

DATA: ls_quantity TYPE /scwm/s_quan.


CALL FUNCTION 'GUID_CONVERT'

  EXPORTING

    iv_guid_c22            = '051McJFT7jYUxULe4SPX3W' "lv_UIDC22

  IMPORTING

    ev_guid_c32            = lv_pmat

  EXCEPTIONS

    no_unicode_support_yet = 1

    parameters_error       = 2

    OTHERS                 = 3.

MOVE lv_pmat TO lv_matid.


CREATE OBJECT lo_pack.


TRY .


*   Set LGNUM

    /scwm/cl_tm=>set_lgnum( lv_lgnum ) .

*   Init

    CALL METHOD lo_pack->init_pack

      EXPORTING

        iv_badi_appl = 'WME'

*       IT_GUID_HU   =

        iv_loc_type  = 'L'

        iv_loc_index = 'W03'

        IV_NO_REFRESH = 'X'

        iv_lgnum     = lv_lgnum

*       IV_LOCK      = SPACE

*       importing

*       ET_HUTREE    =

*       ET_HUHDR     = lt_huhdr

*       ET_HUITM     =

*      exceptions

*       ERROR        = 1

*       OTHERS       = 2

      .

    IF sy-subrc <> 0.

*     Implement suitable error handling here

    ENDIF.


CALL METHOD lo_pack->/scwm/if_pack_bas~create_hu

      EXPORTING

        iv_pmat  = lv_matid

*       IV_HUIDENT   =

*       IS_HU_CREATE =

*       IV_NOHUIDENT =

*       I_LOCATION   =

*       IV_LOGHU =

      RECEIVING

        es_huhdr = ls_huhdr

*  exceptions

*       ERROR    = 1

*       OTHERS   = 2

      .

    IF sy-subrc <> 0.

* Implement suitable error handling here

    ENDIF.



    ls_quantity-quan = '1'.

    ls_quantity-unit = 'KI'.



*  ls_material-dguid_hu = ls_huhdr-GUID_HU.

*  ls_material-LGNUM = 'W001'.

*  ls_material-VSI = 'D'.

    ls_material-matid = '0050569933DD1ED89EA3B0B855F6210E'.

    ls_material-batchid = '0050569933DD1ED8A6FA1D51B56B810F'.

    ls_material-cat = 'F1'.

    ls_material-owner = 'BP1000'.

    ls_material-owner_role = 'BP'.

    ls_material-entitled = 'BP1000'.

    ls_material-ENTITLED_ROLE = 'BP'.

    ls_material-vfdat = '20190719'.

*  ls_material-quan = 1.

*  ls_material-unit = 'KI'.

    ls_material-qdocid = '0050569933DD1ED8ADBA26DF4A91E110'.

    ls_material-qitmid = '0050569933DD1ED8ADBA26DF4A928110'.

    ls_material-qdoccat = 'PDI'.



    CALL METHOD lo_pack->/scwm/if_pack_bas~pack_stock

      EXPORTING

        iv_dest_hu  = ls_huhdr-guid_hu

        is_material = ls_material

        is_quantity = ls_quantity

*       IS_VALUATION =

*       IV_CWEXACT  =

*       IT_SERID    =

*       IV_ALTUOM   =

*  importing

*       ES_QUANTITY =

*  exceptions

*       ERROR       = 1

*       OTHERS      = 2

      .

    IF sy-subrc <> 0.

* Implement suitable error handling here

    ENDIF.



*   save

    CALL METHOD lo_pack->/scwm/if_pack_bas~save.



*   clean up

    /scwm/cl_pack=>/scwm/if_pack_bas~cleanup( ).



ENDTRY.

Brgds

M.Ozgur Unal

former_member183155
Active Contributor
0 Kudos

However , this thread is benefitful for developers.

https://archive.sap.com/discussions/thread/3668135

Brgds

M.Ozgur Unal

former_member183155
Active Contributor

Also check ,

https://blogs.sap.com/2018/04/02/create-and-pack-handling-unit-in-ewm/

https://archive.sap.com/discussions/thread/3668135

Differences are implementations.

CL_WM_PACKING is used after good receipt.

CL_HU_PACKING is used before good receipt.

Brgds

M.Ozgur Unal

Answers (4)

Answers (4)

former_member183155
Active Contributor

Hi Markus Kaas ,

Thanks for respond. I have SAP EWM Architecture-Programming book. This book have lots of example but this is not contained.

We tried CL_WM_PACKING class but it is designed for good receipt completed process.

Brgds

M.Ozgur Unal

basarozgur_kahraman
Contributor
0 Kudos

Hello Özgür,

You saved my day! 🙂

Thank you so much

Best Regards

Özgür

former_member230160
Active Participant
0 Kudos

Hello Mehmet,

the only source that I am aware of are one book:

https://www.amazon.de/SAP-EWM-Architecture-Programming-PRESS/dp/1493212338/ref=sr_1_1?ie=UTF8&qid=14.... But here please first have a look in the table of contents, as I do not know by heart what is contained).

and also here you can partly get some information (e.g.

https://wiki.scn.sap.com/wiki/display/SCM/How-To+Guides+for+SAP+EWM (e.g. Service_Provider_Call_Example.pdf, but this is for the delivery object only).

Best regards

Markus

haiboshen
Explorer
0 Kudos

Hello, expert,

I verify this class /SCWM/CL_HU_PACKING . it Just availabe when create a new HU then immediately to the method /SCWM/IF_PACK_BAS~PACK_STOCK. It is OKay.
If you use the exist HU in system and HU status is 'B', even it is empty, or delete it to recreate for status 'A', pack_stock is okay, but nerver display in inbound delivery. What an interesting issue.