Today I will discuss about a scenario where I try to extract data from a
BAPI extractor named
BAPI_IM_HERE from
ECC.
if you put the
BAPI FM as a source of a generic data extractor you will get the error of
E_T_DATA table mentioned below -
Solution : You can not take data directly from
BAPI. write a functional module and put the BAPI extracted data into a temp table and them create a generic datasource from there. Consume the datasource in SAP BW and continue BW modeling.
Steps :
1.
Create a functional module from SE37 in ECC where the BAPI exists and put the BAPI extracted DATA into a temporary table. If you want to do it from scratch it will take time. Better you copy a pre existing method RSAX_BIW_GET_DATA and customized according to you need.
You can give the new function name as
ZFM_BAPI_DATA and also select a functional Group
ZFM_BPI which is available in your landscape.
2. after that open the FM and delete all the code and customized your code. But to extract the FM as a genetic data source the table as a E_T_DATA is required. Go to the Table tab and add this two table.
Note : The association type for
E_T_DATA will be the same structure that return by the
BAPI BAPI_IM_HERE when invoking the BAPI from our systems.
3. Now in the code section delete all the prepopulated code and start from the beginning.
- Call the BAPI function.
- Loop on the return structure from BAPI BAPI_IM_HERE.
- append it to E_T_DATA.
Like the below code you can customize.
** Extract BAPI data by invocking it **************************
CALL FUNCTION 'BAPI_IM_HERE'
EXPORTING
system_id = lf_lsys_id
posting_date = lf_postng_dt
TABLES
output_data = lt_data.
** End of BAPI Extraction *************************************
** Start loop the extrated structure from BAPI****************
LOOP AT lt_data ASSIGNING FIELD-SYMBOL(<fs_data>).
ls_data-sales_order = <fs_data>-sales_order.
ls_data-sales_order = <fs_data>-order_date.
ls_data-sales_order = <fs_data>-quantity.
APPEND ls_data TO e_t_data.
ENDLOOP.
*************** End loop *************************************
4. use RSO2 and create a data generic source from FM.
Now you do not get any error while activating the data source.
5. After activating go to RSA3 and check the data.
6. Finally replicate the data in SAP BW sid using RSDS.
Hope this will help.