Generic extractor using SUBMIT program
Generic extractor using SUBMIT program
The document will provide you step by step detail on creating a generic extractor and fetching the data using SUBMIT Program statement. The below development is done on the ECC as well as BW side.
Here is a scenario where we need to collect the data output of the TCODE ‘ZF126’ from ECC system and get it fetch in the BW system.Below are the steps involved:
Changes to be done in the program of the Tcode
1. Go to the Tcode ZF126.
2. Once we press enter, we can see the Tcode ZF126 as below
3. When you go to System >> Status on the Menu bar, you will see the report program which is used to trigger the Tcode ZF126 (here the program is ZFRG_FICOR013_WTR_IN_V2)
4. As we can see there are some mandatory fields in the TCode ZF126, in order to trigger the Tcode we create a variant for it. (Here the variant created is WHTNEW). This variant WHTNEW will be called from the extractor using SUBMIT statement.
5. Ongoing through the program ZFRG_FICOR013_WTR_IN_V2 (the program of the tcode ZF126) ,we see that the program returns the data in an internal table li_zidwtfidoc.
6. Once we identify the internal table li_zidwtfidoc which returns the records from the program, we can use export li_zidwtfidoc to a memory id so that we can have the records which are fetched in the internal table li_zidwtfidoc to be available in a memory id.
Changes to be done related to functional module extractor
1. Create a structure with the necessary fields. The Currency and quantity fields must have reference fields also (here the structure is ZWHT_VENDOR).
NETWR is a currency field so it must have reference field that is in the base table. Click Currency / Quan and give that field name.
2. In transaction SE80, Select Function group, name RSAX. Right click and Copy.
3. Give the function group name and copy only the function modules which you require.Here we have copied FM ‘ZWHT_VENDOR_RSAX_BIW_GET_DATA’ from ‘RSAX_BIW_GET_DATA_SIMPLE’ and this is the only FM required for Generic Extractor.
4. When we go to tables tab in the FM, we can see the E_T_DATA which is of type ‘ZWHT_VENDOR’, it is the structure which will hold the data returning from the FM.
5. In the Functional module extractor , we use submit statement to trigger the program ZFRG_FICOR013_WTR_IN_V2 and get the records from the internal table li_zidwtfidoc. We use import statement to get the data of the internal table li_zidwtfidoc to an internal table it_idwtfidoc.
6. In addition to a simple generic extractor , we have use submit statement and then importing the values of internal table
into an interanl table of generic extractor. .Please find the below code snippet in the attach file ZWHT_VENDOR_RSAX_BIW_GET_DATA.txt) for the FM ZWHT_VENDOR_RSAX_BIW_GET_DATA used in this scenario.
Here is a link for a step by step procedure of simple Function module generic extractor http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/a0f46157-e1c4-2910-27aa-e3f4a9c8df33?overridelayout=true
7. After completion of all the changes ,we can check in the TCode RSA3 whether the extractor is fetching data or not. Give the Data source name ZWHT_VENDOR_EXTRACTOR and press enter, give the relevant details in the selections, once we press execute, we can see the number of data records extracted (Here 8 records are fetched based on the selection).
Changes to be done on BW side
- On BW side , we need to go to ‘Choose Source system’ and select the relevant system under BI. (Here it is RDJCLNT370)
2. Once the source system is selected, we need to go to the Application Component which we gave while creating the Function module extractor in R/3 side (here it is Financial Accounting (FI)). Right click on it and replicate metadata.
3. On completion of replicate metadata, We can see the data source ‘ZWHT_VENDOR_EXTRACTOR’ in the system.
4. In order to test whether data source is fetching data from ECC or not. We need to run the infopackage. We can see the data records in the request monitor as below.
5. The Data in the PSA is as below.
This is the flow when we debug the entire process:
Go to Tcode rsa3, and give the data source name and the values to the selctions, and press extraction.
The debugger first goes to export statement in the FM ZWHT_VENDOR_RSAX_BIW_GET_DATA, and then to the submit statement.
Once the Submit statement is triggered, it then goes to import statement of the FM ‘Z_FI_WT_ALV_INTERFACE’ which is called in the program ‘ZFRG_FICOR013_WTR_IN_V2’ as show below
Once the submit statement is triggered, we export the records (8 records) of internal table li_zidwtfidoc to a memory ‘ZIDWTFIDOC’
As we have the internal table li_zidwtfidoc in the memory id, we import the internal table li_zidwtfidoc to another internal table it_idwtfidoc of the FM ZWHT_VENDOR_RSAX_BIW_GET_DATA from the memory id ‘ZIDWTFIDOC’.
As seen in the screenshot above, internal table it_idwtfodoc has 8 records which are from li_zidwtfidoc. Now as we have the data in an internal table it_idwtfodoc which is of the FM ‘ZWHT_VENDOR_RSAX_BIW_GET_DATA’, we can process these records and pass it in the structure E_T_DATA which is the returning table of the FM.
Once the entire processing is done, we can see 8 records are extracted in the TCode rsa3
On pressing the ALV GRID button you can see the contents of the records extracted in ALV format.