Regarding BAPI Return Parameter.

Hi All,
          I want to create Bapi Return Message with Variable values like : ' Sales Order 1876738267 is not created, please try again.' and want to create a log of this after BAPI calling in Calling FM. How can I do this. Please guide me.
Thanks in Advance.

Hi,
CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT1'
  EXPORTING
    ORDER_HEADER_IN           = sd_header
  WITHOUT_COMMIT            = ' '
  CONVERT_PARVW_AUART       = ' '
IMPORTING
   SALESDOCUMENT             = sd_doc_num
  SOLD_TO_PARTY             =
  SHIP_TO_PARTY             =
  BILLING_PARTY             =
   RETURN                    = return_it
  TABLES
    ORDER_ITEMS_IN            = itemin_it
    ORDER_PARTNERS            = partnr_it
  ORDER_ITEMS_OUT           =
  ORDER_CFGS_REF            =
  ORDER_CFGS_INST           =
  ORDER_CFGS_PART_OF        =
  ORDER_CFGS_VALUE          =
  ORDER_CCARD               =
  ORDER_CFGS_BLOB           =
  ORDER_SCHEDULE_EX         =
WRITE : / 'sy-subrc = ' , SY-SUBRC.
IF NOT SD_DOC_Num IS INITIAL.
WRITE : / 'Sales Order ' , SD_DOC_Num, 'Created'.
ELSE.
WRITE : / 'incorrect'.
WRITE : / RETURN_it-TYPE , RETURN_it-MESSAGE.
WRITE : / RETURN_it-LOG_NO, RETURN_it-LOG_MSG_NO,
          RETURN_it-MESSAGE_V1.
ENDIF.
Hope this helps you.
Thanks,
Ruthra

