In SAP R/3 system, customer master data/vender master data transactions such as FK01/FK02/FK03/XK01/XK02/XK03/FD01/FD02/FD03/XD01/XD02/XD03 are enhanced with country specific / localization requirements with the help of Business Add-In (BAdI) technology. In the customer/vendor master record dialog the fields are admitted via country-specific sub-screens into the maintenance of the customer/vendor master. The Standard customer/vendor master is informed about these sub-screens via interfaces.
Moving to SAP S/4 HANA system, traditional customer/vendor master data transactions are made obsolete and replaced by Business partner transaction (BP). Since the customer/vendor transactions are made obsolete, now the same functionalities/enhancements have to be added / moved to business partner transaction BP.
Business Partner can be enhanced by BDT( Business Data Toolset) framework. Sometimes due to localization requirements you need to add some data in Business Partner and that data should be visible only for particular country.
In this blog we will see how to add such custom data in “Supplier : Country Specific Extension” tab which is already provided by SAP.
Before using the tools/framework, create a function group which will hold the function modules and screens for the extension specific table.
Example: ZLVES_BUPA_ES_RE_INFO
Create a screen in in the function group created. In this example we will add a table control and two button to create and delete rows in table.
Go to the transaction BUPT
Navigate to the menu Business Partner -> Control -> Applications. Within the BDT you can define any number of applications for each application objects.
Navigate to the menu Business Partner -> Control -> Data Sets. A new data set is created based on the functionality and the level of segregation of data. Data sets are created for independent business functionalities.
Create the new data sets by following the naming convention <Application>_<Functionality> for customers and vendors. Example LVESRE.
To decide under which roles of the BP transaction should the data set appear, data set is assigned to respective BP views. From the easy access navigate to Business Partner -> Control -> Divisibility -> BP Views. You can add the data set under the below existing BP Views based on the roles:
- FLCU00 Customer/Vendor Integration: FI Customer
- FLCU01 Customer/Vendor Integration: Customer
- FLVN00 Customer/Vendor Integration: FI Vendor
- FLVN01 Customer/Vendor Integration: Vendor
In this example we will add it in FI Vendor.
Country specific Applications are added to above 4 BP View by going into the cluster “Calling Applications”.
All fields of the screen must be assigned to field groups. Navigate to Business Partner->Control-> Screen Layout -> Field Groups.
Note – In case of table control you need to add both Header Fields and Work Area for table control and both should have different names. You need to mark work area fields as “Input” in field group. You also need to add buttons used in the same field group and mark them as “Input” and “Table” column should be blank for them.
In above image, ADD_RE and DEL_RE are names of the buttons.
Since we are using table control, select the table control checkbox in field group. Add function for field grouping.
How to create function for field grouping?
Function should have below import parameters. FLDGR will have field group that is currently under process. IN_STATUS will have current status of the fields.
FLDGR TYPE TBZ3W-FLDGR
IN_STATUS TYPE BUS000FLDS-FLDSTAT
Below export parameter should be there.
OUT_STATUS TYPE BUS000FLDS-FLDSTAT
Based on values in out_status, field will be visible or invisible in enhancement.
+ Required entry
. Optional entry
* Display
– Hidden
Sample code snippet for this this function module:
lt_r_fldgrp = VALUE #( ( sign = 'I' option = 'EQ' low = '4700' high = '' ) ).
DATA(lv_compcode) = go_cvi_bdt_adater->get_current_company_code( ).
IF lv_compcode IS NOT INITIAL.
CALL FUNCTION 'FI_COMPANY_CODE_DATA'
EXPORTING
i_bukrs = lv_compcode
IMPORTING
e_t001 = ls_t001.
CALL FUNCTION 'FI_COUNTRY_DATA'
EXPORTING
i_land1 = ls_t001-land1
IMPORTING
e_t005 = ls_t005.
*+ Required entry
*. Optional entry
** Display
*- Hidden
IF fldgr IN lt_r_fldgrp.
IF ls_t005-intca EQ gc_spain.
out_status = in_status.
ELSE.
out_status = lc_fstat_suppressed.
ENDIF.
ELSE.
out_status = in_status.
ENDIF.
ELSE.
out_status = in_status.
ENDIF.
Create View and assign field groups to a view:
Again go to BUPT transaction path Business Partner->Control-> Screen Layout -> Views.
- Multiple field groups can be assigned under one view.
- Screen program name, screen number and additional function modules for PBO (e.g. reading texts), PAI (checks on field level), PBC, additional checks (e.g. individual required field checks) can be assigned.
- A BDT view is only displayed if the indicator ‘Entry View’ is set for at least one BDT view. This indicator should normally be set. It has no effect on field control.
- Choose the option “Dialogue View” which indicates that the view is assigned to the dialog. A dialog view is used exclusively to maintain and display business partner data.
- Under screen configuration section, choose data screen.
As of now keep the before output and after entry function modules blank.
Click on Views->Field group and assign field group to the view.
From the easy access navigate to Business Partner -> Control -> Screen Layout -> Sections. Assign the view to the corresponding section.
From the easy access navigate to Business Partner -> Control -> Screen Layout -> Screens. Screens appear as a tab strip (standard) or as a model window in dialog. There are 4 standard screen already provided by SAP.
- LIC001 – Customer: Country Specific Extensions
- LIC002 – Customer: Company Code Country Specific Extensions
- LIV001 – Vendor: Country Specific Extensions
- LIV002 – Vendor: Company Code Country Specific Extensions
Assign the created sections to the respective screens and maintain the Item Numbers for the sections.
Note- Since LIV002 screen will be in “company Code Country Specific Extensions”, first item should be the standard section FI02001 for company code information.
If this section is not there then the company code information shown in below image will not be visible.
Screen Sequence:
Screen Sequence determines the order in which the screens should appear. Screens should be assigned to the corresponding screen sequences.
From the easy access navigate to Business Partner -> Control -> Screen Sequence. LIC001, LIC002, LIV001, LIV002, which are already maintained in the corresponding screen sequence.
Events Handled:
In case any function codes are associated with screen elements, their actions can be handled via events. New function modules should be created and assigned to events to handle events. From the easy access navigate to Business Partner -> Control -> Events -> Business Data Toolset
If the function module should be triggered, then maintain an ‘X’ under the Call column. If this is not maintained, then the function module will not be triggered.
Sample code snippet for for events function module:
function zlves_bupa_event_fcode_wht.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" REFERENCE(I_FCODE) TYPE TBZ4-FCODE
*" REFERENCE(I_CRSFIELD) TYPE BUS000TBFL-TBFLD
*" REFERENCE(I_CRSLINE) TYPE SY-LILLI
*" EXPORTING
*" REFERENCE(E_XHANDLE) TYPE CLIKE
*"----------------------------------------------------------------------
if go_cvi_bdt_adater IS NOT BOUND.
go_cvi_bdt_adater = NEW gcl_cvi_bdt_adater( ).
ENDIF.
CHECK go_cvi_bdt_adater->get_activity( ) NE cvi_bdt_adapter=>activity_display.
e_xhandle = 'X'.
CASE i_fcode.
WHEN 'DEL_RE'.
DELETE g_gtc_fiwtes_re_itab WHERE sel = 'X'.
IF sy-subrc NE 0.
MESSAGE s009(FIWT_ES_RE) DISPLAY LIKE 'E'.
ENDIF.
DATA(lt_fiwtes_re_itab) = g_gtc_fiwtes_re_itab[].
go_cvi_bdt_adater->data_pai_with_company_code(
EXPORTING
i_table_name = gc_table_name
i_data_new = lt_fiwtes_re_itab
i_validate = 'X' ).
WHEN 'ADD_RE'.
APPEND INITIAL LINE TO g_gtc_fiwtes_re_itab.
ENDCASE.
ENDFUNCTION.
Fcodes ADD_RE and DEL_RE are to add and delete real estate data in table respectively.
Extensible Object Enhancements (XO)
XO objects will be created to store/display data from dialog / direct input in to memory. You will need XO object to store the data on the screen in the memory. For that,
Go to the tcode – XO80.
In the drop-down that appears, choose the Name of Business Obj. Type as “Business Partner”.
Under the components node, navigate to Memory Objects and create a new memory object for each new table. The memory object name should be same as table name.
Maintain the customer / vendor field name from your table in the alternate key field.
Select Individual implementation checkbox and create individual implementation for each memory object. The individual class shall be created by inheriting from CVI_MO_VENDOR / CVI_MO_CUSTOMER. Naming convention for individual implementation: CVI_MO_CS_<TABLENAME>.
The method VALIDATE_INTERN shall be redefined to add the validations (the validation that you have done in PAI module should be maintained here as well in order to make sure that the data that is coming through non-dialogue input is also validated ->Mainly for mass processing / direct input).
Assign the persistence object CS_VENDOR/ CS_CUSTOMER to the object. If the tables store both customer / vendor entries with with vendor / customer number stored in a different name e.g ACCO, KOART then a new persistence object has to be created. The persistence objects shall be linked with a new class inheriting from XO_PERSISTENCE_OBJECT.
Assigning memory objects to segment objects:
The memory objects should be assigned to the segment objects.
Memory objects should be assigned to one of the below segment objects:
Segment Object | Description |
CUSTOMER_CC | Company code dependent data for Customer |
VENDOR_CC | Company code dependent data for Vendor |
CUSTOMER_GENERAL | General data of Customer |
VENDOR_GENERAL | General data of Vendors |
To add memory objects to a segment, choose the segment and in the right pane click on the “Add Memory Object” button.
Save the data in Database
To save data to the database tables, the following BAdI’s needs to be implemented,
- VENDOR_EXTENSION_UPDATE
- CUSTOMER_EXTENSION_UPDATE
Example BADI implementations are
BAdI implementation:
- FINLOC_VENDOR_UPDATE
- FINLOC_CUSTOMER_UPDATE
Example implementation class:
BAdI implementation class:
- CL_FINLOC_VENDOR_UPDATE
- CL_FINLOC_CUSTOMER_UPDATE
You need to call your method to update the database in method IF_EX_VENDOR_EXTENSION_UPDATE~UPDATE_MODULES of BADI implementation class.
For append structures to core tables, the saving of data into DB can be enabled with the help of the following BadIs.
- VENDOR_EXTENSION_COMPLETE
- CUSTOMER_EXTENSION_COMPLETE
After completing these steps we will do coding for PAI and PBO function modules ZLVES_BUPA_PBO_LVESRE01 and ZLVES_BUPA_PAI_LVESRE01 which we attached to the view in BUPT transactions.
Sample code snippet for ZLVES_BUPA_PBO_LVESRE01.
FUNCTION zlves_bupa_pbo_lvesre01.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"----------------------------------------------------------------------
DATA: lt_fiwtes_re_info TYPE TABLE OF fiwtes_re_info.
IF gv_lifnr IS INITIAL.
gv_lifnr = cvi_bdt_adater=>get_current_vendor( ).
ENDIF.
IF gv_bukrs IS INITIAL.
gv_bukrs = cvi_bdt_adater=>get_current_company_code( ).
ENDIF.
CALL FUNCTION 'FI_COMPANY_CODE_DATA'
EXPORTING
i_bukrs = gv_bukrs
IMPORTING
e_t001 = gs_t001.
CALL FUNCTION 'FI_COUNTRY_DATA'
EXPORTING
i_land1 = gs_t001-land1
IMPORTING
e_t005 = gs_t005.
cvi_bdt_adater=>data_pbo_with_company_code(
EXPORTING
i_table_name = gc_table_name
IMPORTING
e_data_table = lt_fiwtes_re_info ).
gv_activity = cvi_bdt_adater=>get_activity( ). "get Activity Type
ENDFUNCTION.
You can fill global variables like gv_bukrs and gv_lifnr in above code which you will require in PAI and PBO modules of screen. Call to cvi_bdt_adater=>data_pbo_with_company_code is mandatory in this method for data extraction for PBO event of the screen. gc_table_name is the name of the table which you are going to include in the extension. In this case it is ZFIWTES_RE.
Note: This method will dump if settings in XO80 tcode for memory object are not correct or incomplete. If you are getting dump then please check all the steps mentioned in this blog for tcode XO80 again.
Sample code snippet for ZLVES_BUPA_PAI_LVESRE01.
FUNCTION zlves_bupa_pai_lvesre01.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"----------------------------------------------------------------------
DATA: lt_fiwtes_re_info_set_memory TYPE TABLE OF fiwtes_re_info.
DATA: ls_fiwtes_re_info_set_memory TYPE fiwtes_re_info.
DATA: lt_fiwtes_re_info_get_persi TYPE TABLE OF fiwtes_re_info.
IF gv_lifnr IS INITIAL.
gv_lifnr = cvi_bdt_adater=>get_current_vendor( ).
ENDIF.
IF gv_bukrs IS INITIAL.
gv_bukrs = cvi_bdt_adater=>get_current_company_code( ).
ENDIF.
lt_fiwtes_re_info_set_memory = CORRESPONDING #( g_gtc_fiwtes_re_itab ).
ls_fiwtes_re_info_set_memory-bukrs = cvi_bdt_adater=>get_current_company_code( ).
MODIFY lt_fiwtes_re_info_set_memory FROM ls_fiwtes_re_info_set_memory TRANSPORTING bukrs WHERE bukrs IS INITIAL.
* Set the current data
CALL METHOD cvi_bdt_adater=>data_pai_with_company_code
EXPORTING
i_table_name = gc_table_name
i_data_new = lt_fiwtes_re_info_set_memory
i_validate = 'X'.
* Get the current data
CALL METHOD cvi_bdt_adater=>get_fiwtes_re_info
IMPORTING
et_fiwtes_re_info = lt_fiwtes_re_info_get_persi.
ENDFUNCTION.
After implementing these steps, you will get the screen in BP transaction.
Your call sequence when you click on the tab will be as follows:
So its not like “LVES_BUPA_EVENT_FMOD2_ES_RE” returns the status “suppressed” for a field group means that screen will not get called at all. Screen will be always called but it should mandatorily call “BUS_MAIN” in PBO. That function will check visibility of field group with the help of function module “”LVES_BUPA_EVENT_FMOD2_ES_RE” and then hide fields.
For issues regarding visibility, you can debug the FM “BUS_FMOD_MAIN”.
If you are not fine with the visibility handled by function module “BUS_FMOD_MAIN” , then you can override the visibility in PBO event of the screen but the call to “BUS_MAIN” is mandatory. Otherwise an empty tab with no any elements will appear in case of other countries.
Sample PBO code for the screen:
FORM column_visibility .
LOOP AT gtc_fiwtes_re-cols INTO DATA(ls_cols).
IF gs_t005-intca EQ gc_spain.
gtc_fiwtes_re-invisible = ''.
IF gv_activity = '03'.
ls_cols-screen-input = 0.
ELSE.
ls_cols-screen-input = 1.
ENDIF.
ELSE.
ls_cols-screen-active = 0. "Any other combination like screen-invisible = 1 will not work. tab will be hidden only if no any active lements are there
ENDIF.
MODIFY gtc_fiwtes_re-cols FROM ls_cols.
ENDLOOP.
LOOP AT SCREEN.
IF gs_t005-intca EQ gc_spain.
IF gv_activity = '03'.
screen-input = 0.
ELSE.
screen-input = 1.
ENDIF.
ELSE.
screen-active = 0.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
ENDFORM.
Make sure that to hide the fields, you use screen-active = 0. If you do not set this parameter and set some other parameter like screen-invisible = 0, then its considered as element is active but currently invisible. Empty tab with heading will appear in that case in BP transaction. screen-active = 0 means element is inactive.
If you find this post helpful then please like, share and subscribe. You can also share your feedback in comments section.
Follow the topic page ABAP Topics,
post and answer questions on ABAP Q&A, and read other posts on the topic ABAP Posts