How to BP screen enhancement by adding custom tab
What is Business Partner (BP) ?
In SAP, the ‘BP screen’ refers to the interface used for managing Business Partner (BP) master data. In SAP S/4HANA systems, the Business Partner model is utilized instead of traditional customer and vendor accounts. The BP screen includes general data about the business partner as well as company code-specific data.
To access the BP screen, the transaction code ‘BP’ is commonly used. This screen contains general information such as the business partner’s name, contact details, tax details, and company code-level details like payment terms.
Which section do we want to add the custom tab to?
The section where we want to add the customer-specific fields is the Sales and Distribution section on the Business Partner (BP) screen.
How to BP screen enhancement by adding custom tab ?
STEP 1 →First, we going to the BUPT transaction code then expanding business partner, control and screen layout.
STEP 2 → Then, new entry from the BUS1 →Applications section and create our application.
That holds all the respective screens and views and helps manage the data flows. It is recommended to use a unique naming convention to identify the custom application.
STEP 3 → Now, from the BUS23 →Data Sets section and create our data set.
Datasets split attributes for an application object into meaningful business units. Relevant datasets are assigned to corresponding BP roles. It is recommended to use the application name in the dataset.
STEP 4 → From the Screen Layout section, go to BUS4 →Sections then new entries to create a section.
Sections are used to link the BDT application to the view.
STEP 5 → First, create screen from the BUS5 →Screens section.
It is necessary to assign the correct header section to this screen.
STEP 5.1 → Now, we add the sections in the BUS5 →Screens →Sections.
STEP 6 → BUS6 →Screen Sequences
A screen sequence contains the maintenance screens displayed in succession by the functions on the next screen or previous screen. You can store as many screen sequences as you want for each application object. If the application object uses object parts, you can define which screen sequence should be used for each object part. In all other cases, the standard screen sequence is used.
STEP 6.1 → BUS6 →Screen Sequences →Screen Sequence →Screens
STEP 6.2 →BUS6 →Screen Sequence Categories
STEP 6.3 →BUS6 →Screen Sequence Categories →Screen Sequence Category
STEP 6.4 →Now, we go back to the BUS6 →Screen Sequences section again, select CVIC01, and then in the →Screen sequence → Screens section we have to add the screen with the item number of our section created in BUS5 .
STEP 7 — Creating a function group with screen, pbo and pai. After creating the function group, create function modules for pai and pbo.
Enter coding
FUNCTION zts_bp_cfields_pai.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"----------------------------------------------------------------------
DATA: lt_knvv TYPE TABLE OF knvv,
ls_sales_area TYPE cvis_sales_area,
tab_name_knvv TYPE fsbp_table_name VALUE 'KNVV'.
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.
** update xo memory from dynpro structure
cvi_bdt_adapter=>get_current_bp_sales_data(
EXPORTING i_table_name = tab_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>-zzcrname = gs_knvv-zzcrname.
<knvv>-zzcrdate = gs_knvv-zzcrdate.
ENDIF.
ENDIF.
ENDIF.
cvi_bdt_adapter=>data_pai_with_sales_area(
i_table_name = tab_name_knvv
i_data_new = lt_knvv[]
i_validate = abap_false ).
** or you can use;
* cvi_bdt_adapter=>set_current_bp_data(
* EXPORTING
* i_table_name = tab_name_knvv " Table Name
* i_data_new = lt_knvv[]
* i_validate = abap_false " Validate Data Automatically
* RECEIVING
* r_messages = " Return Table
* ).
** CHECK fields
CHECK cvi_bdt_adapter=>get_activity( ) <> cvi_bdt_adapter=>activity_display.
ENDFUNCTION.
FUNCTION zts_bp_cfields_pbo.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"----------------------------------------------------------------------
DATA: lt_knvv TYPE TABLE OF knvv,
tab_name_knvv TYPE fsbp_table_name VALUE 'KNVV'.
** 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 = tab_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.
** update text fields for dynpro
**Required only if screen field names are different
ENDFUNCTION.
TOP Include
FUNCTION-POOL zts_bp_customer_fields. "MESSAGE-ID ..
DATA gs_knvv TYPE knvv.
"Screen 9001 – Create sub-screen and add custom fields to screen
MODULE pai INPUT.
CALL FUNCTION 'ZTS_BP_CFIELDS_PAI'.
ENDMODULE.
MODULE pbo OUTPUT.
CALL FUNCTION 'ZTS_BP_CFIELDS_PBO'.
IF cvi_bdt_adapter=>get_activity( ) = '03'.
"disable screen field for editing
ENDIF.
ENDMODULE.
* INCLUDE LZTS_BP_CUSTOMER_FIELDSD... " Local class definition
STEP 8 → Extend Complex Interface CVIS_EI_EXTERN
To enable data transportation, CVI’s complex interface must be extended with additional fields.
Extend structure CVIS_EI_EXTERN by appending custom fields to relevant DATA / DATAX substructures.
STEP 8.1 → Run transaction SE11 and enter data type CVIS_EI_EXTERN
STEP 8.2 → Use forward navigation to reach customer’s sales data
STEP 8.3 →Create append to DATA structure type
Component and component type as definition in KNVV
Save and Activate.
STEP 8.4 → Back to Structure CMDS_EI_SALES and Create append to DATAX structure type
Component as definition in KNVV but component type BAPIUPDATE
Save and Activate.
STEP 9→Create field group from the BUS2→Field groups section.
Field Groups control the field status on the screen, like the input field and mandatory field. In addition, a function module for the FMOD2 event in the field group is to be added.
CVIC_BUPA_EVENT_FMOD2 — Customer general data
CVIV_BUPA_EVENT_FMOD2 — Vendor general data
CVIC_BUPA_EVENT_FMOD2_SALES — Sales data
CVIC_BUPA_EVENT_FMOD2_ENH —Customer enhancements
CVIV_BUPA_EVENT_FMOD2_PORG — Purchasing Org. data
CVIC_BUPA_EVENT_FMOD2_CC — Company code data
CVIV_BUPA_EVENT_FMOD2_CC — Company code data
STEP 9.1 →In BUS2 →Field groups → Fields, enter the table and field name of the field group we created.
STEP 10 → From BUS3 →Views, create a view, enter the description, application, differentiation type and data set.
View serves as a central link between the BDT application, data set, and screen. A function group with Custom Screens and PBO-PAI function modules will be added to the view. The coding in the PBO and PAI modules can be copied from standard modules.
STEP 10.1 →And here, enter the function group, screen number, pai and pbo function modules into the relevant fields.
CVIC_BUPA_PBO_CVIC01 / CVIC_BUPA_PAI_CVIC01 for general customer data
CVIC_BUPA_PBO_CVIC15 / CVIC_BUPA_PAI_CVIC15 for sales area customer data
CVIC_BUPA_PBO_CVIC30 / CVIC_BUPA_PAI_CVIC30 for company code customer data
CVIV_BUPA_PBO_CVIV01 / CVIV_BUPA_PAI_CVIV01 for general vendor data
CVIV_BUPA_PBO_CVIV30 / CVIV_BUPA_PAI_CVIV30 for company code vendor data
CVIV_BUPA_PBO_CVIV71 / CVIV_BUPA_PAI_CVIV71 for purchasing vendor data
STEP 10.2 → BUS3 →Views →View →Field Groups Here we add field group.
STEP 11→ BUS4 →Sections →Section →Views, we enter the view we have created into the View part.
STEP 12 → To display the Customer-Specific fields, go to the BUSD t-code and select the relevant view from the BP views section.
STEP 13 → After selecting, go to BP Views → BP View → Data Sets and add the data set you have created.
STEP 13 →Lastly, go to BP Views →BP View →Called Applications and add the application you have created.
Result
When data is entered into the fields we have added and saved, the data will be recorded in the database table.
REFERENCES
https://www.yash.com/blog/business-partner-custom-tab-addition/