Skip to Content
avatar image
Former Member

Dynamic Context Attributes - Download to Excel.

Hi Experts,

I have a view with a Context Node in which the context attributes are added dynamically. And further,i bind these attributes dynamically to a dynamically

created UI element Table.

I want to have a functionality to download the contents of this context node (which

are filled in the application) to an Excel file.

I have successfully implemented the Download to Excel for context nodes which were not dynamically added attributes using the following blog:

/people/sap.user72/blog/2006/05/04/enhancing-tables-in-webdynpro-java-150-custom-built-table-utilities

and also using the Table Tutorial from the Web Dynpro Samples and Examples.

Using the same concepts for this application, I an getting an exception, that the

context that was dynamically created, does not exist (very specifically in

TableUtilities.java file, in the downloadtoexcel method).

I wanted to know how can I use the TableUtilities.java for Dynamically Created

Context Attributes, or any other method which can be used for this purpose.

Any ideas regarding this will be helpful.

Regards,

Alka.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Apr 12, 2007 at 01:42 PM

    Hallo Alka,

    in NW04s you can download the table data as Excel File on-demand. This means my existing table and Excel export tutorials (written for NW04) are not up-to data any more regarding NW04s. Read my post on downloading an Excel resource from a table tool bar on-demand: poll-web-dynpro-ui-elements-enhancement-proposals. I intend to write an article on this specific solution. It can also be applied for your use-case where the context attributes and the Table UI element are dynamically created.

    Regards, Bertram

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hello Bertram,

      I have just gone through the post of yours and am trying to understand the steps.

      I'll try doing that with some sample application in NW04s, but for right now I'm

      using NW04 for the application I was talking of.

      It will be very helpful, if you can throw some light on using Dynamic Context for

      table contents download for NW04.

      Thanx for the post, I'll surely try that out.

      Regards,

      Alka.

  • avatar image
    Former Member
    Apr 12, 2007 at 08:51 AM

    Alka,

    Could you post complete stack trace?

    VS

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Q) Are you trying to add the entire table or just few columns of that table ?

      I'm adding the entire table .

      Q) Are you facing a problem to create the UI Element or the Context Attribute ?

      I'm getting no problems in either of the two.

      Q)Your code does not show where you have created a new Context Attribute.

      <b>wdContext.nodeTable_Data().getNodeInfo().addAttribute(ColumnName[a],ColumnType[a]);</b>

      line 476:

      wdContext.currentContextElement().setLink_XL((String)wdContext.currentContextElement().getTableUtility().DownloadToExcel(al_ex).get("url"));

      al_ex: Arraylist in which i'm passing all the attribute names that are created dynamically.

      Exception occurs in TableUtilities.java at:

      xml_file.append("<")

      .append(attributeName)

      .append(">")

      <b>.append(elem.getAttributeValue(attributeName))</b>

      .append("</")

      .append(attributeName)

      .append(">\n");

      Regards,

      Alka.

      Message was edited by:

      Alka Panday