You are on page 1of 11

3/5/2014

Generic Extraction via Function Module | SCN


Getting Started New sletters Store

Welcome, Guest

Login

Register

Search the Community

Products Industries Lines of Business

Services & Support Training & Education University Alliances

About SCN Partnership Events & Webinars

Downloads Developer Center Innovation


Activity Brow se Communications Actions

siegfried.szameitat

Generic Extraction via Function Module


Posted by Siegfried Szameitat in siegfried.szameitat on Sep 29, 2005 9:14:25 AM
Share 0 Tw eet 0 Like 0

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

Generic Extraction via Function Module | SCN

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

Average User Rating (0 ratings)

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)

Siegfried Szameitat Mar 3, 2006 6:38 AM (in response to Arturo Snchez)

Hi Arturo, please let me know your email adress and I will sent you a template. Siggi
Like (0)

Siegfried Szameitat Mar 3, 2006 6:40 AM (in response to Siegfried Szameitat)

http://scn.sap.com/people/siegfried.szameitat/blog/2005/09/29/generic-extraction-via-function-module

2/11

3/5/2014
Arturo,

Generic Extraction via Function Module | SCN

my email can be found in my business card. Siggi


Like (0)

Arunava Ganguly Apr 5, 2006 11:25 PM (in response to Siegfried Szameitat)

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)

Community User Jul 3, 2008 8:13 AM (in response to Arunava Ganguly)

Hi Siggy, I have the same problem with him. Pls send me document. My email is : hieutruc2002@yahoo.com
Like (0)

Community User Jul 3, 2008 8:13 AM (in response to Arunava Ganguly)

Hi Siggy, I have the same problem with him. Pls send me document. My email is : hieutruc2002@yahoo.com
Like (0)

Sreeni N Jan 13, 2009 9:50 PM (in response to Siegfried Szameitat)

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

Meena Kabra Oct 30, 2009 6:16 AM (in response to Sreeni N)

Please can anyone send me the same.Thanks


Like (0)

Saleem Shaikh Dec 30, 2010 6:15 AM (in response to Sreeni N)

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)

Please send me the FM to manage delta.Please send to mohd.bw@gmail.com


Like (0)

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

Generic Extraction via Function Module | SCN

Could you please send the template to Regards, Chama.

cmandepudi@gmail.com.

Like (0)

Paul Porta May 9, 2008 4:01 AM (in response to Siegfried Szameitat)

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)

Arturo Snchez Mar 3, 2006 5:34 PM

arturo.sanchez@prospectiva.com.mx I will appreciate your help.

Thanks Arturo.
Like (0)

Mariem GHOUAIEL May 24, 2006 8:11 AM

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)

rishi malhotra Aug 25, 2006 12:25 AM

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

Generic Extraction via Function Module | SCN


Like (0)

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)

Sajeed M S Sep 18, 2006 2:14 AM

Hi Siggi, Can you send me the template of Delta Loads in FM. Thanks Sajeed sap4bw@rediffmail.com
Like (0)

Markus Hochreiter Sep 18, 2007 1:10 AM (in response to Sajeed M S)

can you also sent me the mentioned delta template? markus.hochreiter@makuntu.com Thanks, markus
Like (0)

Uma mahesw ara Rao A Nov 22, 2006 11:59 PM

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)

arvind mohan Dec 21, 2006 7:31 AM

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

Linda Brunton Jan 18, 2007 5:57 PM

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,

Generic Extraction via Function Module | SCN


Siegfried Szameitat Jan 23, 2007 3:17 AM (in response to Linda Brunton)

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)

Yuva Raaju Jan 20, 2007 6:08 AM

Hello Sig, Could you please send me the document for creating data extract with Delta enabled. yuvaraaju@yahoo.com Thanks.
Like (0)

G P Feb 13, 2007 9:13 AM

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)

Claes Widestadh Mar 6, 2007 6:49 AM (in response to G P)

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)

Nishu Gupta Mar 8, 2007 6:20 AM

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

FUNCTION Z_BIW_GET_DATA_SIMPLE. *"----------------------------------------------------------------------

http://scn.sap.com/people/siegfried.szameitat/blog/2005/09/29/generic-extraction-via-function-module

6/11

3/5/2014

Generic Extraction via Function Module | SCN


