Column heading -refer to the webdynpro tutorial 34

Excel Export Using the Web Dynpro Binary Cache (34)
column heading problem
https://www.sdn.sap.com/irj/sdn/downloaditem?rid=/library/uuid/1208c2cd-0401-0010-4ab6-f4736074acc6
u will get the heading like
/Products
/ProductsElement/Article
/ProductsElement/Quantity
/ProductsElement/Price
the code that form the heading
public void exportToExcel2003( com.sap.tc.webdynpro.progmodel.api.IWDNode dataNode, java.util.Map columnInfos )
    //@@begin exportToExcel2003()
    byte[] excelXMLFile;
    IWDCachedWebResource cachedExcelResource = null;
    String fileName = dataNode.getNodeInfo().getName() + ".xls";
    try {
      // create Excel 2003 XML data as a byte array for the given context node, attributes and headers       
      excelXMLFile = this.toExcel(dataNode, columnInfos).getBytes("UTF-8");
      // create a cached Web Dynpro XLS Resource for the given byte array and filename
      cachedExcelResource = this.getCachedWebResource(excelXMLFile, fileName, WDWebResourceType.XLS);
      // Store URL and filename of cached excel resource in context.
      if (cachedExcelResource != null) {
        wdContext.currentContextElement().setExcelFileURL(cachedExcelResource.getURL());
        wdContext.currentContextElement().setExcelFileName(cachedExcelResource.getResourceName());
        // Open popup window with a link to the cached excel file web resource.
        this.openExcelLinkPopup();
      } else {
        wdComponentAPI.getMessageManager().reportException("Failed to create Excel file from table!", true);
    } catch (UnsupportedEncodingException e) {
      wdComponentAPI.getMessageManager().reportException(e.getLocalizedMessage(), true);
    } catch (WDURLException e) {
      wdComponentAPI.getMessageManager().reportException(e.getLocalizedMessage(), true);
    //@@end
  //@@begin javadoc:closeExcelLinkPopup()
   * Destroys popup window. To be called in an action event handler of a view controller related to
   * the opened popup window. View controller must have a controller usage declared for invoking
   * this public method of the public component controller API. 
  //@@end
  public void closeExcelLinkPopup( )
    //@@begin closeExcelLinkPopup()
    if (excelLinkWindow != null) {
      excelLinkWindow.destroy();
      excelLinkWindow = null;
    //@@end
   * The following code section can be used for any Java code that is
   * not to be visible to other controllers/views or that contains constructs
   * currently not supported directly by Web Dynpro (such as inner classes or
   * member variables etc.). </p>
   * Note: The content of this section is in no way managed/controlled
   * by the Web Dynpro Designtime or the Web Dynpro Runtime.
  //@@begin others
   * Create an XML respresentation of the given context data.
   * RESTRICTION: Excel 2003 must be installed on the client machine for opening the given xml data
   * representation as an Excel file. 
   * @return string respresentation of the created xml data for Excel 2003.
  private String toExcel(IWDNode dataNode, Map columnInfos) {
    StringBuffer x = new StringBuffer();
    String attributeName, headerName;
    String entriesName = dataNode.getNodeInfo().getName();
    String entryName = entriesName + "Element";
    // trim given header texts, so that XML element names adhere to the rule 'no spaces contained'.    
    trimHeaderTexts(columnInfos);
    x.append("<?xml version='1.0' encoding='UTF-8' standalone='no'?>n");
    x.append("<").append(entriesName).append(">n");
    for (int i = 0; i < dataNode.size(); ++i) {
      IWDNodeElement dataNodeElement = dataNode.getElementAt(i);
      x.append("<").append(entryName).append(">n");
      for (Iterator iter = columnInfos.keySet().iterator(); iter.hasNext();) {
        attributeName = (String) iter.next();
        headerName = (String) columnInfos.get(attributeName);
        x
          .append("<")
          .append(headerName)
          .append(">")
          .append(dataNodeElement.getAttributeValue(attributeName))
          .append("</")
          .append(headerName)
          .append(">n");
      x.append("</").append(entryName).append(">n");
    x.append("</").append(entriesName).append(">n");
    return x.toString();
   * Create cached Web Dynpro resource for given byte-array, filename and web resource type (xls).
   * @return Excel file as cached Web Dynpro web resource. 
  private IWDCachedWebResource getCachedWebResource(byte[] file, String name, WDWebResourceType type) {
    IWDCachedWebResource cachedWebResource = null;
    if (file != null) {
      cachedWebResource = WDWebResource.getWebResource(file, type);
      cachedWebResource.setResourceName(name);
    return cachedWebResource;
   * Opens new popup window. The popup contains a link to the newly generated, cached excel file. 
  private void openExcelLinkPopup() {
    excelLinkWindow =
      wdComponentAPI.getWindowManager().createModalWindow(
        wdComponentAPI.getComponentInfo().findInWindows("ExcelLinkPopup"));
    excelLinkWindow.setWindowPosition(WDWindowPos.CENTER);
    excelLinkWindow.open();
  * Trims all given header texts because XML element names (to be created) must adhere to XML
  * rules (that is, they cannot include special characters, spaces, and so on.
  private void trimHeaderTexts(Map columnInfos) {
    String attributeName, trimmedHeaderText;
    for (Iterator iter = columnInfos.keySet().iterator(); iter.hasNext();) {
      attributeName = (String) iter.next();
      trimmedHeaderText = trimHeaderText((String) columnInfos.get(attributeName));
      columnInfos.put(attributeName, trimmedHeaderText);
   * Trims one single header text. Omit empty strings. Convert sub-strings to lower case.
   * Convert first char of sub-strings to upper case.
   * Example: "Product Price in EURO" ->"ProductPriceInEuro"
  private String trimHeaderText(String headerText) {
    StringBuffer newHeaderText = new StringBuffer();
    String token;
    StringTokenizer tokenizer = new StringTokenizer(headerText.trim());
    while (tokenizer.hasMoreTokens()) {
      token = tokenizer.nextToken();
      newHeaderText.append(token.substring(0, 1).toUpperCase());
      newHeaderText.append(token.substring(1).toLowerCase());
    return newHeaderText.toString();
  // private member variable for storing instance of an opened popup window.  
  private IWDWindow excelLinkWindow;
public void onActionExportToExcel(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
    //@@begin onActionExportToExcel(ServerEvent)
     wdThis.wdGetExcelExportCompInterface().exportToExcel2003(
            wdContext.nodeAddress(),
            getProductColumnInfos());     
            //wdContext.nodeCustomer().nodeAddress()
    //@@end
   * The following code section can be used for any Java code that is
   * not to be visible to other controllers/views or that contains constructs
   * currently not supported directly by Web Dynpro (such as inner classes or
   * member variables etc.). </p>
   * Note: The content of this section is in no way managed/controlled
   * by the Web Dynpro Designtime or the Web Dynpro Runtime.
  //@@begin others
      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;
if i can modify the code so that it read from behind and when it reached the "/" it stop and insert the string for the header

Check this
https://forums.sdn.sap.com/click.jspa?searchID=870698&messageID=292922
/people/alfred.barzewski/blog/2005/07/27/new-samples-and-tutorials-for-web-dynpro-programming
Regards, Anilkumar

Similar Messages

  • Change the column header according to the filter value ?

    Hello Experts,
    I have a requirement in which the customer wants to change the column header of the Sales Volume Key Figure to change according to the filter selected for the Calender Year / Month in the Free characteristics.
    I could display the header as 'Sales Volume for OCT 2000' as this is the value restricted intially in the free characteristics for Calender Year / Month.
    Any suggestion is appreciated.
    Thanks,

    Ioan Thanks for the reply.
    Probably my previous explanation of the problem was a little incomplete. Let me give a better description.
    The situation is something like this.
    I have a requirement in which the customer wants the column header to reflect the 'keep filter value' restriction that he does dynamically in the query report.
    i.e:
    -- usually the kf column header shows 'sales volume'
    -- column header with text variable of the Calender year / month variable -- 'sales volume for 2000 oct'
    -- but when the report is run, if the user wants to go and change the filter:   calender year / month > rt clk > keep filer value > select Jan 2003.
      The kf column header still shows 'Sales Volume 2000 Oct'
    How to make the column header change to 'sales volume for Jan  2003' ?
    Any suggestions greatly appreciated.
    Thanks,

  • Column header in all the pages

    Hi all,
    I have designed the Account Statement report for banking application. In this report i want to show all the credit and depit history for the particular account. So that i have grouped this report based on account number.
    In this report i am not using report header and column header for showing the report title and coulmn name. Because i want to show the report title and column header for all the selected accounts. So that i have devided the account number group into two part(header a and header b) and in the first part(header a) i am showing the report title(Deposit Account Statement) and in the second part(header b) is showing the column header(such as txn date, txn description, debit amount and etc...).
    In this design i want to show the column header(header b) alone for all the pages.
    Please help me for this issue.

    Hi,
    If u want to display each item of group header on each page,then check the option repeat group header on each page in group expert.
    And if u want display only one part of group header in each page, then u may create a formula in section expert for suppress and write if groupNumber>1.
    I hope this will work.
    Regards,
    Misra P.

  • How do I sort songs in the iTunes store?  You used to be able to click on the column header to sort the column (ie Popularity)?

    How do I sort songs in the iTunes store?  You used to be able to click on the column header to sort the column (ie Popularity)?

    It seems this is a "backwards" upgrade from Apple in their iTunes 11 release....like you, I used to use that function in the iTunes store to sort through and decide which song version to purchase.   (For a large returned list of songs...see all...then sort by any of the headers, including Popularity...this functionality is now gone.)  
    The iPad always suffered from this...was never able to sort on those same column headers with an iPad.   It seems, this new iTunes release killed that functionality on the Mac as well.
    Just one of the few things that went wrong with number 11!
    Better luck next time,

  • How to fix the table column header and resize the width of a table column?

    Hi all,
    I have the following two requirements,
    1) I need to wrap the table column header into two rows. I mean the header must be displayed in two rows.
    2) I need to to able to resize the width of the column. i.e The user should be able to drag the column width according to his requirement.
    Is this possible. Any help would be appreciated!
    Regards
    Kishan

    Hi Kishan,
    Refer to these links.They may ne useful for you.
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/80d81237-b780-2a10-d398-cc33af6bd75c
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/ded11778-0801-0010-258f-ac3b9408a194
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/30291df2-b980-2a10-0884-839c4f7f147e
    Regards,
    Sumangala

  • How can I use the WebDynpro tutorial  template in APAB workbench?

    Hi,
    I have downloaded the tutorial template zip file from sdn (https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/webdynpro/tutorial on creating trees in web dynpro - 12.htm), but I don't know how to use it in ABAP workbench.
    Is that only for Java environment and can be used in Eclipse?
    If not, How can it be used in APAB workbench?
    Thank you.
    Swee Hu

    Hi,
    Its a template used in NDS(NetWeaver Developer Studio),in Webdynpro perspective.
    what do u mean by how can i use it in ABAP workbench?
    Sorry u cant use tat existing template.
    if u need the same feature u have to develop ur own...:)
    Regards,
    Sirisha.R.S

  • Changing the Column Header and Hiding the Column dynamically???

    Hi friends..
    I'm new to OBIEE field. I'm working in a OBIEE project that requires to dynamically change the column header, and dynamically hide the column depending on the prompt value.
    I know we can dynamically change the table header using the presentation variable but I couldn't do that same thing with column header.
    I searched some forums that suggest to use java script for this purpose but I'm not able to do the same also. If anyone had same issue before please help.

    toony, I'm not sure it's possible to do all that you want exactly the way you want, but here are some ideas you can pursue.
    To dynamically change column headers without javascript, check this blog out...
    http://oraclebizint.wordpress.com/2008/01/25/oracle-bi-ee-101332-dynamic-column-headers-using-presentation-variables-sets-and-conditional-formatting/
    As far as dynamically hiding a column, I don't think you can do this, but since you don't provide any details on how the PV is supposed to hide a column based on the value, are you talking about hiding a column for one PV value and another (different) column for a different PV value? Or are you talking about hiding one column when a PV has certain values and displaying it when the PV has a different set of values?
    I have managed to create both scenarios via a work-around, but the procedures require some writing so I don't want to put both. Please detail how you want your PV to "hide" a column or columns.
    P.S. I don't think column selectors will do the trick for you. Basically column selectors work like this: Say you have a report using Sales Region ID, Region Name, and Sales. Now let's say you want the user to choose if he/she wants to see annual sales, or quarter sales or weekly sales, etc. The column selector view would allow you to put the various columns (Year Sales, Quarter Sales, Weekly Sales) as an option the user can select. Once selected, the sales figure will change for the time period selected. For an example of how this is done, check out the section in this "Oracle by Example" link.
    Waited too long to publish this... Madan beat me to it, so there is some overlap here...
    http://www.oracle.com/technology/obe/obe_bi/bi_ee_1013/saw/saw.html
    Edited by: LC143 on Oct 27, 2008 9:21 AM

  • How to sort data in descending order when user clicks on the column heading

    Hi
    I have a report called "Top customers", which shows the top customers for a specific product line. It displays the customer name and one column with the total amount spent in the period for each product line. By default, the leftmost product line is sorted in descending order.
    If the user wants to know who are the top customers for another product line, they simply click on the column heading to sort the list by that column.
    The problem is that when you click for the first time on a sortable column heading, Apex sorts it in ascending order; you need to click on the same column heading again to sort in descending order.
    Is it possible to change this behaviour and sort the data in descending order in the first click? So the users don't have to click twice...
    Thanks
    Luis
    PS: Apex 3 running on Oracle 10.2.0

    Luis,
    See: Can I "catch" a click on a sortable column header of a report?
    Take a look at Anton Nielsen's answer with regards to hiding a column and displaying its value instead of the sortable column.
    Asumming the following simple report query:
    select product,sales
    from <table>
    Change that into:
    select product
    ,sales*-1 as reverse_sales -- Select this one as an extra column
    ,sales -- Hide this column
    from <table>
    In your report column attributes (of column reverse_sales), html-expression, type #sales#. It then displays the normal sales. However apex will generate a 'order by 2 asc' for the first time. The '2' will refer to the sales*-1 value: sorting it asc, is the same as sorting sales descending...
    Toon

  • Change Column Header / Column Background color based on a value in a specific row in the same column

    SSRS 2012
    Dataset (40 columns) including the first 3 rows for Report layout configuration (eg: the <second> row specifies the column background color).
    Starting from the 4th row, the dataset contains data to be displayed.
    I would like to change the background color of the ColumnHeader/Column based on the value in the same column in the <second> row.
    How can I accomplish the this requirement? (this must be applied for all the columns)
    Thanks

    Hi Fasttrck2,
    Per my understanding that you want to specify the background color of all the columns/column header based on the value in one special column of the special row, right?
    I have tested on my local environment and you can add expression to condition show the background color in the columns properties or the column header properties.
    Details information below for your reference:
    Specify the background color in the Column header: you can select the entire column header row and in the properties add expression in the Background color :
    If you want to specify the background color for the entire column, you can select the entire column and add the expression, repeat to add background color for other columns.
    If you want to specify the background color based on the value in the specific columns and row, you can create an hidden parameter to get the list of values from the  specific column, specify the Available values and default values by select "Get
    values from a query", finally using the expression as below to get the specific value you want:
    Expression(Backgroud Color):
    =IIF(Parameters!Para.Value(1)="1221","red","yellow")
    If your problem still exists, please try to provide some smaple data of the report and also the snapshot of the report structure to help us more effective to provide an solution.
    Any problem, please feel free to ask.
    Regards
    Vicky Liu
    If you have any feedback on our support, please click
    here.
    Vicky Liu
    TechNet Community Support

  • Right/Left align the column header.

    Hi All,
    Is there any option for align the column header irrespective to the column contents.
    There is an option for align data inside the column.But I can't find any for the column headers.
    Give me an idea.
    Thanks
    Swapna

    use the
    align="Left" or "right"and use the "margin-left:10px" for the component.
    for example
    <af:column sortable="false" width="80"
                             headerText="#{viewcontrollerBundle.UNIT_PRICE}" id="c8" align="right"> // this will align the column header
                    <af:outputText value="#{node.lineItem.amount}" id="ot8" inlineStyle="margin-right:15px;"/> // this will align column data
                  </af:column>

  • How to change the height of the column header cells

    Hi,
    I have been working with Oracle BI Discoverer 10g. I want to increase the height of the column header cells. The labels within the column headers are almost cut off. Is there a way to change the height of the column header cells?
    Thanks...

    Hi
    In dic.4.1 ,we are using format heading ,and manipulating by entering extra space and changing font and mode.
    try the same
    Rgds
    NP

  • Can clicking on column heading sort the column contents instead of drill in

    I have a pivot table with data that the client doesn't want to drill into. Instead, they want to be able to click the column heading and have the pivot table re-sort the data in the table based on the data in that column. Is that possible, or are clickable column headings only used for drilling in OBIEE? Thanks.

    Madan -
    That seems like a feature that should be added to the Pivot Table view if they are going to have it in the Table View. Still, thanks for pointing out the "Enable column sorting in Dashboards" check box in the Table view. I'll see if I can either get this data into the Table view, or at least let the client know the limitations of OBIEE.
    Thanks again.
    Daniel

  • How to set title/text for ALV table column header in WD ABAP

    Hello,
    I am working in WDA using SALV_WD_Table to display data in table. I need to change the column header text, the obvious way is to get the column header and call the method SET_TEXT to set new text / title. However, this method does NOT work, it does not change the column header text. I also tried the SET_TOOLTIP, this one works, but SET_TEXT does not work. Anyone has idea why this not working and do you find any go-around solution?
    My version is NW 7.0
    Thank
    Jayson

    Hi jason ,
    For setting Heder text for your ALV table
    ip_confing type ref to CL_SALV_WD_CONFIG_TABLE.
    "set alv table header
      ip_config->if_salv_wd_table_settings~r_header->set_text( 'Test ALV Header functionality' ).
    first you have to hide the DDIC text and then try to set your own text .
    "modify columns
      LOOP AT lt_columns INTO ls_column.
        lr_column = ls_column-r_column.
        CASE ls_column-id.
          WHEN 'MANDT'.
            "hide this field
            lr_column->set_visible( cl_wd_abstr_table_column=>e_visible-none ).
           WHEN 'SEQNR'.
            "set header to different string
            lr_column->r_header->set_ddic_binding_field( if_salv_wd_c_column_settings=>ddic_bind_none )." use this line to hide ddic text
            lr_column->r_header->set_text( 'Position' ).     
        endcase.
      endloop.
    Regards
    Chinnaiya P

  • Background color for column heading

    Hi,
    I have 5 columns in my report and I would like to have different background color for column headings. How can I do this in report templates?
    I was looking at Column heading section-
    <th class="t10ReportHeader"#ALIGNMENT# id="#COLUMN_HEADER_NAME#">#COLUMN_HEADER#</th>
    How can I specify backgrund colors for all columns here?
    Thanks in advance

    G'day Karen,
    Thanks for ur reply.
    I have seen this note before, its not that the header colors have changed after latest SP was applied in our systems. Also the ABAP and JAVA stacks are in sync.
    Scenario is that we are trying to set up a new Portal theme for Enterprise Reporting with some specific color codes (hex codes).
    What i have observed is Characterstics Header background color is set up using the element "Background Color of Level 1 Column Heading ".
    While the Background color for Key Figures header is using element "Background Color of Level 2 Column Heading ".
    But the problem is element "Background Color of Level 2 Column Heading " is also used as the Background color for Standard Characterstics cell, so if we make it same the whole report of the same color, which we dont want.
    Requirement is to get the same Background color for Header cells (both Char. and Key Figure headers).
    Any further suggestions will be appreciated.
    Thanks
    CK

  • Dynamic Column Heading on Interactive Report

    I have my column headings for my table columns stored in the database. I want the Interactive Report to use these heading (instead of static headings). Is there a way to have the columns set from the database(with a function/procedure)?

    you can replace the column headings with &PAGE_ITEM.
    obviously one page item per column header
    then use the database to populate the items with your column headings.
    craig
    [http://www.oracleapplicationexpress.com]

Maybe you are looking for

  • Digital Signature while approving a document in KM

    Dear all, We have a an approval enabled folder in KM. My question is, can we enable digital signature for documents in that folder? Scenario will be like this. I'm an approver. When I approve I should be allowed to digitally sign on the document. Is

  • Firefox 3.6.13 will not uninstall after I installed Firefox 4.9 beta

    I have Windows XP Pro Service Pack 3. I installed Firefox 4.9 beta and have 2 Firefox browsers (also Firefox 3.6.13). Now I want to uninstall 3.6.13. When I click on uninstall Firefox 3.6.13 from Add/Delete Programs nothing happening - no response. P

  • Indexing across many documents

    I am making a 442 page book, but the process used to get this book published has required me to ship the pages in spreads. So, I have 221 documents. I wanted to Index them ASAP. Is there a way to index all as separate documents or am I forced to make

  • Dynamic Routing

    Hi, Can anyone explain how ESB works using Dynamic Routing? Thanks

  • 3Minute Clip Takes 3 HOURS to encode

    Got a Dual core XPSP2 system with 2GB RAM. Taking THREE HOURS to make a little 3 Minute clip to Windows media (disaster area 9) THREE MINUTES! CS3 has been taking HOURS, often TEN or more to do straight forward encoding that Canopus would do in 0.67