SAP S4 BP增强 BDT方式 添加自定义屏幕 KNA1和KNVV 通用数据视图、销售与分销视图(英文)

其他参考(中文):https://blog.csdn.net/guangcong2009/article/details/80569877

网上没找到销售与分销 视图:KNVV的添加方式,发出来分享下。

1、添加销售区域屏幕时, 直接将下步骤KNA1改为 KNVV即可。

2、屏幕->部分 里面改为,否则不会在KNVV的屏幕显示

3、同时添加 通用数据和销售与分销屏幕 一直不成功,最后将KNVV的应用程序和数据集都指向KNA1的就成功了(视图和事件中),原因没时间研究了。

1、经过分析,在视图里面调用KNA1的可以显示,但是调用KNVV应用程序不能显示。应该是应用程序调用问题,但是找了好久没有找到位置

最后发现在 屏幕顺序里面加入 数据集+调用程序 就可以了。

 

BP KNVV销售与分销 增强保存时一直提示 KNVV_NEW 表错误:

1、分析应该是增强KNVV造成,跟踪代码,发现系统会取上次的销售与分销的记录

2、一直在BDT里面找原因,却没有找到控制的地方。

3、找了几个小时后在事件里面的 ISDAT 发现,系统会在这里取缓存数据

4、根据前面的自动生成的代码 发现有对当前销售区域的值判断

CHECK CVI_BDT_ADAPTER=>GET_CURRENT_SALES_AREA( ) IS NOT INITIAL

在所有事件里面  DASVB ISDAT XCHAG 加入此判断后,问题解决。

 

Step by step explanation of how to add a new tab to BP screen.

  • Add new fields to standard structure incl_eew_kna1. incl_eew_kna1 is included in KNA1. Fields will be in KNA1 automatically.

            Click on images to see with original size.

          Click on images to see with original size.

TABLES:
  kna1.

constants:
  table_name_kna1     type fsbp_table_name    value 'KNA1',
  false               type boole-boole        value ' '.

DATA:
  gs_kna1 TYPE kna1.
  1. Create a new screen in function group.
  2. IN PBO of sceen call function ‘BUS_PBO’ and in PAI call BUS_PAI. 
  3. MODULE status_9001 OUTPUT.
      CALL FUNCTION 'BUS_PBO'.
    ENDMODULE.
    
    user_command_9001 INPUT.
      CALL FUNCTION 'BUS_PAI'.
    ENDMODULE.

     

  4. In screen layout press F6.Get KNA1-Z fields to the screen. Activate the screen and function group.

Lets begin to customizing.

  • Go to BUPT t-code. 

           Click on images to see with original size.

  • Create a new application named ‘ZKNA’ with New Entries button. Bussiness Partner->Control->Applications. Define a description and active is selected. 

           Click on images to see with original size.

  • Create a new dataset named ‘ZKNA01’ New Entries button. Bussiness Partner->Control->Data Sets.  Click on images to see with original size.
  • Create a new field group named 601 New Entries button. Bussiness Partner->Control->Screen Layout->Field Groups.  Set a description and save. 

           Click on images to see with original size.

  • Assign fields to fields group. Table and field name should be added on screen that is created in Z function group. Click on images to see with original size.
  • Create a new view named ZKNA01 New Entries button. Bussiness Partner->Control->Screen Layout->Views. Set a description.Set Application we created before, same as Data Set. Set program name and screen number. Save the view. Double click on View -> Field Groups. Set field group number we created. Now we should set fm names for before output and after entry. Click on images to see with original size.Click on images to see with original size.
  • Create a fm for before output named zsd_kna1_pbo. Copy ‘CVIC_BUPA_PBO_CVIC03’. Assign fm to Z function group.
function ZSD_KNA1_PBO.
*"--------------------------------------------------------------------
*"*"Local Interface:
*"--------------------------------------------------------------------
  data:
    lt_kna1   type table of kna1,
    lt_knas   type table of knas.

* step 1: request data from xo for dynpro structure
  cvi_bdt_adapter=>data_pbo(
    exporting
      i_table_name = table_name_kna1
    importing
      e_data_table = lt_kna1[]
  ).
  if lt_kna1[] is initial.
    clear gs_kna1.
  else.
    read table lt_kna1 into gs_kna1 index 1.
  endif.

endfunction.
  • Create a fm for after entry named zsd_kna1_pai. Copy ‘CVIC_BUPA_PAI_CVIC03’. Assign fm to Z function group.change     
function ZSD_KNA1_PAI.
*"--------------------------------------------------------------------
*"*"Local Interface:
*"--------------------------------------------------------------------
  data:
    lt_kna1         type table of kna1.
  field-symbols:
    <kna1>          like line of lt_kna1.

  check cvi_bdt_adapter=>is_direct_input_active( ) = false.
