best practice for data source enhancement

3
7/27/2019 Best Practice for Data Source Enhancement http://slidepdf.com/reader/full/best-practice-for-data-source-enhancement 1/3 Best Practice for Data Source Enhancement    Added by MAYURI SINHA, last edited by Arun Varadarajan on Jul 28, 2009 (view change) Data Extractor Enhancement - Overview of Approach Following are the steps for data source enhancements: The flowchart explains the step we need to follow while enhancing a standard LIS extractor. Determine the fields with which the extractor is to enhanced. Recheck if these fields are not the ones which are already provided by SAP. As if they are already provided, we need not enhance them. As a next check we need to check the LBWE pool where we have some extra fields which we can easily add to our datasource. If these fields do not exist in the LBWE pool either, we need to enhance the data source.  Above flowchart would give an overview of the same, but here we would go through each of those steps in detail. The approach which we are going to discuss here is the Function Module approach of data source enhancement. Steps of Data Source Enhancement -Function Module approach Step 1: Go to T Code CMOD and choose the project you are working on. Step 2: Choose the exit which is called when the data is extracted. Step 3: This is the step where we have a difference from the normal approach. Normal Approach: CMOD Code Code Sample: WHEN '2LIS_05_Q0ACTY'. ------- Note: This is just a sample code. Logic will vary according to the requirements.In this normal approach, which is followed in most of the BW instances, we write  ABAP CASE/WHEN conditions. Function Module Approach: CMOD Code *&---------------------------------------------------------------------* *& Include ZXRSAU01 * *&---------------------------------------------------------------------* DATA: L_FNAME TYPE RS38L_FNAM, L_EXP_FNAME type rs38l_fnam, L_EXP_ACTIVE TYPE RS38L_GLOB, L_ACTIVE TYPE RS38L_GLOB, L_S_SELECT TYPE RSSELECT. SELECT SINGLE FUNC INTO L_FNAME FROM ZTEST WHERE DSNAM = I_DATASOURCE. *&---------------------------------------------------------------------*

Upload: okrashid2001

Post on 02-Apr-2018

216 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Best Practice for Data Source Enhancement

7/27/2019 Best Practice for Data Source Enhancement

http://slidepdf.com/reader/full/best-practice-for-data-source-enhancement 1/3

Best Practice for Data Source Enhancement 

 

   Added by MAYURI SINHA, last edited by Arun Varadarajan on Jul 28,2009 (view change) 

Data Extractor Enhancement - Overview of Approach Following are the steps for data source enhancements:The flowchart explains the step we need to follow while enhancing a standardLIS extractor.Determine the fields with which the extractor is to enhanced. Recheck if thesefields are not the ones which are already provided by SAP. As if they are alreadyprovided, we need not enhance them. As a next check we need to check theLBWE pool where we have some extra fields which we can easily add to our datasource.If these fields do not exist in the LBWE pool either, we need to enhance the datasource.

 Above flowchart would give an overview of the same, but here we would gothrough each of those steps in detail. The approach which we are going todiscuss here is the Function Module approach of data source enhancement.Steps of Data Source Enhancement -Function Module approach Step 1: Go to T Code CMOD and choose the project you are working on.

Step 2: Choose the exit which is called when the data is extracted.Step 3: This is the step where we have a difference from the normal approach.Normal Approach: CMOD Code 

Code Sample:

WHEN '2LIS_05_Q0ACTY'.

-------Note: This is just a sample code. Logic will vary according to the requirements.Inthis normal approach, which is followed in most of the BW instances, we write

 ABAP CASE/WHEN conditions.Function Module Approach: CMOD Code *&---------------------------------------------------------------------*

*& Include ZXRSAU01 **&---------------------------------------------------------------------*DATA: L_FNAME TYPE RS38L_FNAM,

L_EXP_FNAME type rs38l_fnam,

L_EXP_ACTIVE TYPE RS38L_GLOB,L_ACTIVE TYPE RS38L_GLOB,L_S_SELECT TYPE RSSELECT.

SELECT SINGLE FUNCINTO L_FNAMEFROM ZTEST 

WHERE DSNAM = I_DATASOURCE.*&---------------------------------------------------------------------*

Page 2: Best Practice for Data Source Enhancement

7/27/2019 Best Practice for Data Source Enhancement

http://slidepdf.com/reader/full/best-practice-for-data-source-enhancement 2/3

* Cehck to see if a local versio of the extractor exists*&---------------------------------------------------------------------*IF L_FNAME IS NOT INITIAL.CALL FUNCTION 'RS_FUNCTION_ACTIVE_CHECK'

EXPORTING

FUNCNAME = L_FNAMEIMPORTING ACTIVE = L_ACTIVEEXCEPTIONSNOT_FOUND = 1OTHERS = 2.

IF SY-SUBRC EQ 0 AND L_ACTIVE IS NOT INITIAL.CALL FUNCTION L_FNAMEEXPORTINGI_DATASOURCE = I_DATASOURCEI_ISOURCE = I_ISOURCE

I_UPDMODE = I_UPDMODETABLESI_T_SELECT = I_T_SELECTI_T_FIELDS = I_T_FIELDSC_T_DATA = C_T_DATAC_T_MESSAGES = C_T_MESSAGES

EXCEPTIONSRSAP_CUSTOMER_EXIT_ERROR = 1.

ENDIF. " IF SY-SUBRC EQ 0...ELSE.CLEAR L_FNAME.CONCATENATE 'ZTEST_ ' I_DATASOURCE INTO L_FNAME.CALL FUNCTION 'RS_FUNCTION_ACTIVE_CHECK'

EXPORTINGFUNCNAME = L_FNAME

IMPORTING ACTIVE = L_ACTIVEEXCEPTIONSNOT_FOUND = 1OTHERS = 2.

IF SY-SUBRC = 0 AND L_ACTIVE = 'X'.CALL FUNCTION L_FNAMEEXPORTINGI_DATASOURCE = I_DATASOURCEI_ISOURCE = I_ISOURCEI_UPDMODE = I_UPDMODE

TABLESI_T_SELECT = I_T_SELECTI_T_FIELDS = I_T_FIELDSC_T_DATA = C_T_DATA

Page 3: Best Practice for Data Source Enhancement

7/27/2019 Best Practice for Data Source Enhancement

http://slidepdf.com/reader/full/best-practice-for-data-source-enhancement 3/3

C_T_MESSAGES = C_T_MESSAGESEXCEPTIONSRSAP_CUSTOMER_EXIT_ERROR = 1.

ENDIF. " IF SY-SUBRC = 0...ENDIF. " IF L_FNAME IS NOT INITIAL.

Note: This is a reusable code. Here ZTEST is a table which maintains the datasource name and the function module corresponding to that data source.Step 4: Here in this step we create a function module for each data source. Wecreate a new FM (Function Module in SE37)Data Extractor Enhancement - Best Practice/Benefits 

This is the best practice of data source enhancement. This has the followingbenefits:

1. No more locking of CMOD code by 1 developer stopping others toenhance other extractors.

2. Testing of an extractor becomes more independent than others.

3. Faster and a more robust Approach