cancel
Showing results for 
Search instead for 
Did you mean: 

Export to Excel: Column heading and order

Former Member
0 Kudos

Hi All,

I am using 'Web Dynpro Binary Cache' for downloading data to excel file. Though, content is downloaded properly, I am facing the following problems:

1) Header text of columns is not appropriate, it shows me the name of context attribute and not the text I have set in Map.

2) Order of column is not proper. It does not match with the order in context or the order in which I have set the header text.

3) For columns holding an integer value, it adds an extra column for aggregate. Though type of corresponding attribute is string and not integer.

I printed the string formed in XML format, it shows correct header text without any extra aggregate columns.

Please help...

Regards,

Tejal

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

the linked hashmap does not solve the problem of repeated columns.

Thanks,

Former Member
0 Kudos

Hello everyone,

I'm having exactly the same problem as Tejal. Can anyone help? My main concern is the column order.

Thank you,

Nuno

Former Member
0 Kudos

I can help with the column order part.

You need to use an ArrayList (or similar list) to hold the list of columns. See forum web log /people/sap.user72/blog/2006/05/04/enhancing-tables-in-webdynpro-java-150-custom-built-table-utilities

and look in the 'Creating an Excel File' section.

The problem with Map is that it does not keep the columns in the order you add them to the map.

-Cindy

BeGanz
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hallo Cindy,

used LinkedHashMap instead of HashMap:

  private Map getProductColumnInfos() {
    Map columnInfosMap = new LinkedHashMap();
    columnInfosMap.put(IPrivateTableCompBasketView.IProductsElement.QUANTITY, "Quantity");
    columnInfosMap.put(IPrivateTableCompBasketView.IProductsElement.ARTICLE, "Article");
    columnInfosMap.put(IPrivateTableCompBasketView.IProductsElement.COLOR, "Color");
    columnInfosMap.put(IPrivateTableCompBasketView.IProductsElement.PRICE, "Price in EURO");
    columnInfosMap.put(
      IPrivateTableCompBasketView.IProductsElement.TOTAL__PER__ARTICLE,
      "Total Per Article In Euro");
    return columnInfosMap;
  }

This keeps the order of key-displaytext-pairs passed by the client (table component) to the service (excel export component) stable.

Regards, Bertram