BP供应商主数据新增页签增强

1

文档说明

78651276afd237453aae9abe274c9271.png

之前发表过BP客户主数据的页签增强,本篇文档介绍BP供应商主数据公司视图下新增页签增强

BP客户主数据新增页签增强

斌将军,公众号:斌将军BP新增页签增强

与上篇文章相比,因为在公司视图下新增,代码有些区别,本篇文章也只介绍代码方面的实现,配置方面仍可以参考《BP客户主数据新增页签增强》中的配置,只要注意区分客户和供应商即可,本文章不在赘述。

除此之外,在屏幕中画输入框时,放弃使用全局结构GS_LFB1-ZXX定义,而是参照了表LFB1-ZXX进行定义,将表字段对应的域值也显示为搜索帮助,更加方便使用。

2

实现过程

b0ff8b444a75eaaee75cc6992074f73d.png

增强字段

28eee0f955a2333f9f80a14c897ff934.png

c6514f208700f8a846a4f2f2c3f36e07.png

ZMM19_PBO

"--------------------@斌将军--------------------
FUNCTION zmm19_pbo.
*"-----------------------
*"*"本地接口:
*"-----------------------


  DATA:lt_lfb1  TYPE TABLE OF lfb1,
       lv_lifnr TYPE lfb1-lifnr,
       lv_bukrs TYPE lfb1-bukrs.


  lv_lifnr = cvi_bdt_adapter=>get_current_vendor( ).
  lv_bukrs = cvi_bdt_adapter=>get_current_company_code( ).
  IF lv_bukrs IS INITIAL.
    CLEAR:lfb1.
  ELSE.
    cvi_bdt_adapter=>data_pbo(
    EXPORTING
      i_table_name = table_name_lfb1
    IMPORTING
      e_data_table = lt_lfb1[]
  ).


    READ TABLE lt_lfb1 INTO lfb1 WITH KEY lifnr = lv_lifnr bukrs = lv_bukrs.
    IF sy-subrc EQ 0.
      gs_lfb1 = lfb1.
    ELSE.
      CLEAR:gs_lfb1,lfb1.
    ENDIF.


  ENDIF.
ENDFUNCTION.
"--------------------@斌将军--------------------

ZMM19_PAI

"--------------------@斌将军--------------------
FUNCTION zmm19_pai.
*"----------------------
*"*"本地接口:
*"----------------------


  DATA: lt_lfb1  TYPE TABLE OF lfb1,
        lv_lifnr TYPE lfb1-lifnr,
        lv_bukrs TYPE lfb1-bukrs.


  FIELD-SYMBOLS:  LIKE LINE OF lt_lfb1.


  CHECK cvi_bdt_adapter=>is_direct_input_active( ) = false.
  CHECK cvi_bdt_adapter=>get_current_company_code( ) IS NOT INITIAL.


  "公司代码
  lv_lifnr = cvi_bdt_adapter=>get_current_vendor( ).
  lv_bukrs = cvi_bdt_adapter=>get_current_company_code( ).


  cvi_bdt_adapter=>get_current_bp_data(
    EXPORTING
      i_table_name = table_name_lfb1
    IMPORTING
      e_data_table = lt_lfb1[]
  ).
  IF lt_lfb1[] IS INITIAL.
    IF lfb1 IS NOT INITIAL.
      lfb1-lifnr = lv_lifnr.
      lfb1-bukrs = lv_bukrs.
      IF lfb1-lifnr IS NOT INITIAL AND lfb1-bukrs IS NOT INITIAL.
        APPEND lfb1 TO lt_lfb1.
      ENDIF.
    ENDIF.
  ELSE.
    READ TABLE lt_lfb1 ASSIGNING  WITH KEY lifnr = lv_lifnr bukrs = lv_bukrs.
    IF sy-subrc EQ 0.
      <lfb1>-zgmp = lfb1-zgmp.
    ENDIF.


  ENDIF.


  cvi_bdt_adapter=>data_pai(
    i_table_name = table_name_lfb1
    i_data_new   = lt_lfb1[]
    i_validate   = false
  ).


ENDFUNCTION.
"--------------------@斌将军--------------------

ZMM19_EVENT_DSAVB

