How to capture Exception error message in Odata ?

Hi,
  I am new to sap gateway. Currently i am creating a Odata Service through the transaction SEGW. In the query i have mapped a RFC. When i execute the service sometimes the RFC throws exception like 'No data Found'. But i dont know how to capture the exception returned from the RFC.
I read some threads which says use
RAISE EXCEPTION TYPE /IWBEP/CX_MGW_BUSI_EXCEPTION
      EXPORTING
        textid            = /iwbep/cx_mgw_busi_exception=>business_error
        message       =  lv_text
        message_container = io_message_container.
My doubt is since i have not done any code in the DPC method. As said in many threads should i go to DPC_EXT method and redefine the method or how to capture the exception.
Kindly advise. Thanks in advance

Hello Velsankar,
You need not to capture the error messages explicitly by writing custom code in you DPC_EXT if you are using service builder when the return error message table is of type BAPIRET2.
GW itself will handle and return the error messages.
If at all the return error message table is of different type , i mean to say if it is not of type BAPIRET2 then you need to capture explicitly.
The below is the code you need to write in DPC_EXT to capture.
DATA: LO_MECO TYPE REF TO /IWBEP/IF_MESSAGE_CONTAINER.
DATA: LX_BUSI_EXC TYPE REF TO /IWBEP/CX_MGW_BUSI_EXCEPTION.
        LO_MECO = MO_CONTEXT->GET_MESSAGE_CONTAINER( ).
         LO_MECO->ADD_MESSAGES_FROM_BAPI( IT_BAPI_MESSAGES = LT_ERR_RET_TAB ).
         CREATE OBJECT LX_BUSI_EXC
           EXPORTING
             MESSAGE_CONTAINER = LO_MECO.
         RAISE EXCEPTION LX_BUSI_EXC.
Note : where LT_ERR_RET_TAB is your internal table where you would have captured all the error messages.
That is it. You will be able to see the messages .
Regards,
Ashwin

