Datasource via function module

Hi,
I am building a function that is due to be used by a Datasource (via Function Module).
This function uses table WDRD. It applies to this table a code that needs the use of an internal table for the calculation (for intermediary calculation storage). After which, I want to get the result of this internal table (say T1_DATA), and return it to E_T_DATA, which will be used to fill my datasource. This is where I am stuck.
-> When I try to get the content of my internal table in my cursor (code: OPEN CURSOR WITH HOLD S_CURSOR FOR
      select * from T1_DATA
    endif.),
I get an error message stating the table is not defined in the ABAP dictionary.
-> When I try to avoid the cursor and put directly the content of my table T1_DATA in table E_T_DATA, I don't get anything in my Datasource.
Any help would be greatly appreciated.
Thanks,
Pierre

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

Similar Messages

  • 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

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

  • 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

  • WBS copy via function module "K_PLAN_TO_PLAN_COPY"

    Hi Experts
    anybody please advise whether WBS copy to other via function module "K_PLAN_TO_PLAN_COPY"
    is possible or not in below situation.
    Currently we faced some issue when WBS satus is "TECO", we can not
    copy WBS to another WBS (we want to copy whole wbs into others) by
    function module "K_PLAN_TO_PLAN_COPY".
    So we just change system status from TECO to REL then copy wbs to other,
    however, we could face another issue with this way of copying. (since we
    have to change wbs status, it could cause conflict against other project)
    We want to copy wbs without changing wbs status via function module "K_PLAN_TO_PLAN_COPY".
    Can it be possible? if yes, please advise how to, (settings/conditions/something like that)
    Thank you.
    Satoru

    Hi Satoru,
    The Function Module K_PLAN_TO_PLAN_COPY is not released for customers and therefore it is not intended to be used in customer specific programs or enhancements. For further details, please have a look SAP Note 109533.
    Sorry for not having better news.
    BR,
    Enrique

  • Adding a new conditon on head via function modul?

    Hi,
    is there a way to add a condition to an order via function module? I mean in customizing we have maintained the calc scheme (and everything else) and assign it to the order. What we want is to add the new condition type to the head of the order via function module. The scenario is as follows:
    We create an order and have on the header a field for a value. If you type a value in the field and press enter the condition should be created and calculatetd. The result is given in the condition tab of the order on header level.
    We try to not do a modifictaion. therefore i am looking for a function module. Is there someone who could help?
      thanks and regards,
           Ming

    Why can't this be done by the pricing configuration?
    There are also pricing user exits available, which are not modifications and exist for this purpose exactly (i.e. when for some reason configuration alone is not enough). See the list here:
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/erplo/sdUserexits

  • Error during XML inbound via Function Module 'EDI_DATA_INCOMING'

    Hi Team,
    I am facing below error while trying to upload a inbound XML file via Function Module  'EDI_DATA_INCOMING'.
    The control record must begin with <EDI_DC40 segment="1"> instead of
    Message no. EA719
    Diagnosis
    The tag '<EDI_DC40 segment="1">' must be at the start of a control record in XML format, otherwise string '' would be found.
    System Response
    The file cannot be processed.
    Procedure
    Correct file DEV_H\SGIDOCI\MSUTEST\00082_ATT..
    Please suggest a proper solution for the same. If it is because of wrong structure of XML file then please send me correct XML format for file upload.
    Regards,
    Amit Sharma

    Hello,
    It's the error is SAP code.
    Look notes 1616333 and 1535033. Those should fix the error.
    BR, Janne

  • Generic Delta Extraction via Function Module

    Hello,
    i need a help for a generic delta extraction based on a Function Module. As an example i take the function module RSVD_BW_GET_DELTA_DATA.
    My generic delta extractor based on the field AEDAT - Change Date and i will extract purchase service orders and entry sheets.
    In the sample function module the select for the extraction worked with the table ROBWQTSTAT, but this table ist empty after the initialization.
    OPEN CURSOR WITH HOLD G_CURSOR FOR
          SELECT * FROM ROVERCUBE1
                   WHERE COUNTRY IN L_R_COUNTRY AND
                         REGION  IN L_R_REGION AND
                         KUNNR   IN L_R_KUNNR AND
                         TYPE    IN L_R_TYPE AND
                         GJAHR   IN L_R_GJAHR AND
    Here the timerange calculated in form GET_TIME_INTERVAL is evaluated.
                         TSTMP   IN S_R_TSTMP AND
                         OBJVERS = 'A'.
    I found the table ROOSGENDLM. In this table i found the field DELTAID with the last date of the extraction and the field REPEATID with the date for the repead-Update.
    My Questions:
    Is this the right way to build an generic delta extraction with an function module or must i install a coding in my function module for an update of the table ROBWQTSTAT?
    Which settings are needed in the table ROOSOURCE for a generic delta extraction via function module?
    Best regards
    Uwe

    Hi Uwe,
    please have a look at https://weblogs.sdn.sap.com/pub/wlg/2415. [original link is broken] [original link is broken] [original link is broken] It might help
    kind regards
    Siggi
    PS: We already had almost the same question here today.

  • 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

  • Datasource using Function Module

    Hi Guys,
    I have two ODS objects...the first ODS has 5 fields and it gets data from flat file.
    I created a custom Datasource based on Function module and i'm extracting data from first ODS based on one of the field 'DATE'. This datasource extracts correct number of records as per my logic in RSA3.
    So i think there is no problem with Datasource.
    Now, i created Infosource and i'm trying to load data from Custom Datasource to second ODS. But when i start the infopackage, the records are not extracted completely...i can see 3 records sent( 0 records received) '0 from 3' records in the monitor...it's a yellow request...
    In status i get following message -
    No request Idoc generated in BW
    Diagnosis
    No request IDoc has been created in BW. A short dump has most probably been logged in BW.
    Procedure
    Look for the short dump belonging to your data request in the short dump overview in BW. Pay attention to the correct date and time in the selection screen.
    You can get the short dump list using the Wizard or from the monitor detail screen via the menu path "Environment -> Short dump -> Data Warehouse".
    Removing errors:
    Follow the instructions in the short dump.
    Please let me know if anyone of you have faced similar problem...
    Thanks,

    Hi,
    There are no short dumps in the system. Only the message in Bold in my first post is the help i can get and provide.
    Strange thing is, RSA3 works correctly but it's not successful in actual extraction.
    Thanks,

  • 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