* step 1: update xo memory from dypro structure
  cvi_bdt_adapter=>get_current_bp_data(
    exporting
      i_table_name = table_name_kna1
    importing
      e_data_table = lt_kna1[]
  ).

  if lt_kna1[] is initial.
    if gs_kna1 is not initial.
      gs_kna1-kunnr = cvi_bdt_adapter=>get_current_customer( ).
      append gs_kna1 to lt_kna1.
    endif.
  else.
    read table lt_kna1 assigning <kna1> index 1.
    <kna1>-zz_field1 = gs_kna1-zz_field1.
  endif.

  cvi_bdt_adapter=>data_pai(
    i_table_name = table_name_kna1
    i_data_new   = lt_kna1[]
    i_validate   = false
  ).

endfunction.

Set these fm’s to view by Bussiness Partner->Control->Screen Layout->Views.Click on images to see with original size.  

  • Create a new section named ZKNA1 New Entries button. Bussiness Partner->Control->Screen Layout->Sections. Set a description and title. 

            Click on images to see with original size.

  • Select the section we created and double click on Section -> Views. Set item number and view name we created. Save changes. Click on images to see with original size.
  • Create a new screen named ZKNA1 New Entries button. Bussiness Partner->Control->Screen Layout->Screens. Set a description and screen title. Save changes. Click on images to see with original size.
  • Select the screen we created and double click on Screen -> Sections. Set first item section as BUP009 and second number will be section we created. Save changes. Click on images to see with original size.
  • Create a new screen sequence named ZKNA1 New Entries button. Bussiness Partner->Control->Screen Sequenes. Set a description and save changes. Click on images to see with original size.
  • Select the screen seq. we created and double click on Screen Sequence -> Screens. Set item number as screen name that we created. Save changes. 

            Click on images to see with original size.

Now we can see additional tab in BP under FLCU00. Events must be defined for this app.

  •  Go to Bussiness Partner->Control->Events->Bussiness Data Toolset. To set first data we should use ISDAT event. Select ISDAT and double click on Events -> Function Modules. Here we should create a new function in the same fg.  ZSD_KNA1_EVENT_ISDAT. Set Call as ‘X’. And set app name. Save changes.
FUNCTION zsd_kna_event_isdat.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"----------------------------------------------------------------------

  CALL FUNCTION 'CVIC_BUPA_KNA1_GET'
    IMPORTING
      e_kna1 = gs_kna1.

  kna1-zz_field1 = gs_kna1-zz_field1.

ENDFUNCTION.

 Click on images to see with original size.

  1. Turn back to Events. Now we should check if anything is changed in the screen with XCHNG event. Double click on fms. Here we should create a new function in the same fg.  ZSD_KNA1_EVENT_XCHNG. Set Call as ‘X’. And set app name. Save changes. 
    FUNCTION zsd_kna_event_xchng.
    *"----------------------------------------------------------------------
    *"*"Local Interface:
    *"  EXPORTING
    *"     REFERENCE(E_XCHNG) TYPE  BOOLE_D
    *"----------------------------------------------------------------------
    
      IF gs_kna1-zz_field1 NE kna1-zz_field1.
        e_xchng = 'X'.
      ENDIF.
    
    ENDFUNCTION.
     Click on images to see with original size.
  2. Turn back to Events. Now we should set changed values with DSAVB event. Double click on fms. Here we should create a new function in the same fg.  ZSD_KNA1_EVENT_DSAVB. Z Structure is created with Z fields. Set Call as ‘X’. And set app name. Save changes.
  3. FUNCTION zsd_kna_event_dsavb.
    *"--------------------------------------------------------------------
    *"*"Local Interface:
    *"--------------------------------------------------------------------
    
      DATA : ls_kna1 TYPE kna1.
      ls_kna1 = kna1.
      MOVE-CORRESPONDING gs_kna1 TO kna1.
      kna1-zz_field1 = ls_kna1-zz_field1.
    
    
      CALL FUNCTION 'CVIC_BUPA_KNA1_COLLECT'
        EXPORTING
          i_subname = 'ZSD_KNA1_S001'
          i_kna1    = kna1.
    
    ENDFUNCTION.
     Click on images to see with original size.                                                Click on images to see with original size.

Now everything looks fine. Lets test it.

             Click on images to see with original size.

Now we can get current value and change it. With the same solution we can display/update fields in LFA1, KNB1 etc. We only need to find the right fm's for them.  Hopefully it will be useful for you.

  • 0
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值