Step By Step Procedure to Enhance Standard BI/BW Extractor Using BADI

By N. Rajendran(Raj)

Introduction Generally SAP user exit RSAP0001 is used to add any additional fields to the Standard BW Extractors which includes both Master Data and Transactions Data extractors. But as per SAP’s recommendation BADI’s are more efficient way to enhance the standard extractors than using the exit RSAP0001. Enhancing a Standard DataSource using BADI has the following advantage over using the exit RSAP0001: BADI can have multiple implementations so several developers can work simultaneously on different implementations and different logics. RSU5_SAPI_BADI is used to enhance the standard BI DataSources. Scenario In this document the Standard MM Master DataSource 2LIS_06_INV is appended with the field ZZDUE_DATE – Due Date. The due date is calculated by using function module and passing the value to the due date field. Procedure Enhancing the Extract Structure. First go to transaction SBIW and expand business content DataSources and click Transfer Business Content Datasources.

It will take you to the following screen. .Next step. Double click on the datasource 2LIS_06_INV. expand SAP-R/3 and identify the relevant datasource. In this case 2LIS_06_INV is the datasource.

It will take you to the following screen .Double click the extraction structure “MC06M_0ITM”.

. you can use the same append structure or can create a new append structure.Now click on “Append Structure” and create append structure and then add the required field ZZDUE_DATE(if there is an append structure already available.) to the append structure and activate the Extract Structure “MC06M_0ITM”.

Now activate the DataSource and make sure the newly added filed is available in the DataSource. .

Verify the custom fields are added in the Extraction structure. Make sure the hide field and field only unchecked. .

2. Now 2 methods “DATA_TRANSFORM” and “HIER_TRANSFORM” will be available in the Method tab. Go to SE24 and create a class “ZCL_MM_BW_2LIS_06_INV” ( Note: Use appropriate name that way you can easily identify the datasource) and in the Interfaces tab of the class enter “IF_EX_RSU5_SAPI_BADI”.Filling Data to the Enhanced field 1. .

method IF_EX_RSU5_SAPI_BADI~DATA_TRANSFORM.3. FIELD-SYMBOLS: <ls_data> TYPE MC06M_0ITM. ***check the correct data source. CHECK i_datasource = '2LIS_06_INV'. lt_data[] = c_t_data[]. . v_zbd1t TYPE DZBD1T. loop at lt_data assigning <ls_data>. v_due_dt TYPE faedt_fpos. v_zfbdt TYPE DZFBDT. DATA: lt_data TYPE TABLE OF MC06M_0ITM. Write the code in the method “IF_EX_RSU5_SAPI_BADI~DATA_TRANSFORM” as below to fill the data to the Enhanced field and activate the class. If not exit.

the field symbol points directly to the memory of internal table. clear: c_t_data[]. So during loop if i assign any value to the field symbol then it directly changes the internal table value. ********************************************** " Extract the due date * ********************************************** CALL FUNCTION 'NET_DUE_DATE_GET' EXPORTING i_zfbdt = v_zfbdt i_zbd1t = v_zbd1t i_zbd2t = 0 i_zbd3t = 0 i_shkzg = 'H' i_rebzg = <ls_data>-belnr i_koart = <ls_data>-koart IMPORTING e_faedt = v_due_dt.v_due_dt. Use whenever possible. endmethod. i have not used modify statement because when I loop the internal table. endif. else. Go to BADI Definition “RSU5_SAPI_BADI” using T-code SE18 and create implementation “ZBW_0PROF_ATTR” or you can use T-code SE19 and create the implementation. if sy-subrc = 0. c_t_data[] = lt_data[]. clear: c_t_data[].clear:v_zfbdt. v_zbd1t) WHERE bukrs = c_bukrs AND lifnr = <ls_data>-lifnr AND gjahr = <ls_data>-gjahr AND belnr = <ls_data>-belnr AND gsber = <ls_data>-gsber. ****Modified data passed back to the Extraction table. so there won’t be any need to use modify statement. v_zbd1t. c_t_data[] = lt_data[]. Implementation of created BADI 1. endmethod. delete lt_data. MOVE v_due_dt TO <ls_data>-zzdue_date. endloop. That is the advantage of using field symbol. endloop. NOTE: Now you see in the above code. SELECT single zfbdt zbd1t FROM bsak INTO (v_zfbdt. .

. Go to the Interface tab and enter the created class “ZCL_MM_BW_2LIS_06_INV” in the Implementing class name field and activate.2.

Testing through RSA3 Go to RSA3 and execute the DataSource “2LIS_06_INV” and check the extracted data to see the data to the enhanced field is filled. .

.Data output Note if the data is not extracted correctly or any issue. you can debug and correct your code accordingly.

Master your semester with Scribd & The New York Times

Special offer for students: Only $4.99/month.

Master your semester with Scribd & The New York Times

Cancel anytime.