Error message handling in BAPI...

Hi Guys,
I am working on documentation of a BAPI used SAP insurance module. Now I want to see all the error messages associated/ handled in that BAPI. How can I do that ? Is there a table in data dictionary where I can see error messages handled by a given Function module/ BAPI?
Any inputs will be highly appreciated.
Thanks.
Regards,
Tushar.

Hi,
here´s one possible solution:
  CALL FUNCTION 'MESSAGES_INITIALIZE'.
  LOOP AT it_return_bapi.
    CALL FUNCTION 'MESSAGE_STORE'
         EXPORTING
              arbgb          = it_return_bapi-id
              exception_if_not_active = ' '
              msgty                = it_return_bapi-type
              msgv1          = it_return_bapi-message_v1
              msgv2          = it_return_bapi-message_v2
              msgv3          = it_return_bapi-message_v3
              msgv4          = it_return_bapi-message_v4
              txtnr          = it_return_bapi-number
              zeile          = ' '
         EXCEPTIONS
              message_type_not_valid  = 1
              not_active              = 2
              OTHERS                  = 3.
  ENDLOOP.
  CALL FUNCTION 'MESSAGES_STOP'
       EXCEPTIONS
            a_message = 04
            e_message = 03
            i_message = 02
            w_message = 01.
  IF NOT sy-subrc IS INITIAL.
    CALL FUNCTION 'MESSAGES_SHOW'
         EXPORTING
              i_use_grid         = 'X'
              i_amodal_window    = i_amodal_window
         EXCEPTIONS
              inconsistent_range = 1
              no_messages        = 2
              OTHERS             = 3.
  ENDIF.
ENDFUNCTION.
Best regards

