Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

[SCWM] Create HU(Handling Unit) Buffer vs Database

Former Member
0 Likes
12,096

Hi Experts,

I am facing a problem when creating an Handling Unit with the module function: "/SCWM/HUHDR_CREATE"

Everything is OK, the MF give me back the ID of the HU freshly created but when I checked in the database nothing has been created.

I tried to put the statement: "Commit Work and..." but nothing new.

Do you know, how can I commit the data created in the buffer via the MF, in the database definitively.

Thank you.

Best regards.

Rachid.

1 ACCEPTED SOLUTION
Read only

Phillip_Morgan
Contributor
0 Likes
9,391

Hi Rachid,

This module does not exist in my system. (SRM? SCM?)

You probably already did this, but look in the function group, there may be related functions that are helpful or give an idea of what to do. And don't forget use case...

16 REPLIES 16
Read only

Former Member
0 Likes
9,391

noone?

Read only

Phillip_Morgan
Contributor
0 Likes
9,392

Hi Rachid,

This module does not exist in my system. (SRM? SCM?)

You probably already did this, but look in the function group, there may be related functions that are helpful or give an idea of what to do. And don't forget use case...

Read only

0 Likes
9,391

Hi Phillip,

thank you for your reply. Yes I did it.

The module is eWM. 

In fact, I freshly created several times, many HU with using:

"/SCWM/IF_PACK_BAS~CREATE_HU" and the HU numbers were correctly provided by SAP.


But, no HU number exist in the database. Only, in the buffer.


So, I tried several ways to save the data from the buffer to the database like:


  • /SCWM/IF_PACK_BAS~SAVE
  • /SCWM/CL_HU_PACKING->SAVE
  • /SCWM/CL_WM_PACKING->SAVE or using exactly the same standard program:


PERFORM SAVE_ALL from the program /SCWM/LUI_PACKINGI01.


but absolutely nothing happend.

It is really strange...

Rachid

Read only

0 Likes
9,391

Hi Rachid,

could you solve your problem?

I'm facing exactly the same issue righ now.

BR

Denis

Read only

0 Likes
9,390

Hi Denis,

I will spare you many sleepless nights



DATA lo_pack    TYPE REF TO   /scwm/cl_pack       .

DATA lo_wm_pack TYPE REF TO   /scwm/cl_wm_packing .

CREATE OBJECT lo_pack.

CREATE OBJECT lo_wm_pack.

TRY .

*   Set LGNUM

     /scwm/cl_tm=>set_lgnum( lgnum )                             . " 'E439'

*   Init

     lo_wm_pack->init( iv_lgnum = lgnum )                        .

*   Create HU.

     s_out   lo_wm_pack->create_hu( iv_pmat     = me->zif_sc_factory_adapter~o_sc_tools_ctrl->convert_matnr_to_matid( iv_pmat )

                                       i_location  = i_location ).

*   Save

     lo_wm_pack->/scwm/if_pack_bas~save( iv_commit = abap_true

                                         iv_wait   = abap_true ) .

*   clean up

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

.

Enjoy.

Rachid.

Read only

0 Likes
9,390

Thank you

Read only

0 Likes
9,390

Hi Rachid,

i got a similar requirement and i have already spent some time on it without any success. Can you please elaborate on the code you have shared. i will mean a lot for me

Read only

0 Likes
9,390

HI  Rachid Roughi

   For me also  "/SCWM/HUHDR_CREATE"  not creating HU in database table may i know why ?

Read only

zayidu
Participant
0 Likes
9,390

Hi Rachid,

I want to create HU and the created HU must be barcoded and must be printed using SMARTFORMS in EWM???

Please help me creating HU  by using class /SCWM/IF_PACK_BAS or /SCWM/CL_WM_PACKING.

Method CREATE_HU or /SCWM/IF_PACK_BAS~CREATE_HU.


Please provide me a complete code since I am new to EWM.


Please, Experts, do reply.....

Thanks.

Read only

0 Likes
9,390

Hi Zayidu A

        To create a HU follow this,

       it will surely work i am doing like this only,

data:  zob_wm_pack TYPE REF TO /scwm/cl_wm_packing.

CREATE OBJECT zob_wm_pack .

CALL METHOD zob_wm_pack->/scwm/if_pack~create_hu

           EXPORTING

             iv_pmat    = z_pmatid   (pass packing material matid)

             iv_huident = zco_desthu   (name of hu to be created)

             i_location = zco_storageb  (name of storage bin in which Hu will be created)

           RECEIVING

             es_huhdr   = zwa_huhdr

           EXCEPTIONS

             error      = 1

             OTHERS     = 2.


CALL METHOD zob_wm_pack->/scwm/if_pack~save

           EXPORTING

             iv_commit = abap_true

           EXCEPTIONS

             error     = 1

             OTHERS    = 2.

         IF sy-subrc <> 0.

           /scwm/cl_pack_view=>msg_error( ).

         ENDIF.

Read only

0 Likes
9,390

Bro Can you upload the whole coding please....?

Read only

0 Likes
9,390

Pass packing material matid,  name of hu to be created,  name of storage bin in which Hu will be created...
How should be done this ?? I am new to this EWM ...Kindly reply please....

