Explore return table BAPI_MATERIAL_SAVEDATA

Hi Friends,
I would like write the content of the return table in BAPI_MATERIAL_SAVEDATA.
The code is like this.
REPORT  Z_CREATE_MAERIAL_BAPI.
data clientdata type BAPI_MARA.
data wa_clientdata TYPE bapi_mara_ga.
data up_clientdata type TABLE OF BAPI_MARA_GA.
data HEADERDATA TYPE BAPIMATHEAD.
data RETURN type BAPIRET2.
data wa_return...................?????????
CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
  EXPORTING
    HEADDATA                    = HEADERDATA
   CLIENTDATA                  = clientdata
IMPORTING
   RETURN                      = return
LOOP AT return INTO wa_return.
   WRITE: / 'Return Type: ', wa_return-type.
    WRITE: / 'Return ID: ', wa_return-id.
    WRITE: / 'Return #: ', wa_return-number.
    WRITE: / 'Message 1: ', wa_return-message.
    WRITE: / 'Message 2: ', wa_return-message_v1.
    WRITE: / 'Message 3: ', wa_return-message_v2.
    WRITE: / 'Parameter: ', wa_return-parameter.
    WRITE: / 'Row: ', wa_return-row.
    WRITE: / 'Field: ', wa_return-field.
    WRITE: / 'System: ', wa_return-system.
    SKIP.
    ULINE.
    SKIP.
    ENDLOOP.
During the check it says 'return' is no internal table.
How can I manage that.
Thanks in advance for you help.
Rg. Jimbob
Edited by: jimbob on Jun 29, 2008 8:21 PM

Yes thats true..for this bapi FM return parameter is an export parameter, it is not a table instead it is a structure.
EXPORTING
*"     VALUE(RETURN) LIKE  BAPIRET2 STRUCTURE  BAPIRET2.
You should use RETURNMESSAGES instead of RETURN which is defined under TABLE.
RETURNMESSAGES STRUCTURE  BAPI_MATRETURN2.
REPORT Z_CREATE_MAERIAL_BAPI.
data clientdata type BAPI_MARA.
data wa_clientdata TYPE bapi_mara_ga.
data up_clientdata type TABLE OF BAPI_MARA_GA.
data HEADERDATA TYPE BAPIMATHEAD.
data RETURN type BAPIRET2.
data wa_return type BAPI_MATRETURN2.
data returnmessages type standard table of BAPI_MATRETURN2.
CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
EXPORTING
HEADDATA = HEADERDATA
CLIENTDATA = clientdata
IMPORTING
RETURN = return
tables
RETURNMESSAGES = returnmessages.
LOOP AT returnmessages INTO wa_return.
WRITE: / 'Return Type: ', wa_return-type.
WRITE: / 'Return ID: ', wa_return-id.
WRITE: / 'Return #: ', wa_return-number.
WRITE: / 'Message 1: ', wa_return-message.
WRITE: / 'Message 2: ', wa_return-message_v1.
WRITE: / 'Message 3: ', wa_return-message_v2.
WRITE: / 'Parameter: ', wa_return-parameter.
WRITE: / 'Row: ', wa_return-row.
WRITE: / 'Field: ', wa_return-field.
WRITE: / 'System: ', wa_return-system.
SKIP.
ULINE.
SKIP.
ENDLOOP.
Hope it will help.
Regards,
Joy.

