Generic Datasource by Function Module.

Hi there,
Our ABAP guy is building a function module to bring data to BW by using Generic DataSource. My qtn is how we are going to handle delta?
Can we use the delta provided in Rso2 or we have to hard code it in the function module?
Your prompt help will be highly appreciated.
Kara.

Hi,
Just Go through these.
/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/84bf4d68-0601-0010-13b5-b062adbb3e33
Hope it helps.
Thanks,
-Vijay

Similar Messages

  • 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

  • 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.

  • 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

  • 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

  • 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

  • Generic datasource by function module to fetch data from multiple tables?

    I'm writing a function module to fetch price, for generic datasource.
    At first, extract test is OK. But InfoPackage never stop  when loading data to PSA in BW.
    And I find the example codes:
         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.
    There using Cursor to fetch data package by package, and raise exception NO_MORE_DATA to stop the loading process.
    Now I fetch data from multiple tables, I don't think I can use Cursor.
    Then How can I handle this?  
    Thanks a lot.

    Thanks
    IF IT_999[] IS INITIAL.
        SELECT A~KNUMH A~MATNR A~KSCHL VKORG VTWEG A~DATBI A~DATAB KBETR KMEIN KPEIN C~MTART APPENDING CORRESPONDING FIELDS OF
          TABLE TP_DATA
            FROM A999 AS A
              INNER JOIN KONP AS B
                  ON A~KNUMH = B~KNUMH
              INNER JOIN MARA AS C
                 ON A~MATNR = C~MATNR
    *          FOR ALL ENTRIES IN IT_999
                    WHERE
    *      A~KNUMH = IT_999-KNUMH  AND
           ( ( A~KSCHL = 'ZPRC' AND VKORG = 'Z000' AND VTWEG = 'Z1' ) OR
                          ( A~KSCHL = 'ZPRD' AND VKORG = 'A000' AND VTWEG = 'Y3' ) ) AND
    *                      A~DATBI >= SY-DATUM AND
                          LOEVM_KO = ''.
        SELECT A~KNUMH A~MATNR A~KSCHL VKORG VTWEG A~DATBI A~DATAB KBETR AS KHETR  KMEIN KPEIN C~MTART APPENDING CORRESPONDING FIELDS OF
          TABLE TP_DATA
            FROM A999 AS A
              INNER JOIN KONP AS B
                  ON A~KNUMH = B~KNUMH
              INNER JOIN MARA AS C
                 ON A~MATNR = C~MATNR
    *          FOR ALL ENTRIES IN IT_999
                    WHERE
    *      A~KNUMH = IT_999-KNUMH AND
          A~KSCHL = 'ZPR3' AND A~VKORG = 'I000' AND
    *                      DATBI >= SY-DATUM AND
                          LOEVM_KO = ''.
      ENDIF.
      IF IT_997[] IS INITIAL.
        SELECT A~KNUMH A~MATNR A~KSCHL VTWEG A~DATBI A~DATAB KBETR AS KHETR KMEIN KPEIN C~MTART APPENDING CORRESPONDING FIELDS OF
          TABLE TP_DATA
            FROM A997 AS A
              INNER JOIN KONP AS B
                  ON A~KNUMH = B~KNUMH
              INNER JOIN MARA AS C
                 ON A~MATNR = C~MATNR
    *          FOR ALL ENTRIES IN IT_997
                    WHERE
    *      A~KNUMH = IT_997-KNUMH      AND
          A~KSCHL = 'ZPRA' AND VTWEG = 'Y1' AND
    *                      DATBI >= SY-DATUM AND
                      LOEVM_KO = ''.
      ENDIF.
      IF IT_996[] IS INITIAL.
        SELECT A~KNUMH A~MATNR A~KSCHL A~DATBI A~DATAB KBETR AS KHETR KMEIN KPEIN C~MTART APPENDING CORRESPONDING FIELDS OF
           TABLE TP_DATA
             FROM A996 AS A
               INNER JOIN KONP AS B
                   ON A~KNUMH = B~KNUMH
               INNER JOIN MARA AS C
                  ON A~MATNR = C~MATNR
    *          FOR ALL ENTRIES IN IT_996
                    WHERE
    *      A~KNUMH = IT_996-KNUMH AND
          A~KSCHL = 'ZPRB' AND
    *                       DATBI >= SY-DATUM AND
          LOEVM_KO = ''.
      ENDIF.
      SELECT   MATNR     "u7269u6599u53F7u7801
               MEINH     "u4ED3u50A8u5355u4F4Du7684u5907u7528u8BA1u91CFu5355u4F4D
               UMREZ     "u57FAu672Cu8BA1u91CFu5355u4F4Du8F6Cu6362u5206u5B50
               UMREN     "u8F6Cu6362u4E3Au57FAu672Cu8BA1u91CFu5355u4F4Du7684u5206u6BCD
          FROM MARM
          INTO CORRESPONDING FIELDS OF TABLE IT_MARM
           FOR ALL ENTRIES IN TP_DATA
         WHERE MATNR = TP_DATA-MATNR AND  MEINH = TP_DATA-KMEIN.
      LOOP AT TP_DATA.
        IF TP_DATA-KPEIN NE 0.
          TP_DATA-KBETR =  TP_DATA-KBETR / TP_DATA-KPEIN.
          TP_DATA-KHETR =  TP_DATA-KHETR / TP_DATA-KPEIN.
        ENDIF.
        IF TP_DATA-KSCHL = 'ZPRA'.
    *       TP_DATA-MEINH = 'ZI'.
    *      TP_DATA-KSCHL = 'B4'.
          IF TP_DATA-KMEIN = 'ZI'.
            TP_DATA-KBETR = TP_DATA-KHETR / '1.17'.
          ELSE.
            READ TABLE IT_MARM INTO WA_MARM1 WITH KEY MATNR = TP_DATA-MATNR MEINH = TP_DATA-KMEIN.
    *           READ TABLE IT_MARM INTO WA_MARM2 WITH KEY MATNR = TP_DATA-MATNR MEINH = 'CT'.
            TP_DATA-KHETR = TP_DATA-KHETR * WA_MARM1-UMREN / WA_MARM1-UMREZ.
    *           * WA_MARM2-UMREZ / WA_MARM2-UMREN.
            TP_DATA-KBETR = TP_DATA-KHETR / '1.17'.
          ENDIF.
        ELSEIF TP_DATA-KSCHL = 'ZPRB'.
    *      TP_DATA-KSCHL = 'L0'.
    *       TP_DATA-MEINH = 'ZI'.
          IF TP_DATA-KMEIN = 'ZI'.
            TP_DATA-KBETR = TP_DATA-KHETR / '1.17'.
          ELSE.
            READ TABLE IT_MARM INTO WA_MARM1 WITH KEY MATNR = TP_DATA-MATNR MEINH = TP_DATA-KMEIN.
    *           READ TABLE IT_MARM INTO WA_MARM2 WITH KEY MATNR = TP_DATA-MATNR MEINH = 'BAG'.
            TP_DATA-KHETR = TP_DATA-KHETR * WA_MARM1-UMREN / WA_MARM1-UMREZ.
    *           * WA_MARM2-UMREZ / WA_MARM2-UMREN.
            TP_DATA-KBETR = TP_DATA-KHETR / '1.17'.
          ENDIF.
        ELSEIF TP_DATA-KSCHL = 'ZPRC' OR TP_DATA-KSCHL = 'ZPRD'.
    *       TP_DATA-MEINH = 'ZI'.
          IF TP_DATA-KMEIN = 'ZI'.
            TP_DATA-KHETR = TP_DATA-KBETR * '1.17'.
          ELSE.
            READ TABLE IT_MARM INTO WA_MARM1 WITH KEY MATNR = TP_DATA-MATNR MEINH = TP_DATA-KMEIN.
    *           READ TABLE IT_MARM INTO WA_MARM2 WITH KEY MATNR = TP_DATA-MATNR MEINH = 'WZI'.
            TP_DATA-KBETR = TP_DATA-KBETR * WA_MARM1-UMREN / WA_MARM1-UMREZ.
    *           * WA_MARM2-UMREZ / WA_MARM2-UMREN.
            TP_DATA-KHETR = TP_DATA-KBETR * '1.17'.
          ENDIF.
        ELSEIF TP_DATA-KSCHL = 'ZPR3'.
    *      TP_DATA-KSCHL = 'B2'.
          IF TP_DATA-KMEIN = 'ZI'.
            TP_DATA-KBETR = TP_DATA-KHETR / '1.17'.
          ELSE.
            READ TABLE IT_MARM INTO WA_MARM1 WITH KEY MATNR = TP_DATA-MATNR MEINH = TP_DATA-KMEIN.
    *           READ TABLE IT_MARM INTO WA_MARM2 WITH KEY MATNR = TP_DATA-MATNR MEINH = 'BAG'.
            TP_DATA-KHETR = TP_DATA-KHETR * WA_MARM1-UMREN / WA_MARM1-UMREZ.
    *           * WA_MARM2-UMREZ / WA_MARM2-UMREN.
            TP_DATA-KBETR = TP_DATA-KHETR / '1.17'.
          ENDIF.
        ENDIF.
        TP_DATA-MEINH = '01'.
        MODIFY TP_DATA.
    E_T_DATA-MATNR =   TP_DATA-MATNR.
    E_T_DATA-KSCHL =   TP_DATA-KSCHL.
    E_T_DATA-KHETR =   TP_DATA-KHETR.
    E_T_DATA-KBETR =   TP_DATA-KBETR.
    E_T_DATA-KMEIN =   TP_DATA-KMEIN.
    E_T_DATA-DATAB =   TP_DATA-DATAB.
    E_T_DATA-DATBI =   TP_DATA-DATBI.
    APPEND E_T_DATA.
        CLEAR WA_MARM1.
        CLEAR WA_MARM2.
      ENDLOOP.
    Edited by: Shen Peng on Oct 20, 2010 10:09 AM

  • 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 DataSOurce on Function Module

    Hi Everyone,
    I know how to create a Generic Datasource based on a view. I amfirst time trying to create a Generic DS based on FM. I know the steps. Like we go to SE11..select database type..give the name..select structure..give the name..enter the fields name in component save it..then go to SE80..select function gp..etc...etc.
    My question is This function module should get data from two tables. In which step we need to mention the table names?
    Can anyone please explain?
    Regards

    Hi,
    If you would like to have a DS which'll extract using FM then you've to copy RSAX_BIW_GET_DATA_SIMPLE FM.
    Now once you copy it then in that only you see the line:
    open cursor with hold s_cursor for
    select distinct pernr from pa0000
    where pernr in l_r_pernr
    and stat2 = '3'.
    If you want to have more than one table then create cursors and use them accordingly.
    Best Regards,
    Rachit

  • Generic datasource with function module

    I am trying to create a transactional generic datasouce with fm.
    I create my structure ZNVBAK1, create a function group ZRSAX, a FM ZRSAX_BIW_GET_DATA_SIMPLE1 and I adjust my source code.
    I activated both FM and Function Group.
    Now under RSO2 I enter the datasource name as in my code, I enter the application component SD as well as the description
    When I choose extraction by FM, nothing happens, no windows prompting me to enter my function module as well as extract structure, I checked everthing look good.
    Any Idea what I might be doing wrong?
    Thanks!!

    Hi ,
    First put values in Short Description, Medium Description & long Description,fields and then click on the Extraction by FM. You will get those filelds unabled.
    You can also refer.
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/a0f46157-e1c4-2910-27aa-e3f4a9c8df33?quicklink=index&overridelayout=true
    Edited by: Nilesh Vakil on May 31, 2011 7:57 AM

  • Error in Extraction with Generic Datasource via Function Module

    Dear Gurus,
    Iam working for BI-HR module.We are extracting data with generic data source via function module. The client some more extra fields in already existing DS. So we made a copy of that Function module and tried to create new generic DS, we got error while extraction like "Error occured during the extraction process". Can you please help in resolving this issue, your valuable suggestion would be highly appreciated.
    Thanks and regards
    Arun S

    Hi,
    Which structure are you using??
    Are you using the same old structure for this function module as well.
    Have you enhanced the structure with new required fields.
    New extrac fields needs to be added to existing structure if you are using the same or create a new one and make sure that you have all the fields in the structure which you are going to use in the data source.
    You need to take care for the append as well and the issue could be in the code as well.
    Make sure you have written the proper code and just for the new fields done an append
    Thanks
    Ajeet

  • Problem with Generic datasource from function

    I developed generic datasource from function module.
    But I have problem with the select options.
    First one is order number  OBJECT_ID type char 10. When I input Object_ID = 45755 , no data selected.
    When input 0000045755, one data record selected.
    But I called functiion CONVERSION_EXIT_ALPHA_INPUT to conevet the input data. And I found  45755 was converted to 0000045755, but no record selected.
         LOOP AT S_S_IF-T_SELECT INTO L_S_SELECT WHERE FIELDNM = 'OBJECT_ID'.
            MOVE-CORRESPONDING L_S_SELECT TO L_R_OBJECT_ID.
            APPEND L_R_OBJECT_ID.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
      EXPORTING
        INPUT         = L_R_OBJECT_ID-high
      IMPORTING
       OUTPUT        = L_R_OBJECT_ID-high
             CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
      EXPORTING
        INPUT         = L_R_OBJECT_ID-low
      IMPORTING
       OUTPUT        = L_R_OBJECT_ID-low
          ENDLOOP.
    Another problem is CREATED_AT, which type is DEC 15,  how could I handle it ?  input is yyyymmdd, I tried to add '000000', but can't select any data.
    Thanks for any help.

    code is :
    FUNCTION ZACTIVITY_PLAN_PARTNER.
    ""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
    *"     VALUE(I_REMOTE_CALL) TYPE  SBIWA_FLAG DEFAULT SBIWA_C_FLAG_OFF
    *"  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  ZACTIVITY_PLAN_PARTNER OPTIONAL
    *"  EXCEPTIONS
    *"      NO_MORE_DATA
    *"      ERROR_PASSED_TO_MESS_HANDLER
    Example: DataSource for table SFLIGHT
      TABLES: CRMD_ORDERADM_H.
    Auxiliary Selection criteria structure
      DATA: L_S_SELECT TYPE SRSC_S_SELECT.
      DATA:   BEGIN OF ACTIVITY,
                       OBJECT_ID       type CRMT_OBJECT_ID_DB,
                       PROCESS_TYPE    type CRMT_PROCESS_TYPE_DB,
                       OBJECT_TYPE     type CRMT_SUBOBJECT_CATEGORY_DB,
                       CREATED_BY      type CRMT_CREATED_BY,
                       CREATED_AT      type CRMT_CREATED_AT,
               END OF ACTIVITY.
      DATA: ZACTIVITY   LIKE TABLE OF ACTIVITY WITH HEADER LINE,
            Zorder   LIKE TABLE OF ZORDER_S WITH HEADER LINE,
            d_start type c length 15,
            d_end type c length 15
    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_OBJECT_ID FOR CRMD_ORDERADM_H-OBJECT_ID,
              L_R_CREATED_AT FOR CRMD_ORDERADM_H-CREATED_AT,
              L_R_date for ZACTIVITY_PLAN_PARTNER-ZPLAN_DAT.
    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 'ZACTIVITY_PLAN_PARTNER'.
          WHEN OTHERS.
            IF 1 = 2. MESSAGE E009(R3). ENDIF.
    this is a typical log call. Please write every error message like this
            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.
        APPEND LINES OF I_T_FIELDS TO S_S_IF-T_FIELDS.
      ELSE.                 "Initialization mode or data extraction ?
    First data package -> OPEN CURSOR
        IF S_COUNTER_DATAPAKID = 0.
          LOOP AT S_S_IF-T_SELECT INTO L_S_SELECT WHERE FIELDNM = 'OBJECT_ID'.
            MOVE-CORRESPONDING L_S_SELECT TO L_R_OBJECT_ID.
            APPEND L_R_OBJECT_ID.
         ENDLOOP.
    if  L_R_OBJECT_ID-option is initial.
      L_R_OBJECT_ID-option = 'EQ'.
      L_R_OBJECT_ID-sign ='I'.
      endif.
      CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
      EXPORTING
        INPUT         = L_R_OBJECT_ID-high
      IMPORTING
       OUTPUT        = L_R_OBJECT_ID-high
             CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
      EXPORTING
        INPUT         = L_R_OBJECT_ID-low
      IMPORTING
       OUTPUT        = L_R_OBJECT_ID-low
          LOOP AT S_S_IF-T_SELECT INTO L_S_SELECT WHERE FIELDNM = 'CREATED_AT'.
            MOVE-CORRESPONDING L_S_SELECT TO L_R_CREATED_AT.
            APPEND L_R_CREATED_AT.
          ENDLOOP.
          OPEN CURSOR WITH HOLD S_CURSOR FOR
          SELECT OBJECT_ID FROM CRMD_ORDERADM_H
                                  WHERE OBJECT_ID  IN  L_R_OBJECT_ID
                                  AND          CREATED_AT IN L_R_CREATED_AT    and
                                        PROCESS_TYPE EQ 'Z220'.
        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.

  • Generic Datasource with Fuction Module with delta on Created Date

    Hi Experts,
    I have created a generic datasource using Function Module RSAX_BIW_GET_DATA. I have copied this function module and created a my own Function Module. I want to load delta using this. But I don't know how to handle delta in the code.
    my code is working for full load but not for delta. I have seen that in ROOSOURCE tabel the Delta field is showing the AIE instead of D and extraction method  is showing as F2. I have searched a lot of forums and articles but didn't get how to handle this.
    Please advice.

    Hi Amit,
    Go through the link as suggested by AKhan which lets you understand the concept of offsets and the last extraction status.
    In case of Table or View based GDS, the system takes care of the deltas based on the selections you make in the "Generic Delta" screen whereas in case of FM based DS, it is your responsibility to handle this part. Within your code, capture if the load is a Delta load (I_UPDMODE = D). Since your delta is on Created Date, maintain a Z table with name of the DS as the Key and a field representing the current value of the Delta field(created date in this case). When you first load the delta, there will be no record for your DS in this table. Create an entry with the current day. Next time when you load a delta, take this value, compare it with sy-datum and get all the records falling within these days. This has to be done in the Select stmt. Once selection happens, replace the value in the Z table with sy-datum. This way you can simulate the delta. The Z table can be used for other FM based Datasources also as it has DS as the key.
    It would be easy if the exact SAP table where RSA7 delta field status is stored is known. Otherwise, the above method can be used.
    Revert for any further queries.

  • Urgent: Problems in Generic Extraction by Function Module

    Hi BW Gurus,
    I am new to SDN and also new to generic extraction using function module. My requirement is to extract long text(142 char) from CRM to BW as the text is not stored in database table I used function module read_text with in another ZXXX function module copy of (RSAX_BIW_GET_DATA_SIMPLE). In my extract structure I used GUID(char,32), Langu, long text(142 char) and 2 placeholders. Text can be extracted by passing STXH table fields(Tdname, Tdid, Tdobject, Tdspars) to read_text as parameters and i also need to use CRMD_ORDERADM_H field GUID(32 char) to compare 1st 32 chars of tdname(70 char) with Guid to select Guids and loop thru this Guids and for each Guid i need to append lines of text to e_t_data but as i donot know ABAP i unable to write the code for this. Through my friends help i wrote code when i check in RSA3 it is displaying the text but when i replicate into BW and load into data target in monitor the status is red with records initially but afterwards it will be red status again with 0 from 0 records for initial load again.when i check on job logs the errors i have are:
    The background job has created a job log file of 2Gb size and it is currently on a infinite loop writing entries into the SAP System Log that it cannot write to the Job log file due to “Error 22 for write/read access to a file” this is because of the datasource i have created. Please find my Function module and if anyone would please correct FM and send me that will be really great.I appreciate it in advance.
    MY Function Module is:
    FUNCTION Z_CRMORDERH_STR_TXT.
    ""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
    *"     VALUE(I_REMOTE_CALL) TYPE  SBIWA_FLAG DEFAULT SBIWA_C_FLAG_OFF
    *"  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  YCRM_TEXT_STR OPTIONAL
    *"  EXCEPTIONS
    *"      NO_MORE_DATA
    *"      ERROR_PASSED_TO_MESS_HANDLER
    ***"  EXCEPTIONS     NO_MORE_DATA
    *"      ERROR_PASSED_TO_MESS_HANDLER
      Tables: CRMD_ORDERADM_H, STXH.
    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.
    data: i_crmtext type standard table of TLINE .
      types: begin of xsreph ,
              GUID type CRMD_ORDERADM_H-guid,
            end of xsreph.
       data: i_guid type standard table of xsreph.
      data: I_TEXT type STXH-TDNAME.
      data: xempl like  YCRM_TEXT_STR occurs 0 with header line.
      data: t_tab like dd03l-tabname.
    Select ranges
      ranges: l_r_guid for CRMD_ORDERADM_H-guid.
             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 'yCRM_TEXT'.  " for S_SREPH1
          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.
    we will do our selection based on what is in the p table for the
    infoobject
      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'.
        LOOP AT S_S_IF-T_SELECT INTO L_S_SELECT WHERE FIELDNM = 'GUID'.
            MOVE-CORRESPONDING L_S_SELECT TO L_R_GUID.
            APPEND L_R_GUID.
          ENDLOOP.
          case i_dsource.
            when 'YCRM_TEXT'.  " for S_SREPH1
              t_tab = 'CRMD_ORDERADM_H'.
          endcase.
          select GUID
          from (t_tab)
          into table i_guid where   PROCESS_TYPE = 'ZACI'  and ( OBJECT_ID < '0000000042').
         select tdname from stxh into i_text where tdobject = 'TEXT'.
         if sy-subrc ne 0.
           message e009(r3).
    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
                     'No master data found'.           "message variable 2
           raise error_passed_to_mess_handler.
         endif.
    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 CRMD_ORDERADM_H
                                  where GUID in L_R_GUID .
                                   ENDIF.
    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.
    as we are doing this only once can use the select statement.
    ***data: crmtext like tline occurs 0 with header line.
    **data: i_crmtext type standard table of TLINE.
    **data: i_guid type standard table of xsreph.
    data: l_guid type THEAD-TDNAME.
    data: st_guid type xsreph.
    data: st_crmtext type TLINE.
    data: lan type THEAD-TDSPRAS.
    lan = 'E'.
    loop at i_guid into st_guid.
    l_guid = st_guid-guid.
    CALL FUNCTION 'READ_TEXT'
       EXPORTING
       CLIENT                        = SY-MANDT
         ID                            = 'A002'
         LANGUAGE                      = lan
         NAME                          = l_guid
         OBJECT                        = 'CRM_ORDERH'
       ARCHIVE_HANDLE                = 0
       LOCAL_CAT                     = ' '
    IMPORTING
       HEADER                        =
       TABLES
         LINES                         = i_crmtext.
    EXCEPTIONS
       ID                            = 1
       LANGUAGE                      = 2
       NAME                          = 3
       NOT_FOUND                     = 4
       OBJECT                        = 5
       REFERENCE_CHECK               = 6
       WRONG_ACCESS_TO_ARCHIVE       = 7
       OTHERS                        = 8
    e_t_data-guid = l_guid.
    loop at i_crmtext into st_crmtext.
    move lan to e_t_data-langu.
    move st_crmtext-tdline to e_t_data-description.
    append e_t_data.
    endif.
    endloop.
    clear: st_guid,l_guid.
    refresh: i_crmtext.
    endloop.
    S_COUNTER_DATAPAKID = S_COUNTER_DATAPAKID + 1.
    endif.
    ENDFUNCTION.
    please Gurus as I donot know ABAP i appreciate if anyone would write a FM based on requirement and send me that will be really great this is my request. I gurantee of award points for good answers.
    Regards
    Kishore

    Hi,
    The statement <b>RAISE NO_MORE_DATA</b> should be active (uncommented) in your code. Otherwise, the infinte loop occurs.
    See also, the Siggi's blog:
    /people/siegfried.szameitat/blog/2005/09/29/generic-extraction-via-function-module
    BTW, was it your thread here:
    Re: Urgent: problems in extracting Long Text
    Best regards,
    Eugene

Maybe you are looking for