LO Data Source Enhancement using BAPI
In this blog we will discuss about LO Data source enhancement using BAPI. The scenario is same.
In one of the scenario I was involved, where we need to replicated purchase order fields which is available in standard Purchase Order Item datasource but we need customer and his address in Dashboard which needs to be build using BW query.
For a Particular Purchase Order we need to have Customer and Address fields in our data flow along with the other available field in our datasource 2LIS_02_ITM.
But before going to the implementation I want to discuss about the enhancement framework architecture , for BAPI interface implementation architecture in BW4/HANA in is involving Operational delta queue. The architecture is given below –
It is better and good practice to enhance i.e. append to communication structure instead of directly appending extract structure. It will increase the scope for reusability.
Customer (KUNNR) and Customer Address(ADRNR) is available in table EBAN and not exists in communication structures and using join EKPO-BANFN = EBAN -BANFN and EKPO-BNFPO = EBAN -BNFPO we will populate it. But before that lets go through the SMOD and CMOD concept and diagram which will help you to understand the enhancement.
The below diagram will describe how we implement the definition in customer space –
Now we will go step by step to implement i.e. Enhance our scenario i.e. 2LIS_02_ITM enhancement.
1. If the datasource is not activated then go to RSA5 and activate.
2. Go to RSA6 generate the Datasource if the datasource not generated already .
3. Check the datasource in ROOSOURCE table to check the datasource type if it is transactional or Master data type. It is transactional type datasource.
4. Now we have to release the datasource for ODP –
- As our datasource is a standard datasource go to se11 and display the table ROOSATTR. Check the flag BS_ANLY_DS_RELEASE_ODP(EXPOSE_EXTERNAL). It should be checked for the datasource to be released for Operational Delta Queue. If not checked edit and checked to available in ODQ .
5. Go to the LO cockpit by using LBWE transaction and check the field Customer (KUNNR) and Customer Address(ADRNR) exists in any of the communication system or not. In our case it is not there .
6. When the required field is not exists in the communication structure the we need to enhance the communication structure by appending the structure . This scenario is our case and our communications structure is MCEKPO which we will enhance by appending a structure.
7. Go to se11 and put in Data Type MCEKPO. click Display.
8. Click on append structure and provide name ZMCEKPO.
9. Add field KUNNR and ADRNR with same data type into the append structure. Activate it –
10. Drag drop the MMSTA field into the extract structure MC02M_0ITM.
11. Go to Se19. Create a Custom BADI inside the enhancement Spot RSU5_SAP_BADI.
With the below name.-
Customized BADI Name – ZPP_DS_2LIS_02_ITM.
Implemented class Name – ZCL_DS_2LIS_02_ITM.
12. Go inside the class ZCL_DS_2LIS_02_ITM and implement the below code –
ATA : LT_DATA TYPE STANDARD TABLE OF MC02M_0ITM. FIELD-SYMBOLS : <LS_DATA> TYPE MC02M_0ITM, <LV_KUNNR> TYPE EBAN-KUNNR, . <LV_ADRNR> TYPE EBAN-ADRNR. CLEAR LT_DATA. LT_DATA = C_T_DATA. LOOP AT LT_DATA ASSIGNING <LS_DATA> SELECT SINGLE KUNNR,ADRNR INTO (<LV_KUNNR>,<LV_ADRNR>) FROM EBAN WHERE BANFN = <LS_DATA>-BANFN AND BNFPO = <LS_DATA>-BNFPO. IF SY-SUBRC = 0. <LS_DATA>-KUNNR = <LV_KUNNR>. <LS_DATA>-ADRNR = <LV_ADRNR>. ENDIF. ENDLOOP. REFRESH C_T_DATA. c_t_data = lt_data.
13. Activate the calls and customized enhancement.
14. Activate the datasource using LBWE source which is deactivated.
15. Go to ODQMON and create a dummy subscription to test the data of the datasource using RODPS_REPL_TEST.
Note : When DTP executed from the BI for the first time for the datasource a Subscription will automatically crated in the SAP ECC side ODQMON.
16. Execute Tcode OLI3BW to load the Setup table.
17. Execute RSA3 and check the data.