LO Data source enhancement using SAPI

In this blog we will discuss about LO Data source enhancement using SAPI. The scenario is same.

For a Particular Order we need to have material Status and other fields in our data flow for which Material Number is available in our datasource 2LIS_04_P_MATNR.

But before going to the implementation I want to discuss about the enhancement framework architecture which 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.

List of TCODE for filling different setup table –

Material Status MMSTA exists in T141 and using join with MATNR 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 I will go step by step to implement i.e. Enhance our scenario i.e. 2LIS_04_P_MATNR enhancement –

1. Check the datasource in ROOSOURCE table to check the datasource type if it is transactional or Master data type.

2. Go to the LO cockpit by using LBWE transaction and check the field MMSTA  exists in any of the communication system or not. in our case it is not there .Go to step 3 directly. But suppose for any other field the field exists in communication structure then follow below –

  • A. Go to LBWE and go to maintenance ,deactivate the datasource

  • Clear the delta queue using RSA7.

  • Add the field from the communication structure from the extract structure by dragging the required field.

  • Activate the datasource.

3. 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 MCAFKO which we will enhance by appending a structure.

4. Go to se11 and put in Data Type MCAFKO. click Display.

5. Click on append structure and provide name ZMCAFKO.

6. Add field into MMSTA with data type into the append structure. Activate it  –

7. Drag drop the MMSTA field into the extract structure .MC04P_0MAT.

8. Now we have to populate the field by enhancing the enhancement definition RSAP00001.

9. As I describe earlier you can go to SMOD to check the details of enhancement component definition of  RSAP00001.

10. Before going to CMOD repeat the below steps –

  • Delete the  setup table for datasource 2LIS_04_P_MATNR if exist using LBWG Tcode. Put application 04 for  our scenario Shop Floor Control. Delete the data.

  • Delete outbound queue for the application component 04 using transaction LBWQ  if any doc posted.
  • Clear delta queue using Tcode RSA7 as described earlier.

11. Then go to CMOD and create a project in which the customize enhancement component. If it is already created use it.

12.Create an enhancement and assign it to the project.

13.Four Functional module will be created after this assignment.

14. As our datasource is of Transaction Type we will enhance EXIT_SAPLRSAP_001 component.  For different datatype we will enhance different component and it is given below –

15. Double click on EXIT_SAPLRSAP_001 and double on Include ZXRSAU01.

16. Implement the below code . Check and activate it.

DATA : LT_DATA TYPE STANDARD TABLE OF MC04P_0MAT. FIELD-SYMBOLS : <LS_DATA> TYPE MC04P_0MAT, <LV_MMSTA> TYPE T141T-MMSTA. CLEAR LT_DATA.
LT_DATA[] = C_T_DATA[]. LOOP AT LT_DATA ASSIGNING <LS_DATA> SELECT SINGLE MMSTA INTO <LV_MMSTA> FROM T141 WHERE MATNR = <LS_DATA>-MATNR. IF SY-SUBRC = 0. <LS_DATA>-MMSTA=<LV_MMSTA>. ENDIF. ENDLOOP. REFRESH C_T_DATA.
c_t_data[] = lt_data[].

17. Activate the datasource.

17. Execute Tcode OLI4BW to load the Setup table.

18. Check the RSA3  to check the data for the datasource. New added field MMSTA will be populated.