How to get short text of a exception thrown by abap rfc

Hi buddy,
I use jco to communicate with backend, an abap function module will raise a exception. I can catch that exception,
The example exception is:
<b>Exception</b>     <b>Short text</b>
Test                   This is exception test.
e.getKey()
will return TEST.
Does any know how to get that short text "This is exception test." from the exception I caught?
Thanks
Austin

Hi Austin,
There are 2 methods to raise errors in function modules.
1) Using the raise Exception statement
2) Using a return structure like BAPIRET to populate the message details like type, error number, error text etc.
Generally method 1 is not recommended for any RFC/BAPI function modules because it causes the calling program to crash if the function raises an exception. Method 2 is the recommended way and is used in all standard BAPI's. ABAP programmers are advised to code RFC's as per method 2, but some times it would not be possible as the function would already be used and could be barred from changes.
But whatever method the RFC uses to raise an exception, web dynpro can handle it in the following ways,
Method 1) If the RFC raises an exception using RAISE EXCEPTION,
Dont catch Exception class in your code, instead do the following,
catch (WDDynamicRFCExecuteException e) {
                  wdComponentAPI.getMessageManager().reportException(
                        e.getLocalizedMessage(),
                        true);
Method 2) If the function returns the errors in the standard bapi return structure, you can do the following
            IWDMessageManager MsgMgr = wdComponentAPI.getMessageManager();
            for (int i = 0; i < ReturnNode.size(); i++) {
                  if (Types.indexOf("S") != -1
                        && ReturnNode.getElementAt(i).getAttributeAsText("Type").equals(
                              "S"))
                        MsgMgr.reportSuccess(
                              ReturnNode.getElementAt(i).getAttributeAsText("Message"));
                  if (Types.indexOf("W") != -1
                        && ReturnNode.getElementAt(i).getAttributeAsText("Type").equals(
                              "W"))
                        MsgMgr.reportWarning(
                              ReturnNode.getElementAt(i).getAttributeAsText("Message"));
                  if (Types.indexOf("E") != -1
                        && ReturnNode.getElementAt(i).getAttributeAsText("Type").equals(
                              "E"))
                        MsgMgr.reportWarning(
                              ReturnNode.getElementAt(i).getAttributeAsText("Message"));

Similar Messages

  • How to get the Text name to pass in the  parameter header in save_text

    Hi,
      I am trying to change the long text of operation for historical order by using the flat file.I am using the save_text to do this.I would like to know how  to get the text name in order to pass the parameter header in save_text.
      I went to the tcode iw62 to get the header information of the long text.300100000009200000001
    i would like to know what this 1000000092 indicates and where is this value updated in the table so that i can link it thru the order no  to get the link and pass it in the text_name.
      can anyone help me out?
    krishnan

    Hi,
    Your query is.
    I went to the tcode iw62 to get the header information of the long text.300100000009200000001
    i would like to know what this 1000000092 indicates
    In above number
    300 - Client
    1000000092 - AUFPL - Routing number of operations in the order (You can fetch this from table HIVG)
    00000001 - APLZL - General counter for order ( You can fetch this from table HIVG).
    BR,
    Vijay

  • How to get the text present in JTextArea

    i am writing application for some system to be computerised and i am not getting how to get the text present in text area and set it into database...can anybody suggest me solution??

    You must have named the TextArea like
    JTextArea textArea;so, use the getText() method like
    String strTextAreaContents = textArea.getText();You can then use JDBC to connect to the database that you want and save your contents that is now in strTextAreaContents.
    -- Srikanth

  • How to get Sales Text & Purchase Order Text in MM based on (MSEG-MATNR)

    Hi
      Am working on a Report based on Purchase order & Sales, Could any body tell How to get Sales Text & Purchase Order Text in MM based on (MSEG-MATNR).
    the Field i need to get are : SALES TEXT, PO TEXT.
    Sunil.

    Hi Sunil,
    For getting Material PO text and sales text, you have to rely on Purchase Order and Sales Order. And use READ_TEXT function module to fetch the text.
    Below are examples of PO text and Sales Text:
    1. PO text:
        CALL FUNCTION 'READ_TEXT'
         EXPORT
           ID = 'F03'
           LANGUAGE = SY-LANGU
           NAME = '450000011200010' conacte PO number and line item number
           OBJECT = 'EKPO'
         TABLES
           LINES = INT_TLINES "you will get text in this table
    2. Sales order text:
            CALL FUNCTION 'READ_TEXT'
         EXPORT
           ID = '0001'
           LANGUAGE = SY-LANGU
           NAME = '0000000036000010' conacte SO number and line item number
           OBJECT = 'VBBP'
         TABLES
           LINES = INT_TLINES "you will get text in this table
    ref: STXH and STXL tables.
    Hope it will solve the problem.
    Regards
    Krishnendu

  • How to get the 'text' property value of a button in coding?

    Hi Experts,
    I'm using 10 buttons all are having common action('click'). when i click a button the 'text' value of the button should pass to a function.So the action is same but the passed value will be the 'text' value of the corresponding button.  I don't know how to get the 'text' property of a button in coding. Kindly help me to solve this problem.
    Thanks and Regards
    Basheer

    Hi,
    My event is like this.
    public void onActionclick(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
         String s =  ?  ; // should get the 'text' property of clicked button
         fillInput(s);     // function to be called
    The called function is,
    public void fillInput( java.lang.String id )
        String str=wdContext.currentContextElement().getNum();
        str = str + id;
        wdContext.currentContextElement().setNum(str);
    How can i get the 'text' property value of the corresponding button. Click action should be common to all buttons.
    Thanks and Regards,
    Basheer

  • How to get a text between two XML tags?

    Hello everybody!
    I've got a problem! How can I extract a text that is between tags, like <myTag> My text </myTag> I have no problem to get the attributes inside the tags, however, i don't know how to get some text that is between tags. Here is my xml:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <tangram_request service_id="3">
    <send keep_session="nada">
    <source></source>
    <destination>3196931566</destination>
    <channel_id>2</channel_id>
    <text>Teste ServerSocket!!!</text>
    </send>
    </tangram_request>
    Now, there's a fragment of my code, which gets some tags' attributes:
    DOMParser parser = new DOMParser();
    InputSource resp = new InputSource(new StringReader(XML));
    parser.parse(resp);
    Document doc = parser.getDocument();
    Node node =(doc.getElementsByTagName "tangram_request")).item(0);
    if (node instanceof Element)
    Element el = (Element) node;
    service_id = el.getAttribute("service_id");
    System.out.println("\n\nService_id="+service_id);
    }else{System.out.println("Erro");}
    node = (doc.getElementsByTagName("send")).item(0);
    if (node instanceof Element)
    Element el = (Element) node;
    keep_session = el.getAttribute("keep_session");
    System.out.println("keep_session="+keep_session);
    }else{System.out.println("Erro");}
    Now, I want to get the texte between <destination> ... </destination>
    How could I do that?
    Thanks a lot
    Calegari

    Thanks... It worked fine!!!
    Now how can I get lots of <desctination>... I did something that haven't worked...
    node = (doc.getElementsByTagName("destination")).item(0);
    while(node.hasChildNodes())
    destination = node.removeChild(node.getFirstChild()).getNodeValue();
    System.out.println("destination="+destination);
    And now, my XML is like:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <tangram_request service_id="3">
    <send keep_session="nada">
    <source></source>
    <destination>3196931566</destination>
    <destination>3196931567</destination>
    <channel_id>2</channel_id>
    <text>Teste ServerSocket!!!</text>
    </send>
    </tangram_request>
    Thanks so much!
    Calegari

  • How to get the text in a label which is imbeded in a JTextPane

    I have created a JTextPane that has 5 JLabels inserted in the text. I have attempted to get the text with the following code snippet.
    Component[] lbl = new Componennt[DisplayLetterPane.getComponentCount()];
    //         JTextPane DisplayLetterPane; is defined previously
             lbl = DisplayLetterPane.getComponents();
             int componentIndex = 0;
             String lblText = new String(((JLabel)lbl[componentIndex]).getText());I have run a dump of the sytledDocument of the JTextPane and I see the JLabel listed as a component.
    When this snippet is executed I get the following:
    Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: javax.swing.text.ComponentView$Invalidator
    When I check the character where the component for the JLabel is located in the styled document it does not find an instanceof JLabel.
    How can I get the text from the labels.
    Thank you in advance!

    JTextPane jtp = new JTextPane();
              for (int i = 0; i <5; i++) {
                   jtp.add(new JLabel("labelText"+i));
              Component[] lbl = new Component[jtp.getComponentCount()];
    //      JTextPane DisplayLetterPane; is defined previously
          lbl = jtp.getComponents();
          int componentIndex = 0;
          for (int i = 0; i < lbl.length; i++) {
               System.out.println(((JLabel)lbl).getText());
    When I do like the above, it just works fine. Can u share a little bit more of your code?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How to get the text in module pool program after f4 help

    Hi to all experts,
    My required is to get the text of a field when the user clicks on the f4 help text should be populated automatically beside the field
    how to do it

    >
    > the screen name is defined as t528t-plstx and while passing im using the same name in the POV module after what could be the reason;
    Hi in the POV module, first read the dynpro filed for which a text has to be displayed  (using FM- DYNP_VALUES_READ)and then update your Text Description field uing  the FM -'DYNP_VALUES_UPDATE
        dynpfields-fieldname  = 'FNAME'.                  "FNAME is the field for which POV is called
        append dynpfields.
        repid = sy-repid.
      call function 'DYNP_VALUES_READ'
           exporting
                dyname     = sy-cprog
                dynumb     = sy-dynnr
           tables
                dynpfields = dynpfields
           exceptions
                others.
       read table dynpfields index 1.
       fname = dynpfields-fieldvalue.
    *Fetxh the Text field into a local varaible.
        l_plstx = XXXXXXX. 
        dynpfields-fieldname    = 'T528T-PLSTX'.
        dynpfields-fieldvalue   =  l_plstx.
        APPEND dynpfields .
        CALL FUNCTION 'DYNP_VALUES_UPDATE'
          EXPORTING
            dyname               = sy-repid
            dynumb               = sy-dynnr
          TABLES
            dynpfields           =  dynpfields.
    This will update your text field dynamically.
    Regards,
    Rajesh

  • Get short text of component in packing instruction

    Hi,
    i need to get the short text of Components tab in transaction POP3 (packing instruction). How can i do it?
    Best regards.

    As u r using T u need to use READ_TEXT and pass following..
    Language = E
    Text Id = 0001
    Text name = PACKINSTR
    Text object use FM VHUPODB_PACKOBJ_READ_EXT
    passing
    POBJID_I                        12        
    PACKTYP_I                       P         
    PRE_LOCK_MODE_I                 2         
    POST_LOCK_MODE_I                2         
    ALL_LANGU_I                     X         
    GET_ITEMS                       X         
    GET_TEXT                        X         
    concatenate PACKNR and HDCOUNT

  • How to get selected text values in a textarea by mouse click?

    Hi Everyone,
    What I am trying to do is to click on some texts in a textarea, then get the selected text value.
    If you guys have used an accounting software called Simply Accounting, you might understand better.
    I list all my customer names in a textarea. What I want is, when I click on one customer, another GUI pops up with this customer's information. My problem is that I don't know how to get the selected text value from a textarea.
    Could anyone give a hand here? Thank you in advance.

    Is there some reason you aren't using a JList or
    JTable to display
    the user names/information?Thank you for es5f2000's reply. You just gave me a better idea! There is not a particular reason I have to use TextArea to list my customers. As long as the component can make my idea alive, I definitely use it. Still, if there is any way to get a selected text value, it will help me a lot with my project. Thank you.

  • How to get textbox text inside Repeater based on specific row dropdownlist selection using JavaScript

    Hi All,
    I have dropdownlist and textbox controls inside repeater control. Suppose when i select specific dropdownlist i want get the value of selected item and mean while i want to get the textbox text which in the same row.
    <script type="text/javascript">
    var ddlType;
    function ddl(ddl) {
    ddlType = ddl.value;
    alert(ddlType);
    </script>
    <asp:Repeater ID="RepterDetails" runat="server"
    onitemdatabound="RepterDetails_ItemDataBound"
    onitemcommand="RepterDetails_ItemCommand" >
    <ItemTemplate>
    <tr>
    <td>
    <asp:DropDownList ID="ddlTypeName" runat="server" onchange="ddl(this)"></asp:DropDownList>
    </td>
    <td>
    <asp:TextBox ID="txtCode" runat="server" Text='<%#Eval("otaRoomTypeCode") %>' />
    </td>
    </tr>
    </ItemTemplate>
    </asp:Repeater>
    Using the javascript i got the selected dropdownlist selected value, how to get the textbox text which is in the same row.
    Please give me advice and please find the repeater control screenshot.
    Thanking You, Nagendra.

    This forum if for C# issues, please move your post to asp.net forum:  http://forums.asp.net/
    Thanks
    Fouad Roumieh

  • How to get the text field in the header for only first page of the report

    Hi,
    I am developing reports in BI Publisher Enterprise where i am facing problem i.e., i have to get some text field in header,for only first page in the result but it is displaying in all the other pages of the report in result.So,please if you have any idea of how to solve it, please reply.It is required as early as possible.
    Thanks in Advance

    Invalid path? What are you doing? Writing the report output to an invalid directory?
    Where are your terms and conditions? It would be very easy just to put them in a database table and select them in your report query.

  • How to get Long text in report from FBL3N

    Hi,
    I need to get Long Text from FBL3N (G/L Account Line Item Display) in my report.Can anyone tell me in which table it is stored?

    Hi
    These long texts are not stored completely in any tables
    where as the parameters of these texts like OBJECT,OBJECTNAME and ID, LANGUAGE are stored in STXH table
    You have to pass these 4 parameters to the fun module READ_TEXT and to fetch the text.
    Double click on the long text will goes to text editor
    from menu GOTO-> HEADER  you will see the above 4 paramters
    see the doc of READ_TEXT fun module
    READ_TEXT
    READ_TEXT provides a text for the application program in the specified work areas.
    The function module reads the desired text from the text file, the text memory, or the archive. You must fully specify the text using OBJECT, NAME, ID, and LANGUAGE. An internal work area can hold only one text; therefore, generic specifications are not allowed with these options.
    After successful reading, the system places header information and text lines into the work areas specified with HEADER and LINES.
    If a reference text is used, SAPscript automatically processes the reference chain and provides the text lines found in the text at the end of the chain. If an error occurs, the system leaves the function module and triggers the exception REFERENCE_CHECK.
    Function call:
    CALL FUNCTION 'READ_TEXT'
    EXPORTING CLIENT = SY-MANDT
    OBJECT = ?...
    NAME = ?...
    ID = ?...
    LANGUAGE = ?...
    ARCHIVE_HANDLE = 0
    IMPORTING HEADER =
    TABLES LINES = ?...
    EXCEPTIONS ID =
    LANGUAGE =
    NAME =
    NOT_FOUND =
    OBJECT =
    REFERENCE_CHECK =
    WRONG_ACCESS_TO_ARCHIVE =
    Export parameters:
    CLIENT
    Specify the client under which the text is stored. If you omit this parameter, the system uses the current client as default.
    Reference field: SY-MANDT
    Default value: SY-MANDT
    OBJECT
    Enter the name of the text object to which the text is allocated. Table TTXOB contains the valid objects.
    Reference field: THEAD-TDOBJECT
    NAME
    Enter the name of the text module. The name may be up to 70 characters long. Its internal structure depends on the text object used.
    Reference field: THEAD-TDNAME
    ID
    Enter the text ID of the text module. Table TTXID contains the valid text IDs, depending on the text object.
    Reference field: THEAD-TDID
    LANGUAGE
    Enter the language key of the text module. The system accepts only languages that are defined in table T002.
    Reference field: THEAD-TDSPRAS
    ARCHIVE_HANDLE
    If you want to read the text from the archive, you must enter a handle here. The system uses it to access the archive. You can create the handle using the function module ACHIVE_OPEN_FOR_READ.
    The value '0' indicates that you do not want to read the text from the archive.
    Reference field: SY-TABIX
    Default value: 0
    Import parameters:
    HEADER
    If the system finds the desired text, it returns the text header in this parameter.
    Structure: THEAD
    Table parameters:
    LINES
    The table contains all text lines that belong to the text read.
    Structure: TLINE
    Exceptions:
    ID
    The text ID specified in the parameter ID does not exist in table TTXID. It must be defined there together with the object of the text module.
    LANGUAGE
    The parameter LANGUAGE contains a language key that does not exist in table T002.
    NAME
    The parameter NAME contains the name of a text module that does not correspond to the SAPscript conventions.
    Possible errors:
    The field contains only blanks.
    The field contains the invalid characters ‘*’ or ‘,’.
    OBJECT
    The parameter OBJECT contains the name of a text object that does not exist in table TTXOB.
    NOT_FOUND
    The system did not find the specified text module.
    REFERENCE_CHECK
    The text module to be read has no text lines of its own but refers to the lines of another text module. This reference chain can include several levels. For the current text, the chain is interrupted, that is, one of the text modules referred to in the chain no longer exists.
    WRONG_ACCESS_ TO_ARCHIVE
    The exception WRONG_ACCESS_TO_ARCHIVE is triggered if an archive is accessed using an incorrect or non-existing archive handle or an incorrect mode (that is, read if the archive is open for writing or vice versa).
    <b>Reward points for useful Answers</b>
    Regards
    Anji

  • How to get the text which was clicked in  a A href tag.

    I am displaying the names from database in a page as hyperlink. When this hyperlink is clicked I want to display the corresponding address from DB. What the problem is when the link is clicked how to get the name which is clicked. I know only to link to a page using href. Now I want the text which has been clicked. Pls help.

    Sorry to interrupt here!
    For the code you suggested:
    David,
    if the target path is "http://localhost/testing.jsp", then
    the code would become:
    David.
    So what would the difference between the code shown above and this code:
    David
    What is the function for these two symbols: "<<" and ">>"?

  • How to get Vendor Text in BBP_POC in SRM for Smartforms?

    Hi Guys,
    I kept looking for ways on how to get the Vendor Text in BBP_POC transaction to be used in our Zsmartforms; unfortunately, I was not able to identify how.
    In ECC system, I could get the long text through double-clicking on the text area and go to GOTO>HEADER>Technical name (TEXTID, Langu, etc).
    How about in SRM PO (BBP_POC)?
    Please suggest some ways.
    Thanks and regards,
    Reymar

    I used some GET_DETAIL FMs to get the vendor text.

Maybe you are looking for

  • A suggestion for next 5800XM firmware update

    I hear all the time people wants widgets on their homescreen. i'm not sure if this the waht i really miss there. instead i will be much more happy if i could have the contact bar above (and more than 4 contacts, at least 6-7 which we could roll left/

  • How to access a remote site in dreamweaver

    This might seem like a simple question, but i just downloaded DW as a trial, and want to try it out before buying. Now I've done the remote site set up and tested and it says it can connect to my remote site. But I want to now go to the site, log in,

  • KM Subscription not always sending email notifications

    Experts, We are running EP 7.0 SP18.  We noticed recently that when certain users post forms or documents to folders that have a subscription on it, an email notification is not always sent.  We get email notifications for some users, but not others.

  • Problem with repairing Lion

    A week ago my MacBook Pro was running slow, so I turned it off. When I tried to turn it back on it wouldn't. I took my mac to the local Geek Squad and he told me to boot it up holding option (same as holding command+R). When I do this I click on Repa

  • Sending MAIL on particular date in APEX 4.1

    Hello all, I want send mail automatically on the basis of a date column in my table. whenever that date is the current date of the system a mail should be sent to user? Please help me with this.