*"*"Local Interface: *" IMPORTING *" VALUE(I_REQUNR) TYPE SRSC_S_IF_SIMPLE-REQUNR OPTIONAL *" 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 OPTIONAL *" EXCEPTIONS *" NO_MORE_DATA *" ERROR_PASSED_TO_MESS_HANDLER *"---------------------------------------------------------------------* Example: DataSource for table SFLIGHT TABLES: ZQUOTATION. * Auxiliary Selection criteria structure DATA : L_S_SELECT TYPE SRSC_S_SELECT. DATA : GIT_QTN type table of ZQUOTATION with header line . DATA : GIT_TAB type table of BBP_PDS_CND with header line . * 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. * Select ranges * RANGES: L_R_CARRID FOR SFLIGHT-CARRID, * L_R_CONNID FOR SFLIGHT-CONNID. * * Initialization mode (first call by SAPI) or data transfer mode * (following calls) ? IF I_INITFLAG = SBIWA_C_FLAG_ON. ************************************************************************ * Initialization: check input parameters * buffer input parameters * prepare data selection ************************************************************************ * Check DataSource validity CASE I_DSOURCE. WHEN '0SAPI_SFLIGHT_SIMPLE'. WHEN OTHERS. IF 1 = 2. MESSAGE E009(R3). ENDIF. * this is a typical log call. Please write every error message like this LOG_WRITE 'E' "message type 'R3' "message class '009' "message number I_DSOURCE "message variable 1 ' '. "message variable 2 RAISE ERROR_PASSED_TO_MESS_HANDLER. ENDCASE. APPEND LINES OF I_T_SELECT TO S_S_IF-T_SELECT. * Fill parameter buffer for data extraction calls S_S_IF-REQUNR = I_REQUNR. S_S_IF-DSOURCE = I_DSOURCE. S_S_IF-MAXSIZE = I_MAXSIZE. * Fill field list table for an optimized select statement * (in case that there is no 1:1 relation between InfoSource fields * and database table fields this may be far from beeing trivial) APPEND LINES OF I_T_FIELDS TO S_S_IF-T_FIELDS. ELSE. "Initialization mode or data extraction ? ************************************************************************ * Data transfer: First Call OPEN CURSOR + FETCH * Following Calls FETCH only ************************************************************************ * First data package -> OPEN CURSOR IF S_COUNTER_DATAPAKID = 0. * Fill range tables BW will only pass down simple selection criteria * of the type SIGN = 'I' and OPTION = 'EQ' or OPTION = 'BT'. select * from ZQUOTATION into table GIT_QTN .

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.

Generic Extraction via Function Module | SCN

* 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)

Bhaskar Rao Javvaji Sep 13, 2007 5:16 AM

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)

hello, can u help me in this problem.i am also facing same problem


Like (0)

D d Oct 7, 2007 2:24 PM

HI SIGGI, how would i do delta on only VBBE TABLE

http://scn.sap.com/people/siegfried.szameitat/blog/2005/09/29/generic-extraction-via-function-module

8/11

3/5/2014
Regards pallavi

Generic Extraction via Function Module | SCN

Like (0)

Abhi Pandey May 13, 2008 9:49 AM

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)

Andrew Jabbitt May 27, 2008 5:09 AM

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)

Romina Canales Jun 11, 2008 2:21 PM

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)

Shalini R Jun 18, 2008 6:05 AM

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)

Kenneth Hartman Jul 22, 2008 2:46 PM

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

Generic Extraction via Function Module | SCN


