ME51N/ME52N/ME53N/PR screen enhancement(change tag label)

在PR的item 界面上,增加一个vendor subrange的字段,并对填入的字段进行检查

一, 用增强 MEREQ001 来添加客户增强屏幕

1. 扩展结构CI_EBANDB, 新增字段ZZLTSNR.

2.创建CMOD项目

3.创建subscreen 111

4.激活component fucntion module EXIT_SAPLMEREQ_001获取屏幕输入字段的值,及屏幕的编辑状态   

TABLES : ci_ebandb.
CALL METHOD im_req_item->get_activity
  RECEIVING
    re_aktvt = gv_trtyp.
CASE gv_trtyp.
  WHEN 'A'.
    gv_input = space. "Output only
  WHEN 'V' OR 'H'.
    gv_input = 'X'.          "Input/Output
ENDCASE.
IF im_req_item IS INITIAL.
  CLEAR: ci_ebandb.
ELSE.
  gs_mereq_item = im_req_item->get_data( ).
  MOVE-CORRESPONDING gs_mereq_item TO ci_ebandb.

ENDIF.

 5.激活component function module EXIT_SAPLMEREQ_003设置更改的客户字段存储到表中

DATA : i_mereq_item TYPE mereq_item.
IF NOT im_req_item IS INITIAL.
  i_mereq_item = im_req_item->get_data( ).
  MOVE-CORRESPONDING ci_ebandb TO i_mereq_item .
  CALL METHOD im_req_item->set_data( i_mereq_item ).
  ex_changed = 'X'.
ENDIF.

 6.根据屏幕的状态,更改字段的可是否可编辑,以及输入性数据的检查

   PBO.

MODULE status_0111 OUTPUT.
  IF  gv_input IS INITIAL.
    LOOP AT SCREEN.
      screen-input = 0.
      MODIFY SCREEN.
    ENDLOOP.
  ENDIF.
ENDMODULE.                 " STATUS_0111  OUTPUT

   PAI.

PROCESS AFTER INPUT.
* MODULE USER_COMMAND_0111.
  CHAIN.
   FIELD CI_EBANDB-ZZLTSNR MODULE CHECK_VALUE.
  ENDCHAIN.
MODULE check_value INPUT.
  DATA ls_wyt1 TYPE wyt1.
  IF ci_ebandb-zzltsnr IS NOT INITIAL.
    SELECT SINGLE * FROM wyt1 INTO ls_wyt1 WHERE lifnr =  gs_mereq_item-lifnr
      AND ltsnr =  ci_ebandb-zzltsnr .
    IF sy-subrc <> 0.
      MESSAGE e472(06) WITH ci_ebandb-zzltsnr gs_mereq_item-lifnr.
    ENDIF.
  ENDIF.
ENDMODULE.                 " CHECK_VALUE  INPUT

 Global Data 定义

In include ZXM02TOP:

DATA: gv_trtyp TYPE aktvt.
DATA: gv_input TYPE flag.
data: gs_mereq_item TYPE mereq_item.

更改 custom fields tab 名称,

Se38: SAPLXM02->text element 选择change

添加一条记录ID 为111的文本:并保存激活,(不需要 Access Key)

二. BADI enhancement 用来对输入信息报Error message

SE19: 创建 enhancement implementation:ZME_PROCESS_REQ_CUST

  在method IF_EX_ME_PROCESS_REQ_CUST~PROCESS_ITEM 里面添加检查逻辑

DATA lv_flag TYPE mmpur_bool.
CALL FUNCTION 'ZM00_GET_INTER_COMP_VENDOR' EXPORTING * im_header = im_header im_item = im_item CHANGING ch_failed = lv_flag. IF lv_flag = abap_true. * ch_failed = abap_true. MESSAGE e546(zm00). ENDIF.

 

结果:

 

posted @ 2017-12-02 15:38  Leath.Shi  阅读(1586)  评论(0编辑  收藏  举报