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.

Similar Messages

  • Error in BAPI RETURN for Service Contract

    Hi,
      I get an error in the BAPI Return for the Uploading the Service Contracts by LSMW. The Error Message is E BS No status object is available for &.Also want to know can we upload multiple line of header text for a Contract by this BAPI. If so then how would I do this , as the BAPI structure BAPISDTEXT has textline upto 132 characters. And I am take only one file in LSMW where the header & details come alongwith text. Or could also tell me the file structure of for the data upload. The legacy system sends multiple text in the header for a Contract.For Eg.
    Header1 Detail1 Text1
    HEader1 Detail2 Text2
    Header1 Detail3 Text3
    So I would need this text1TEXT2text3 in the Header Text of the Contracts. Or do I need the change the file structure. Many thanks for your time and help.

    Thanks Nablan, I could do that for multiple header coming in file. But I have a question for you on BAdI ALM_ME_006_GOODSMVT. I have implemented this BAdI , and this BAdI is called by a function Module ALM_MEREP_006_CREATE. When I test this FM giving the Material , Orderid and Movement type entries, this BAdI is triggered when giving a breakpoint. I've given this code for changing the movement type to 961. Cause the stanadrd scenario does not maintain Movement type 961 in Mobile Asset Management. The Movement type 961 for unplanned Materials comes to SAP and changes to 261 as maiantained by TCOKO table. To bypass this & retain the movement type 961 in SAP I'm using this BAdI. Currently this is what I'm doing and am stuck in the method interface how do I call the method.
    method IF_EX_ALM_ME_006_GOODSMVT~CREATE .
    break-point.
    *DATA : i_ce_goodsmovement TYPE REFERENCE
              ALM_ME_CUSTOMER_ENHANCEMENT.
    DATA : lr_badi_goods_movement TYPE REF TO if_ex_alm_me_006_goodsmvt.
    DATA : ls_user_data TYPE ALM_ME_USER_DATA-USERID.
    *DATA : goods_movement TYPE ALM_ME_MATERIAL_MOVEMENT.
    CALL METHOD lr_badi_goods_movement->create
      EXPORTING
           ce_goodsmovement = ce_goodsmovement
      IMPORTING
           user_data        = ls_user_data
           custom_user_data = ls_ce_user_data
           goods_movement   = goods_movement
      changing
           return           = return[].
    CALL FUNCTION 'ALM_ME_COMMIT_OR_ROLLBACK'
           TABLES
                return = return.
    endmethod.
    Please help me to get the data in this method. How do I call this.

  • Function or bapi returning customers or vendors with open items  per plant

    Dear experts.
    may you please tell me which function or bapi can i use that will return all customers or vendors with open items per given plant. i have tried to use BAPI_AR_ACC_GETOPENITEMS and BAPI_AP_ACC_GETOPENITEMS but they return open items for a given customer and vendor respectively per given company code.

    ok but those 2 BAPIs return open items after providing the customer or vendor. what i need is a BAPI which returns a list of customers or vendors with open items

  • How to create a log file for bapi return structure

    Hi ppl,
         I am using BAPI_PO_CHANGE to mark the delivery of POs as complete after many validations through a classic report now my concern is i have been asked to create a log file which details the errors in the POs which is in the bapi return structure.
       I don't know how to do can any one help at the earliest.
    Regards,
    Bharathy.

    hi
    pls see this thread...
    it may help you...
    /people/kamalkumar.ramakrishnan/blog/2007/01/10/a-primer-on-using-and-creating-sap-application-log
    thx
    pavan
    *pls mark for helpful answers

  • 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

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

  • Is there any bapi returns dynamic value of reorder point and safety stock

    Hi all,
    Is there any bapi returns the runtime value of ROP and SS by passing changenr/objectid taken from CDPOS.
    if exists please send me with code.
    Thanks
    PRR R

    hi,
    As far as i know is static means manual entry of reorder point.
    The dynamic or automatic reorder point is used for Forecast based planning...
    the sysstem wii automatically calculate the reoder point evrytime there is the forecast run.
    So, it dependig on ur scenario , select either manual or automatic.
    First entry for both is always manual entry....
    hope u got this..
    Regards,
    Smitha

  • 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(...);

  • Is there any BAPI returning the affected organisational units to users?

    Dear all,
    I would like to ask a question about organizational units. Whenever I want to affect a user to a given unit I
    use PPOME transaction. If I want to do this in ABAP level I use the function module RH_RELATION_WRITE.
    I would like to know, is there any BAPI returning the affected organizational unit to a given user?
    Thanks in advance,
    Kind Regards,
    Dariyoosh

    Alberto Sesma wrote:
    You can use Function Module RH_STRUC_GET
    >
    >
    > CALL FUNCTION 'RH_STRUC_GET'
    >   EXPORTING
    >      ACT_OTYPE = 'US'
    >      ACT_OBJID = user_name
    >      ACT_WEGID = 'US_CP_O'
    >   TABLES
    >        RESULT_TAB = LT_RESULT_TAB.
    >
    >
    > You will get the related org units in LT_RESULT_TAB. There are other two table parameters in that function module that you may find useful.
    >
    > If the function does not return any valid data you may try with other values for WEGID. You will find all the possible evaluation paths in transaction OOAW.
    >
    > Kind regards
    Dear Alberto,
    Thank you very much for your answer. I didn't know this FM and it solved my problem.
    For those who may be intered here is exactly I proceed. Suppose that in the table HRP1000 you have an
    structure (type S) with ObjID = 50000342 and you wish to have the SapUserID of the affected persons.
    DATA:
          affected_users TYPE STANDARD TABLE OF swhactor,
          user LIKE LINE OF affected_users.
    START-OF-SELECTION.
      CALL FUNCTION 'RH_STRUC_GET'
        EXPORTING
          act_otype              = 'S'
          act_objid              = '50000342'
          act_wegid              = 'A008'
          act_plvar              = '01'
          act_begda              = sy-datum
          act_endda              = sy-datum
          act_tdepth             = 0
       TABLES
         result_tab             = affected_users
    EXCEPTIONS
       NO_PLVAR_FOUND         = 1
       NO_ENTRY_FOUND         = 2
       OTHERS                 = 3
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
      LOOP AT affected_users INTO user.
        WRITE: / user-objid.
      ENDLOOP.
    Also in transaction OOAW we can have all possible values for the third argument of the module function (act_wegid).
    For those who are interested, here are a few among many possible values which seem to be intesting for my
    problem.
    DFPS_DG1----
    Organizational Unit of User
    DFPS_DG3----
    All Org. Units Above a User
    ORGAS----
    Closest Organizational Unit and structure
    ORGASS----
    Closest Organizational Unit and structure     
    PPLEORG     -
    Organizational unit of an employee or position
    SAP_ORGP----
    Organizational assignments of a user/person
    SAP_USOG----
    Organizational Assignments of a User
    SAP_US_S----
    Positions and Personnel Number of a User
    US_S_S_C----
    All positions and jobs of a user
    WFM_ORGU----
    Organizational Assignment of User
    WF_ORGUN----
    Organizational unit of a user/person (module id Ben./Pers.)
    For example, let's say we have a userid named MYUSER01 and we would like to find all structures to which the user
    is affected. Here is how I proceed.
    DATA:
          itab_user_structures TYPE STANDARD TABLE OF swhactor,
          row_user_structures LIKE LINE OF itab_user_structures.
    START-OF-SELECTION.
    CALL FUNCTION 'RH_STRUC_GET'
        EXPORTING
          act_otype              = 'US'
          act_objid              = 'MYUSER01'
          act_wegid              = 'US_S_S_C'
          act_plvar              = '01'
          act_begda              = sy-datum
          act_endda              = sy-datum
          act_tdepth             = 0
       TABLES
         result_tab             = itab_user_structures
    EXCEPTIONS
       NO_PLVAR_FOUND         = 1
       NO_ENTRY_FOUND         = 2
       OTHERS                 = 3
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
      LOOP AT itab_user_structures INTO row_user_structures.
        WRITE: / row_user_structures-objid.
      ENDLOOP.
    Thank you very much for your help.
    Kind Regards,
    Dariyoosh

  • How to display BAPI return message as a pop up

    Hi,
    I am able to get BAPI return message but my requirement is to display these BAPI return messages as pop up's like alerts in javascript.
    I am using abstract portal component.
    any suggestions.
    Regards
    Praveen

    Hi,
    Place a hidden field in your abstract portal component like this:
    <input type ="hidden" name ="returnedmessage" value=<i>the variable returned from JCO</i>>
    In addition to this:
    <script language = "javascript">
    if (document.<i>formname</i>.returnedmessage.value != null || document.<i>formname</i>.returnedmessage.value != "")
    alert(document.<i>formname</i>.returnedmessage.value);
    </script>
    If you are transferring your code to a JSP it would less cumbersome else you would have to enclose all this in response.write(); statements.
    Regards,
    Prem

  • Popup BAPI return messages

    Hello experts,
    I would like a way to quickly handle the BAPI return table (TYPE TABLE OF bapiret2).  I would like to pass the table into a function module or helper method to popup all the messages at once.  This is the same way MIGO (and many other programs) do a popup of messages with little red, yellow, and green icons to the left.  Currently I am using a series of calls to function module BAL_LOG_... and I feel there has to be a better way.
    I tried searching for the answer to this question, but if the answer exists, it is buried within the noise of a million people saying use 'POPUP_TO_CONFIRM' and other function modules.  To clarify: I do not want buttons to confirm.  I want a popup of a list of messages with red, yellow, and green icons on the left.
    Whoever answers my question correctly will henceforth be referred to by me as "the Magnificent."

    My 2 cents ...
    IF_RECA_MESSAGE_LIST is the most convenient message handler i have used so far So i would use it in this way -
    Get the instance using the factory class CF_RECA_MESSAGE_LIST=>CREATE( ).
    Add the BAPI messages using the method ADD_FROM_BAPI( ).
    Get the handle via GET_HANDLE( ) & display using function BAL_DSP_LOG_DISPLAY.
    DATA(o_msg_list) = cf_reca_message_list=>create( ).
    o_msg_list->add_from_bapi(
      EXPORTING
        it_bapiret = VALUE #( id = 'BC_IBF'
                            ( type = 'I'  number = '008' )
                              type = 'E' ( number = '050' message_v1 = 'AA')
                                         ( number = '051' message_v1 = 'BB')
                                         ( number = '055' message_v1 = 'CC')
    DATA st_log_disp_prof TYPE bal_s_prof.
    CALL FUNCTION 'BAL_DSP_PROFILE_POPUP_GET'
      IMPORTING
        e_s_display_profile = st_log_disp_prof.
    st_log_disp_prof-use_grid   = abap_true.
    st_log_disp_prof-disvariant
      = VALUE #( handle = o_msg_list->get_handle( )
                 report = sy-repid
    CALL FUNCTION 'BAL_DSP_LOG_DISPLAY'
      EXPORTING
        i_s_display_profile  = st_log_disp_prof
      EXCEPTIONS
        profile_inconsistent = 1
        internal_error       = 2
        no_data_available    = 3
        no_authority         = 4
        OTHERS               = 5.
    IF sy-subrc <> 0.
    * Implement suitable error handling here
    ENDIF.
    BR,
    Suhas

  • About bapi return types

    hi guys,
    i was wondering if the bapi return table with the types, is it possible that the type 'E' and the type 'W' co-exist in the return table.
    'cause my program now need to make a judging under the type 'W'.
    thanks.

    Adamyam,
    It is possible to get a Warning and Error for a single transaction.
    Warnings are discarded and the transaction will go further, however when a Error happens processing is stoppped and is not taken further.
    Regards,
    Ravi
    Note : Please reward points if this helps.

  • Function or bapi returning customers or vendors with open items

    Dear experts.
    may you please tell me which function or bapi can i use that will return all customers or vendors with open items per given plant. i have tried to use BAPI_AR_ACC_GETOPENITEMS and BAPI_AP_ACC_GETOPENITEMS but they return open items for a given customer and vendor respectively per given company code.

    willard,
    the term "open items per given plant" is not defined exactly. VENDORS and CUSTOMERS are not linked to  specific plant. GOODS are produced and stotred in one or more plants. They may be sold  by a sales organization linked to a company code. Copany may have seral plants.
    That may be one reason for SAP not to provide the function you are looking for.
    Please give more information about company structure and sales and purchase process.
    Regards,
    Clemens

  • What bapi return structure consists

    Hi experts,
        can anybody clarify my doubt regarding bapi's used for data transfer.
    when we r using bapi for data transfer how error transactions will be handled.
    what exactly return structure consists. can we get error transactions log in the return structure.
    plz reply me.
    Regards
    Trinadh.

    Moderator message - Please search before asking
    Please do not spam the forum with this sort of question
    post locked

Maybe you are looking for