Generic Extraction Via Function Module - SCN
Generic Extraction Via Function Module - SCN
Welcome, Guest
Login
Register
siegfried.szameitat
Previous Next
How does the extraction api work in case you are extracting data using a self defined function module with generic delta? Sometimes, if your application or requirement makes it necessary, you have to create your own function module to extract the data from whatever sap system to bw. Therefore you normally make a copy of the standard fm 'RSAX_BIW_GET_DATA_SIMPLE'. To make this new function work for you, you have to realize the following. 1.) the fm gets called by the extraction api for at least 2 times. First time is for initialization and from the 2nd time on it is for data extraction. postpost 2.) right after the last data package (somehow you need to make sure that it is the last one) you have to raise the exception no_more_data. Example with lots of comments
FUNCTION RSAX_BIW_GET_DATA_SIMPLE. *"-------------------------------------------------------------------------*"*"Lokale Schnittstelle: *" IMPORTING *" VALUE(I_REQUNR) TYPE SRSC_S_IF_SIMPLE-REQUNR *" VALUE(I_DSOURCE) TYPE SRSC_S_IF_SIMPLE-DSOURCE OPTIONAL *" VALUE(I_MAXSIZE) TYPE SRSC_S_IF_SIMPLE-MAXSIZE OPTIONAL *" VALUE(I_INITFLAG) TYPE SRSC_S_IF_SIMPLE-INITFLAG OPTIONAL *" VALUE(I_READ_ONLY) TYPE SRSC_S_IF_SIMPLE-READONLY OPTIONAL *" TABLES *" I_T_SELECT TYPE SRSC_S_IF_SIMPLE-T_SELECT OPTIONAL *" I_T_FIELDS TYPE SRSC_S_IF_SIMPLE-T_FIELDS OPTIONAL *" E_T_DATA STRUCTURE SFLIGHT OPTIONAL *" EXCEPTIONS *" NO_MORE_DATA *" ERROR_PASSED_TO_MESS_HANDLER *"-------------------------------------------------------------------------* Auxiliary Selection criteria structure DATA: L_S_SELECT TYPE SRSC_S_SELECT. * Maximum number of lines for DB table STATICS: S_S_IF TYPE SRSC_S_IF_SIMPLE, * counter S_COUNTER_DATAPAKID LIKE SY-TABIX, * cursor S_CURSOR TYPE CURSOR. * Initialization mode (first call by SAPI) or data transfer mode IF I_INITFLAG = SBIWA_C_FLAG_ON. * the coding here will be processed the first time the fm gets called. * it is used to populate static or global variables and to check wether * it's called by the right datasource or not. ELSE. "Initialization mode or data extraction ? * this part will be executed from the 2nd call on * First data package -> OPEN CURSOR
http://scn.sap.com/people/siegfried.szameitat/blog/2005/09/29/generic-extraction-via-function-module
1/11
3/5/2014
IF S_COUNTER_DATAPAKID = 0. * in case it is for the first data package, range tabs gets filled, a cursor will * be opened or a initial dataset will be read from database into a global internal table * this has to be done here, with the first data package, to avoid getting the same data with * each call of the fm. * additionally you can check wether you get select-options for your 'generic delta'-field or not, * and, if it is provided, you are able to set a flag in order to do different selections * based on this flag for delta or full load. ENDIF. "First data package ? * from now on records gets fetched from the database or gets read from the internal table * and the return table e_t_data gets populated with the number of rows given by parameter s_s_if-maxsize. * if the last record is populated to table e_t_data you need to raise the exeption no_more_data * and you need to close the cursor, if you opened one. * with each data package you also have to increase s_counter_datapakid. ENDIF. "Initialization mode or data extraction ? ENDFUNCTION.
If you forget to raise no_more_data, the extraction api will call the fm forever.
7481 View s
My Rating:
Share
Tw eet
Like
44 Comments
Arturo Snchez Mar 2, 2006 11:11 AM
Hi Siegfried, Your example is very good, but I dont understand manage of delta load, this is a work of BW or I need to develop it in my FM? I was created a FM for generic extraction, with a Extract Structure view (and fill it a select condition tab with because a need to save DB space: table field operator Comparative Value EKPO AEDAT GE '20051001'). The FM ran wrong because the delta is mayor than the initialization delta load. I have only a difference than the standard FM this manage is correct? I only need the information by the last 62 days. data: f_extra = sy-datum - 62. SELECT (S_S_IF-T_FIELDS) FROM EKPO WHERE AEDAT >= f_extra. Can U send me an example code of a FM with a few fields? Thanks for your help. Regards, Arturo
Like (0)
Hi Arturo, please let me know your email adress and I will sent you a template. Siggi
Like (0)
http://scn.sap.com/people/siegfried.szameitat/blog/2005/09/29/generic-extraction-via-function-module
2/11
3/5/2014
Arturo,
Hi Siggy, I have written a FM ( QUITE A COMPLEX ONE) data extractor using. My main table has two fields( create /change DATA and Create/Change Time) How can I effectively write this to make this delta enabled. Thx Arunava arunava_ganguly@yahoo.com
Like (0)
Hi Siggy, I have the same problem with him. Pls send me document. My email is : hieutruc2002@yahoo.com
Like (0)
Hi Siggy, I have the same problem with him. Pls send me document. My email is : hieutruc2002@yahoo.com
Like (0)
Hi Siggi, Could you please send a copy of the Function Module extraction(delta extraction) template to my mail id. thanks, my email is: Sai
Like (0)
sai.nsreeni@yahoo.in
Can anyone please send me the same i.e. manage delta in the FM Thanks Sal
Like (0)
Saleem Shaikh Dec 30, 2010 6:25 AM (in response to Saleem Shaikh)
Jose Angelo Ladim Sep 17, 2006 11:56 PM (in response to Siegfried Szameitat)
Hi Siggy, Could you send a copy of the template you mentioned? i am trying to extract an abap report using FM. thanks! my email ad is jiggs.ladim@goldenabc.com.
Like (0)
Chandu Mandepudi Apr 15, 2008 1:14 AM (in response to Siegfried Szameitat)
http://scn.sap.com/people/siegfried.szameitat/blog/2005/09/29/generic-extraction-via-function-module
3/11
3/5/2014
Hi Siggi
cmandepudi@gmail.com.
Like (0)
Hi Siggy, Could you send a copy of the template you mentioned? (delta extractor) thanks! my email is hamilporta@yahoo.com.
Like (0)
Aline Brunen Jun 18, 2009 1:48 AM (in response to Siegfried Szameitat)
Hi Siggi, can you send me the template also. I am facing the same problems. abrunen@web.de Thanks a lot!! Aline
Like (0)
Meena Kabra Oct 30, 2009 6:17 AM (in response to Siegfried Szameitat)
My email id meenakabra@yahoo.com. Please send me the template yo handle the delta in FM.
Like (0)
Thanks Arturo.
Like (0)
Hello, I have a different problem whith FM and DS : We use the 0MATERIAL_LKLS_HIER hierarchy datasource to load material hierachy in BW. I had to modify the function module CLBW_HIERARCHY_TRANSFER_LKLS that creates the hierarchy. Now, i need to create a new datasource based on the new function module (Z_CLBW_HIERARCHY_TRANSFER_LKLS). To do so, i created a generic datasource (with SBIW), a master data attributes datasource. I tried to put the same parameters that in 0MATERIAL_LKLS_HIER, but i didn't find how to indicate that it's a hierarchy and some other parameters (as you can see in RSA2 for 0MATERIAL_LKLS_HIER in the "semantic attributes" area). Also, i couldn't run the new datasource in RSA3 because it didn't show me the right selection fields. Then i tried BW10 but it generated a datasource for application component FI-SL-IO (internal name ROOTYPEHC) and with the extractor GSBH_HIERARCHY_TRANSFER_SETS, when what i need is a datasource for application component LO-IO (internal name 0MATERIAL) and with extractor Z_... Have you any idea form me ? thanks. MGH
Like (0)
Hi Siegfried, I am not able to manage delta loads in my FM. I need to have deltas for the last 3 days ( sy-datum - 3) I can compare it in my 'where' condition of my select statement. But how the program will know whether its a delta load or a full load. Can you help mer in this ? Regards, Rishi rishi_malhotra@infosys.com
http://scn.sap.com/people/siegfried.szameitat/blog/2005/09/29/generic-extraction-via-function-module
4/11
3/5/2014
SHIRISH MAHAJAN Jan 17, 2008 6:25 AM (in response to rishi malhotra)
Hi friends, I am facing exactly similar issue with the Function Module's interface not providing means to identify whether the load is a delta. Did any of you get a solution to this issue. I will greatly appreciate some tips on this. Thanks Shirish.Mahajan@Bentley.com
Like (0)
SHIRISH MAHAJAN Jan 17, 2008 6:30 AM (in response to rishi malhotra)
I am facing exactly similar issue with the Function Module's interface not providing means to identify whether the load is a delta. I will greatly appreciate knowing how this issue can be handled. Thanks Shirish.Mahajan@Bentley.com
Like (0)
Hi Siggi, Can you send me the template of Delta Loads in FM. Thanks Sajeed sap4bw@rediffmail.com
Like (0)
can you also sent me the mentioned delta template? markus.hochreiter@makuntu.com Thanks, markus
Like (0)
i have a doubt........ i have to make changes in FM of extractor. What the FM does give some values which are extracted into the item table... when i check or test the extractor for a value of commorcial agreement say 717 it gives me all the values present in the table but i want only the distinct values of 717 in testing the extractor.
Like (0)
Hi Siggi, Could you please send me the document for creating with Delta enabled and also how does it work. Kindly let me know what fields are passed to I_T_SELECT and I_T_FIELDS. Please draft this to Thanks, Arvind M
Like (0)
arvinmsc@rediffmail.com
Hi Siggy, I am trying to create an FM in a CRM 5.0 system. I have copied the sample FM RSAX_BIW_GET_DATA_SIMPLE. When I try to change the E_T_DATA table parameter to my structure, I receive message FL069 "TABLES parameters are obsolete!". Have you encountered this problem ? Thanks and regards, Linda
Like (0)
http://scn.sap.com/people/siegfried.szameitat/blog/2005/09/29/generic-extraction-via-function-module
5/11
3/5/2014
Hi Linda,
yes I already faced the same issue. But it is just a warnig and you can ignore it. I guess in the next future there will be a change here. kind regards Siggi
Like (0)
Linda Brunton Jan 23, 2007 7:34 PM (in response to Siegfried Szameitat)
Thanks Siggi, I could not exit the tables tab once the warning message was displayed. However, I have since discovered that you don't need to specify the type spec and the associated type at all. You can just leave them blank and only specify E_T_DATA in the Parameter Name. The extractor seems to work just fine. Cheers, Linda
Like (0)
Hello Sig, Could you please send me the document for creating data extract with Delta enabled. yuvaraaju@yahoo.com Thanks.
Like (0)
Hi RSAX_BIW_GET_DATA_SIMPLE is assuming that the data source is a TABLE. I have a similar need wherein my function is pulling data from various sources & loading the net result into an internal table (structure). Do I have to follow the same methodology to feed my cube from this internal table ?
Like (0)
HI GP, I have the exact same problem, have you figured out how to manage this? Best Regards Claes
Like (0)
Andrei Grechko Nov 11, 2008 11:41 AM (in response to Claes Widestadh)
did you figure it out? "Hi RSAX_BIW_GET_DATA_SIMPLE is assuming that the data source is a TABLE. I have a similar need wherein my function is pulling data from various sources & loading the net result into an internal table (structure). Do I have to follow the same methodology to feed my cube from this internal table ? * Extraction via Function Module 2007-03-06 06:49:31 Claes Widestadh Business Card [Reply] HI GP, I have the exact same problem, have you figured out how to manage this?" Thanks
Like (0)
Do i need to copy all the includes dat are present in standard function module .. wen i m using rsa3 its giving error Error 6 in function module RSS_PROGRAM_GENERATE do let me know my code is
http://scn.sap.com/people/siegfried.szameitat/blog/2005/09/29/generic-extraction-via-function-module
6/11
3/5/2014
http://scn.sap.com/people/siegfried.szameitat/blog/2005/09/29/generic-extraction-via-function-module
7/11
3/5/2014
LOOP AT GIT_QTN . CALL FUNCTION 'BBP_PDCND_GETDETAIL' EXPORTING i_p_guid = GIT_QTN-GUID1 * I_P_KIND = 'B' * I_OBJECT_TYPE = 'BUS2000136' * IV_VERSION_TYPE = ' ' iv_header_guid = GIT_QTN-HEADER * IV_WITH_DELETED_RECORDS = ' ' IMPORTING ET_CONDITIONS = GIT_TAB * E_COM = * TABLES * E_T_DATA = . MOVE-CORRESPONDING GIT_TAB TO E_T_DATA. ENDLOOP.
* LOOP AT S_S_IF-T_SELECT INTO L_S_SELECT WHERE FIELDNM = 'CARRID'. * MOVE-CORRESPONDING L_S_SELECT TO L_R_CARRID. * APPEND L_R_CARRID. * ENDLOOP. * * LOOP AT S_S_IF-T_SELECT INTO L_S_SELECT WHERE FIELDNM = 'CONNID'. * MOVE-CORRESPONDING L_S_SELECT TO L_R_CONNID. * APPEND L_R_CONNID. * ENDLOOP. * Determine number of database records to be read per FETCH statement * from input parameter I_MAXSIZE. If there is a one to one relation * between DataSource table lines and database entries, this is trivial. * In other cases, it may be impossible and some estimated value has to * be determined. * OPEN CURSOR WITH HOLD S_CURSOR FOR * SELECT (S_S_IF-T_FIELDS) FROM SFLIGHT * WHERE CARRID IN L_R_CARRID AND * CONNID IN L_R_CONNID. ENDIF. "First data package ? * Fetch records into interface table. * named E_T_'Name of extract structure'. * FETCH NEXT CURSOR S_CURSOR * APPENDING CORRESPONDING FIELDS * OF TABLE E_T_DATA * PACKAGE SIZE S_S_IF-MAXSIZE. * IF SY-SUBRC <> 0. * CLOSE CURSOR S_CURSOR. * RAISE NO_MORE_DATA. * ENDIF. S_COUNTER_DATAPAKID = S_COUNTER_DATAPAKID + 1. ENDIF. "Initialization mode or data extraction ? ENDFUNCTION.
Like (0)
Hi, i am tyring to craete ZCOPY of "RSAX_BIW_GET_DATA_SIMPLE" . but if i try to check this one, its showing "SRSC_S_IF_SAMPLE" is unkmnown even after mention 'SRSC' type-pools. Thanks in advance, Bhaskar
Like (0)
sreenu vasu May 31, 2008 12:21 AM (in response to Bhaskar Rao Javvaji)
http://scn.sap.com/people/siegfried.szameitat/blog/2005/09/29/generic-extraction-via-function-module
8/11
3/5/2014
Regards pallavi
Like (0)
Hi Siggy I need to do a delta extraction based on AEDAT or ERDAT. If AEDAT is initial, then load delta based on ERDAT. If AEDAT is not initial, then load delta based on AEDAT. Is this possible via the deltaenabled generic extractor using FM. Thanks!! abhi abhi_999@hotmail.com
Like (0)
Hi siggi, Thanks for a great weblog. I have been able to apply it successfully to extract long texts from table STXL. But I have a problem whenever the parameter: i_maxsize is greater than the size of the extracted dataset. It seems the 'no_more_data' exception closes the connection before e_t_data is received and I get 0 records. Any idea what I am doing wrong? Rgrds, Andrew
Like (0)
Hi, Im new at this.. I am also trying to craete a COPY of "RSAX_BIW_GET_DATA_SIMPLE" . Its showing "SRSC_S_IF_SAMPLE" is unkmnown. I added: Type-pools: SRSC. in the main program of the function group. Thanks for your help, Romina
Like (0)
Lucas Mena May 27, 2010 12:18 PM (in response to Romina Canales)
Hi Romina! did you solve the problem? i have the same error regards LUCAS
Like (0)
Hi, I am in a situation whereby a generic extractor has to be created based on the table CDHDR and CDPOS(Cluster table) to track change document details. I guess a FM is an only way out. Do you have any suggestions on how to maintain a delta extraction on this? Thank you.
Like (0)
It seems that if I populate E_T_DATA priror to the "Fetch" statement I receive 0 records, but if I do it afterwards I go into an endless loop. Please see the code below and provide a sample or critique on where the code is incorrect. <br/><br/> tables: pa0000.<br/><br/><br/><br/><br/> data: l_s_select type srsc_s_select.<br/>* t_pernr TYPE TABLE OF w_pernr.<br/><br/><br/><br/><br/>* Maximum number of lines for DB table<br/> statics: s_s_if type srsc_s_if_simple,<br/><br/>* counter<br/> s_counter_datapakid like sy-tabix,<br/><br/>* cursor<br/> s_cursor type cursor.<br/>* Select ranges<br/><br/><br/> ranges: l_r_pernr for zbw_payroll_str-pernr,<br/> l_r_fpbeg for zbw_payroll_str-fpbeg,<br/> l_r_fpend for zbw_payroll_str-fpend,<br/>* L_R_Z_P_FRDAT FOR ZBW_PAYROLL_STR-Z_P_FRDAT,<br/>* L_R_Z_P_FRTIM FOR ZBW_PAYROLL_STR-Z_P_FRTIM,<br/> l_r_chkdt for zbw_payroll_str-chkdt.<br/><br/>* Initialization mode (first call by SAPI) or data transfer mode<br/>* (following calls) ?<br/><br/> if i_initflag = sbiwa_c_flag_on.<br/>
http://scn.sap.com/people/siegfried.szameitat/blog/2005/09/29/generic-extraction-via-function-module
9/11
3/5/2014
Hi, I was wondering if creating multiple extraction FMs in the same function group, affects it's working if every FM is run in parallel. Kindly comment. Regards, Sameer
Like (0)
Hi Siggi, I created a Custom Extractor using FM RSAX_BIW_GET_DATA_SIMPLE for Full Upload. The requirement now is that it should be able to handle Delta also. Please suggest me the changes I have to make in this to be able to upload Delta also. My mail id is Thanks Nageswara Nageswara_M@satyam.com
Like (0)
http://scn.sap.com/people/siegfried.szameitat/blog/2005/09/29/generic-extraction-via-function-module
10/11
3/5/2014
ramona.leabu@thyssenkrupp.com Thank you very much Ramona
Like (1)
Copyright
Follow SCN
http://scn.sap.com/people/siegfried.szameitat/blog/2005/09/29/generic-extraction-via-function-module
11/11