BP 屏幕增加自定义字段定制步骤
【摘要】 进入 BUPT 事物代码选择 业务伙伴->控制->屏幕布局新增字段组新条目,然后填入 610,填入下面的内容:BUA_BUPA_EVENT_FMOD2双击 字段组->字段:新增视图双击视图,单击 新条目:添加完 ZKNA01 视图,然后双击它进入,编辑如下内容:双击 视图->字段组:新增部分新条目:部分:ZKNA1描述:Field Territory标题:Territory双击 部分->视图...
进入 BUPT 事物代码
选择 业务伙伴->控制->屏幕布局
新增字段组
新条目,然后填入 610,填入下面的内容:
BUA_BUPA_EVENT_FMOD2
双击 字段组->字段
:
新增视图
双击视图,单击 新条目:
添加完 ZKNA01
视图,然后双击它进入,编辑如下内容:
双击 视图->字段组
:
新增部分
新条目:
-
部分:ZKNA1
-
描述:Field Territory
-
标题:Territory
双击 部分->视图
:
新增屏幕
新条目:
-
屏幕:ZKNA1
-
描述:KNA1 Addtional Field Territory
-
屏幕标题:Territory
双击 ZKNA1:
双击 屏幕 -> 部分
:
选中 BUA130,双击 屏幕->部分:
新增屏幕顺序
新增保存事件
选择 DSAVB
双击 事件 -> 功能模块,新条目:
定义一个函数 ZSD_BUA110
1. ZSD_BP_BUP001_BUPA_PAI_ZBUA110
FUNCTION zsd_bp_bup001_bupa_pai_zbua110.
*"----------------------------------------------------------------------
*"*"本地接口:
*"----------------------------------------------------------------------
DATA: false TYPE boole-boole VALUE ' ',
lt_kna1 TYPE TABLE OF kna1,
table_name_kna1 TYPE fsbp_table_name VALUE 'KNA1'.
FIELD-SYMBOLS: <kna1> LIKE LINE OF lt_kna1.
CHECK cvi_bdt_adapter=>is_direct_input_active( ) = false.
* step 1: update xo memory from technical screen 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>-zterritory = gs_kna1-zterritory.
* gv_country = gs_kna1-land1.
ENDIF.
cvi_bdt_adapter=>data_pai(
i_table_name = table_name_kna1
i_data_new = lt_kna1[]
i_validate = false
).
* step 2: check fields
CHECK cvi_bdt_adapter=>get_activity( ) <> cvi_bdt_adapter=>activity_display.
* SPACE to implement own PAI checks
ENDFUNCTION.
2. ZSD_BP_BUP001_BUPA_PBO_ZBUA110
FUNCTION zsd_bp_bup001_bupa_pbo_zbua110.
*"----------------------------------------------------------------------
*"*"本地接口:
*"----------------------------------------------------------------------
DATA:
lt_kna1 TYPE TABLE OF kna1,
table_name_kna1 TYPE fsbp_table_name VALUE 'KNA1'.
* 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.
3. ZSD_KNA1_EVENT_DCHCK
FUNCTION ZSD_KNA1_EVENT_DCHCK .
*"----------------------------------------------------------------------
*"*"本地接口:
*"----------------------------------------------------------------------
DATA: ls_kna1 TYPE kna1.
ls_kna1 = kna1.
IF gs_kna1-zterritory IS INITIAL.
CLEAR ls_kna1-zterritory.
ENDIF.
ENDFUNCTION.
4. ZSD_KNA1_EVENT_DSAVB
FUNCTION zsd_kna1_event_dsavb.
*"----------------------------------------------------------------------
*"*"本地接口:
*"----------------------------------------------------------------------
DATA: ls_kna1 TYPE kna1.
ls_kna1 = kna1.
MOVE-CORRESPONDING gs_kna1 TO kna1.
kna1-zterritory = ls_kna1-zterritory.
CALL FUNCTION 'CVIC_BUPA_KNA1_COLLECT'
EXPORTING
i_subname = 'ZKNA1_ENH'
i_kna1 = kna1.
IF gs_kna1-zterritory IS INITIAL.
CLEAR ls_kna1-zterritory.
CLEAR kna1-zterritory.
ENDIF.
* MODIFY kna1 FROM gs_kna1.
ENDFUNCTION.
5. ZSD_KNA1_EVENT_ISDAT
FUNCTION zsd_kna1_event_isdat.
*"----------------------------------------------------------------------
*"*"本地接口:
*"----------------------------------------------------------------------
CLEAR gs_kna1.
CALL FUNCTION 'CVIC_BUPA_KNA1_GET'
IMPORTING
e_kna1 = gs_kna1.
* kna1-zterritory = gs_kna1-zterritory.
ENDFUNCTION.
6. ZSD_KNA1_EVENT_XCHNG
FUNCTION zsd_kna1_event_xchng.
*"----------------------------------------------------------------------
*"*"本地接口:
*"----------------------------------------------------------------------
* DATA: old_territory TYPE kna1-zterritory.
* SELECT SINGLE zterritory FROM kna1 INTO old_territory WHERE kunnr = kna1-kunnr.
* IF gs_kna1-zterritory NE old_territory.
IF gs_kna1-zterritory NE kna1-zterritory.
e_xchng = 'X'.
ENDIF.
ENDFUNCTION.
参考链接:
-
https://blogs.sap.com/2019/11/07/sap-s-4hana-business-partner-field-enhancement/
-
https://blogs.sap.com/2020/06/23/sap-s-4hana-bp-screen-enhancement-with-custom-tab/
【版权声明】本文为华为云社区用户原创内容,转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息, 否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
评论(0)