Web Dynpro – Changing Dynamic Table Header

Home / SAP / ABAP Coding / Web Dynpro – Changing Dynamic Table Header

Well, this strangely was a lot tougher than I expected.  I just wanted the ability to change the column headers based on my own descriptions (or perhaps by language).  Dynamic table header changes took more research than I originally expected, so here’s what I found…  Hope if can help you…

*** get the reference to your table
l_table ?= view->get_element( ID = ‘TB_XXX’ ).
*** get all of the columns so you can name them as you like
lt_cols = l_table->get_columns( ).
LOOP AT lt_cols into wa_cols.
*** Get the text you want to add to the column headings and assign to lv_col_text
lv_col_fld = “column name”.
l_col_hdr = wa_cols->get_header( ).
l_col_hdr->set_text( lv_col_text ).
wa_cols->set_header( l_col_hdr ).
ENDLOOP.

Happy coding =)

As always, thanks for reading and don't forget to check out our SAP Service Management Products at my other company JaveLLin Solutions,
Mike

3 thoughts on “Web Dynpro – Changing Dynamic Table Header

  1. hi. i’m new to abap … but i would love to have this functionality in my project… could you expand on the topic and maybe say what you have defined in data ? thanks in advance

    1. Hi Sirin,
      I would start by looking through more of my posts. I have quite a few different posts on ABAP Web Dynpro. If these aren’t what you are looking for I’d be happy to go into more details. If you could just expand on what isn’t clear. Thanks, Mike

  2. Thanks for the example. I successfully devised similar code to adjust my table.
    Though I did have difficulties determining the data types and where to place the code.
    For others which may wonder: you need to use method WDDOMODIFYVIEW of the WebDynpro view. That’s where you have VIEW as a parameter, which you do see in the code above at the very beginning.

    (WebDynpro is old technology by now, but still in use in areas like MDG, so for some it is still valuable.)

Leave a Reply

Your email address will not be published. Required fields are marked *