Tuesday, November 15, 2011

Read Handling Unit Items

If you need to get the contents of a handling unit , this function will help you.

*** Data
  DATA lf_highest_level_hu TYPE  exidv ,
              lt_hu_header TYPE hum_hu_header_t WITH HEADER LINE,
              lt_hu_items TYPE hum_hu_item_t WITH HEADER LINE .

*** Get Items
  CALL FUNCTION 'HU_GET_ONE_HU_DB'
    EXPORTING
      if_hu_number        i_handling_unit
      if_all_levels       'X'  
" Get All Levels
      if_with_text        'X'
    IMPORTING
      ef_highest_level_hu lf_highest_level_hu
      et_hu_header        lt_hu_header[]
      et_hu_items         lt_hu_items[]
    EXCEPTIONS
      hu_not_found        1
      hu_locked           2
      fatal_error         3
      OTHERS              4.
 

*** Delete root HUs if you need only materials 
   DELETE lt_hu_items WHERE unvel IS NOT INITIAL.  



No comments:

Post a Comment