<br/>***********************************************************************<br/> Initialization: check input parameters<br/>* buffer input parameters<br/>* prepare data selection<br/>***********************************************************************<br/><br/><br/> <br/> append lines of i_t_select to s_s_if-t_select.<br/><br/>* Fill parameter buffer for data extraction calls<br/> s_s_if-requnr = i_requnr.<br/> s_s_if-dsource = i_dsource.<br/> s_s_ifmaxsize = i_maxsize.<br/><br/>* Fill field list table for an optimized select statement<br/>* (in case that there is no 1:1 relation between InfoSource fields<br/>* and database table fields this may be far from beeing trivial)<br/> append lines of i_t_fields to s_s_if-t_fields.<br/><br/> else. "Initialization mode or data extraction ?<br/> <br/>***********************************************************************<br/> Data transfer: First Call OPEN CURSOR + FETCH<br/>* Following Calls FETCH only<br/>***********************************************************************<br/><br/> First data package -> OPEN CURSOR<br/>* BREAK-POINT.<br/> if s_counter_datapakid = 0.<br/><br/>* Fill range tables BW will only pass down simple selection criteria<br/>* of the type SIGN = 'I' and OPTION = 'EQ' or OPTION = 'BT'.<br/> loop at s_s_if-t_select into l_s_select where fieldnm = 'PERNR'.<br/> move-corresponding l_s_select to l_r_pernr.<br/> append l_r_pernr.<br/> endloop.<br/><br/>* LOOP AT S_S_IF-T_SELECT INTO L_S_SELECT WHERE FIELDNM = 'FPBEG'.<br/>* MOVE-CORRESPONDING L_S_SELECT TO L_R_FPBEG.<br/>* APPEND L_R_FPBEG.<br/>* ENDLOOP.<br/><br/> LOOP AT S_S_IF-T_SELECT INTO L_S_SELECT WHERE FIELDNM = 'FPEND'.<br/>* MOVE-CORRESPONDING L_S_SELECT TO L_R_FPEND. <br/>* APPEND L_R_FPEND.<br/>* ENDLOOP.<br/><br/> LOOP AT S_S_IF-T_SELECT INTO L_S_SELECT WHERE FIELDNM = 'CHKDT'.<br/>* MOVE-CORRESPONDING L_S_SELECT TO L_R_CHKDT.<br/>* APPEND L_R_CHKDT.<br/>* ENDLOOP.<br/><br/> loop at s_s_if-t_select into l_s_select<br/> where fieldnm = 'Z_P_FRDAT'.<br/> movecorresponding l_s_select to s_frdat.<br/> append s_frdat.<br/> endloop.<br/><br/> loop at s_s_if-t_select into l_s_select<br/> where fieldnm = 'Z_P_FRTIM'.<br/> movecorresponding l_s_select to s_frtim.<br/> append s_frtim.<br/> endloop.<br/><br/>* Determine number of database records to be read per FETCH statement<br/>* from input parameter I_MAXSIZE. If there is a one to one relation<br/>* between DataSource table lines and database entries, this is trivial.<br/>* In other cases, it may be impossible and some estimated value has to<br/>* be determined.<br/><br/> open cursor with hold s_cursor for<br/> select distinct pernr from pa0000<br/> where pernr in l_r_pernr<br/> and stat2 = '3'.<br/><br/> endif. "First data package ?<br/><br/>* Fetch records into interface table.<br/>* named E_T_'Name of extract structure'.<br/><br/> fetch next cursor s_cursor<br/> appending corresponding fields<br/> of table e_t_data<br/> package size s_s_ifmaxsize.<br/><br/> if sy-subrc <> 0.<br/> perform fill_e_t_data tables e_t_data<br/> using s_counter_datapakid .<br/> close cursor s_cursor.<br/> raise no_more_data.<br/> else.<br/>* Fill E_T_DATA<br/>* PERFORM fill_data TABLES l_r_pernr e_t_data<br/>* USING s_counter_datapakid .<br/> perform fill_e_t_data tables e_t_data<br/> using s_counter_datapakid .<br/> endif.<br/><br/> s_counter_datapakid = s_counter_datapakid + 1.<br/><br/> endif. "Initialization mode or data extraction ?<br/><br/>&---<br/>& <br/> <br/> Form fill_e_t_data<br/>&-text<br/>*--->E_T_DATA text<br/>* >REF_COUNTER_DATAPAKID text<br/>*-using
Like (0)

<br/>form fill_e_t_data tables e_t_data structure zbw_payroll_str<br/> ref_counter_datapakid.<br/><br/> FIELD-SYMBOLS :

Sameer Pathak Jul 23, 2008 6:09 AM

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)

Nagesw ara Reddy Jul 9, 2009 12:16 AM

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)

Ramona Leabu Feb 5, 2010 1:40 PM

Can anybody send me the template for delta extraction?

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

Generic Extraction via Function Module | SCN

Like (1)

Site Index Privacy

Contact Us Terms of Use

SAP Help Portal Legal Disclosure

Copyright

Follow SCN

http://scn.sap.com/people/siegfried.szameitat/blog/2005/09/29/generic-extraction-via-function-module

11/11

You might also like