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 –
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.
Thanks for this amazing tutorial!
I have a question. My Zfields in KNVV are not getting updated. Do I need to use DSAVE and DCHCK events? Any insight?
I used your code, and included my KNVV-ZCustomFields in an existing Tab like the blog by Andi Mauersberger on this topic – https://blogs.sap.com/2019/11/07/sap-s-4hana-business-partner-field-enhancement/
Thank you!
Hi Marielys,
Check if custom fields appended on CVIS_EI_EXTERN sub structure are populated properly. (DATA / DATAX)
No additional coding is required.
Hi Badrinath,
Thanks for explaining in detail.
I have made the necessary additions for CVIS_EI_EXTERN for DATA and DATAX structures at vendor and customer level(S/4 HANA version 2020 FP01). The fields are appearing on screen. But when I press the SAVE button, the existing data is clear and newly entered data is getting cleared. Could you please suggest?
Thanks,
Deepashree S
Hi Badrinath,
I followed your blog, i am able to see the fields added to SCreen but data is not getting updated in table. Please suggest any badi used for saving data
Hi Badrianth,
Thanks for your amazing work.
I did all the steps completely. but my KNVV-ZFIELD field is not updated in the table. I have made the necessary additions for CVIS_EI_EXTERN. For DATA and DATAX structures.
The field comes to the screen. But when you press the SAVE button, this data is clear.
Hi Omer,
Is the issue resolved ? Even i am facing the same issue.
I have made the necessary additions for CVIS_EI_EXTERN for DATA and DATAX structures at vendor and customer level(S/4 HANA version 2020 FP01). The fields are appearing on screen. But when I press the SAVE button, the existing data is clear and newly entered data is getting cleared. Could you please suggest?
Thanks,
Deepashree S
Hello I have the same issue. Did you solve this problem?
Even i am facing same issue, Please reply if it worked for you with any changes
Badrinath Ravi Thank you for details step. I would like to update the custom field in table UKMBP_CMS (SAP Credit Management: Credit Master Data for Partner) in BP transaction. I have added field on screen and tried but no luck to get it update.
Do you have any input on this how to update the credit profile tab custom fields.
Your response will be highly appreciated.
Thanks in Advanced,
Thanks & Regards,
Yogesh Bagul
Hi Yogesh,
I do have similar requirement to add custom fields in External credit information table control in credit profile, If your issue is solved can you please let us know the approach.
Regards
Raghavendra
Hi Yogesh Bagul and Badrinath Ravi
Thanks Badrinath for the tutorial.
I have the same requirement as Yogesh has but in Payment Transactions table control (Bank Details). I need to add a custom display field from LFBK table. Could you please guide me with the steps for changing a table control in BP t-code? I am a bit confuse with Badrinath and Yogesh saying that he can solve it with the tutorial.
Thanks in advance and kind regards.
Marcela.
Nice Explanation