Function module to reactivate datasource

hello all,
anyone out there with a useful function module which will allow me to reactivate a datasource?
thanks.

Hi,
You can also use the program "RSDS_DATASOURCE_ACTIVATE_ALL" to activate all / individual  datasources for a source system.
Here, you also have an option to choose whether you want to activate an inactive datasource or to reactivate an active datasource. Hope this helps.
Regards,
Sarika

Similar Messages

  • Function Module in Generic DataSources in BI

    Hi,
    I appreciate your answer about the Function Module in Generic DataSources in BI.
    These are the steps I followd on R/3 side.
    1) Create a structure with the R/3 table fileds based on the requirement.
    2) Create a function module by copying RSAX (Function Group) and RSAX_BIW_GET_DATA_SIMPLE (Functin Module) into our own function group & Function Module (name starting with Y /Z). And use the structure(ex: ZSPMT) created in the reference data of 'Tables' tab (ex: E_T_DATA LIKE ZSPMT).
    3) Use the structure name & function module name in the Generic DataSource
    Finally when I want to use the Generic DataSource, do i need to insert the records myself in the table (or structre) I created  ZSPMT? (which is used in Function Module)
    If I need to insert the data into table ZSPMT myself, what is use of function module?
    Can't I use the view of this table (ZSPMT) directly in Generic DataSource?
    Is the function module used to filter/restrict the data based on client need?
    Thank you in advance for you answers
    It will help undderstand the difference among View, InfoSet Query & Function Module
    used in  creating Generic DataSource.
    Regards,
    Lakshmi

    hi,
    why did you prefered function module?
    if the table ZSPMT egts the data that you enter automatically then no need to use FM.
    directly extract with tables/if more than one table then use views.
    if you need especially the FM that could solve ur complex requirmnet.
    http://help.sap.com/saphelp_nw04/helpdata/en/3f/548c9ec754ee4d90188a4f108e0121/content.htm
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/84bf4d68-0601-0010-13b5-b062adbb3e33
    Ramesh

  • Datasource as a function module

    hi,
      I am looking for a sample code to use function module as a datasource.
      Is there any document which i can use for this ?
    Thanks in advance.

    Hi
    Please have a look into the following link.
    https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_all&query=genericdatasourcefromfunction+module&adv=false&sortby=cm_rnd_rankvalue
    hope it helps
    Thanks,
    Teja

  • Runtime Error while extracting data by datasource based on function module

    Hi all,
    I am facing an issue while extracting data from a customised data source based on a new function module.
    The datasource is extracting data successfully for only 15000 records but after that the runtime error is displayed.
    I am not able to extract whole data from R/3 system.
    Please take a look into the details and tell me what should I have to do.
    Details of Issue:
    Runtime Error : GETWA_NOT_ASSIGNED
    What happened?                                                                               
    Error in the ABAP Application Program                                                        
    The current ABAP program "SAPLZ_99Z_BW_SD_PRICING"had to be terminated because  it has  come across a statement that unfortunately cannot be executed.
    Error analysis                                                                               
    You attempted to access an unassigned field symbol                                          
        (data segment 32790).                                                                               
    This error may occur if                                                                   
        - You address a typed field symbol before it has been set with                               
          ASSIGN                                                                               
    - You address a field symbol that pointed to the line of an                              
          internal table that was deleted                                                          
        - You address a field symbol that was previously reset using                           
          UNASSIGN or that pointed to a local field that no                                        
          longer exists                                                                               
    - You address a global function interface, although the                                      
      respective function module is not active - that is, is                                  
          not in the list of active calls. The list of active calls                                 
          can be taken from this short dump. 
    Edited by: anshu13 on Apr 27, 2010 10:28 AM

    The code is displayed here:
    error is in line no. 625
    Source Code Extract                                                                               
    Line SourceCde                                         
      595            <fs_fldval> = l_fieldval.
      596            APPEND <fs_dyntable> TO <it_dyntable>.                               
      597            CLEAR :l_fieldval, wa_fldcat.                                                  
      598            CLEAR l_totlength.                                                             
      599            CLEAR <fs_dyntable>.                                                        
      600         ENDIF.                                                                           
      601        ENDIF.                                                                               
    602        MOVE-CORRESPONDING <dd03l_fields> TO wa_dd03l.                                    
      603        IF <dd03l_fields>-datatype EQ 'DATS'.                                             
      604          l_fieldval = 'X'.                                                                
      605       ELSE.                                                                               
    606        SHIFT <dd03l_fields>-intlen LEFT DELETING LEADING '0'.                         
      607          IF l_totlength IS INITIAL.                                                       
      608            SHIFT l_totlength LEFT DELETING LEADING '0'.                                   
      609            l_totlength = '0'.                                                            
      610          ENDIF.                                                                           
      611          l_currlength = <dd03l_fields>-intlen.                                            
      612          CONCATENATE l_totlength '('  l_currlength ') ' INTO l_fieldval .                 
      613          l_totlength = l_totlength + l_currlength.                                        
      614        ENDIF.                                                                               
    615*** Consider both field name and domian name for checking in range list:                   
      616        IF <dd03l_fields>-fieldname IN s_fieldlist.                                        
      617          wa_fldcat-fieldname = <dd03l_fields>-fieldname.                                  
      618        ELSEIF <dd03l_fields>-domname IN s_fieldlist.                                      
      619          wa_fldcat-fieldname = <dd03l_fields>-domname.                                    
      620        ELSE.                                                                               
    621          wa_fldcat-fieldname = <dd03l_fields>-fieldname.                                  
      622        ENDIF.                                                                               
    623        ASSIGN COMPONENT wa_fldcat-fieldname                                               
      624             OF STRUCTURE <fs_dyntable> TO <fs_fldval>.                                    
    >>>>|        <fsfldval> = l_fieldval._                                                             
      626        CLEAR l_fieldval.                                                                  
      627        CLEAR l_currlength.                                                                
      628      ELSE.                                                                               
    629        IF <dd03l_fields>-datatype EQ 'DATS'.                                              
      630          l_fieldval = 'X'.                                                                
      631       ELSE.                                                                               
    632          SHIFT <dd03l_fields>-intlen LEFT DELETING LEADING '0'.                           
      633          IF l_totlength IS INITIAL.                                                       
      634            SHIFT l_totlength LEFT DELETING LEADING '0'.                                   
      635           l_totlength = '0'.                                                              
      636          ENDIF.                                                                           
      637          l_currlength = <dd03l_fields>-intlen.                                            
      638          CONCATENATE l_totlength '('  l_currlength ') ' INTO l_fieldval .                 
      639         l_totlength = l_totlength + l_currlength.                                         
      640        ENDIF.                                                                               
    641*** Consider both field name and domian name for checking in range list:                   
      642        IF <dd03l_fields>-fieldname IN s_fieldlist.                                        
    643        wa_fldcat-fieldname = <dd03l_fields>-fieldname.                                   
      644       ELSEIF <dd03l_fields>-domname IN s_fieldlist.         
    Edited by: anshu13 on Apr 27, 2010 11:33 AM

  • FUNCTION MODULE CREATION FOR GENERIC DATA SOURCE

    Hi BI gurus,
    I am creating function module for generic datasource. For that I followed below mentioned steps
    Steps
    1.     Created s structure with the fields that needed.
    2. Created FM by copying the standard Function module
    " RSAX_BIW_GET_DATA_SIMPLE " and Give a New name starting With
    Y or Z .
    3. IN SE37 ->Your Function module name -> Change, In table tab given structure
    name by deleting the associated type given in “E_T_DATA “.
    And inserted the required code given below
          PROGRAM 'ZHU_BALANCE'.
    *& Report  ZHU_BALANCE
    TABLES: VEKP, VEPO.
    DATA: BEGIN OF T_DISPLAY,
          DATE   LIKE SY-DATUM,
          EXIDV  LIKE VEKP-EXIDV,
          LGORT  LIKE VEPO-LGORT,
          WERKS  LIKE VEKP-WERKS,
          END OF T_DISPLAY.
    DATA: ITAB_DISPLAY LIKE TABLE OF T_DISPLAY.
    DATA: WA_ITAB_DISPLAY LIKE LINE OF ITAB_DISPLAY.
    SELECT VEKPEXIDV VEPOLGORT VEPO~WERKS
           INTO CORRESPONDING FIELDS OF TABLE ITAB_DISPLAY
           FROM VEKP AS VEKP INNER JOIN VEPO AS VEPO
             ON  VEKPVENUM = VEPOVENUM
             AND VEKPWERKS = VEPOWERKS
           WHERE VEKP~VSTEL = SPACE
             AND VEKP~VEGR1 = '401'
             AND VEKP~VPOBJ = '12'
             AND VEKP~STATUS = '0020'
             AND VEPO~VEPOS = '000001'.
    LOOP AT ITAB_DISPLAY INTO WA_ITAB_DISPLAY.
    WA_ITAB_DISPLAY-DATE = SY-DATUM.
    MODIFY ITAB_DISPLAY FROM WA_ITAB_DISPLAY TRANSPORTING DATE.
    ENDLOOP.
    WRITE:/ 'DATE', 20 'EXIDV', 40 'LGORT', 60 'WERKS'.
    ULINE.
    LOOP AT ITAB_DISPLAY INTO WA_ITAB_DISPLAY.
    WRITE:/ WA_ITAB_DISPLAY-DATE, 20 WA_ITAB_DISPLAY-EXIDV , 40 WA_ITAB_DISPLAY-LGORT, 60 WA_ITAB_DISPLAY-WERKS.
    ENDLOOP.
    While checking the function module it’s populating the syntax error as
    THE TYPE “SRSC_S_IF_SIMPLE” IS UNKOWN. (Though this is commented in program)
    So pls suggest
    Regards,
    praful

    hi indira,
    thanx for ur reply we have created the funcion module successfuly it is also showing the output correct. But when we put that function module in the generic data source and try to extract data in RSA3 it shows the correct output of function module but with the msg ' 0 entries found in customer enhancement' and therfore zero records in the display list.
    is there any correction or steps to be followed in data extraction
    pls suggest
    regards,
    praful

  • Function Module Failing in Run Time

    Hello Friend. Thanks to SDN to get this FM created , but still i have some more issues.  I copied the function module RSAX_BIW_GET_DATA_SIMPLE using SE80 TO Z_CUSTOMERB and also the Function Group I copied from RSAX TO ZCUSTB in SE80 ABAP area.
    <b>Error in SE80 FOR Function Group ZCUSTB: Main program Z_CUSTOMERB does not begin with Function-Pool
    please edit my code and let me know how to fix the code to include FUNCTION-POOL</b>
    But when i go to se37 Activated the FM Z_CUSTOMER and check for any syntax error in FM source code it give no error. But when i run the function module using my datasource rsa3 or execute FM then i get the dump
    dump reasons stated.
    1. FM Z_CUSTOMER is not active and hence cannot be found during run time
    2. Function Library contains incorrect entry for Z_CUSTOMERB
    3. Function Module contains no Code even the FUNCTION ... ENDFUNCTION Missing.
    I checked the code and no errors. Please suggest what should I change in FM Setting to fix the error. where is the function library
    Please revise my code to make it work its very simple logic to populate the custom table se11 ZBW_SFLI001_DS to get the data fields from KNA1 and then fetch other fields from KNB1 where KNA1-KUNNR = KNB1 KUNNR.
    Function Module Code
    FUNCTION Z_CUSTOMERB.
    ""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
    *" 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 ZBW_SFLI001_DS OPTIONAL
    *" EXCEPTIONS
    *" NO_MORE_DATA
    *" ERROR_PASSED_TO_MESS_HANDLER
    TABLES: KNA1, KNB1.
    DATA: L_S_SELECT TYPE SRSC_S_SELECT.
    STATICS: S_S_IF TYPE SRSC_S_IF_SIMPLE,
    S_COUNTER_DATAPAKID LIKE SY-TABIX,
    S_CURSOR TYPE CURSOR.
    RANGES: l_r_zcalweek FOR ZBW_SFLI001_DS-ZCALWEEK,
    l_r_ZKUNNR FOR ZBW_SFLI001_DS-ZKUNNR.
    RANGES: l_r_ERDAT FOR KNA1-ERDAT.
    DATA: zweek LIKE ZBW_SFLI001_DS-ZCALWEEK.
    DATA: ZKNA1 LIKE KNA1 OCCURS 0 WITH HEADER LINE.
    DATA: ZKNB1 LIKE KNB1 OCCURS 0 WITH HEADER LINE.
    DATA: zitab LIKE ZBW_SFLI001_DS OCCURS 0 WITH HEADER LINE.
    IF I_INITFLAG = SBIWA_C_FLAG_ON.
    CASE I_DSOURCE.
    WHEN 'ZBW_SFLI001_DS'.
    WHEN OTHERS.
    IF 1 = 2. MESSAGE E009(R3). ENDIF.
    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.
    s_s_if-requnr = I_REQUNR. "Step (B)
    s_s_if-dsource = I_DSOURCE. "Step (B)
    s_s_if-maxsize = I_MAXSIZE. "Step (B)
    APPEND LINES OF I_T_FIELDS TO s_s_if-t_fields. "Step (B)
    ELSE. "Initialization mode or data extraction ?
    IF s_counter_datapakid = 0. "Step (C)
    "Begin of Step (D)
    LOOP AT s_s_if-t_select INTO l_s_select WHERE FIELDNM = 'ZCALWEEK'.
    MOVE-CORRESPONDING l_s_select TO l_r_zcalweek.
    APPEND l_r_zcalweek.
    ENDLOOP.
    LOOP AT s_s_if-t_select INTO l_s_select WHERE FIELDNM = 'ZKUNNR'.
    MOVE-CORRESPONDING l_s_select TO l_r_ZKUNNR.
    APPEND l_r_ZKUNNR.
    ENDLOOP.
    LOOP AT l_r_zcalweek.
    CASE l_r_zcalweek-option.
    WHEN 'EQ'.
    CALL FUNCTION 'WEEK_GET_FIRST_DAY'
    EXPORTING
    WEEK = l_r_zcalweek-low
    IMPORTING
    DATE = l_r_ERDAT-low
    EXCEPTIONS
    WEEK_INVALID = 1
    OTHERS = 2.
    l_r_ERDAT-high = l_r_ERDAT-low + 7.
    l_r_ERDAT-sign = 'I'.
    l_r_ERDAT-option = 'BT'.
    APPEND l_r_ERDAT.
    when 'BT'.
    zweek = l_r_zcalweek-low.
    WHILE zweek <= l_r_zcalweek-high.
    CALL FUNCTION 'WEEK_GET_FIRST_DAY'
    EXPORTING
    WEEK = zweek
    IMPORTING
    DATE = l_r_ERDAT-low
    EXCEPTIONS
    WEEK_INVALID = 1
    OTHERS = 2.
    l_r_ERDAT-high = l_r_ERDAT-low + 7.
    l_r_ERDAT-sign = 'I'.
    l_r_ERDAT-option = 'BT'.
    APPEND l_r_ERDAT.
    zweek = zweek + 1.
    ENDWHILE.
    ENDCASE.
    ENDLOOP.
    DELETE FROM ZBW_SFLI001_DS "Step (E)
    WHERE ZREQUNR = s_s_if-requnr.
    SELECT * FROM KNA1 "Step (F)
    INTO TABLE ZKNA1
    WHERE ERDAT IN l_r_ERDAT
    AND KUNNR IN l_r_ZKUNNR.
    SELECT * FROM KNB1 "Step (F)
    INTO TABLE ZKNB1
    FOR ALL ENTRIES IN ZKNA1
    WHERE KUNNR = ZKNA1-KUNNR
    AND ERDAT = ZKNA1-ERDAT.
    LOOP AT ZKNA1.
    zitab-zrequnr = s_s_if-requnr.
    CALL FUNCTION 'DATE_GET_WEEK'
    EXPORTING
    DATE = ZKNA1-ERDAT
    IMPORTING
    WEEK = zitab-zcalweek
    EXCEPTIONS
    DATE_INVALID = 1
    OTHERS = 2.
    zitab-ZKUNNR = ZKNA1-KUNNR.
    zitab-ZREGIO = ZKNA1-REGIO.
    zitab-ZFAKSD = ZKNA1-FAKSD.
    READ TABLE ZKNB1 WITH KEY KUNNR = ZKNA1-KUNNR
    ERDAT = zKNA1-ERDAT.
    IF sy-subrc = 0.
    zitab-ZZTERM = ZKNB1-ZTERM.
    ELSE.
    zitab-ZZTERM = 'NULL'.
    ENDIF.
    zitab-ZAKONT = ZKNB1-AKONT.
    ENDLOOP.
    INSERT ZBW_SFLI001_DS FROM TABLE zitab.
    OPEN CURSOR WITH HOLD s_cursor FOR "Step (I)
    SELECT (S_S_IF-T_FIELDS) FROM ZBW_SFLI001_DS
    WHERE zrequnr = s_s_if-requnr.
    ENDIF.
    FETCH NEXT CURSOR s_cursor "Step (J)
    APPENDING CORRESPONDING FIELDS
    OF TABLE E_T_DATA
    PACKAGE SIZE S_S_IF-MAXSIZE.
    IF SY-SUBRC <> 0. "Step (K)
    CLOSE CURSOR S_CURSOR. "Step (L)
    DELETE FROM zbw_sfli001_ds "Step (M)
    WHERE zrequnr = s_s_if-requnr.
    RAISE NO_MORE_DATA. "Step (N)
    ENDIF.
    s_counter_datapakid = s_counter_datapakid + 1. "Step (O)
    ENDIF.
    ENDFUNCTION.
    null

    In the top include for the function group, ensure that the first line is:
    FUNCTION-POOL Z_MY_GROUP.
    Where Z_MY_GROUP is the actual name of the actual function group that your actual function module belongs to.
    Rob

  • Generic Extraction using Function Module

    i want to know the step by step procedure for this extraction and also why we need to go for this, i mean in which scenario this is the best method. and do we need to write any abap code for doing this.and also i need what alla transaction codes we use including concepts.

    1> I don't have a step by step procedre doc. But, there is a sample fucntion module, RSAX_BIW_GET_DATA_SIMPLE. You can take a look at this to create urs.
    2> It is an alternative to the of using InfoSet query (using ABAP datasource) where you cannot split the data to be extracted into DataPackages. So, it is very helpful for huge extracts.
    3> Yes, you have to write ABAP code for this.
    4> Transactions used.
    Create function module - SE37
    Create DataSource  using FM - RSO2
    that is all!
    Regards,
    Sree
    Message was edited by: Sree Damodararaj

  • Amendment to Datasource using Function Module

    Alright Guys,
    Can someone help me? I have amended the '0PU_IS_PS_43' datasource and I need to 'unhide' the new fields I have added. I have logged into trans RSO2 to unhide these fields, but received the following warning - how do I resolve this?
    "DataSource 0PU_IS_PS_43 is extracted using functional module FM_BW_BUDGET_ENTRY_DOCUMENTS
    Message no. RJ042
    Diagnosis
    Up to now, DataSource 0PU_IS_PS_43 has been extracted using function module FM_BW_BUDGET_ENTRY_DOCUMENTS If you edit and save the DataSource using maintenance of the generic extraction, the extraction  will no longer be extracted using this function module, instead this will be done using a database view, a transparent table, an InfoSet of the SAP query or a user-defined extraction module.
    If 0PU_IS_PS_43 is included in delivered SAP Content, you can reactivate the extraction using function module FM_BW_BUDGET_ENTRY_DOCUMENTS by transferring this content with transaction RSA5 or the IMG."
    Thanks,
    Scott

    Hi
    You do not hide/unhide or manipulate this DA thru RSO2 (as its also obvious from the message) but rather thru RSA5 and you should extend the DS via User Exit (CMOD).
    Reg's
    Edan

  • 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

  • Error with quantity field:Datasource Creation Using Function Module method

    Problem with DATASOURCE Creation using Function Module method :
    I have created a datasource ZSTANDARD_COST_PRICE using Function Module method . The datasource creation is successfull when I remove the quantity field from the Z table . If I dont remove the quantity field from my Z table it gives an error as "Units Field WAERS for field STPRS of datasource ZSTANDARD_COST_PRICE is hidden". I am not able to remove this error . Please someone guide.
    Let me know if my explanation is not clear enough.
    Thanks in advance,
    Neha.
    Z table definition is as below :
    MATNR MATNR CHAR 18 0 Material Number
    BWKEY BWKEY CHAR 4 0 Valuation area
    LFGJA LFGJA NUMC 4 0 Fiscal Year of Current Period
    STPRS STPRS CURR 11 2 Standard Price   " Here the currency field is WAERS and table T001
    PEINH PEINH DEC 5 0 Price Unit
    VJSTP VJSTP CURR 11 2 Standard price in previous year
    VJPEI VJPEI DEC 5 0 Price unit of previous year.
    Edited by: Neha Rathi on Jan 30, 2009 3:03 PM

    Hi,
    You should add it as one of the main fields as you have added other fields and not as the currency fields...that is..it should be part of the data source and you should be able to see it in RSO2...
    Also if added as i said then it will come as new field in the data source...you can either let it be there...or hide it..
    also if you want to populate it then you will have to write the code for this fields as well.
    Thanks
    Ajeet

  • 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

  • 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

  • How to debug a function module using in the generic datasource?

    Hi all,
    We have created a generic data source using function modulle and have been extracting the data for a single customer it contains single records but it has pulled out more than 10,000 records. how to debug the function module used in the data source.
    since we schedule for extraction in bi and back ground job gets triggered in ecc for extraction,
    i know in se37 we can select the function module name and then debug but still need to check while the bacground job is trigered through bi.
    Thanks

    Yes you can debug the Function Module.
    Open the function module in SE37 and put a break point in the code where you want to check from, then come to RSA3 and give the datasource name and check the Debug check box on this screen, once you click on the start button it will take you the place where you have placed the break point in the FM, by pressing F5 you can see the flow of the FM.
    Let me know whether this solves your issue.

  • BW/ABAP- Function module is called infinitely by Datasource Extractor.

    Hi All,
    A quick ABAP question related to Function Modules and BW data source extractors.
    I’ve written a function module to select data from a database and simply output the data as a table. I then created a text Datasource using transaction rso2 and set it to Extraction by Function Module.
    When I test this using transaction rsa6, I can manipulate the number of calls to my function module using the Display Extra Calls field.
    However, when I test this using transaction rsa1, my function module seems to be called infinite times. So, the number of records being retrieved is increasing exponentially and finally ends with a dump.
    My question: Do I need to include something in my code such that the Function Module by itself will only be called once?
    Or is there some configuration for the Datasource that will limit my function module call to once only.
    Tried so far
    • Introducing a static variable in the function module that exits as soon as the value is greater than 1.
    o Is there another way out?
    Regards,
    Preethi.

    You need to raise the EXEPTION NO_MORE_DATA afte the last record is populated in the output table. Otherwise the program goes into an infinite loop.
    * From now on records get fetched from the database or gets read from the internal table
        FETCH NEXT CURSOR v_cursor
                   APPENDING CORRESPONDING FIELDS
                   OF TABLE <internal table>
                   PACKAGE SIZE i_s_if-maxsize.
        IF sy-subrc <> 0.
          CLOSE CURSOR v_cursor.
          RAISE no_more_data.
        ENDIF.
    * Populate the Output Data Structure into table E_T_DATA and you need to raise the EXEPTION NO_MORE_DATA and close the cursor to avoid any memory leaks

  • Function Module as Datasource loading error

    Hi,All
      I use function module as datasource and create a fm in function group: RSAX
      But when i loading data from the DS , it display :
      Error occurred in the data selection
    Code:
    DATA: l_s_select type srsc_s_select,.
    statics: s_s_if type srsc_s_if_simple,
             s type i.
    if i_initflag = 'X'.  " determine the selection fields and values
      append lines of i_t_select to s_s_if-t_select.
      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.
      append lines of i_t_fields to s_s_if-t_fields.
    else. "fill the result as e_t_data
      if s = 0.
    add one line to the itab for test
             E_T_DATA-KOKRS = 'HT01'.
             append E_T_DATA.
             s = s + 1.
      else.
         raise no_more_data.
      endif.
    endif.
    ENDFUNCTION.
    The function is all right i think

    Hi, Chivukula
       haha , i forgot to select the passvalue in table tab , after check, it's Ok
      Thanks for your time
    Terry Ni
    Kind Regards