Similar Messages

  • BAPI Error Message Handling

    Hi Group,
    I am using BAPI ,How to display the BAPI  Error Message (eg:BAPIRET1) which is returning by BAPI

    HI ,
    ITS SIMPLE TRY THIS CODE
    AWARD PTS
    DATA: gt_ret     TYPE TABLE OF bapiret2,
               ls_ret    TYPE bapiret2,
    CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
        EXPORTING
          salesdocument     = p_vbeln
          order_header_in   = gt_hdr
          order_header_inx  = gt_hdrx
        TABLES
          return            = gt_ret -
    >>>>.<b>IMPORTANT</b>
          order_item_in     = gt_itm
          order_item_inx    = gt_itmx
          schedule_lines    = gt_sched
          schedule_linesx   = gs_schedx
          order_text        = gs_stdtxt.
          PARTNERS          = gs_partner
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
      LOOP AT gt_ret INTO ls_ret.
        WRITE:/ ls_ret-type.
        WRITE:/ ls_ret-message.
      ENDLOOP.

  • To send the error messages of an BAPI as an attachment in mail

    Hi all,
    I am running the BAPI_EXCHRATE_CREATEMULTIPLE to update the transaction OB08..I am able to do that.What i want now is that if there are error messages in the BAPIRET2 table then i collect these messages in a table and send these records as an attchment in the mail..
    I am using the FM   'SO_NEW_DOCUMENT_ATT_SEND_API1' to send the mail..
    Plz suggest how i should proceed..
    A sample code will be useful..
    <b><REMOVED BY MODERATOR></b>
    Thanks..
    Arun
    Message was edited by:
            Alvaro Tejada Galindo

    You should use the OO approach to sending email out of SAP.  There are several bcs_example* programs in the system.
    REPORT bcs_example_1.
    * This example shows how to send
    *   - a simple text provided in an internal table of text lines
    *   - to some internet email address.
    * All activities done via facade CL_BCS!
    DATA: send_request       TYPE REF TO cl_bcs.
    DATA: text               TYPE bcsy_text.
    DATA: document           TYPE REF TO cl_document_bcs.
    DATA: sender             TYPE REF TO cl_sapuser_bcs.
    DATA: recipient          TYPE REF TO if_recipient_bcs.
    DATA: bcs_exception      TYPE REF TO cx_bcs.
    DATA: sent_to_all        TYPE os_boolean.
    START-OF-SELECTION.
      PERFORM main.
    *       FORM main                                                     *
    FORM main.
      TRY.
    *     -------- create persistent send request ------------------------
          send_request = cl_bcs=>create_persistent( ).
    *     -------- create and set document -------------------------------
    *     create document from internal table with text
          APPEND 'Hello world!' TO text.
          document = cl_document_bcs=>create_document(
                          i_type    = 'RAW'
                          i_text    = text
                          i_length  = '12'
                          i_subject = 'test created by BCS_EXAMPLE_1' ).
    *     add document to send request
          CALL METHOD send_request->set_document( document ).
    *     --------- set sender -------------------------------------------
    *     note: this is necessary only if you want to set the sender
    *           different from actual user (SY-UNAME). Otherwise sender is
    *           set automatically with actual user.
          sender = cl_sapuser_bcs=>create( sy-uname ).
          CALL METHOD send_request->set_sender
            EXPORTING
              i_sender = sender.
    *     --------- add recipient (e-mail address) -----------------------
    *     create recipient - please replace e-mail address !!!
          recipient = cl_cam_address_bcs=>create_internet_address(
                                            '[email protected]' ).
    *     add recipient with its respective attributes to send request
          CALL METHOD send_request->add_recipient
            EXPORTING
              i_recipient = recipient
              i_express   = 'X'.
    *     ---------- send document ---------------------------------------
          CALL METHOD send_request->send(
            EXPORTING
              i_with_error_screen = 'X'
            RECEIVING
              result              = sent_to_all ).
          IF sent_to_all = 'X'.
            WRITE text-003.
          ENDIF.
          COMMIT WORK.
    * *                     exception handling
    * * replace this very rudimentary exception handling
    * * with your own one !!!
        CATCH cx_bcs INTO bcs_exception.
          WRITE: text-001.
          WRITE: text-002, bcs_exception->error_type.
          EXIT.
      ENDTRY.
    ENDFORM.                    "main

  • [BUG] Problem with Error message handling in JDeveloper 11.2.1.0

    Hello!
    I'm Daniel from Brazil.
    I have been facing a problem recently to which I see no solution. I need to use a specific component called 'Panel Label and Message' in order to nest three other components which need to be grouped together to work properly (an input text box, a LOV calling 'search button', which searchs and populates the input box, and an output text box which displays text depending on the input field). This works fine!!
    The problem comes when I try to place an Access Key that should focus on the input text box part of the group component. In order to do that, I put it on the 'Panel Label and Message' component, and set the 'for' property to the input text box. This too works fine, as when I access it the component redirect the focus to the right place.
    Problem is, when the user decides to this specific field (which is required) blank, JDev has problems handling the actual name of the component, and just calls it 'Component', as the screenshots below show. Apparently, for the other error messages that are handled by myself or generated by other means, it deals with the component's actual name just fine. Is there any way around this? Thanks!
    'Panel Label and Message' component properties. it9 is the id of the 'Input Text' field component. Access Key set to F.
    http://img.photobucket.com/albums/v82/myfireburnsblack/PropertiesErrorBug.png
    Error message I get (it's in portuguese). Field has been left blank, and JDev says I have to put something in, but refers to the field as 'Component'. Any other error is handled correctly, as far as I've tested.
    http://img.photobucket.com/albums/v82/myfireburnsblack/jdevError.png

    Hi Daniel,
    You're not the only one who has seen this: {message:id=9938606}
    As mentioned in that other thread - I had tested similar use cases and it works for me.
    Do you have access to https://support.oracle.com to file an SR?
    John

  • Display of Error messages returned in BAPI in the logon language?

    Hi Experts ,
                          I  have a requirement where in I need to display the error messages returned in the return table of BAPI_BILLINGDOC_CREATEMULTIPLE in the logon language..Is there any function module to convert text in the return table to the logon language?..Any pointers on achieving this functionality would be of great help..Thankz in advance

    >
    Shawn Sunny wrote:
    > Hi Experts ,
    >                       I  have a requirement where in I need to display the error messages returned in the return table of BAPI_BILLINGDOC_CREATEMULTIPLE in the logon language..Is there any function module to convert text in the return table to the logon language?..Any pointers on achieving this functionality would be of great help..Thankz in advance
    Hello Shawn,
    Messages are always displayed in the logon language so what's the big deal in it?
    May be the translation is not maintained for this message in the logon language, hence the issue.
    You maintain the translation from SE91.
    Get the message details from the RETURN table --> Trxn SE91 --> Select the Message to translate --> From the menu bar : Goto --> Translation
    BR,
    Suhas

  • Error Message Handling

    Hi,
               I am trying to execute the below code resulting in a 'refernce to null'. Could any one please help me with some sample code.
    DATA : IM_MESSAGE_HANDLER type ref to IF_HRBAS_MESSAGE_HANDLER.
    DATA message TYPE symsg.
    MESSAGE E015(zhr) WITH 'ERROR MESSAGE' INTO message_dummy1.  
    MOVE-CORRESPONDING sy TO message.
    im_message_handler->add_message( EXPORTING message = message ).
    Thanks,
    Vind.

    Posted across ABAP forum, so closing here

  • ALE Error Message Handling

    Hi,
             In ALE:
    (1) If it is a error means it has to be send to a particular user---> where we will configure these this thing.
    (2) How the user will be intimated for the error in the IDOC, what's the medium he will be intimated whether by
    e-mail it can be intimated. what are the other possible mediums?
    In ALE STANDALONE  METHOD (i.e., i created my own program for sending the IDOC)
    (3) If i got error message --> i want to reprocess that IDOC, where i can reprocess.
    (4) I what to find where that error has occured, where we can find. Is there any possibility of debugging there?

    Hello Mahesh
    On ERP 6.0 you have the standard report RSEIDOCA ( Active IDoc Monitoring as of Release 6.10 ) available. Unfortunately this report does not offer an e-mail notification (see also thread e-mailing: How to sent out an email to the Managers OUTLOOK express account). Normal procedure is to generate work items.
    Reprocessing of failed IDocs is done using transaction BD87.
    In order to debug IDoc processing you can use transaction WE19. Please note that in this case a new IDoc (having the same data as the chosen one) is created.
    Regards
      Uwe

  • Error message handling in PO Badi

    Hi,
    We have some usewr checks in Process_item method of the purchase order BADI.
    We use macro mmpur_message_forced to display the messages and macros:
    mmpur_remove_messages_by_id le_item-id.
    mmpur_business_obj_id le_item-id.
    to delete the messages.
    The problem is that this last two also delete the system messages. How can we solve this?.
    Rgds,
    Jose

    hi kavitha,
    Y dont u use BAPI, it can collect all the errors.
    BAPI_INCOMINGINVOICE_CREATE
    warm regards
    Gokul

  • Error message handling in Integration Process

    How to use the fault message type? when define the fault message type for inbound message interface, how to output that fault message?
    hope from your helps
    Thanks,
    Michael

    Hi,
      A fault message is usually sent from the receiver system to the sender system.
    <i>when define the fault message type for inbound message interface,</i>
    We usually use fault messages when we need the receiver to report an application error to the sender.
    <i>How to use the fault message type?</i>
    In order to use these fault messages, we need to make use of the data type exchange fault data.
    We need to create a message type which has exchange fault data as the message type.
    When we create an outbound synchronous interface, we need to specify this fault message type.
    <i>how to output that fault message?</i>
    This i am not very sure.
    But we must be able to map it to a similar structure, and send it as a file to a file server.
    Regards,
    Smitha.

  • RF screen FM error message handling

    Hi Experts,
    I have created RF transaction to create transfer orders to for moving storage loc.
    Using the FM LEINT_To_MOVE_SU_CREATE
    The issue is if the FM returns any Exception..its directly displayed in the status bar of the main SAP screen.
    How can i capture the FM exception and show them on the RF screen itself.
    Need help on this.
    Thanks
    Jaif

    You need to check sy-subrc and capture those exceptions and messages from sy-msg* variables. Once you know exception is raised by FM, prepare your own screen output as per your RF screen setting (8x40 or 16x20) and populate proper message with message variables on custom error handeling screen.
    Regards,
    Pranav

  • Catching System Error Message in Abap Proxy.

    Hi all,
        I want to know whether it is possible to catch the system error message from SXMB_MONI in proxy scenario's.
        The error i am getting is :
    <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
    - <!--  Call Adapter
      -->
    - <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="1">
      <SAP:Category>XIServer</SAP:Category>
      <SAP:Code area="INTERNAL">HTTP_RESP_STATUS_CODE_NOT_OK</SAP:Code>
      <SAP:P1>403</SAP:P1>
      <SAP:P2>Forbidden</SAP:P2>
      <SAP:P3 />
      <SAP:P4 />
      <SAP:AdditionalText>Service is not active</SAP:AdditionalText>
      <SAP:ApplicationFaultMessage namespace="" />
      <SAP:Stack>HTTP response contains status code 403 with the description Forbidden Error when sending by HTTP (error code: 403, error text: Forbidden)</SAP:Stack>
      <SAP:Retry>N</SAP:Retry>
      </SAP:Error>
    Is it possble to catch the above message text.
    Regards,
    Keith

    Hi Keith,
    Check this forums also should be definitely help u..
    Error message handling in Integration Process
    and
    http://help.sap.com/saphelp_nw04/helpdata/en/dd/b7623c6369f454e10000000a114084/content.htm
    also refer
    Check this weblog once ... sure it will give u an idea..
    /people/sap.user72/blog/2006/01/16/xi-propagation-of-meaningful-error-information-to-soap-client
    and also go through this
    /people/alessandro.guarneri/blog/2006/01/26/throwing-smart-exceptions-in-xi-graphical-mapping
    Regards,
    Sridhar

  • 'CRM_ORDER_MAINTAIN'  error messages

    HI guys,
    I am using BAPI 'CRM_ORDER_MAINTAIN' to create FS Quotation, but i want to get error message before SAVE, Bapi only return exceptions table and CV_LOG_HANDLE. How can I get details of errors generated in the process of creation?
    Thanks ind advance,
    Regards.
    Marisol
    Edited by: Marisol on May 3, 2011 4:22 PM

    Hi Marisol,
                    Not sure how you are using it - but CRM_ORDER_MAINTAIN returns exception names. Please use pattern button to get the complete code (or CONTROL + F6)
    * EXCEPTIONS
    *   ERROR_OCCURRED                = 1
    *   DOCUMENT_LOCKED               = 2
    *   NO_CHANGE_ALLOWED             = 3
    *   NO_AUTHORITY                  = 4
    *   OTHERS                        = 5
      Also, you are right BAPI would return exception table - but CRM_ORDER_MAINTAIN is just an FM and not bapi.
    Also, further I am sure you are calling CRM_ORDER_SAVE  and 'BAPI_TRANSACTION_COMMIT' after this .
      CV_LOG_HANDLE is for application log - you can use FM BAL_LOG_CREATE to create it and BAL_LOG_HDR_READ to read what it contains.
    I hope it helps.
    Thanks,
    Rohit

  • Handling error messages in BAPI

    Hello,
       I am doing a replica of an SAP R3 std report in portal. I've converted the report pgm to a BAPI. My question is how to populate the BAPIRETURN table with the error messages raised from a std report? I mean how to capture these error messages? I am doing a SUBMIT to call this report from within the BAPI.
    Thanks in advance.
    Rgds,
    Nathan.

    Hi,
      Collect all the errors in an internal table..Lets say ITAB.
      At the end of the program export it to the memory.
      EXPORT T_ERRORS TO MEMORY ID 'BAPI_CALL'.
    In the Bapi after the program is completed..use the import statement to get it from the memory...
      SUBMIT 'ZREPORT' AND RETURN.
      IMPORT T_ERRORS FROM MEMORY ID 'BAPI_CALL'.
      Then pass the errors to the return parameter of the BAPI..
    Thanks,
    Naren

  • Error handling in bapi

    hi all,
          how to handle errors in bapis,and also can anyone send faqs on bapis.

    Hi
    A BAPI should be able to record and classify all possible errors that may occur a function Module BAPI_MESSAGE_GETDETAIL is used to Handle the Error Messages..
    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.
    All error messages or indeed any message that may be returned by the BAPI, must be defined in message table (Tools ® ABAP Workbench ® Development ® Programming environment ® Messages) and described in the documentation for the return parameter. This also applies to the most important or most likely error messages generated by other programs that can be indirectly passed via the BAPI to the application program.
    You must not use exceptions in BAPI interfaces.
    When a termination message (message type A) is triggered, a database rollback is executed in the standard programming model, that is, all tasks performed since the last COMMIT WORK are canceled. When you program BAPIs, we recommend that you also execute a database rollback in the return parameter for termination messages. You must describe this process in the documentation for the Return parameter. For messages of type E (error), the calling program performs the error handling.
    Application developers are provided with two service BAPIs to diagnose and process error messages from BAPI calls:
    BapiService.MessageGetDetail() displays the short and long texts of BAPI error messages.
    BapiService.ApplicationLogGetDetail(), with which information in application logs can be displayed.
    Features
    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.
    Reward if Helpfull,
    Naresh.

  • Passing Error message to BAPI Structure in RFC

    Hi Experts,
    I would like to know how we pass error message to BAPI structurre in RFC?
    Plz some one give the details about how we handle the errors.
    Thanks in advance.

    Like already mentioned before, every Standard SAP BAPI, has an export or tables parameter which is called something like RETURN with structure BAPIRET2. In here, you can store all the messages that are generated during the BAPI Call.
    However, if you also want to catch errors like system exceptions and communication errors, you will have to add these exceptions manually:
    EXCEPTIONS
         SYSTEM_FAILURE        = 1 MESSAGE RFC_MESS
         COMMUNICATION_FAILURE = 2 MESSAGE RFC_MESS.
    However, not sure if this addition works when calling BAPI from NON-sap application.
    Declaration:
    DATA: RFC_MESS(128).

Maybe you are looking for

  • 2" Business Card = 1.99" in Template

    I just noticed something strange. Business cards are 2" high. You'd think that a business card template shoud then have a table with cells that are 2" high. When I print such a template, each cell is taller than the business card! In fact, I have to

  • Modifying animated text in iDVD themes

    In themes with animated text, such as "Pass Through" (a v6.0 theme), what text object is used to define the actual text that is animated? and if that text object is deleted, how can it be re-added? (presuming that the undo function cannot be used due

  • Multi window applications

    Hi, I am messing around with swing and designing an app that will consist of multiple panels. I am not sure how I should go about this. What I intend to do is have various panels in my app and as the user creates different events I want a panel that

  • WARNING, WARNING - Delete and AutoCommit

    I've just hit a bug which has cost me a couple of days work and a fair bit of hair loss! Deleting data seems to autocommit. You cannot roll it back even though the autocommit button is off. There should be flashing lights in the front of the app sayi

  • Identification of AR Reserve Invoice

    What identifes an AR Reserve Invoice within OINV? In other words, what values are set for an AR Reserve Invoice which are different from a normal AR Invoice? Regards, Douglas