SAP MD04 Screen BADI : MD_ADD_COL_EZPS/MD_MRP_PARAMETERS

21 篇文章 0 订阅

method IF_EX_MD_ADD_COL_EZPS~ACTIVATE_ADD_COLUMNS.
*----------------------------------------------------
* Sample implementation to show batch related data
*----------------------------------------------------
* - Rename text of button3_ez to the caracteristic
*   you are actually displaying.
* - Example button/column text is in english, better
*   use textelements here so you can use the example
*   in a multilanguage environment.
*----------------------------------------------------
*   define column titels
    button1_ez text-ez1. " Order Number
 button2_ez text-ez2.   " Order Status

 Define an icon for button 1, but text only as quickinfo
    button1_ez-icon_id '@3O@'.             " ICON_FINAL_DATE
    button1_ez-icon_text space.
    button1_ez-quickinfo text-ez1.

    button2_ez-icon_id '@3O@'.             " ICON_FINAL_DATE
    button2_ez-icon_text space.
    button2_ez-quickinfo text-ez2.
*   The column with the date is visible by default, but the user
*   should have the possibility to turn it off
    ez1_mode '3'.
    ez2_mode '3'.
* Remember that ACTIVATE_ADD_COLUMNS was just called
  sv_activate_called 'X'.
endmethod.

 

 

METHOD if_ex_md_add_col_ezps~fill_add_columns.
*--------------------------------------------------
* Sample implementation to show batch related data.
* The buttons and columns are only shown if the
* column does actually contain some data.
*--------------------------------------------------
* - Change the value of constant lc_atnam to the
*   name of the caracteristic you want to display
*--------------------------------------------------

  CONSTANTS:
    lc_char_x     TYPE xfeld VALUE 'X',
    lc_char_s     TYPE xfeld VALUE 'S',
    lc_atnam      TYPE atnam VALUE 'CHARACTERISTIC',
    lc_col_act(3TYPE c     VALUE 'X13'.

  DATA:
    lv_date(10)   TYPE c,
    lv_refresh(1TYPE c,
    lv_column1    TYPE mdez-usex1,
    lv_column2    TYPE mdez-usex2,
    lv_objnr      TYPE aufk-objnr,
    lv_line       TYPE bsvx-sttxt,
    lv_string     TYPE string.
  DATA:
    BEGIN OF mdanz,
      refre(1)    TYPE c,
    END OF mdanz.

* On the first call
  IF NOT sv_activate_called IS INITIAL.
*   remember the default button/column status
    sv_ez1 cbutt1.
    sv_ez2 cbutt2.
*   Do not show button/column by default.
*   (They will be re-enabled if the column does contain data)
    cbutt1 '0'.
    cbutt2 '0'.
*   Reset Flag
    CLEAR sv_activate_called.
  ENDIF.
* refresh button pressed?
* -> refresh batch buffers...
  IMPORT mdanz-refre TO lv_refresh FROM MEMORY ID 'MD04_REFR'.

  IF sy-subrc IS INITIAL AND
     lv_refresh EQ lc_char_x.

    CALL FUNCTION 'VB_INIT'
      EXPORTING
        init_reset lc_char_x.

    CALL FUNCTION 'VB_INIT'.

    FREE MEMORY ID 'MD04_REFR'.

  ENDIF.
************** Prepare data ******************
* Column 1
  IF ie3mdpslx-delkz 'AR'.
    CLEAR:lv_line.
    MOVE ie3mdpslx-del12 TO lv_column1.
    "Read Order Status
    CONCATENATE 'OR' ie3mdpslx-del12 INTO lv_objnr.
    CALL FUNCTION 'STATUS_TEXT_EDIT'
      EXPORTING
*       CLIENT            = SY-MANDT
*       FLG_USER_STAT     = ' '
        objnr             lv_objnr
*       ONLY_ACTIVE       = 'X'
        spras             sy-langu
        bypass_buffer     'X'
      IMPORTING
        line              lv_line
      EXCEPTIONS
        object_not_found  1
        OTHERS            2.
    IF sy-subrc 0.
      SPLIT lv_line AT space INTO lv_column2 lv_string.
    ENDIF.
  ENDIF.
  IF ie3mdpslx-delkz 'PP' OR ie3mdpslx-delkz 'PA'.
    MOVE ie3mdpslx-delnr TO lv_column1.
  ENDIF.
  IF  ie3mdpslx-delkz 'SB' .
    SELECT SINGLE plnum
      INTO lv_column1
      FROM plaf
      WHERE rsnum ie3mdpslx-delnr.
  ENDIF.
*** Re-enable button/column if data exists ***
* Column 1
  IF cbutt1 '0' AND NOT lv_column1 IS INITIAL.
    cbutt1 sv_ez1.
  ENDIF.
  IF cbutt2 '0' AND NOT lv_column2 IS INITIAL.
    cbutt2 sv_ez2.
  ENDIF.
********** Move data to user-fields **********
  MOVE lv_column1 TO emdezx_usex1.
  MOVE lv_column2 TO emdezx_usex2.
ENDMETHOD.

 

 

METHOD if_ex_md_mrp_parameters~adjust_material_master_params.
*IM_CM61X
*IM_CM61B
*IM_PLSC
*IM_MT61D
*IM_AUFRUF
*CH_MT61D_EXT
*CH_CHANGED

*  break-point . "test
*MOQ Process. last order
  DATA: p_mark(1TYPE c .  " product attribute1

* get leading order
  SELECT SINGLE  prat1 INTO p_mark FROM mvke WHERE matnr im_mt61d .
  IF p_mark 'X' .
    IF ch_mt61d_ext-bstmi <> OR ch_mt61d_ext-bstrf <> 0 .
      CLEAR ch_mt61d_ext-bstmi .
      CLEAR ch_mt61d_ext-bstrf .
    ENDIF .
  ENDIF .
  ch_changed =  'X' .
ENDMETHOD.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值