Similar Messages

  • Bapi RETURN Parameter

    All,
      I'm calling the BAPI, which returns the Error via Return Parameter. Can anyone tell me how can i show it Message interface?
    Thanks..
    BM

    Go thru this document - Page no 29. This will show in the message area only.
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/d352a790-0201-0010-5082-b1a608d22b6c
    If you wants show in a specific area on the view, use a Label Control, bind this label with a context variable(showErrorMsg), bind ur error message in that context variable like,
    wdContext.setShowErrorMsg("This is the error");
    Regards,
    Sridhar
    Message was edited by:
            Sridhar kanchanapalli

  • Regarding BAPI Return Table

    Hi all,
    I am having an issues, when the user enters the correct value into an input field then i am getting the output properly. But if he enters any wrong value a message is populated into the BAPI return table. So how do I check if the BAPI return table is empty or not. If it is empty then it has to open the output table and if it is not empty it has to show the error message as an pop-up or table format.
    Please reply, points will be rewarded.
    Thanks & Regards,
    M.Ramana Murthy

    Hi Ramana,
    If you want to capture the message returning from the BAPI which you are using then do the following:
    1.> Drag the line from the BAPI return port and link it to a form or to a table.
    2.> Then go to the form/table click the UIelement and in properties of that assign the default value which you want to display. It may be a message coming out of the BAPI.Through this way you can capture the values coming out of the BAPI
    Regards,
    Nutan

  • Multiline BAPI return structure  and RFC Adapter

    Since SP14 RFC Adapter check return structure of RFC function.
    But how it works if BAPI returns multiline BAPIRET2?
    Will adapter loop all elements and perfom commit only if <b>all</b> alements don't have errors.

    I'am about this:
    <i>As of SP 14 support for commit handling for single BAPI calls was added to the RfcAdapter receiver channel. If activated in the receiver channel setting, the received XI message will be executed as synchronous RFC (sRFC) in the receiving system. This is also true for asynchronous (QoS EO) XI messages to receive and analyze the execution result by the RfcAdapter.
                   The received response is parsed by the RfcAdapter to get the BAPI return parameter with name "RETURN". This return parameter can be of BAPIRETURN, BAPIRET1 or BAPIRET2 types. The "RETURN" parameter is checked for the response status (field TYPE) which can take following values:
                  1. 'S' : Success
                  2. 'I' : Information
                  3. 'W' : Warning
                  4. ''  : Empty String
                  5. 'A' : Abort
                  6. 'E' : Error
                   If the response contains one amongst the first four response status then it implies that the BAPI was successful. If the response contains one amongst the last two response then the BAPI failed. If the BAPI "RETURN" parameter is of not of type ABAP structure rather of type ABAP table, a empty table is also considered as successful execution result.
                   In case of a successful execution the BAPI function module "BAPI_TRANSACTION_COMMIT" is called within the same context to trigger the commit of the BAPI. In case of a failure the BAPI function module "BAPI_TRANSACTION_ROLLBACK" is executed by RFC Adapter which rolls back the changes.</i>

  • How to use Return parameter of BAPI in DOE

    Hello all,
    I have a question on Return parameter of BAPI wrappers written in backend. When we use the BAPI in DOE there i do not see any table which stores these Return parameters then what is the use of writting it in BAPI wrappers.
    Can anyone please clarify??
    Thanks & Best Regards,
    Abhishek

    Hi,
    BAPIRET are stored in log tables during delta download(You can check it in logs and traces of backend integration).
    In case of upload, the bapiret is returned in message error list to the devices. Its also stored in message error list table which you can see it in message monitoring.
    In upload scenario case all the BAPIRET returned by backend are captured ,where as in case of delta load or push the BAPIRET of type 'A' and 'E' are captured by default and other message types are captured when trace setting is higher.(SMMW_TRC_SETTING).
    Regards,
    Dhana

  • Is it necessary to pass RETURN parameter in bapi function module

    Hai All,
                Is it necessary to pass structure to RETURN parameter in bapi_transaction_rollback function module. If it is not necessary then how can it gives return value. Please give me the answer for this one. some sample code below...
    CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'
    IMPORTING
       RETURN        = i_return.
            LOOP AT i_return into wa_return WHERE type EQ c_error.
              wa1_out-postdoc = wa_return-message.
            ENDLOOP.
    Thanks & Regards.
    Laxman.P

    hi
    bapi should never throw an error as it might be called for mass data proceessing
    and it is prefferred not to hault the proceess bcoz of one or two errors.
    that's why the error or success messages are caught and returned in return table.
    in bapi_transaction_rollback the return parameter is not necessary as it will work without that as well.
    the purpose of rollback bapi is just to undo whatever done before that.
    regards
    vijay
    <b>reward points if helpful</b>
    Message was edited by:
            vijay sharma

  • Return Parameter in BAPI

    can any one tell me...... what is the purpose of Return parameter in BAPI ?

    it return all the Message's  ,Exceptions  ,etc
    it  is  a  kind  of
    Catch ..... endcatch & Try & endtry   what ever  message's  (S,E,A,I,W)it will capture and   maintain in the strucuture called  BAPIRETURN (or)BAPIRETURN2.
    Reward points  if it is usefull ..
    Girish

  • Regarding Returning Parameter and Static method

    Hi frnds,
    I am learning oops ABAP. I want to use returning parameters in method and also STATIC METHOD.
    If any example it will be more helpful
    regards,
    satya

    Hi satya,
                 Check this out ,Its helpful.
    To get some values from a method , one can use the exporting, changing or returning parameters.If one uses RETURNING parameters, the following restrictions apply:-(1) No EXPORTING/CHANGING parameters can be used for the method.(2) Only one RETURNING parameter can be used.(3) RETURNING parameters are only passed by value.This program demonstrates the use of RETURNING parameters and the various ways   to call a method with RETURNING parameter to get the value into some variable.
    Sample Program
    </code>
    report ysubdel1 message-id 00.
    data : w_num type i.
    class c1 definition .
    public section. 
    methods : m1 importing input1 type i
                            input2 type i
                            returning value(result) type i .
    endclass.
    class c1 implementation.
    method  : m1.
    result = input1 * 2 + input2.
    endmethod.
    endclass.
    start-of-selection.
    data : obj1 type ref to c1 . 
    create object obj1.
    Syntax 1     
    call method obj1->m1 EXPORTING input1 = 5                                                        input2 = 4  
                                   RECEIVING result = w_num.  
      write:/5 w_num .
    Syntax 2
         w_num = obj1->m1( input1 = 10 input2 = 20 ).
      write:/5 w_num .
    Syntax 3     
    move obj1->m1( input1 = 2 input2 = 3 ) to w_num .  
    write:/5 w_num .
    </code>
    Static method example
    <code>
    REPORT  zstatic.                              .
    data : num type i.
    class testclass definition.
    public section.
      class-methods : testmethod.
    endclass.
    class testclass implementation.
    method : testmethod.
      num = 5.
      write:/5 num.
    endmethod.
    endclass.
    start-of-selection.
    call method testclass=>testmethod.
    </code>
    Reward Points if u find helpful.
    Thnks & Regards,
    Rajesh

  • BAPI return

    Hi all,
    I am working on an SOAP to RFC scenario:
    I am able to execute the scenario. I am testing it using SOAP test tool.But i am facing a problem. when we give valid inputs to the BAPi, the BAPI return structure returns correct values, which is mapped to the response msg and the response is also fine, in the testing tool.
    But when i give non-valid values to the BAPI, the BAPI returns an error msg like "partner does not exist" and for some reason i am not able to see this msg in my response msg, instead i get an "XI Exception error in my
    testing tool display. How can i achieve, the BAPI return value to be displayed in my response msg for invalid values?
    Thanks in advance

    Hi,
    I had also faced the same problem in one of my scenarios. What you can do is, you can check the length of the parameter returned by BAPI. If it is zero, it means that non valid value has been passed to BAPI. In this case you have to map some constant to the target field during mapping.
    If the length is not zero, you can map it as it is.
    For finding the length of the field, you can use the standard text function: length. Hope this helps.
    Regards,
    Divija.

  • How to handle BAPI RETURN message?

    Hi ,
    I developed a bapi ,it is calling from java  application . i don't konw how to send the return message to java application .Pl any one help out this problem.
    Thanks&Regards,
    Pratap

    bapi's normally have a return parameter of type BAPIRETURN (structure) or BAPIRET (internal table) that contain the result messages from a bapi. So if you develop your own bapi you should add this kind of export parameter.
    regards,
    Hans

  • BAPI-RETURN CODE INF

    Hi everybody what is the main purpose of return code.
    Data dictionary structures
    -BAPIRETURN
    -BAPIRETURN1
    -BAPIRET1
    -BAPRET2.
    THANKS IN ADVANCE.

    Each BAPI has a return parameter that is either an export parameter or an export table.
    A BAPI should be able to record and classify all possible errors that may occur.
    You have to create a parameter named Return for every BAPI. This parameter returns exception messages or success messages to the calling program.
    BAPIs themselves must not trigger any messages (such as MESSAGE xnnn) in the coding. In particular they must not generate terminations or display dialog boxes. Instead, all messages must be intercepted internally and reported back to the calling program in the Return parameter. Otherwise the BAPI will not be processed correctly and control may not be given back to the calling program.
    The export parameter Return can be implemented as follows:
    As a structure, whereby it must be defined in the function module as an export parameter, as well as in the method in the BOR.
    As a table, whereby it must be defined in the function module as a table parameter, as well as in the method in the BOR as an export parameter.
    Before filling the Return parameter you should either initialize the structure with CLEAR or the table with REFRESH and CLEAR.
    If the return parameter is not set or is set to an initial value this means that no error has occurred.
    The Return parameter may be based on the following reference structures:
    BAPIRET2
    You must use this reference structure when developing new BAPIS.
    BAPIRET1, BAPIRETURN
    These reference structures are still partly used in old BAPIs.
    Both structures must be filled in the logon language.
    Have a look at return parameters in below link.
    http://help.sap.com/saphelp_nw04/helpdata/en/a5/3ec9f74ac011d1894e0000e829fbbd/frameset.htm
    Best Regards,
    Vibha
    *Please mark all the helpful answers

  • URGENT--Converting the BAPI return structure to XML

    Hi,
    I need to convert the return structure(export parameter) from a BAPI call to XML but not able to make out how to do that.
    Before this I was required to convert the BAPI return table(export table) to XML and I did that by first converting it to the AdoDataTable, added it to a dataset and then used the builtin function to return the dataset in XML format. But here I am not able to make out how can I do the same with the Export structure.
    Any help would be appreciated.
    You may also mail on [email protected]
    regards,
    Ankit Bhansali

    If the XML schema that you find as Xml attributes on the fields of the structure is good for you, you can just use the XML serializer to serialize it out:
    XmlSerializer ser = new XmlSerializer(typeof(BRFCKNA1));
    ser.Serialize(...);

  • Regarding bapis for sales order creation and modification

    Hi,
    I am trying to create a syncbo for sales order creation, modification and display. The bapis that I am using are
    1.BAPI_SALESORDER_GETLIST
    2.BAPISDORDER_GETDETAILEDLIST
    3.BAPI_SALESORDER_CREATEFROMDATA1
    4. BAPI_SALESORDER_CHANGE
    Am I using the correct bapis. When I tried to create a syncbo it gave the following errors
    BAPISDORDER_GETDETAILEDLIST does not have RETURN parameter in export or tables parameter
    RETURN parameter in Create BAPI Wrapper should refer to structure BAPIRET2
    RETURN parameter in GetList BAPI Wrapper should refer to structure BAPIRET2
    GetDetail BAPI Wrapper does not have RETURN parameter in export or tables parameter
    No Export parameter referring to header structure exists in GetDetail BAPI Wrapper
    No Import parameter referring to header structure exists in Create BAPI Wrapper
    No Import parameter referring to header structure exists in Modify BAPI Wrapper
    No Import parameter referring to a field of header structure exists in GetDetail BAPI Wrapper
    No Export parameter referring to a field of header structure exists in Create BAPI Wrapper
    No Tables parameter referring to item structure exists in Create BAPI Wrapper
    No Tables parameter referring to item structure exists in Modify BAPI Wrapper
    I am informed that the above bapis are standard bapis.
    I am not sure as to why I am getting the errors.
    Does the syncbo require the  bapi's to be in a specific format.
    What would be the header and item structures for sales order bapis
    Regards
    Raja Sekhar

    Hi Raja,
      ya , for creating Sync BOs ,our BAPI wrappers must satisfy certain conditions..
    just go through this link.
    u can use the standard BAPIs of SALES Order in ur Custom BAPI Wrapper
      http://media.sdn.sap.com/public/html/submitted_docs/MI/MDK_2.5/content/appdev/smartsync/what_is_a_bapi_wrapper.html
    the RETURN must be of type BAPIRET2..
                    Regards
                    Kishor Gopinathan

  • How to read ABAP return parameter into java code

    Hi all,
    How JAVA environment can trap an error returned from abap code?
    E.g.:
    From a BAPI wrapper written like this:
    "function zpm_gi_create .
    ""Interfaccia locale:
    *"  IMPORTING
    *"     VALUE(ZBAPIGOODSMVT) TYPE  ZBAPIGOODSMVT
    *"  EXPORTING
    *"     VALUE(RETURN) TYPE  BAPIRET2
    *"     VALUE(PO_NUMBER_ES) TYPE  ZBAPIEKKO-PO_NUMBER
    *"  TABLES
    *"      GOODSMVT_ITEM STRUCTURE  ZGOODSMVT_ITEM
      data: goodsmvt_header type bapi2017_gm_head_01,
            return2         type bapiret2 occurs 0 with header line,
      call function 'BAPI_GOODSMVT_CREATE'
        exporting
          goodsmvt_header             = goodsmvt_header
          goodsmvt_code               = zbapigoodsmvt-gm_code
          testrun                     = 'X'
    importing
      GOODSMVT_HEADRET   GM         =
        materialdocument              = matdoc
        matdocumentyear               = matyear
    tables
        goodsmvt_item                 = gm_item
      GOODSMVT_SERIALNUMBER       =
          return                      = return2.
    Our return (for istance is):
    "EBM                  312The (internal) unit xx has not been maintained in
    the unit table"
    How JAVA environment can trap this error or interpret the BAPIRET2 structure?
    Is there something to do in the corresponding syncBO?
    regards,
    eliana

    Hi elina ,
    these topic is already discussed in forum.
    Jo has replied to this doubt in these links.
    Re: Return messages in SyncBo
    Can't see RETURN parameter in SyncBO
    Return messages in SyncBo
    just note this..
    have to change like this , when u follow the help.
    if (messageReply.getType() == MessageReplyType.SYNC_BEGIN) {
              if (messageReply.getType() == MessageReplyType.SYNC_END) {
                Regards
                  Kishor Gopinathan

  • The type of RETURNING parameter must be fully specified

    Hello,
    I want to program a locall class, a method to return a table of a local type:
    TYPES:
    BEGIN OF ty_line,
       id   TYPE char10,
       txt  TYPE string,
    END OF ty_line,
    ty_line_tt type standard table of ty_line.
    CLASS cl_html DEFINITION FINAL CREATE PRIVATE.
      PUBLIC SECTION.
        CLASS-METHODS parse importing fdata        type string_table
                            returning value(fmeta) type ty_line_tt.
    ENDCLASS.                    "cl_rep DEFINITION
    Got an error as in the subject. Does that mean that the table type MUST be declared in the ABAP dictionary?
    Regards,
    Michal

    Hello Michal
    Since your static method is PUBLIC you cannot use local types in its interface. The type of the RETURNING parameter must be public as well. Thus, you have to define it in the DDIC.
    Alternatively, you could switch to the more flexible EXPORTING parameters. Or you could return you itab as data reference, e.g.:
    *& Report  ZUS_LOCAL_CLASS                                             *
    REPORT  zus_local_class                                             .
    TYPES:
    BEGIN OF ty_line,
    id TYPE char10,
    txt TYPE string,
    END OF ty_line,
    ty_line_tt TYPE STANDARD TABLE OF ty_line.
    *       CLASS cl_html DEFINITION
    CLASS cl_html DEFINITION FINAL CREATE PRIVATE.
      PUBLIC SECTION.
        CLASS-METHODS parse IMPORTING fdata TYPE string_table
    *    RETURNING value(fmeta) TYPE ty_line_tt.
        RETURNING value(data_obj) TYPE REF TO data.
    ENDCLASS. "cl_rep DEFINITION
    *       CLASS cl_html IMPLEMENTATION
    CLASS cl_html IMPLEMENTATION.
      METHOD parse.
    *   define local data
        DATA:
          lt_line_tt    TYPE ty_line_tt.
        APPEND INITIAL LINE TO lt_line_tt.
        GET REFERENCE OF lt_line_tt INTO data_obj.
      ENDMETHOD.                    "parse
    ENDCLASS.                    "cl_html IMPLEMENTATION
    Regards
      Uwe

Maybe you are looking for

  • Date format in BI query

    Hi, We need to display a single date format independent of date format of SAP User settings. For ex: as below. In a current query the  date, depending on the user's configuration could appear as: dd.mm.yyyy (English format)         or        yyyy-mm-

  • Macbook Pro with Samsung LED TV

    Macbook Pro detecting TV but nothing shows with mirroring. Works fine with other TV. Port and cable are fine.

  • PO Created by User A should not be changed by User B

    Hi Experts, My User has a specific requriement in Purchase Order. If a purchase order is created by User A, Other users like B and C who are in the same purchasing group should not be able to change the PO created by User A. Similarly, Others should

  • Inserting a Recordset Kills PHP Processing

    In Dreamweaver 11.0 (CS5) on both MAMP and a live server, I am experiencing a puzzling issue. Inserting any Recordset kills PHP processing.  For example, this document works perfectly: <!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" con

  • Can't uninstall dreamweaver and photoshop 32 bit from windows 64bit

    I have dreamweaver and photoshop cs6 installed on windows 7 in the c:\program files (x86) folder. I want to remove it, but it won't work. The cleaner tool also doesn't list these files and in the program manager of windows 7 I also can't uninstall it