Similar Messages

  • How to capture the error messages from incorrect session?

    Hi SDNs.,
    i am using BDC Session method to update transaction FB01. So my job runs daily. here i want to capture the error messages and i want to send it to mail.  Can i capture the unprocessed records???
    i think FM <b>SO_NEW_DOCUMENT_ATT_SEND_API1</b> used for sending mail? but how to capture mes or records?
    or Is there any other way to Do it???
    Thankning you.,
    Ram

    Hi Ramakrishna,
       Once you create the session, Process the session using
    the report RSBDCSUB using submit statement.
    It would list out the erroneous records.
    Hence, while submitting, just say submit RSBDCSUB in background and export output list to memory.,
    Then you can retrieve the list from memory using the FM LIST_FROM_MEMORY into the internal table and finally send the email by the fm you have already mentioned.
    Regards,
    Ravi

  • How to show custom error message in WebADI Excel template?

    Hi,
    I've  created a custom Web ADI integrator and associated it with a 'Procedure' based custom interface.
    WebADI Interface API Returns is set to  "Error Message".
    I'm using  raise_application_error(-20001, "Actual Error Message") for invalid rows,but custom error message from PL/SQL  is not populated on the excel template.
    Instead it is showing "SQL exception occurred during PL/SQL upload".
    Am I missing anything? How to show custom error message from Pl/SQL procedure to WebADI Excel template?
    TIA
    Narasimha

    The custom API errors are visible in the BNE log but not on the Excel.
    BNE Log=>
    12/10/13 2:52 PM Web ADI Upload Job 13008 ERROR          BnePLSQLUpload.doUpload: Exception while uploading to PL/SQL API.  Error Code: 20001, Message: ORA-20001: -Please enter CONTAINER_ID -  Enter PO_NO -
    ORA-06512: at "APPS.XXPO_COSTFACTS_WEBADI_PKG", line 264
    ORA-06512: at line 1
    12/10/13 2:52 PM Web ADI Upload Job 13008 ERROR          BnePLSQLUpload.doUpload: Stack trace: java.sql.SQLException: ORA-20001: -Please enter CONTAINER_ID -  Enter PO_NO -
    ORA-06512: at "APPS.XXPO_COSTFACTS_WEBADI_PKG", line 264
    ORA-06512: at line 1
      at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:439)
      at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:395)
      at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:802)
      at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:436)
      at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:186)
      at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:521)
      at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:202)
      at oracle.jdbc.driver.T4CCallableStatement.executeForRows(T4CCallableStatement.java:1005)
      at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1307)
      at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3449)
      at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3550)
      at oracle.jdbc.driver.OracleCallableStatement.execute(OracleCallableStatement.java:4710)
      at oracle.jdbc.driver.OraclePreparedStatementWrapper.execute(OraclePreparedStatementWrapper.java:1374)
      at oracle.apps.bne.integrator.upload.BnePLSQLUpload.doUpload(BnePLSQLUpload.java:284)
      at oracle.apps.bne.integrator.upload.BneSAXUploader.processDeepestLevel(BneSAXUploader.java:2346)
      at oracle.apps.bne.integrator.upload.BneSAXUploader.startElement(BneSAXUploader.java:1182)
      at oracle.xml.parser.v2.XMLContentHandler.startElement(XMLContentHandler.java:181)
      at oracle.xml.parser.v2.NonValidatingParser.parseElement(NonValidatingParser.java:1288)
      at oracle.xml.parser.v2.NonValidatingParser.parseRootElement(NonValidatingParser.java:336)
      at oracle.xml.parser.v2.NonValidatingParser.parseDocument(NonValidatingParser.java:303)
      at oracle.xml.parser.v2.XMLParser.parse(XMLParser.java:234)
      at oracle.apps.bne.integrator.upload.BneUploader.processUpload(BneUploader.java:301)
      at oracle.apps.bne.integrator.upload.BneAbstractUploader.processUpload(BneAbstractUploader.java:114)
      at oracle.apps.bne.integrator.upload.async.BneAsyncUploadThread.run(BneAsyncUploadThread.java:140)
    12/10/13 2:52 PM AJPRequestHandler-HTTPThreadGroup-5 WARNING        BneOracleWebAppsContext.getTimeZone CLIENT_TIMEZONE_ID has not been set
    12/10/13 2:52 PM AJPRequestHandler-HTTPThreadGroup-5 ERROR          BneOracleWebAppsContext.getExtraJDBCConnection recieved the same connection as the base connection.  There may be transaction problems.
    How to show the same error in the excel template?
    Here is the package:
    CREATE OR REPLACE PACKAGE BODY APPS.XXPO_COSTFACTS_WEBADI_PKG
    AS
       PROCEDURE upload_data (
                              P_CONTAINER_ID IN VARCHAR2
                            , P_SAIL_DATE IN DATE
                            , P_PO_NO IN VARCHAR2                     
                             ) IS
        --declare
        lv_err_msg      VARCHAR2(240);
        lf_err_flag     NUMBER := 0;
        ln_temp         NUMBER;
        BEGIN
        --------------------- checking for mandatory parameters---------------------------
          IF (P_CONTAINER_ID IS NULL) THEN
             lf_err_flag := 1;
             lv_err_msg := lv_err_msg||'-'||'Please enter CONTAINER_ID - ';
          END IF;
          -------------Validation for Sail Date Format----------------------
          IF (P_SAIL_DATE IS NULL) THEN
             lf_err_flag := 1;
             lv_err_msg := lv_err_msg || ' ' || 'Enter Sail Date - ';
          ELSE
             BEGIN
                SELECT 1
                  INTO ln_temp
                  FROM DUAL
                 WHERE P_SAIL_DATE =  TO_DATE (TO_CHAR (P_SAIL_DATE, 'DD-MON-YYYY'), 'DD-MM-YYYY');
             EXCEPTION
                WHEN NO_DATA_FOUND THEN
                   lf_err_flag := 1;
                   lv_err_msg := lv_err_msg || ' Enter Sail date in DD-MON-YYYY Format';
                WHEN OTHERS THEN
                   lf_err_flag := 1;
                   lv_err_msg := lv_err_msg || ' Enter Sail date in DD-MON-YYYY Format'|| SQLERRM;
             END;
          END IF;
          -------------Validation for PO_Number----------------------
          IF (P_PO_NO IS NULL) THEN
             lf_err_flag := 1;
             lv_err_msg := lv_err_msg || ' ' || 'Enter PO_NO - ';
          ELSE
             BEGIN
                SELECT count(1)
                  INTO ln_temp
                  FROM PO_HEADERS
                 WHERE Attribute4 =  P_PO_NO;
             EXCEPTION
                WHEN NO_DATA_FOUND THEN
                   lf_err_flag := 1;
                   lv_err_msg := lv_err_msg || ' No Oracle PO for Biceps PO#'||P_PO_NO;
                WHEN OTHERS THEN
                   lf_err_flag := 1;
                   lv_err_msg := lv_err_msg || ' Error getting the Oracle PO for Bicpes PO#'||P_PO_NO||' Error-' || SQLERRM;
             END;
          END IF;
         -----------------------Insert Record----------------------------
         IF lv_err_msg is NULL THEN
         BEGIN
             INSERT
              INTO XXP2P_HW_COST_FACTORS_STG
                     CONTAINER_ID
                    ,SAIL_DATE
                    ,PO_NO
                    , ERROR_FLAG
                    , ERROR_MSG
                   ,CREATED_BY
                    ,CREATION_DATE
                    ,LAST_UPDATED_BY
                    ,LAST_UPDATE_DATE
                    ,LAST_UPDATE_LOGIN              
                VALUES
                     P_CONTAINER_ID
                    ,P_SAIL_DATE
                    ,P_PO_NO              
                    ,lf_err_flag
                    ,lv_err_msg
                  ,FND_GLOBAL.USER_ID
                    , trunc (sysdate)
                    ,FND_GLOBAL.USER_ID
                    , trunc (sysdate)
                    ,FND_GLOBAL.LOGIN_ID              
                  --  commit;
                  DBMS_OUTPUT.put_line
                    '-' || 'After ap_invoices_interface'
            EXCEPTION
            WHEN OTHERS THEN
              ROLLBACK;
              lf_err_flag := 1;
              lv_err_msg  := lv_err_msg || ' ' || 'error loading CONTAINER_ID-' || P_CONTAINER_ID || SQLERRM;
              raise_application_error(-20001, lv_err_msg);
            END;
        ELSE
              raise_application_error(-20001, lv_err_msg);
        END IF;
      END upload_data;                        
    END XXPO_COSTFACTS_WEBADI_PKG;

  • Capturing Runtime Error Messages From ODI (Sunopsis) Operator

    Hi
    I have following question
    1) I want to capture error message of an activity that has failed during execution
    I have created a variable and used following query to capture it
    select T.TXT
    from <%=odiRef.getObjectName("L","SNP_EXP_TXT","D")%> T,
    <%=odiRef.getObjectName("L","SNP_STEP_LOG","D")%> S
    where S.SESS_NO = <%=odiRef.getSession("SESS_NO")%>
    and S.I_TXT_STEP_MESS = T.I_TXT
    order by T.TXT_ORD asc
    unfortunatly am not getting entire error message ,instead am getting first row of the error from SNP_EXP_TXT table.How to get entire error message in a variable.
    2) How can we know scenario name if we know session number?
    Please provide your inputs
    Thanks
    Baji

    Hi,
    Don't use this query, it won't work.
    Use the API GetPrevStepLog, it is simple and better...
    Take a look at:
    Use the http://www.oracle.com/technology/products/oracle-data-integrator/10.1.3/htdocs/documentation/oracledi_api_reference.pdf
    For the session name, just use getSession() Method ( too is at the pdf)
    I hope be helpful.
    Cezar
    Edited by: Cezar Santos on 21/11/2008 09:16

  • Capturing the error messages generated by ALV Grid

    Hi,
    I have a ALV Grid, and a field date of DATS type.
    If i enter wrong date a message pops up with invalid date entry.
    How can i capture this error message in ALV Grid.

    Hi,
    Instead of displaying the error message directly, capture the message into a string variable and display it along with the grid display.
    Thanks,
    Sri.

  • Please help me how concatenate all the error messages and send it as out parameter value.

    Hi Experts,
    Please help me how concatenate all the error messages and send it as out parameter value.
    Thanks.

    Agree with Billy, exception handling is not something that is done by passing parameters around.
    PL/SQL, like other languages, provides a suitable exception handling mechanism which, if used properly, works completely fine.  Avoid misuing PL/SQL by trying to implement some other way of handling them.

  • How to customize the error messages in web analysis reports

    Does anyone know how to customize the error messages that web analysis shows ,
    I want to customize the below error message with a custom error message
    "Document does not exist or no authorization to open document.Error occurred while loading document"
    Does anyone know how to do this ?

    Rajesh,
    you may want to check these links
    How to the Change the Application Stopped Message
    How to Change the Dispatcher Running, No Server Connected Message
    http://help.sap.com/saphelp_nw70/helpdata/en/65/18fc3f9ec4e669e10000000a155106/frameset.htm
    Thanks
    Bala Duvvuri

  • How can we trigger error message in BADI PARTNER_UPDATE

    Hi All,
    I have implemented a BADI PARTNER_UPDATE. In this I have validation ( Error Message ) on saving buisness partner.
    It is giving the error message but it freeze all the fields. On pressing enter it goes for short dump.
    In short dump it gives error The COMMIT WORK processing must not be interrupted.
    Kindly suggest me that how can we pass error message and it also does not freeze the fields.
    Regards,
    Narendra Goyal

    Hi Narendra,
                          How are you trying to display message.
    Is it using message service class instance of message statement (which should not be used, as that is for GUI messages) or using collect FM or by adding to genil message class container.
      Please try different approaches and see what works for you.
    Thanks,
    Rohit

  • How to fix this error message The backup disk image "/Volumes/AirPort Disk/FARES DEL VALLE's iMac.sparsebundle" could not be accessed (error -1).

    how to fix this error message The backup disk image “/Volumes/AirPort Disk/FARES DEL VALLE’s iMac.sparsebundle” could not be accessed (error -1).

    The troubleshooting C17 is the specific article.
    http://pondini.org/TM/Troubleshooting.html
    This is generally a Lion error.. and you will need 5.6 utility to get access to the disk area.
    So download the real utility. Run it instead of v6 toy version.
    http://support.apple.com/kb/DL1482
    Go to the manual setup, disk page and click on disconnect all users.. that will unmount all users connected to the disk and allow it to start working. But there are a number of other issues that are possible cause. Pondini lists some of them.

  • How to populate a Error message in WebUI Screen

    Dear Experts,
    I have a small issue in Lead creation screen. I need to restrict the followup document if the lead end date is lesser than the system date, if the end date lesser than the system date system should through a error message in web Ui Screen and the lead follow up creation should be stoped.
    We found an enhancement spot in backend(GUI) of lead creation we raised the error message in the backend screen. Here its working fine, But we are not able to get any error message in WebUI lead creation screen.
    We written the code in CREATE_ORDER Method of lead creation in GUI ( tcode : CRMD_ORDER). We tried to debug the program using external debuger from webui but its not getting triggered.
    Pls suggest me, how to raise a error message for WEBUI lead follow up creation validation.
    Kindly do the needful.
    Reg,
    Anandhan

    HI Anandhan,
    Try this way,
    This should work.
    lr_global_messages type ref to cl_crm_genil_global_mess_cont,
            lr_core                 type ref to cl_crm_bol_core,
      "Instantiate the error message class.
      lr_core = cl_crm_bol_core=>get_instance( ).
      if lr_core is bound.
        lr_global_messages ?= lr_core->get_global_message_cont( ).
      endif.
            if lr_global_messages is bound.
              call method lr_global_messages->add_message
                exporting
                  iv_msg_type       = lv_msg_type
                  iv_msg_id         = '
                  iv_msg_number     =
                  iv_show_only_once = 'X'
                  iv_msg_v1         =
                  iv_msg_v2         =
            endif.

  • The exception error message was: oracle.jbo.NoDefException: JBO-25002: Defi

    Hi,
    I added a DFF through create item "flex" in iRecruitment (View applicants page).I am getting the following message:
    "The flexfield listener failed while getting the value for segment Job Title from column ASS_ATTRIBUTE1 of the descriptive flexfield with application short name PER and name PER_ASSIGNMENTS. Please contact your system administrator. The exception error message was: oracle.jbo.NoDefException: JBO-25002: Definition AssAttribute1 of type Attribute not found".
    Regards
    Radhika

    Check the DFF you have added according to the error message to confirm that it is setup properly and compiled.
    --Shiv                                                                                                                                                                                                                                               

  • How to display an error message after validation in Formatted Search?

    Hi SBO experts,
    if an error is detected on validation in a Formatted Search, how to display an error message to the user entering the data?
    Thanks & Regards,
    Raghu Iyer

    i created a formatted search query & attached it to the field 'Quantity' at Line Item level in Sales Order screen. just for testing purpose, i eneterd the following code lines in the query validating 'Quantity'
    if $[$38.11.0] > 50
    begin
    select @error = 1
    select @error_message = 'Vendor code cannot begin to X sign.'
    end
    the system throws the error : Internal error (8180) occurred [Message 131-183]
    actually, i need to display an error message to the user if Quantity is not in multiples of the OITM.SalFactor2
    if $[$38.11.0] % (SELECT T0.[SalFactor2] FROM OITM T0 WHERE T0.[ItemCode]  = $[$38.1.0]) > 0
    begin
    select @error = 1
    select @error_message = 'Error in Quantity.'
    end
    but, this expression to get the remainder itself seems to have some error
    $[$38.11.0] % (SELECT T0.[SalFactor2] FROM OITM T0 WHERE T0.[ItemCode]  = $[$38.1.0])
    i guess, % operator is used for modulo (to find the remainder of one number divided by another.) ? am i right ?
    Regards,
    Raghu Iyer

  • How to display an error Message in Web Dynpro

    Hello,
    I want to display an error message in Web Dynpro. I'm using this,
    IWDMessageManager message = wdComponentAPI.getMessageManager();
    message.reportSuccess("<some relevant debug message>");
    However, the message is always shown at the bottom of the screen. It is possible to select the location in the screen for showing this object? Or what is the best way for doing this? I've tried to use a Label but I can't set the type (warning, error, info) it's only a message.
    Thanks
    Regards
    SU

    Hi,
    If you include the UI, it will display at the top of the screen..
    Please see below how to create a message in the message editor.
    http://help.sap.com/saphelp_nw04/helpdata/en/72/1d6526263ff24995016a152705eab2/frameset.htm
    and this is how you access the error message in the application ti display it to the end user
    http://help.sap.com/saphelp_nw04/helpdata/en/72/1d6526263ff24995016a152705eab2/frameset.htm
    Regards,
    Ganesh N

  • How to display an error message on screen?

    Hi experts,
    In screen painter, how to display an error message in the message area just below the screen?
    Thanks!

    hi wuyia,.
    Write like this;
    Message 'Process completed Successfuly' TYPE 'S'.
    Message 'Want to Overwrite Value' TYPE 'W'.
    Message 'Press enter to continue' TYPE 'I'.
    Message 'Invalid Input' TYPE 'E'.
    S - Success
    W - Warning
    I - Information
    E - Error
    You can adjust your GUI option to display the message in a Popup or in the status bar.
    Regards
    Karthik D

  • How to configure a error message

    Hello,
    I have a User bean that hold informations about a user login ( login and password ). I write a method protected String logon() that search if the login and the password entered by the user match with those stored in a database. If not, i would like to add an error message to the FacesContext and so return null value.
    My question is : how to add an error message to the FacesContext and so to get it in the current page.
    Thanks

    Hi flam70,
    well, in my opinion you should do any access to your business logic in an action class and in the invoke application phase and not in the validation phase.
    Your Action class returns e.g. "success" if the user passed the authentication and "null" if not (if jsf gets null value it returns on the same page back)
    To put the error message into context you may do following:
    In the invoke() Method of your Action class do authentication against your database.
    If it fails, use the component(s) that were wrong for the error message(ids e.g. "username" and "password").
    Add the message into context:
    context.addMessage(nameComponent, new MessageImpl(Message.SEVERITY_INFO, "Username not found !", "LoginError"));
    context.addMessage(passwordComponent, new MessageImpl(Message.SEVERITY_INFO, "Password wrong !", "LoginError"));
    On your jsp page you use the error tag:
    <h:output_errors for="username" />
    <h:output_errors for="password" />
    Greetings,
    Rene

Maybe you are looking for

  • How do I get Keynote from Mac to a Dell?

    After intending to for over a year and actually working on a Keynote presentation for many months, I finally finished the project last week. My intent has been that when I'm done that I'd convert to Power Point and display all my work on a Dell PC in

  • MDM Item Details iView modification

    Hello, We have a requirement to implement custom functionality for some of the fields when using the standard Item Details iView. Is there a way to do the following: Currently the field in question has a popup functionality that is standard for the i

  • How to debug payment advice program

    Hi experts, iI copied program from RFFOUS_C and named as ZRFFOUS_C. payment advice is printing through ( ZRFFOUS_C) this program? If yes  how to debug this program ?.I want to konw the values printing in payment advice sheet  came from which subrouti

  • Flash Website Design Help!

    I want to convert my website i use for my computer repair business into a full on blown out flash site. my problem is i know nothing about flash. not even the basics! i need help and resources on where i can go or do to learn the basics and turn my i

  • How do I find if an R/3 field is in a BW Cube?

    I have a PP BW question I was wondering if anyone knew the answer too.  We are trying to find out if the field VGW02 is available in one of the PP cubes.  This is the MACHINE TIME field from the Routing: Operation Details (CA03 tcode).  Do you know h