Maybe you are looking for

  • Printing 4x6 pics using the hp 1410 all in one printer

    Printer hp 1410 all in one OS Windows 2003 Computer Dell Pictures downloaded from the internet and saved into "my pictures" I am currently  trying to print using 4X6 glossy advanced HP photo paper.  I go to print I select paper size 4x6 with tab.  On

  • Certificate Weirdness

    RoboHelp HTML Version 8 I've been generating my AIRHelp to a folder on the local network for ages with no problem. I've been using a self-signed certificate (p12 format). Today, I switched to a "real" certificate from Verisign (pfx format), but for s

  • CX600/700 Polycom phones not displaying mobile & telephone Numbers

    Dear , we have lync 2013 in our setup with polycom CX500/600/700/3000 devices. on phone when we check contact card of any user , by default SIP address display , telephone or mobile numbers not display. but when we add contact on outlook , telephone

  • Bought MacBook Pro a year ago and it came with Quicktime Player.  Bought Quicktime Player Pro, how do I download it??

    Bought macBook Pro a year ago and it came with Quicktime Player.  Just bought Quicktime Pro and am having trouble downloading it.  Do I need it?  How do I download it?

  • Managing 3 iPods from one account

    How is this done? I have 10,000 songs, but each ipod is a different size. So I can only store some of the stuff on each ipod. One is my daughters, and two righ tnow are mind....one with more space. I also want to have movies and tv shows on each. How