"--------------------@斌将军--------------------
FUNCTION zmm19_event_dsavb.
*"-----------------------
*"*"本地接口:
*"-----------------------


  DATA:lt_lfb1      TYPE TABLE OF lfb1,
       ls_lfb1      TYPE lfb1,
       ls_lfb1_temp TYPE lfb1,
       lv_lifnr     TYPE lfb1-lifnr,
       lv_bukrs     TYPE lfb1-bukrs.


  lv_bukrs = cvi_bdt_adapter=>get_current_company_code( ).
  ls_lfb1 = lfb1.
  CHECK ls_lfb1 IS NOT INITIAL.


  MOVE-CORRESPONDING gs_lfb1 TO ls_lfb1_temp.
  ls_lfb1_temp-bukrs = lv_bukrs.
  ls_lfb1_temp-zgmp = lfb1-zgmp."
  APPEND ls_lfb1_temp TO lt_lfb1.


  CALL FUNCTION 'CVIV_BUPA_LFB1_COLLECT'
    EXPORTING
      i_subname = 'ZMMS_LFB1' "附加结构
    TABLES
      t_lfb1    = lt_lfb1.


  lv_lifnr = cvi_bdt_adapter=>get_current_vendor( ).
  READ TABLE lt_lfb1 INTO ls_lfb1 WITH KEY lifnr = lv_lifnr bukrs = lv_bukrs.
  IF sy-subrc EQ 0.
    lfb1 = ls_lfb1.
    gs_lfb1 = lfb1.
  ENDIF.


ENDFUNCTION.
"--------------------@斌将军--------------------

ZMM19_EVENT_ISDAT

"--------------------@斌将军--------------------
FUNCTION zmm19_event_isdat.
*"---------------------
*"*"本地接口:
*"---------------------


  CALL FUNCTION 'CVIV_BUPA_LFB1_GET'
    IMPORTING
      e_lfb1 = gs_lfb1.


  lfb1-zgmp = gs_lfb1-zgmp.   "增强字段赋值


ENDFUNCTION.


"--------------------@斌将军--------------------

ZMM19_EVENT_XCHNG

"--------------------@斌将军--------------------
FUNCTION zmm19_event_xchng.
*"------------------------
*"*"本地接口:
*"  EXPORTING
*"     REFERENCE(E_XCHNG) TYPE  BOOLE_D
*"------------------------


  IF gs_lfb1-zgmp <> lfb1-zgmp.
    e_xchng = 'X'.
  ENDIF.


ENDFUNCTION.
"--------------------@斌将军--------------------

ZMM19_EVENT_DLVE1

"--------------------@斌将军--------------------
FUNCTION zmm19_event_dlve1.
*"---------------------------
*"*"本地接口:
*"---------------------------


  CLEAR:gs_lfb1,lfb1.


ENDFUNCTION.
"--------------------@斌将军--------------------

创建屏幕

此处参照表LFB1画输入框,可以自动将字段的域值作为搜索帮助

369d9278e59057be83e6e9e5f3e1bcac.png

 屏幕流

"--------------------@斌将军--------------------
*&--------------------------------------------
*& Module STATUS_9001 OUTPUT
*&--------------------------------------------
*&
*&--------------------------------------------
MODULE status_9001 OUTPUT.
  CALL FUNCTION 'BUS_PBO'.


  DATA:lv_bukrs TYPE lfb1-bukrs.
  lv_bukrs = cvi_bdt_adapter=>get_current_company_code( ).


  LOOP AT SCREEN.
    IF screen-name+0(4) = 'LFB1'.
      IF lv_bukrs = '3060'."
        screen-active = '1'.
      ELSE.
        screen-active = '0'.
      ENDIF.
      MODIFY SCREEN.
    ENDIF.
  ENDLOOP.
ENDMODULE.
*&--------------------------------------------
*&      Module  USER_COMMAND_9001  INPUT
*&--------------------------------------------
*       text
*---------------------------------------------
MODULE user_command_9001 INPUT.
  CALL FUNCTION 'BUS_PAI'.
ENDMODULE.


"--------------------@斌将军--------------------

—— 希望本篇文章对您有所帮助 ——

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值