Skip to Content

SAP EWM - Finding HU details using Class or Function module

Hi Guys,

I'm busy creating a class that needs to find HU's assigned to TU's and then pull detail associated with those HU's.

I've managed to get the HU's assigned to the correct TU's but I've currently only got a SELECT statement to pull the detail I need for those HU's.

My question is:

Is there a class or Function Module that can pull the HU detail I need, essentially replacing my current SELECT statement?

Here's a snippet of my current code getting the HU's assigned to TU's and then the SELECT statement grabbing the detail for each HU:

  method execute_action.

    data: lt_tu_hus type /scwm/tt_tudlv.

*   Get HUs from TU
    io_tu_dlv->get_assigned_hus( exporting
                                   it_tu_act_key  = it_tu_act_key
                                 importing
                                   et_tudlv = lt_tu_hus ).

*   Get HU data
*   Get ODO details
    select /scdl/db_proci_o~doccat, /scdl/db_proci_o~itemtype, /scdl/db_proci_o~docno, /scdl/db_proci_o~cretst, /scdl/db_proci_o~creusr,
           /scdl/db_proci_o~docid,/scdl/db_proci_o~productno, /scdl/db_proci_o~productid, /scdl/db_proci_o~batchno, /scdl/db_proci_o~qty, uom,
           /scwm/gmhuhdr~huident, /scdl/db_proci_o~entitled, /scwm/gmhuhdr~dstgrp,/scdl/db_refdoc~refdocno, /scdl/db_refdoc~refitemno, /scdl/db_proci_o~/scwm/aarea
     from /scdl/db_proci_o
        inner join /scwm/gmhuitm on /scwm/gmhuitm~qdocid = /scdl/db_proci_o~docid
                                and /scwm/gmhuitm~qitmid = /scdl/db_proci_o~itemid
        left outer join  /scwm/gmhuhdr  on /scwm/gmhuhdr~guid_hu = /scwm/gmhuitm~guid_parent
        left outer join /scdl/db_refdoc on /scdl/db_refdoc~docid = /scdl/db_proci_o~docid
                                     and /scdl/db_refdoc~itemid = /scdl/db_proci_o~itemid
                                     and /scdl/db_refdoc~refdoccat = 'ERP'
        into corresponding fields of table @ct_output
        for all entries in @lt_tu_hus
        where /scwm/gmhuhdr~guid_hu = @lt_tu_hus-top_hu.


    if not ct_output is initial.

*   Get material descriptions
      select /sapapo/matkey~matnr as productno /sapapo/mattxt~maktg
        from /sapapo/matkey
        inner join /sapapo/mattxt on /sapapo/mattxt~matid = /sapapo/matkey~matid
        into corresponding fields of table ct_mat
        for all entries in ct_output
        where matnr = ct_output-productno
          and langu = sy-langu.

*   Get shipto
      select docid party_role partyno partyid from /scdl/db_bploc into corresponding fields of table ct_ship
        for all entries in ct_output
        where docid = ct_output-docid.

*   Get locations
      if not ct_ship is initial.
        select partner_guid from /sapapo/loc into corresponding fields of table ct_dc
          for all entries in ct_ship
          where partner_guid = ct_ship-partyid
            and loctype      = '1002'.      "DC

*   Get country
        select but020~partner adrc~country from adrc
          join but020  on but020~addrnumber = adrc~addrnumber
          into corresponding fields of table ct_country
          for all entries in ct_ship
          where partner = ct_ship-partyno.


      endif.

*   Get delivery dates
      select docid tstfr tstto tzone from /scdl/db_date into corresponding fields of table ct_date
         for all entries in ct_output
        where docid   = ct_output-docid
          and tsttype = 'TDELIVERY'.

    endif.
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Jan 24, 2017 at 08:55 AM

    For re-use purpose, I would like to separate into two functions.

    1. find Outbound delivery order assigned to TU
      /SCWM/TU_DLV
      /SCWM/TUNIT
      /SCWM/TU_SR_ACT
      /SCDL/DB_PROCH_O
    2. find HU related(picked) by delivery
      /SCWM/HUREF
      /SCWM/HUHDR
    Add comment
    10|10000 characters needed characters exceeded

  • Feb 07, 2017 at 10:19 AM

    Hi Guy,

    Please check the class-/SCWM/CL_SR_BOM_DLV

    Methods: GET_TU_DLV_DATA,GET_TU_DLV_DEPENDENCIES

    Kindly check the code inside methods.Hope It will help to replace.

    Kind regards,

    Ajit

    Add comment
    10|10000 characters needed characters exceeded