Read only

0 Likes
9,390

Hi zayidu

    This will work.

discuss with Func cons to get input to give when creating HU, in this example i have added my input

         PERFORM initialize

                          USING    zwa_wrkc

                          CHANGING zob_wm_pack.

         PERFORM matid CHANGING z_pmatid.

FORM initialize

   USING    zwa_wrkc       TYPE /scwm/tworkst

   CHANGING zob_wm_pack    TYPE REF TO /scwm/cl_wm_packing.

   DATA: zwa_pack_controle TYPE /scwm/s_pack_controle.

   CONSTANTS : zco_prmode TYPE /scwm/s_pack_controle-prmode VALUE '02'.

   IF zob_wm_pack IS NOT BOUND.

     CALL METHOD /scwm/cl_wm_packing=>get_instance

       IMPORTING

         eo_instance = zob_wm_pack.

   ENDIF.

   zwa_pack_controle-prmode           = zco_prmode.

   zwa_pack_controle-cdstgrp_mat      = abap_true.

   zwa_pack_controle-cdstgrp_hu       = abap_true.

   zwa_pack_controle-processor_det    = abap_true.

   zwa_pack_controle-chkpack_dstgrp   = zwa_wrkc-chkpack_dstgrp.

   zwa_pack_controle-chkpack_stoprout = zwa_wrkc-chkpack_stoprout.

   zwa_pack_controle-lock_source      = zwa_wrkc-lock_source.

   CALL METHOD zob_wm_pack->init_by_workstation

     EXPORTING

       is_workstation   = zwa_wrkc

       is_pack_controle = zwa_pack_controle

       iv_no_hu_by_wc   = abap_true

     EXCEPTIONS

       error            = 1

       OTHERS           = 2.

   IF sy-subrc <> 0.

     /scwm/cl_pack_view=>msg_error( ).

   ENDIF.

ENDFORM.                    " INITIALIZE



FORM matid CHANGING  z_pmatid TYPE /scwm/de_matid.

   DATA:zwa_matnr           TYPE LINE OF rseloption,

        zra_matnr     TYPE         rseloption,

        zit_matid_matnr     TYPE         /scwm/tt_matid_matnr.

   CONSTANTS : z_packmat TYPE char4 VALUE 'CART'.

   zwa_matnr-sign   = wmegc_sign_inclusive.

   zwa_matnr-option = wmegc_option_eq.

   zwa_matnr-low    = z_packmat.

   APPEND zwa_matnr TO zra_matnr.

   FIELD-SYMBOLS: <zlwa_matid_matnr>   TYPE /scwm/s_matid_matnr.

   TRY.

       CALL FUNCTION '/SCWM/MATERIAL_READ_RANGE'

         EXPORTING

           it_matnr_range = zra_matnr

         IMPORTING

           et_matid       = zit_matid_matnr.

     CATCH /scwm/cx_md_interface /scwm/cx_md_internal_error.

   ENDTRY.

   READ TABLE zit_matid_matnr ASSIGNING <zlwa_matid_matnr> INDEX 1.

   IF sy-subrc IS INITIAL.

     z_pmatid = <zlwa_matid_matnr>-matid.

   ENDIF.

ENDFORM.                    " MATID

* Creating HU Vagrant**********************

         CALL METHOD zob_wm_pack->/scwm/if_pack~create_hu

           EXPORTING

             iv_pmat    = z_pmatid

             iv_huident = zco_desthu

             i_location = zco_storageb

           RECEIVING

             es_huhdr   = zwa_huhdr

           EXCEPTIONS

             error      = 1

             OTHERS     = 2.

* saving HU***********************************

         CALL METHOD zob_wm_pack->/scwm/if_pack~save

           EXPORTING

             iv_commit = abap_true

           EXCEPTIONS

             error     = 1

             OTHERS    = 2.

         IF sy-subrc <> 0.

           /scwm/cl_pack_view=>msg_error( ).

         ENDIF.

       ENDIF.

Read only

0 Likes
9,390

Hi Selva,

May i know what all the input fields you used.

zwa_huhdr is the created HU ??



Read only

0 Likes
9,390

Hi Zayidu,

CALL METHOD zob_wm_pack->/scwm/if_pack~create_hu

           EXPORTING

             iv_pmat    = z_pmatid

             iv_huident = zco_desthu

             i_location = zco_storageb

           RECEIVING

             es_huhdr   = zwa_huhdr

           EXCEPTIONS

             error      = 1

             OTHERS     = 2.


z_pmatid -  pass matid of the Packing material (askk packing materila type from functional)

zco_desthu - pass the name of HU to be created (give some name or number)

zco_storageb - pass storage bin name (ask functional in which bin the HU need to be created)



zwa_huhdr  once HU is created it will provide HU details here

Read only

0 Likes
9,390

Thanks Selva. That was really helpful!

Without using select queries can I fetch data from the standard/custom tables in SAP EWM ? I mean is there any methods or class or any FM's to fetch data from DB tables??

What's the difference in using the select queries and FM's to fetch the data??

Kindly reply ASAP.... Thanks!