Skip to Content
Technical Articles

SAP S/4HANA BP screen enhancement with custom tab

Introduction –

This requirement came up as a part of customer migration from SAP ECC system to SAP S/4HANA system. They had a few custom fields on Customer master data which had to be preserved post conversion. These fields had to be placed in a custom tab on Business Partner transaction.

Links / References –

You would find detailed explanation in SAP cookbook.

SAP note 2309153 – Cookbook for enhancing the SAP Business Partner with additional customer/vendor fields

Additionally,

There is blog post written by Andi Mauersberger on this topic – https://blogs.sap.com/2019/11/07/sap-s-4hana-business-partner-field-enhancement/

 

Current example would add custom fields to an additional tab instead of an existing one.

[Custom fields attached on KNVV table needs to placed on Business Partner custom tab for updates]

We would follow steps under scenario B of cookbook.

Steps –

BUS1

BUS23

BUS4

BUS5

BUS6

Screen is attached to Sales Area section of Customer Screen

BUS3

BUS2

 

BUSD – Data Set attached to standard Business Role

 

BP Screen Customer role –

 

Extend structure CVIS_EI_EXTERN by appending custom fields to respective DATA / DATAX sub structures identified

 

Function group –

FUNCTION-POOL ZZ_CVI.
data:  gs_knvv               type knvv,

Screen 9001 – Create sub-screen and add custom fields to screen

MODULE USER_COMMAND_9001 INPUT.
CALL FUNCTION ‘ZCVI_CUST_PAI’.
ENDMODULE.

MODULE STATUS_9001 OUTPUT.
CALL FUNCTION ‘ZCVI_CUST_PBO’.
if cvi_bdt_adapter=>get_activity( ) = ’03’.
“disable screen field for editing
endif.
ENDMODULE.

Code –

function ZCVI_CUST_PAI.
data:
lt_knvv         type table of knvv,
ls_sales_area   type cvis_sales_area.
field-symbols:
<knvv>          like line of lt_knvv.
constants:
lc_dynp_struc   type fsbp_table_name value ‘GS_KNVV’,
lc_bdt_view     type bu_sicht        value ‘ZCUS01’.

check cvi_bdt_adapter=>is_direct_input_active( ) = abap_false.
check cvi_bdt_adapter=>get_current_sales_area( ) is not initial.
* step 1: update xo memory from dypro structure
cvi_bdt_adapter=>get_current_bp_sales_data(
exporting
i_table_name = ‘KNVV’
importing
e_data_table = lt_knvv[]
).

if gs_knvv is not initial.
if lt_knvv[] is not initial.
read table lt_knvv assigning <knvv> index 1.
if sy-subrc = 0.
<knvv>-ZZDIVISION = gs_knvv-ZZDIVISION.
<knvv>-ZZDEPARTMENT = gs_knvv-ZZDEPARTMENT.
<knvv>-ZZSECTION = gs_knvv-ZZSECTION.
<knvv>-ZZTEAM = gs_knvv-ZZTEAM.
<knvv>-ZZRESPOSIBLE = gs_knvv-ZZRESPOSIBLE.
endif.
endif.
endif.

cvi_bdt_adapter=>data_pai_with_sales_area(
i_table_name = ‘KNVV’
i_data_new   = lt_knvv[]
i_validate   = ‘ ‘
).

** step 2: check fields
*  check cvi_bdt_adapter=>get_activity( ) <> cvi_bdt_adapter=>activity_display.

endfunction.

FUNCTION ZCVI_CUST_PBO.

data: lt_knvv type table of knvv.
* step 1: receive data from xo
if cvi_bdt_adapter=>get_current_sales_area( ) is initial.
clear gs_knvv.
else.
cvi_bdt_adapter=>data_pbo_with_sales_area(
exporting
i_table_name = ‘KNVV’
importing
e_data_table = lt_knvv[]
).
if lt_knvv[] is initial.
clear gs_knvv.
else.
read table lt_knvv into gs_knvv index 1.
endif.
endif.

** step 2: update text fields for dynpro
**Required only if screen field names are different

ENDFUNCTION.

 

Conclusion – We can extend customer / vendor master data table append structures on Business Partner transaction code for maintenance.

 

2 Comments
You must be Logged on to comment or reply to a post.