Equipmentstückliste löschen

Das Löschen einer Equipmentstückliste erfolgt ebenfalls über Standardbausteine. Der Trick hierbei ist, das die Stückliste zuerst gelesen werden muss, bevor die Löschung vorgenommen werden kann.

DATA ls_bom_head  TYPE bicsk.
DATA ls_bom_zub   TYPE stzub.
DATA lt_bom_items TYPE STANDARD TABLE OF bicsp.
DATA lv_flag      TYPE c.

PARAMETERS p_equnr TYPE equnr.
PARAMETERS p_del AS CHECKBOX.

START-OF-SELECTION.

*** Zuerst: Lesen der Stückliste
  CALL FUNCTION ‘CS_CI_BOM_READ’
    EXPORTING
      estlan         = ‘4’
      ewerks         = ‘ ‘
      estlty         = ‘E’
      eequnr         = p_equnr
    IMPORTING
      abicsk         = ls_bom_head
      astzub         = ls_bom_zub
    TABLES
      bom_items      = lt_bom_items
    EXCEPTIONS
      alt_invalid    = 1
      alt_not_exist  = 2
      bom_invalid    = 3
      bom_not_exist  = 4
      foreign_lock   = 5
      no_auth        = 6
      system_failure = 7
      OTHERS         = 8.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ELSE.
    IF p_del <> space.
*** Löschen der Stückliste
      CALL FUNCTION ‘CS_BT_BOM_DELETE’
       EXPORTING
         i_stzub            = ls_bom_zub
       IMPORTING
         flg_complete       = lv_flag.
      IF lv_flag IS NOT INITIAL.
*** Verbuchen
        CALL FUNCTION ‘CS_DI_BOM_VB’
          EXPORTING
            flg_commit_and_wait = ‘X’
            flg_no_commit_work  = space.
      ENDIF.
    ENDIF.
  ENDIF.

Enno Wulff

Leave a Comment