Step by Step Procedure to Enhance Standard BI 'r' BW Extractor Using BADI

14
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.

description

Step by Step Procedure to Enhance Standard BI 'r' BW Extractor Using BADI Step by Step Procedure to Enhance Standard BI 'r' BW Extractor Using BADI Step by Step Procedure to Enhance Standard BI 'r' BW Extractor Using BADI

Transcript of Step by Step Procedure to Enhance Standard BI 'r' BW Extractor Using BADI

Page 1: Step by Step Procedure to Enhance Standard BI 'r' BW Extractor Using BADI

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.

Page 2: Step by Step Procedure to Enhance Standard BI 'r' BW Extractor Using BADI

Next step, expand SAP-R/3 and identify the relevant datasource. In this case 2LIS_06_INV is the datasource.

Double click on the datasource 2LIS_06_INV. It will take you to the following screen.

Page 3: Step by Step Procedure to Enhance Standard BI 'r' BW Extractor Using BADI

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

Page 4: Step by Step Procedure to Enhance Standard BI 'r' BW Extractor Using BADI

 

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, you can use the same append structure or can create a new append structure.) to the append structure and activate the Extract Structure “MC06M_0ITM”.

Page 5: Step by Step Procedure to Enhance Standard BI 'r' BW Extractor Using BADI

  

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

Page 6: Step by Step Procedure to Enhance Standard BI 'r' BW Extractor Using BADI

 

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

Page 7: Step by Step Procedure to Enhance Standard BI 'r' BW Extractor Using BADI

 

Filling Data to the Enhanced field

1.     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”.  

  

2.     Now 2 methods “DATA_TRANSFORM” and “HIER_TRANSFORM” will be available in the Method tab.

Page 8: Step by Step Procedure to Enhance Standard BI 'r' BW Extractor Using BADI

3.     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.  

method IF_EX_RSU5_SAPI_BADI~DATA_TRANSFORM. DATA: lt_data TYPE TABLE OF MC06M_0ITM, v_zfbdt TYPE DZFBDT, v_zbd1t TYPE DZBD1T, v_due_dt TYPE faedt_fpos. FIELD-SYMBOLS: <ls_data> TYPE MC06M_0ITM.***check the correct data source. If not exit. CHECK i_datasource = '2LIS_06_INV'. lt_data[] = c_t_data[]. loop at lt_data assigning <ls_data>.

Page 9: Step by Step Procedure to Enhance Standard BI 'r' BW Extractor Using BADI

clear:v_zfbdt, v_zbd1t,v_due_dt. SELECT single zfbdt zbd1t FROM bsak INTO (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. if sy-subrc = 0.********************************************** " 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. MOVE v_due_dt TO <ls_data>-zzdue_date. else. delete lt_data. endif. endloop. clear: c_t_data[]. c_t_data[] = lt_data[].endmethod. endloop. clear: c_t_data[].****Modified data passed back to the Extraction table. c_t_data[] = lt_data[].endmethod.

NOTE:

Now you see in the above code, i have not used modify statement because when I loop the internal table, the field symbol points directly to the memory of internal table.

So during loop if i assign any value to the field symbol then it directly changes the internal table value, so there won’t be any need to use modify statement. That is the advantage of using field symbol. Use whenever possible.  

Implementation of created BADI

1. 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.  

Page 10: Step by Step Procedure to Enhance Standard BI 'r' BW Extractor Using BADI

  

 

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

Page 11: Step by Step Procedure to Enhance Standard BI 'r' BW Extractor Using BADI

 

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.  

Page 12: Step by Step Procedure to Enhance Standard BI 'r' BW Extractor Using BADI

Data output  

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