Can anybody explain me creating Generic Datasource using Function module?

Hi,
can anybody explain me creating Generic Datasource using Function module?
Thax in advance,
Ravi.

Generic Extraction via Function Module
/people/siegfried.szameitat/blog/2005/09/29/generic-extraction-via-function-module
1. Create s structure with the fields that you need from the 4 tables . Activate.
2. Goto SE 80 Select The Function Group , Copy , Select the Function module
" RSAX_BIW_GET_DATA_SIMPLE " and Give a New name starting With
Y or Z .
3. SE37 ->Your Function module name -> Change , In table tab give your structure
name by deleting the associated type given in " E_T_DATA " .
4. Now select source code and Do the coding . Give Data source name in Coding .
In your case you have to take data from more that 1 table .
5. Activate the Function Group .
6. In RSO2 Create the Data source , Give the Function Module Name , And Save.
7. RSA3 -> Give data source name and Check for the Records .
Creation of custom datasource. (Using function module)
<b>is an example</b>
1.Create a function group .
2. Structure ZTEST123
ZMATNR MATNR CHAR 18 0 Material Number
ZMTART MTART CHAR 4 0 Material type
ZMBRSH MBRSH CHAR 1 0 Industry sector
ZMATKL MATKL CHAR 9 0 Material group
ZBISMT BISMT CHAR 18 0 Old material number
ZMAKTX MAKTX CHAR 40 0 Material description
3. Create function module (i.e. ZTEST….) .
FM - YMARA_DATA_TRNS
FUNCTION YMARA_DATA_TRNS.
""Local Interface:
*" 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 ZTEST123 OPTIONAL
*" EXCEPTIONS
*" NO_MORE_DATA
*" ERROR_PASSED_TO_MESS_HANDLER
data : ZTEST123 type ZTEST123 occurs 0 with header line.
Maximum number of lines for DB table
STATICS: S_S_IF TYPE SRSC_S_IF_SIMPLE,
S_COUNTER_DATAPAKID LIKE SY-TABIX.
DATA: begin of t_mara occurs 0,
ZMATNR type MATNR,
ZMTART type MTART,
ZMBRSH type MBRSH,
ZMATKL type MATKL,
ZBISMT type BISMT,
end of t_mara.
DATA: begin of t_makt occurs 0,
ZMATNR type MATNR,
ZMAKTX type MAKTX,
end of t_makt.
Initialization mode (first call by SAPI) or data transfer mode
(following calls) ?
IF I_INITFLAG = SBIWA_C_FLAG_ON.
Check DataSource validity
CASE I_DSOURCE.
WHEN 'ZZMARA_DATA'.
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.
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.
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.
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.
select MATNR
MTART
MBRSH
MATKL
BISMT
from mara up to 10 rows
into table t_mara.
if not t_mara[] is initial.
select MATNR
maktx
from makt
into table t_makt
for all entries in t_mara
where matnr = t_mara-zmatnr.
endif.
loop at t_mara.
read table t_makt with key zmatnr = t_mara-zmatnr.
ZTEST123-zmatnr = t_mara-zmatnr.
ZTEST123-ZMTART = t_mara-ZMTART.
ZTEST123-ZBISMT = t_mara-ZBISMT.
ZTEST123-ZMBRSH = t_mara-ZMBRSH.
ZTEST123-ZMATKL = t_mara-ZMATKL.
ZTEST123-zmaktx = t_makt-zmaktx.
append ZTEST123.
clear ZTEST123.
endloop.
clear E_T_DATA.
refresh E_T_DATA.
E_T_DATA[] = ZTEST123[].
ENDIF.
S_COUNTER_DATAPAKID = S_COUNTER_DATAPAKID + 1.
ENDIF. "Initialization mode or data extractio
ENDFUNCTION.
3. Create the data source using transaction (RSO2).
4. If structure exists for the table parameter of your function module then ok else create a structure for the table parameter ‘E_T_DATA’.
5. Test the datasource in R/3 using transaction RSA3.
6. Transfer the data source to BW –System and replicate it in the BW-System.