Maybe you are looking for

  • Cannot print to pdf with Acrobat 8

    I have just gotten a new laptop and moved my CS2 over to it. Everything works fine except I cannot print to a pdf like I used to. I can save as a pdf, but when I print to Adobe pdf, the printer icon pops up in the system tray. When I click on it, the

  • Issue with lock screen language

    My OS X Lion language is set to Italian, but when I lock the screen on the locked screen the language is English. No issue once I log in, I get everything into the italian language, but when I get to the lock screen everything is in English. I have 2

  • Automotive client AR open items warranty transactions

    Hi All, My client in  4.6  has written a custom process to deal with "Dealer Warranty claims".  Currently the custom process  will clear multiple open items in a customers account (debits and credits) and create one open item (Post with Clearning). 

  • Crystal Reports-EJB as a Report Source

    Hi! I have a web project in RAD with embeded crystal enterprise and crystal reports advanced developer.I publish my report on web with Java Reporting Component.I want to show my EJBs as a source of my reports.I couldn't find any document about this s

  • Not syncing anything bought on itunes

    hi, sorry if this has already been posted. ive recently bought a new laptop and installed itunes again I bought 3 songs from i tunes but they wont sync o my iphone. dont know what im doing wrong. they are in my 'store' on itunes but i cant get them t