BAdi:BOM_UPDATE - Check update for BOM Save

需求:BOM中替代项目组要求同一组比率之和必须是100.

实现:BAdi:BOM_UPDATE

METHOD if_ex_bom_update~change_at_save.

  DATA:

        ls_wa   TYPE stpob,

        ls_str  TYPE string.



  TYPES:BEGIN OF ty_check,

    alpgr TYPE stpob-alpgr ,

    ewahr TYPE stpob-ewahr ,

    END OF ty_check.

  DATA:

        lt_check TYPE STANDARD TABLE OF ty_check,

        ls_check TYPE ty_check.



  LOOP AT delta_stpob INTO ls_wa WHERE selkz = 'X'.

    MOVE-CORRESPONDING ls_wa TO ls_check .

    COLLECT ls_check INTO lt_check .

  ENDLOOP.



  LOOP AT lt_check INTO ls_check.

    IF ls_check-ewahr <> 100.

      CONCATENATE 'The total number of Usage prob. of Group ' ls_check-alpgr ' must equal to 100.' INTO ls_str SEPARATED BY space.

      MESSAGE ls_str TYPE 'E' .

    ENDIF.

  ENDLOOP.

ENDMETHOD.

 

你可能感兴趣的:(update)