Similar Messages

  • Creating generic datasource using function module in R/3 4.6c

    Hi,
    I am not able to see the option (in TC RSO2) to create generic datasource using function module in R/3 4.6c. Is there any special plug in or some SAP Note to be applied to get the option ?
    Waiting for a quick response.
    Thanks and Regards,
    Deepak

    Hi Sat,
    Thanks for the reply.
    I know that creating generic datasource from function module is available in R/3 4.7.
    In 4.6c version there are only two options available. They are Extraction from DB View and Extraction from SAP Query.
    The third option i.e. Extraction from Function Module is not available in 4.6c. I wanted to know if there is any plugin that needs to be installed to get this option.
    Thanks and Regards,
    Deepak

  • Creating a Generic Datasource using Function Module

    Hi Guru's
                  We are tryin to create a Generic datasource using function module, we have found few old how to guides for doing the same but it is not effective and need to be altered. Can anyone suggest me the latest step by step procedure to create the above, also if you have the how to guide kindly paste the link as it will be a great help at this point.
    Thanks in advance
    Regards
    Liquid

    Hi,
    Please goto the Following links  :-
                                                                          PDF
    1)         http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/c062a3a8-f44c-2c10-ccb8-9b88fbdcb008?quicklink=index&overridelayout=true
    2)        http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/a0f46157-e1c4-2910-27aa-e3f4a9c8df33?quicklink=index&overridelayout=true
                                                     SAP Forum
    3)        Re: DataSouce based on FM
    4)       http://forums.sdn.sap.com/post!reply.jspa?messageID=10050614
    5)       https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/a0f46157-e1c4-2910-27aa-e3f4a9c8df33
    6)       Re: Generic datasource with functional module
    7)       Generic Extractor (FM based) - Delta Enabled
    Regards
    Obaid

  • Generating a Generic DataSource using Function Modules

    I am attempting to create a generic DataSource using a  function module.  All of our DataSources are business content or custom generated that involve views.  At least in our company this is true.  Is there any resources available to me with examples on how to do this.  I have looked at SAP's 'simple example' and would need a ABAP/BW Guru to figure it out!  Any help would be greatfull.  Thanx.  JJ

    Hi Jerry,
       The simple example should provide you with the necessary requisite. All what you need to do is to
    create your own extract structure and assign that as type for the table parameter e_t_data.
    Now you will get the selection criteria, as well as the fields selected in the datasource from the 2 incoming tables. You need to write the necessary abap code to execute a query and populate your extract struture.
    Once important peculiarity of this function module is that it is called several times, or as many times as the MAX parameter + 1. ie, once for each row fetched. Hence you will find a persistence method of using a CURSOR with HOLD property to retain the data between the function calls.
       The help in generic datasource explains the 3 modes,
    initialize, first call and the repeat call for the
    function module. The simple function module example actually provides the necessary logic to deal with these modes and the example uses the sflight table.
    Hope that is some information that could help u begin with.
    Anoop C M

  • Generic DataSource using function module

    Hello experts,
    I created a generic dataSource using copy of function module RSAX_BIW_GET_DATA. It is syntactilly correct. But when I execute  and debug associated generic DataSource in RSA3, this generic function module could not identify DataSource(i_isource) and update mode(i_updmode).
    Could you please answer what went wrong?
    I also created by using copy function module RSAX_BIW_GET_DATA_SIMPLE. I did not find above such problem. The generic DataSource is executed fine in this case.
    Thanks in advance,
    Zak.

    http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/c062a3a8-f44c-2c10-ccb8-9b88fbdcb008
    /people/p.renjithkumar/blog/2009/10/07/generic-datasource-creation-using-function-module

  • Generic Extraction - Using Function Modules

    Hi Friends,
    Can you pl let me know the step by step process for creating generic extraction using function module?
    Thanks in Advance.
    Regards,
    Ari.
    Please search the forum before posting a thread
    Edited by: Pravender on Aug 5, 2010 7:31 PM

    Hi,
    Plz find this doc.
    http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/a0f46157-e1c4-2910-27aa-e3f4a9c8df33.
    And go this link...
    http://www.sdn.sap.com/irj/scn/advancedsearch?query=genericextractionwithfunctionmadule
    Regards.....KP
    Edited by: kundan.sap on Aug 5, 2010 4:35 PM

  • Generic Extractor using Function module with Complex Interface

    Hi,
    Has anyone created Generic extractor using Function module with Complex Interface?
    What is the difference between Complex and Simple interface in Function module?
    Pls explain.
    Thanks,
    Gopal

    Hi,
    Go through this link.....
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/d3219af2-0c01-0010-71ac-dbb4356cf4bf
    GTR

  • How to create a generic datasource from function module?

    Dear experts,
    I have created a generic datasource from function module. For this extrator, I created a function module and a structure.
    I have now some difficulties to continue:
    In this function module, i get data from different transparent tables. Then i put these data into an internal table.
    I just don't know what is the relatioin between the structure i defined and this internal table.
    I should make "iTab structure AA" in the source code?
    Thanks

    Hi..
    check this
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/84bf4d68-0601-0010-13b5-b062adbb3e33
    Generic Extraction via Function Module
    /people/siegfried.szameitat/blog/2005/09/29/generic-extraction-via-function-module
    1. Create s structure with the fields that you need from the 4 tables . Activate.
    2. Goto SE 80 Select The Function Group , Copy , Select the Function module
    " RSAX_BIW_GET_DATA_SIMPLE " and Give a New name starting With
    Y or Z .
    3. SE37 ->Your Function module name -> Change , In table tab give your structure
    name by deleting the associated type given in " XXXX " .
    4. Now select source code and Do the coding . Give Data source name in Coding .
    In your case you have to take data from more that 1 table .
    5. Activate the Function Group .
    6. In RSO2 Create the Data source , Give the Function Module Name , And Save.
    7. RSA3 -> Give data source name and Check for the Records .
    Creation of custom datasource. (Using function module)
    .Create a function group .
    . Structure ZTXXXX
    Create function module (i.e. ZTESTXXX) .
    . Create the data source using transaction (RSO2).
    . If structure exists for the table parameter of your function module then ok else create a structure for the table parameter ‘        ’.
    Test the datasource in R/3 using transaction RSA3.
    Transfer the data source to BW –System and replicate it in the BW-System.
    Message was edited by:
            shiv

  • Create a generic extractor using Function module,  what steps must I follow

    Hello gurus team
    I need to Create a generic extractor using Function module,  what steps must I follow?
    Just I have a function module not estructures or something, only the program.... and I have intented to do it in rso2 using the fm option, but give an error... somebody can helpme???
    BR

    Hi,
    Generic Extraction via Function Module
    /people/siegfried.szameitat/blog/2005/09/29/generic-extraction-via-function-module
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/a0f46157-e1c4-2910-27aa-e3f4a9c8df33
    http://help.sap.com/saphelp_nw04/helpdata/en/86/1c8c3e94243446e10000000a114084/frameset.htm
    Thanks,
    JituK

  • Error occurred while loading Generic extraction using Function module

    Hi all
    I'm trying to do INIT for Generic Extractor using Function module, but i'm getting error as "Error occurred in the source system"
    Error message from the source system
    Diagnosis
    An error occurred in the source system.
    System Response
    Caller 09 contains an error message.
    Further analysis:
    The error occurred in Extractor .
    Refer to the error message.
    Procedure
    How you remove the error depends on the error message.
    Note
    If the source system is a Client Workstation, then it is possible that the file that you wanted to load was being edited at the time of the data request. Make sure that the file is in the specified directory, that it is not being processed at the moment, and restart the request.
    Job terminated in source system --> Request set to red
    Message no. RSM078
    Can u help plz....

    Hi Vishnu
    This are the Job log details i found in source system...Can u tell what whould be the problem?
    Message
    Job started
    Step 001 started (program SBIE0001, variant &0000000002861, user ID
    Asynchronous transmission of info IDoc 2 in task 0001 (0 parallel tasks)
    DATASOURCE = ZYFI102
    RLOGSYS    =
    REQUNR     = REQU_D9Y4CZDQULRIHRRVU33KOLQZO
    UPDMODE    = D
    LANGUAGES  = *
             Current Values for Selected Profile Parameters               *
    abap/heap_area_nondia......... 0                                       *
    abap/heap_area_total.......... 10737418240                             *
    abap/heaplimit................ 40000000                                *
    zcsa/installed_languages...... DE                                      *
    zcsa/system_language.......... E                                       *
    ztta/max_memreq_MB............ 2047                                    *
    ztta/roll_area................ 3000000                                 *
    ztta/roll_extension........... 2000000000                              *
    No authorization for Acct type D
    Job cancelled after system exception ERROR_MESSAGE
    Thanks in advance
    Edited by: MohanDP on Feb 25, 2011 11:58 AM
    Edited by: MohanDP on Feb 25, 2011 12:01 PM

  • Generic DataSource on Function Module - Query

    Hi All,
    We have a requirement wherin we have to pull data from MARM  (Material UOM fields) table. This table has some 1,130,000 records.  Since this table doesn't have a Last Changed on or Created on field we are not able to create a Generic Delta on the table itself.
    We have come to know that in MM02, we can change the Unit of Measure fields for material. When we update in MM02, both MARA and MARM table gets changed. MARA will be updated with  the last changed date.
    So we are thinking of creating a Generic DataSource on Function module so that we can perform the delta on Last changed or Created on field of MARA.
    I have a doubt about creating the function module. How should we achieve the initial load (Getting all the material and it's UOM to BW) and then Delta loads through the function module?
    Does the first load needs to be or should be a full load?
    If someone can tell me the steps that should be followed, it would be very helpful
    Please let me know your suggesstion.
    Regards,
    Vivek Das Gupta

    Hi
    Could u try creating a view based Datasource.
    Also u can do a full load in parallel by creating 4-5 Infopackages. After which a Init without data transfer can be done.
    Hope this helps.
    Reg
    Aparna

  • Delta with Generic Extractor using function module

    Hi,
    I have created an extractor using function module and it work fine (mode FULL)
    It's an extractor based on the FM RSAX_BIW_GET_DATA_SIMPLE.
    In TCODE RSO2, I have specified a delta field (AEDAT).
    In table ROOSOURCE, this extractor is defined by :
    DELTA = AIE
    EXMETHOD = F1
    When I extract data in Init mode, there is no problem. But delta don't extract any entries.
    When I trace with TCODE ST01, in Init mode the function module is executed but in delta mode, there is no trace of any use of this function module.
    I don't know how to do to make this extractor work fine in delta mode.

    Hi Pascal,
    The same function module i have used and succesffuly doing delta using it. So it works for both full & delta.
    How ur testing it and where are you testing it for delta.
    Do the delta testing through BI end. Set the
    As u have already set the delta field., now Follow below steps:
    1. First set the safety interval upper limit to -1, so that it will extract the delta data of 1 day back records also.
    2. Please make sure wether the delta records are available or not in r/3, if there is no records to be fetched in for delta then u will not be able to track out wether delta is working or not.
    3. Now do the init from BI end first. Delta initialization without data transfer. - It will give u green status with 1 dummmy record.
    4. Now do the delta. It will extract the delta records.
    Before that make sure that if any selection your giving in Infopackage should be met out by these delta records.
    Thanks
    Dipika

  • Create virtual infocube using function module

    HI all,  Searched lot of document to create virtual infocube using function module, I am not getting good one, If any one give PDF document step by step process it will be useful for me. thank u

    Hi
    Please refer this document.
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/9066d1fa-efc1-2b10-7b96-9ddee3b11b40?quicklink=index&overridelayout=true
    Thanks
    Suganya

  • Problem while creating generic DataSource using table

    Hello all,
    I am creating a generic DataSource using table EKBE. It is giving error " invalid extract structure template EKBE ". The reason is " The system tried to generate an extract structure with the template structure EKBE. This operation failed, because the template structure quantity fields or currency fields, for example, field MENGE refer to a different table (EKPO)".
    Could you suggest how to approach?
    Thanks,
    Zak.

    hi zahir,
    In your case the reference table used for quantity is ekko and the field is meins.
    and the reference table used for currency is ekpo and the field is waers.
    So you are not taking data from a single table. so you better create a view give the table name ekbe and select the corresponding fields you want.
    Add MEINS and WAERS and as well your required field in the view for example Zview and for Quantity field mention Zview as reference table and reference field as MEINS same for WAERS.
    try this if it doent work, tell me what error you are facing.
    with regards!
    ramesh

  • Generic extraction using function module and view

    hi every one ,
    iam new to bw and can anyone plz tell me how to extract the data from R/3 to bw using generic extractor by creating function module and a view
    thank u,
    kishore

    Hi Kishore,
    Check this blog:
    /people/siegfried.szameitat/blog/2005/09/29/generic-extraction-via-function-module
    Also Check this doc:
    http://help.sap.com/saphelp_nw04/helpdata/en/3f/548c9ec754ee4d90188a4f108e0121/frameset.htm
    Generic Extractors
    Generic data sources
    Generic DS
    Bye
    Dinesh

Maybe you are looking for