Using the XML returned by XI to populate table in Web Dynpro UI

Hi,
In Web Dynpro,I have a scenario where i have to generate reports. For this, I enter the "Customer number", "Date" & "Item No" in 'Generate report' page  and hit the "submit" button. These details are sent as XML to XI which interacts with the ABAP R/3 system, performs the search and returns the search results as an XML
Now, I want to display search results contained in this XML by populating it in a table.
From, the point where the XML is returned by XI, could you please tell me the step by step process to populate this XML in a table. Please include code, if any.
Kindly help.

Hello Sandeep,
Create context node with following strucure:
<i>
result
-CustomerNumber
-ItemNumber
-Material
-OrderDate</i>
Create data handler:
public class XIDataHandler extends DefaultHandler {
     private String lastAttribute;
     private IWDNodeElement newElement;
     public void startElement(String namespaceURI, String localName, String rawName, Attributes atts) {
          if ("Result".equals(localName)) {
               newElement = wdContext.createResultElement();
               wdContext.nodeResult().addElement(newElement);
          } else {
               if(null!=newElement)
                    lastAttribute = localName.trim();
     public void endElement(String namespaceURI, String localName, String rawName) {
          if ("Result".equals(localName)) {
               newElement = null;
               lastAttribute = null;
     public void characters(char[] data, int off, int length) {
          if(null!=newElement && null!=lastAttribute) {
               final String value = new String(data, off, length).trim();
               if(!"".equals(value)) {
                    newElement.setAttributeValue(lastAttribute, value);
And parse XML in appropriate place within your application:
try {
     SAXParserFactory factory = SAXParserFactory.newInstance();
     SAXParser parser = factory.newSAXParser();
     //Loading XML from string (XI_DOCUMENT), change if source differs
     StringReader sr = new StringReader(XI_DOCUMENT.trim());
     InputSource is = new InputSource(sr);
     parser.parse(is, new XIDataHandler());
} catch (Exception e) {
     final StringWriter sw = new StringWriter();
     final PrintWriter pw = new PrintWriter(sw);
     e.printStackTrace(pw);
     wdComponentAPI.getMessageManager().reportException(sw.toString(), true);
Create table and table columns and map your context to it.
Best regards, Maksim rashchynski.

Similar Messages

  • How to send job postings to multiple third party sites using the XML output

    Dear Friends,
    We are Implementing Irecruitment for our client, Client requirement is how can we send job postings to multiple third party sites using the XML output from i-Recruitment
    With regards
    Surya
    .

    Can you be more specific about your Requirement. In General, Please navigate to iRecruitment Recruiter Responisbility.
    Then Select, Setup > Recruiting Sites. Here, you can configure your Third Party Websites information and attach stylesheets. The default mode oracle sends the vacancy information is HR-XML Format.
    If you would like to select more sites information select "Add Another Row".
    Then, you can see this information while "New Vacancy Creation Process".
    iRecruiter.
    Edited by: iRecruiter on Oct 18, 2009 7:43 AM

  • HOW TO: Use the XML parser in Oracle 8.1.7

    I am trying to figure out how to use the xml parser provided in oracle 8.1.7. all i want to do is parse a xml report that is defined using a schema, and place the data into the proper tables. i am totally unfamiliar with the xml parser and how it works. i have done some reading on the subject, but seem to be getting some conflicting infromation about which utilites i need and how to invoke them. can someone please tell me what utilities i need, how to invoke them, and what i need to do to get a xml document to parse and insert to a table? I would greatly appreciate any help anybody could offer. thanks.

    You can parse the XML Document with XML Parser and place the data into database using XSU(XML SQL Utility).
    Both of these are included in XDK for Java at:
    http://otn.oracle.com/tech/xml/xdk_java
    The following document could also help:
    Oracle9i XML Developer's Guide--XDK [PDF] at http://otn.oracle.com/tech/xml/doc.html

  • Can I use the value returned from a Text Function in another Formula?

    I'm writing a report in Hyperion System 9 BI + Financial Reporting Studio version 9.2. I have 2 grids in my report.
    Grid1 Column A is set up as a text function using the function type - <<GetCell("Grid2", 1, a, 1)>>. I would like to use the values returned from this text function in Column A (Grid 1) in a formula in Column B (Grid 1).
    Is it possible to use the values returned in Column A of the text function in another formula? My report does not seem to recognize Column A as numerical values, even though the values to be returned are numerical.
    If so, how do I recognize the values in Column A Grid 1 as numerical values and not text?
    Thanks for any help you can offer!

    Hi Edson,
    Yes you need to use the CALC_ERROR macro function to be able to test whether the last macro function returned an error. CALC_ERROR will return an 'X' if there an error occured during the execution of the last macro function.
    You can use a macro similar to the following:
    IF
      CALC_ERROR( )
      = 'X'
          DO SOMETHING HERE
    ENDIF
    Let me explain how this works internally. The SAP system maintains a global variable g_flg_calc_error during the execution of macros in the planning book. The g_flg_calc_error variable will contain the value of f_calc_error that was set by the last macro function which executed. The ABAP coding of a planning book is something like this:
    data: g_flg_calc_error type /SAPAPO/FLAG.
    * SAP will pass g_flg_calc_error variable to all macro
    * functions. When SAP calls a macro function, it does
    * something like this.
    call function '/SAPAPO/MACRO_FUNCTION_HERE'
            exporting
              plob_values      = i_s_adv_plob_values
              sdp_book         = g_c_advf_sdp_book
              sdp_view         = g_c_advf_sdp_view
            tables
              cols_index       = i_t_cols
              value_tab        = l_t_value_tab
            changing
              f_calc_error     = g_flg_calc_error
    As you can see, the g_flg_calc_error variable
    is passed in the "changing" part of the call. The macro  function being called can then use the f_calc_error
    variable to change the value of the global
    g_flg_calc_error variable. In fact, the macro function being called can also check (by looking at the f_calc_error variable) if the last macro function reported an error.  The CALC_ERROR macro function just checks the value of f_calc_error parameter (w/c in fact is the value of the g_flg_calc_error variable) and returns "true/X" if the f_calc_error was set to true by the last macro function.
    Hope this helps in clearing things out

  • Connect to SharePoint web service using the XML / Web Service connector

    Hi experts,
    I am currently trying to display my SharePoint list in Crystal Report. Therefore my plan is to use a SharePoint web service to get the data and paste them to the Crystal Report.
    Is it possible to use the "XML and Web services" connector of the Crystal Reports database expert?
    When I enter the web service URL, for instance:
    https://[url]/_vti_bin/lists.asmx?wsdl
    and click next... I have to enter the web service credentials.
    On the next page I have to enter Service, Port and Method.
    Do I have to enter the service URL again here?
    What If, there is no port? Can I leave that field empty?
    I know the methods, but where can I add the mandatory parameters?
    Thanks for any helps and comments!
    Sebastian

    Hi Ananth,
    thank you, but this document does not help at all.
    We are using Crystal Reports 2008 SP2.
    We want to use the Web Service Connector.
    What I need is more informationen about the Web service connect. For example - the connection in Microsoft InfoPath is much easier - there I don't have to enter a port and can choose the methods from a list.
    Is it possible to use the Crystal web service connector for MS SharePoint Webservices?
    Or must I use the Crystal SDK to carry out a connection?
    Best regards,
    Sebastian

  • I can't open my mail unless I use the Enter/Return key or go to the File -Open Message

    Up until yesterday I could open an email just by double clicking the message. Now if I want to open a message I have to use the Enter/Return key or go into FILE and press Open Message.
    The only thing different since yesterday morning is that I decided to turn off File Vault --that process took all day but finally finished and that's when I ran into problems with mail.
    I've checked my mail settings and they are the same as before. Have OSX Yosemite 10.10.1 installed.

    ''SuperSluether [[#answer-671002|said]]''
    <blockquote>
    Is this problem in Firefox? It sounds as if you are referring to an email program such as Apple Mail or Mozilla Thunderbird. As far as I know, you can't open emails in Firefox with File > Open Message because there is no such option.
    </blockquote>
    Thank you for your response. I finally found out why this was happening. It had to do with the Trackpad settings for my Mac. I adjusted the track speed to a slower speed as it was set quite fast. This seems to have fixed the problem :)
    I’m not too computer savy so sometimes things can be a little confusing trying to figure out whats what and where to look for solutions.
    Thank you

  • Should I use the object returned from em.merge()

    I am still confused how to use em.merge() correctly. I need to know if I should use the result of em.merge().
    PersistentObject obj = new PersistentObject();
    obj.setSomething("Value#1");
    // Should I do this and continue to use the object returned from merge().
    obj = em.merge(obj);
    obj.setSomething("Value#2");

    Chris,
    First thanks for your and your teams awesome support.
    The reason I always get confused with merge() is my misunderstanding about how clones and caching are handled. Let me give you 2 scenerios and could you tell me what the problems are, is any?
    Scenerio #1: (using return from merge)
    -- Start of Transaction #1
    EntityObject obj = new EntityObject();
    obj.setName("chris");
    obj = em.merge(obj);
    -- End of Transaction #1
    -- Start of Transaction #2
    obj.setName("scott");
    obj = em.merge(obj);
    -- End of Transaction #2
    Is this ok, will I lose data, are the clones and cache ok?
    Scenerio #2: (NOT using return from merge)
    -- Start of Transaction #1
    EntityObject obj = new EntityObject();
    obj.setName("chris");
    em.merge(obj);
    -- End of Transaction #1
    -- Start of Transaction #2
    obj.setName("scott");
    em.merge(obj);
    -- End of Transaction #2
    Is this ok, ?
    These 2 scenerios are different in the fact that one uses the return from merge and one does not. Which one is correct, and what would the problem be with the wrong one?

  • How to create the Dynamic UI element table in web dynpro in abap

    Hi All,
    Does anybody have reference note or teach me how to create dynamic UI element table in web dynpro in abap ?
    Regards,
    Luke

    HI LukeWong ,
    for creating any UI dynamically you shoul use their runtime class that always start with cl_wd_* ui element name*
    so for the Table UI element the runtime class is CL_WD_TABLE
    now reffer the below code for creating the Table UI dynamically
    METHOD wddomodifyview.
    DATA lr_table TYPE REF TO cl_wd_table.
    DATA lr_flow_data TYPE REF TO cl_wd_flow_data.
    DATA lr_container TYPE REF TO cl_wd_uielement_container.
    DATA lr_column_name TYPE REF TO cl_wd_table_column.
    DATA lr_text_view TYPE REF TO cl_wd_text_view.
    DATA lr_table_header TYPE REF TO cl_wd_caption.
    DATA lr_column_name_header TYPE REF TO cl_wd_caption.
    IF first_time EQ abap_true.
    lr_container ?= view->get_element( 'ROOTUIELEMENTCONTAINER' ).
    lr_table = cl_wd_table=>new_table(
    id = 'TBL_TABLE'
    bind_data_source = 'TABLE'
    design = cl_wd_table=>e_design-alternating
    visible_row_count = 3
    lr_flow_data = cl_wd_flow_data=>new_flow_data( element =
    lr_table ).
    lr_container->add_child( lr_table ).
    lr_column_name = cl_wd_table_column=>new_table_column(
    id = 'TBL_EXAMPLE_NAME'
    lr_table_header ?= cl_wd_caption=>new_caption( text = 'Table UI elem
    ent - example').
    lr_table->add_column( the_column = lr_column_name ).
    lr_table->set_header( lr_table_header ).
    lr_text_view = cl_wd_text_view=>new_text_view(
    id = 'TXV_NAME'
    bind_text = 'TABLE.NAME'
    lr_column_name_header ?= cl_wd_caption=>new_caption( text = 'Name').
    lr_column_name->set_table_cell_editor( the_table_cell_editor = lr_text_view).
    lr_column_name->set_header( lr_column_name_header ).
    ENDIF.
    ENDMETHOD.
    Regards
    Chinnaiya P
    Edited by: chinnaiya pandiyan on Sep 17, 2010 12:01 PM

  • Unable to use the values returned by a PL/SQL stored procedure in a XSQL page

    Hi,
    I've been messing around with XML and XSQL in particular. I was trying to write a xsql page to display a report with account totals...I have the following .xsql which calls a PL/SQL stored procedure :
    <?xml version="1.0"?>
    <xsql:query connection="pfcdm" xmlns:xsql="urn:oracle-xsql">
    <xsql:set-session-param name="zasset_total" value="100">
    <xsql:dml connection="pfcdm">
    rraman.sp_vw_id(zasset_total,zinvm_total,zmkt_val);
    </xsql:dml>
    </xsql:set-session-param>
    select 'Asset total is {@zasset_total}' as "ASSET_TOTAL" from dual
    </xsql:query>
    My procedure sp_vw_id returns the values that it should. But, I am not sure how to declare variables within a page, and to output the return values. There is very scanty documentation on the usage of <xsql:dml> or <xsql:ref-cursor-function>.
    Any response would be greatly appreciated.
    Thanks,
    Raja

    Here is the example from the Oracle9i (complete rewrite) of the XSQL Chapter in our Oracle documentation.
    Question
    I using <xsql:dml> to call a stored procedure which has one OUT parameter, but I was not able to see any results. The executed code results in the following statement:
    <xsql-status action="xsql:dml" rows="0"/>
    Answer
    You cannot set parameter values by binding them in the position of OUT variables in this release using <xsql:dml>. Only IN parameters are supported for binding. You can create a wrapper procedure that constructs XML elements using the HTP package and then your XSQL page can invoke the wrapper procedure using <xsql:include-owa> instead.
    For an example, suppose you had the following procedure:
    CREATE OR REPLACE PROCEDURE addmult(arg1 NUMBER,
    arg2 NUMBER,
    sumval OUT NUMBER,
    prodval OUT NUMBER) IS
    BEGIN
    sumval := arg1 + arg2;
    prodval := arg1 * arg2;
    END;You could write the following procedure to "wrap" it, taking all of the IN arguments that the procedure above expects, and then "encoding" the OUT values as a little XML datagram that you print to the OWA page buffer:
    CREATE OR REPLACE PROCEDURE addmultwrapper(arg1 NUMBER, arg2 NUMBER) IS
    sumval NUMBER;
    prodval NUMBER;
    xml VARCHAR2(2000);
    BEGIN
    -- Call the procedure with OUT values
    addmult(arg1,arg2,sumval,prodval);
    -- Then produce XML that encodes the OUT values
    xml := '<addmult>'&#0124; &#0124;
    '<sum>'&#0124; &#0124;sumval&#0124; &#0124;'</sum>'&#0124; &#0124;
    '<product>'&#0124; &#0124;prodval&#0124; &#0124;'</product>'&#0124; &#0124;
    '</addmult>';
    -- Print the XML result to the OWA page buffer for return
    HTP.P(xml);
    END;This way, you can build an XSQL page like this that calls the wrapper procedure:
    <page connection="demo" xmlns:xsql="urn:oracle-xsql">
    <xsql:include-owa bind-params="arg1 arg2">
    BEGIN addmultwrapper(?,?); END;
    </xsql:include-owa>
    </page>This allows a request like:
    http://yourserver.com/addmult.xsql?arg1=30&arg2=45
    to return an XML datagram that reflects the OUT values like this:
    <page> <addmult><sum>75</sum><product>1350</product></addmult>
    </page>

  • How can I use the value returned for a function into the macro ??

    I create a function to work in a macro and I would like to use the value of parameter f_calc_error returned by function in a condition like IF, but I don't know how can I do that. I have to use the macro function CALC_ERROR ??
      Thanks.
    Edson Suzuki

    Hi Edson,
    Yes you need to use the CALC_ERROR macro function to be able to test whether the last macro function returned an error. CALC_ERROR will return an 'X' if there an error occured during the execution of the last macro function.
    You can use a macro similar to the following:
    IF
      CALC_ERROR( )
      = 'X'
          DO SOMETHING HERE
    ENDIF
    Let me explain how this works internally. The SAP system maintains a global variable g_flg_calc_error during the execution of macros in the planning book. The g_flg_calc_error variable will contain the value of f_calc_error that was set by the last macro function which executed. The ABAP coding of a planning book is something like this:
    data: g_flg_calc_error type /SAPAPO/FLAG.
    * SAP will pass g_flg_calc_error variable to all macro
    * functions. When SAP calls a macro function, it does
    * something like this.
    call function '/SAPAPO/MACRO_FUNCTION_HERE'
            exporting
              plob_values      = i_s_adv_plob_values
              sdp_book         = g_c_advf_sdp_book
              sdp_view         = g_c_advf_sdp_view
            tables
              cols_index       = i_t_cols
              value_tab        = l_t_value_tab
            changing
              f_calc_error     = g_flg_calc_error
    As you can see, the g_flg_calc_error variable
    is passed in the "changing" part of the call. The macro  function being called can then use the f_calc_error
    variable to change the value of the global
    g_flg_calc_error variable. In fact, the macro function being called can also check (by looking at the f_calc_error variable) if the last macro function reported an error.  The CALC_ERROR macro function just checks the value of f_calc_error parameter (w/c in fact is the value of the g_flg_calc_error variable) and returns "true/X" if the f_calc_error was set to true by the last macro function.
    Hope this helps in clearing things out

  • How to use my own DTD and table using the XML SQL utility.

    Hey,
    Here is my question. I have succesfully installed Oracle XML SQL utility and I had played around on that. Now I have my own DTD that too from Rosettanet(PIP). Tell me how can I use my own table, and my dtd using the existing utility. What are all the changes do I need to do. I am strugling it from past 4 days. I couldn't. Please help me!

    Hi chris,
    Yes, the SQL can be changed only by using Discoverer Administrator.
    Open the report/workbook that is based on the custom SQL that you want to change in Discoverer Plus. Look at the Folder that is being used to select the columns of the report.
    Open up the Discoverer Administrator with the id that has access to the tables referenced in the report. And the custom folder with the same name as in Disc Plus would be listed down in the Business Area (Which Business Area the custom folder belongs to can be determined with the help of disc plus).
    Just open up that folder, and change the SQL in it. You can pasted your new sql in there and click on Validate SQL to validate it for errors. If no errors, then the custom folder is successfully changed.
    In order to have it reflected, close your existing disc plus session and reopen it, and you can go about using the custom folder.
    Hope this helps!
    Thanks.

  • SPA122 - How to turn off "DHCP Option To Use" in the Provisioning tab using the XML configuration file?

    As default, SPA122 and SPA112 have DHCP Options 66, 160, 159 and 150 turned on.
    Our pre-provisioning process includes adding our default profile rule to our provisioning server for the device to pull its configuration files once the device has been added to an account.
    However, it seems like some customers have had problems with the device downloading the definite configuration file and manually turning off option Option 66 in the provisioning tab in the device solves this issue.
    Is there any option we could add to our pre-provisioning file so that it removes 66 from the "DHCP Option to Use" field in the provisioning tab?
    Please advise...

    Thanks Dan,
    I didn't know the dhcp server could serve different options to different classes of clients, I'll have to look that up!
    Moises
    so if your provisioning file has this line below (this is from a spa5xx config I had in my temp folder, so use the line from your provisioning file, or use the SPC tool to create a new default config for that device type)
    <DH<DHCP_Option_To_Use group="Provisioning/Configuration_Profile">66,160,159,150,60,43,125</DHCP_Option_To_Use>
    change it to
    <DH<DHCP_Option_To_Use group="Provisioning/Configuration_Profile">160,159,150,60,43,125</DHCP_Option_To_Use>
    Hope it helps,
    Provisioning guide is here
    Cisco IP Telephony Devices Provisioning Guide - Cisco Support Community
    Dan

  • How did i use the xml schema in WLS 6.0 and up

    i check the WLS6.0 console that can setup the xml dtd
    but how did i setup the xml schema in WLS6.0 and up ??

    Hello-
    The knowledge base: "Can Matlab for Windows Call the National Instruments GPIB Driver?" Also applies to this question as well. This article is very extensive. Try searching on ni.com for "+matlab +gpib" for more details.
    Randy Solomonson
    Application Engineer
    National Instruments

  • Use the XML with data template

    Hi,
    I want to use double sql query with data template.
    How can I do ??
    Thanks...

    it's okey, I had use a rtf file insead and search/replace my keywords using the String.replaceAll(String, String) function...

  • How to get the Response Code when a URL is launched from Web Dynpro

    Hello Experts,
    I have a Web Dynpro Application in which in one of its views i have an IFrame UI element in which i will show a resource stored somewhere ..
    But before showing it i want to check if the resource actually exists. For this i have to check the HTTP Response code from Web Dynpro Application without setting it in the Iframe..
    I am using the following code to get the Response Code:
    try{
    URL url = new URL("Some Url");
    HttpURLConnection.setFollowRedirects(false);
    HttpURLConnection connection = (HttpURLConnection) url.openConnection();
    connection.connect();
    wdComponentAPI.getMessageManager().reportSuccess("Response code ="+connection.getResponseCode());
    }catch(Exception e){
    wdComponentAPI.getMessageManager().reportSuccess("Exception");
    Now the Problem is whatever response Code occurs 403 (for No Proper Authorization), 404 (for Resource not found) etc..
    i always get Response Code=  500 (which is for Internal Server Error) shown in the messgae i have printed.
    Please let me know the correct way of getting the Response Code from Web Dynpro.
    Also my resource is lying on a SAP Portal 6.4
    Best Regards
    Sundeep
    Edited by: Sundeep Sethi on Feb 18, 2008 9:07 AM
    Edited by: Sundeep Sethi on Feb 18, 2008 10:23 AM

    Hi,
      Check this code from /thread/5242768 [original link is broken] if it works.
    try{
    URL myurl = new URL("http://calendar.google.com");
    URLConnection connection = myurl.openConnection();
    if(connection instanceof HttpURLConnection) {
    HttpURLConnection httpConnection = (HttpURLConnection) connection;
    HttpURLConnection.setFollowRedirects(true);
    httpConnection.setRequestMethod("HEAD");
    httpConnection.connect();
    System.out.println("Response = "+httpConnection.getResponseCode());
    catch(Exception e) {
    // print exception
    Regards,
    Harini S

Maybe you are looking for