Similar Messages

  • Problem with Return table

    Hi all,
    Greetings!
    I am facing a probelm with return table, i.e it is adding body record and workarea record also to the data target. so, it is adding the actual record to data target including the workarea record to with the key figure and year values as zeros and spaces. I worked with Return table one or two times, but this time amazing it is adding extra record.
    Please guide me..
    Thanks and Regards
    Chand

    Hi Chand,
    Adding extra rows is kind of strange. It must be either, the records in the data request being duplicated or the logic in the RETUN table must be messed up. If possible just have a snapshot of pseud code may be it could help analyzing the error.
    Regards,
    Praveen

  • Problem with return table(adding extra record)

    Hi,gurus,
      I am facing a probelm with return table, i.e it is adding body record and workarea record also to the data target. so, it is adding the actual record to data target including the workarea record to with the key figure and year values as zeros and spaces. It's quite strange.
    Please help me out, thanks a lot.

    Hi,
       I have an ODS with the keys fields(ZPS_TXMID,ZPS_NODE,ZPS_NODE) and data fields(ZAU_C108,ZAU_C109,0PROJECT). I have to split one record from datasource to 6 records into my ODS. I'm updating ZAU_C109 with a routine with return table. Here is the code, please check it for me:
    <i> data: prj like /BIC/PZPS_TXMID-PROJECT.
    data: ls_icube_value like ICUBE_VALUES.
    clear ls_icube_value.
    select single PROJECT into prj from /BIC/PZPS_TXMID
            where /BIC/ZPS_TXMID = COMM_STRUCTURE-/BIC/ZPS_TXMID.
    ls_icube_value-/BIC/ZPS_TXMID = COMM_STRUCTURE-/BIC/ZPS_TXMID.
    ls_icube_value-/BIC/ZAU_C108 = COMM_STRUCTURE-/BIC/ZAU_C108.
    ls_icube_value-/BIC/ZPS_NODE = '1'.
    ls_icube_value-/BIC/ZPS_SNODE = '0'.
    ls_icube_value-PROJECT = prj.
    ls_icube_value-/BIC/ZAU_C109 = COMM_STRUCTURE-/BIC/ZPS_HJHSJ.
    APPEND ls_icube_value TO RESULT_TABLE.
    ls_icube_value-/BIC/ZPS_NODE = '1'.
    ls_icube_value-/BIC/ZPS_SNODE = '1'.
    ls_icube_value-PROJECT = prj.
    ls_icube_value-/BIC/ZAU_C109 = COMM_STRUCTURE-/BIC/ZPS_HPSJ.
    APPEND ls_icube_value TO RESULT_TABLE.
    ls_icube_value-/BIC/ZPS_NODE = '1'.
    ls_icube_value-/BIC/ZPS_SNODE = '2'.
    ls_icube_value-PROJECT = prj.
    ls_icube_value-/BIC/ZAU_C109 = COMM_STRUCTURE-/BIC/ZAU_C101.
    APPEND ls_icube_value TO RESULT_TABLE.
    ls_icube_value-/BIC/ZPS_NODE = '2'.
    ls_icube_value-/BIC/ZPS_SNODE = '0'.
    ls_icube_value-PROJECT = prj.
    ls_icube_value-/BIC/ZAU_C109 = COMM_STRUCTURE-/BIC/ZPS_TJHSJ.
    APPEND ls_icube_value TO RESULT_TABLE.
    ls_icube_value-/BIC/ZPS_NODE = '2'.
    ls_icube_value-/BIC/ZPS_SNODE = '1'.
    ls_icube_value-PROJECT = prj.
    ls_icube_value-/BIC/ZAU_C109 = COMM_STRUCTURE-/BIC/ZPS_TDSJ.
    APPEND ls_icube_value TO RESULT_TABLE.
    ls_icube_value-/BIC/ZPS_NODE = '2'.
    ls_icube_value-/BIC/ZPS_SNODE = '2'.
    ls_icube_value-PROJECT = prj.
    ls_icube_value-/BIC/ZAU_C109 = COMM_STRUCTURE-/BIC/ZAU_C102.
    APPEND ls_icube_value TO RESULT_TABLE.
    ABORT = 0.</i>
       After loading, I checked the contents of ODS, there are 6 records(0project, ZAU_C108 are blank, other fields are correct) + 1 more record(ZPS_TXMID,0project, ZAU_C108 are correct, other fields are blank), what I expect is only 6 records with all fields being filled properly, no blanks, no extra records. Is it strange? or am I doing sth. wrong?
      Your help is appreciated.

  • Currency unit in return tables

    Hi @ all,
    I'm working with a return table in the update rules to calculate a key figure. Is it possible, that the currency unit of the key figure is not filled automatically? The currency units in source system and target system are the same.
    Thank you for your help!
    Clemens

    Hallo Clemens,
    yes, you're right; are you sure as well to not have more COMP_CODES then 0009 and 0010?
    perhaps it would be wiser to lookup the comp_code-currency from the master data of 0COMP_CODE (0CURRENCY is one of its attributes) in order to avoid having it empty and always hardcode it... This is of course if you want to derive the company code currency...
    hope this helps....
    let us know if you question is answered by closing the thread!
    Olivier.

  • Return Table empty in Web Service response

    Hi All,
    My Question is more of related to Web Service. I have created a Web Service from ABAP for BAPI_PO_GETDETAIL. This BAPI is working fine in R/3.
    I am using this particular Web Service in Adobe Form (using only ADOBE LIVECYCLE Designer). It's is working fine If i pass the correct Data(Purchase order no.) I'll get the O/p. In case I put a wrong PO number I am not getting the values in return Table in response. (If i test the BAPI in R/3 i m getting a message in Return table that PO no. doesn't exist)
    Any Help will be appreciated.
    PS; I m using Adobe liveCycle designer 7.1 and Acrobat Professional 9.
    Regards,
    Sachin

    Hi,
    It is sufficient to make changes in the WebService Definition.
    I communicated wrong entries, do make changes like: follow the previous steps and goto the se80 to respective webservice and do make changes in both External View and Internal View, as when you go into these views you'll find under some node "Input" and "Output", here need to do changes in tables present in the "input" and "output" as when you go into "input" or "output" to a respective table there you'll find two sections "External" and "Abap" do edit in Section "External" as Check the checkbox "Exposed" and Uncheck the checkbox "Optional" also "Min Occurr" should be "1" and "Max occurr" should be unbounded.
    Make sure in the Adobe Form, for the button which you are calling the webservice, goto the object pallette of that button and goto execute tab and there check the checkbox "Re-merge form data" or if you are invoking the webservice through scripting then you make change the script like"......execute(1)...".
    Regards
    Pradeep Goli

  • JCo issue - return table is null

    Hi,
    I am trying to read the return table from a function module using
    JCoParameterList jplExport = function.getTableParameterList();
    This works fine in the development environment, however in QA I am getting jplExport as null.
    I have debugged it in QA using an external debugger and the return table has rows.
    We have also ruled out the possibility of it being a authorization issue after checking with the security team.
    I have debugged the FM using the JCo user and it has the return table, also if I run it from within SAP GUI it returns values in the return table.
    To re-iterate the same code works fine in Dev.
    In QA the import is good as I can see the values in the return table.
    I am unable to understand what the issue is here. Why will it return null inspite of having values ?
    Please suggest.
    Thanks,
    Veena.

    Hi Veena,
    -> Check if you can call any other function modules in the QA environment. If not, something is wrong with JCo configuration.
    ->Do you see any differences in function modules signatures from Dev and QA?
    Cheers,
    ~kranthi

  • Sort/filter datablock based on procedure that return table type

    Hi All,
    I’ve got datablock based on procedure that return table type. In the form I have to provide ‘filter and sort records’ functionality. Previously, using tables/views based datablocks, I’ve done that by using:
    -- filter
    SET_BLOCK_PROPERTY (L_BLOCK_NAME, DEFAULT_WHERE, L_WHERE_CLAUSE);
    -- sort
    SET_BLOCK_PROPERTY(L_BLOCK_NAME ,ORDER_BY, L_ORDER_BY_CLAUSE);
    -- and then
    EXECUTE_QUERY;
    It doesn’t work with procedure that return table type. How I can do that?
    Bartek

    I agree with Andreas, from the sample you have given us, I don't see any reason why you could not merge these queries into a single UNION/UNION ALL query. Also, I would add your summation query to your main query to eliminate this extra step. The result would look something like:
    SELECT DISTINCT
         pih.id
         ,d.document_id
         ,pih.doc_serial_no
         ,pih.purch_invoice_date
         ,oh.company_name
         ,(SELECT NVL(SUM(amount),0)
              FROM "YOUR TABLE HERE" yth
              WHERE yth."YOUR COLUMN HERE" = pih.id) AS sum_amount
      FROM "YOUR TABLES HERE"
    WHERE "YOUR JOIN CONDITIONS HERE"
    UNION ALL
    SELECT DISTINCT
         sih.id
         ,d.document_ind
         ,sih.doc_serial_no
         ,sih.sales_invoice_date
         ,sih.company_name
         ,(SELECT NVL(SUM(amount),0)
              FROM "YOUR TABLE HERE" yth
              WHERE yth."YOUR COLUMN HERE" = sih.id) AS sum_amount
      FROM "YOUR TABLES HERE"
    WHERE "YOUR JOIN CONDITIONS HERE"
    [/code]
    Hope this helps.
    Craig...
    +If a response is helpful or correct, please mark it accordingly+
    Edited by: CraigB on Feb 23, 2010 1:39 PM
    It appears the CODE tags are not working as well as the URL tags.  :(                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Where is the option "return table" in BW7.0

    Is it possible to have a transformation rule return a table in stead of one single record?
    I remember from teched that this option would be added in SP13, but we are at SP16 and I can't find it.

    BI 7.0 does not have Return table option till now. That has been replaced by(or rather say the functinality can be acheived by) END Routine.
    Thanks..
    Shambhu

  • Function returning table in Oracle 8i

    I have one function written in SQL server 2000. I am not getting the way to write this function in oracle so that it can return table me as an output.
    SQL server's code
    CREATE FUNCTION dbo.GetTerminalAccessPolicy4AdHocShift(@rDate datetime,@rTerminal bigint)
    RETURNS TABLE
    AS
    RETURN SELECT [EmployeeShift].[UserId], [CLSCData].[CardTagId], [Shift].[MinIn] AS FromTime, [Shift].[MaxOut] AS ToTime, 8 AS Priority, 1 AS AccessRights
    FROM (((EmployeeShift INNER JOIN SiteEmployee ON [EmployeeShift].[UserId]=[SiteEmployee].[UserId]) INNER JOIN SiteTerminal ON
    [SiteEmployee].[SiteId]=[SiteTerminal].[SiteId]) INNER JOIN Shift ON [EmployeeShift].[ShiftId]=[Shift].[ShiftId]) INNER JOIN CLSCData ON [EmployeeShift].[UserId]=[CLSCData].[UserId]
    WHERE [siteTerminal].[TerminalId]=@rTerminal And @rDate Between [SiteEmployee].[FromDate] And [SiteEmployee].[ToDate] And @rDate Between [EmployeeShift].[FromDate] And [EmployeeShift].[ToDate]
    Can any ont please help me to write this function?

    Hello,
    As previously posted you should use export and import utilities.
    To execute exp or imp statements you have just to open a command line interface, for instance,
    a DOS box on Windows.
    So you don't have to use SQL*Plus or TOAD.
    About export/import you may care on the mode, to export a single or a list of Tables the Table mode
    is enough.
    Please, find here an example to begin:
    http://wiki.oracle.com/page/Oracle+export+and+import+
    Hope this help.
    Best regards,
    Jean-Valentin

  • How to migrate sql server 2000 user defined function returns table

    Hi,
    How do I capture the SQL Server 200 user defined function that returns table? Is this supported in the current version of Oracle Migration Workbench? I am using the latest version - Release 9.2.0.1.0 with SQL SERVER 2000 plug-in.
    I was able to capture the SQL Server 2000 user defined function that returns string and smalldatetime but not the functions return table during the migrate data source stage.
    Thanks in Advance,
    Susan

    Susan,
    This is not currently supported. The next release of the Oracle Migration Workbench (due very soon), will do a better job of catching this mad reporting an error. We are looking into a suitable mapping and have created bug # 2355073 - TABLE DEFINITIONS NOT ACCEPTED FOR TABLE FUNCTIONS to track this issue.
    Once possible solution we are looking into is using the object type to emulate. Here is an example from the bug:
    Original table
    SQL> create table tabela (a number, b number, c number, d number);
    SQL> insert some values...
    SQL> select * from tabela;
    A B C D
    1 1 1 1
    2 2 2 2
    3 3 3 3
    4 4 4 4
    SQL Server 2000 code
    CREATE FUNCTION FUNCRETORNATABELA()
    RETURNS TABLE
    AS
    RETURN SELECT A,B,C,D FROM TABELA
    SELECT A,B,C,D
    FROM FUNCRETORNATABELA()
    ORDER BY A
    Oracle code (workaround)
    SQL> create or replace type MyObjType as object (
    2 a number, b number, c number, d number);
    3 /
    Type created.
    SQL> create or replace type MyTabType as table of MyObjType;
    2 /
    Type created.
    SQL> create or replace function teste return Mytabtype pipelined as
    2 aa MyObjType := MyObjType(null, null, null, null);
    3 cursor c1 is select a,b,c,d from tabela;
    4 begin
    5 open c1;
    6 loop
    7 fetch c1 into aa.a, aa.b, aa.c, aa.d;
    8 exit when c1%NOTFOUND;
    9 pipe row (aa);
    10 end loop;
    11 close c1;
    12 return;
    13 end;
    14 /
    Function created.
    SQL> select * from table(teste);
    A B C D
    1 1 1 1
    2 2 2 2
    3 3 3 3
    4 4 4 4
    SQL> select a, c from table(teste) order by c desc;
    A C
    4 4
    3 3
    2 2
    1 1
    Donal

  • WHAT IS THE USE OF RETURN TABLE IN BW

    Hi Gurus,
    I would like to know what is the use of return table in bw.. can any one give me the perfect answer....
    Ramesh

    Hii
    Imagine a situation where 1 record coming into a cube needs to be split into multiple records. Lets say you get values total values for sector in the PSA. Now you may want to partition that value based on the various sectors existing. In that case you can use a return table and split a single record into multiple records.
    return table option is available in update rules
    go thru these links
    Return table
    Return table
    Message was edited by:
            Sheeba Bhaskaran

  • Return Tables

    Hi fellow SAPians,
    what is the significance of Return tables in SAP BW. I wonder can it be used for distribution purposes similar to SEM -BPS ? Cld anybody clarify me these concepts ?
    thanking you in Advance,

    Have a look at these posts in the help: they explain pretty well what it's all about.
    " Update routines generally only have one return value. However, in the Key Figure Calculation tabstrip, you can create a routine by choosing the Return table option. The corresponding key figure routine now has a return table instead of a return value. You can now generate as many key figure values as you like from one data record."
    http://help.sap.com/saphelp_nw04/helpdata/en/21/894eeee0b911d4b2d90050da4c74dc/frameset.htm (2nd part)
    http://help.sap.com/saphelp_nw04/helpdata/en/7f/61fc37f456491ee10000009b38f8cf/frameset.htm

  • Return tables in Routines used in an Update Rule

    I previously had a routine configured as an update method in an Update Rule.  On the configuration screen where I specified the Routine name, I checked "Return Table". 
    Now I've deleted this Routine and I am using the Source Key Figure as the Update Method.  However the "Return Table" box is still checked and if I uncheck it, it goes back to "Checked" status as soon as i scroll to the next key figure and then back to the original key figure. 
    While this doesnt sound like too serious a problem, I think it's causing my Update rules to fail during activation with the message, The field "RESULT" is unknown, but there is a fiel rows 1698."  (SAP typo, not mine).
    Following the suggestions in the Help for this error do not work either.  When I try to choose Extras -> Display Activated Program, I receive a second message "Unable to find a tool to process the request".
    Can anyone help?

    Wardell,
    sounds like a bug to me. Open a message to SAP support to get a fix.
    Regards,
    Marc
    SAP NetWeaver RIG

  • Return tables in Update routines

    Hi,
    Can anyone send me some documents on the use of return tables in Update Routines?
    email id: [email protected]
    Thanks in advance,
    RP

    Hi Ram,
    <b>Table as a return</b>                                                                               
    In general, routines in the update rules have only one return code.                                                                               
    If you select this field, the corresponding key figure routine no longer
        has a return code (defined in RESULT), rather a return table (defined in
        RESULT_TABLE). In this case you can create as many key figure values    
        from the data record as you wish. You can find the calculated           
        characteristic values in the structure ICUBE_VALUES.                                                                               
    <b>Activities</b>                                                                               
    If you change these values accordingly, then you fill the field for the 
        relevant key figure and use this to fill RESULT_TABLE.                                                                               
    Regards
    Happy Tony
    <b>Points == Thanks</b>

  • Web Service XML Changes Return Table  Field Names

    I am writing a Web service to return a employee information from SAP using .Net Connector. My Webservice XML changes return table column names with few escape characters. Does anyone know why this happens? and How to prevent it?
    Every column name is changed: e.g. PERS_NO to PERS_--5fNO
    NCo -> 2.0
    RFC- > Custom Function module
    RFC Return Type -> ZFPSYNC
    VS.Net -> VS Studio 2003, ( C# Web service)
    Here is part of XML document:
      <?xml version="1.0" encoding="utf-8" ?>
    - <ArrayOfZFPSYNC xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://tempuri.org/">
    - <ZFPSYNC>
      <PERS_5fNO>00100001</PERS_5fNO>
      <PDS_5fEMPID>00054740</PDS_5fEMPID>
      <SSN>001380261</SSN>
      <NAME_--5fPFX />
      <FIRST_5fNAME>Tuesday</FIRST_5fNAME>
      <LAST_5fNAME>October</LAST_5fNAME>
      <NAME_--5fSFX />
      <PRIOR_5fNAME>Tuesday October</PRIOR_5fNAME>
      <NICKNAME />
      <CO_5fCODE>TAX</CO_5fCODE>
      <CO_5fCODE_5fT>Tax LLP</CO_5fCODE_5fT>
      <CO_5fCTRY>US</CO_5fCTRY>
      <ORG_5fUNIT>50191687</ORG_5fUNIT>
      <ORG_5fUNIT_5fT>Northeast Region Lead Tax</ORG_5fUNIT_5fT>
      <EE_5fLEVEL>C1</EE_5fLEVEL>
      <EE_5fLEVEL_5fT>Firm Director</EE_5fLEVEL_5fT>
      <SRV_5fAREA>TAX</SRV_5fAREA>
      <SRV_5fAREA_5fT>Tax</SRV_5fAREA_5fT>
      <JOB_5fFAM>CS-TAX</JOB_5fFAM>
      <JOB_5fFAM_5fT>CS - Tax</JOB_5fFAM_5fT>
      <PER_5fAREA>BOSX</PER_5fAREA>
      <PER_5fAREA_5fT>Boston-Berkeley St-TAX</PER_5fAREA_5fT>
      <PER_5fADDR>200 Berkeley Street</PER_5fADDR>

    Please install patch from OSS note 506603. This should correct the problem.

Maybe you are looking for