Create grouped column headers dynamically

Hi all,
I want to create grouped column headers dynamically.
DATA lr_table_column TYPE REF TO cl_wd_table_column.
DATA lr_column_group TYPE REF TO cl_wd_table_column_group.
DATA lr_caption TYPE REF TO cl_wd_caption.
lr_table_column = cl_wd_table_column=>new_table_column( ).
lr_table_column->set_table_cell_editor( lr_input ).
lr_caption = cl_wd_caption=>new_caption( ).
lr_caption->set_text( 'Min' ).
lr_column_group = cl_wd_table_column_group=>NEW_TABLE_COLUMN_GROUP( ).
lr_column_group->set_header( EXPORTING the_header = lr_caption ).
CALL METHOD lr_column_group->add_column
        EXPORTING
          index      = 1
          the_column = lr_table_column.
       lr_table->ADD_GROUPED_COLUMN( EXPORTING the_grouped_column = lr_column_group ).
But I don't understand how I can get the grouping of the columns.
The following structure should be realized:
FR  | Headline 1  |  Headline 2  |
SR  | Min |  Max   |  Min |  Max   |
FR = first row
SR = second row
regards
Edited by: Wolfgang Bauer on May 19, 2010 7:52 AM

LOOP AT it_comp_header INTO wa_comp_header.
Minimum
      counter = counter + 1.
      CONDENSE counter.
      CONCATENATE 'INPUT_' counter INTO id.
     c_count = sy-index.
      c_count = counter.
      CONDENSE c_count.
      CONCATENATE 'IT_BIN_COMP.MIN' c_count INTO binding.
      cl_wd_input_field=>new_input_field(
        EXPORTING
           bind_value             = binding
           id                     = id
        RECEIVING
          control                = lr_input ).
      lr_column_group = cl_wd_table_column_group=>new_table_column_group( ).
      lr_table_column = cl_wd_table_column=>new_table_column( ).
      lr_table_column->set_table_cell_editor( lr_input ).
      lr_caption = cl_wd_caption=>new_caption( ).
      lr_caption->set_text( 'Min' ).
      lr_table_column->set_header( lr_caption ).
      lr_column_group->add_column( lr_table_column ).
      lr_table_column = cl_wd_table_column=>new_table_column( ).
      lr_table_column->set_table_cell_editor( lr_input ).
      lr_caption = cl_wd_caption=>new_caption( ).
      lr_caption->set_text( 'Max' ).
      lr_table_column->set_header( lr_caption ).
      lr_column_group->add_column( lr_table_column ).
      lr_table_column = cl_wd_table_column=>new_table_column( ).
      lr_table_column->set_table_cell_editor( lr_input ).
      lr_caption = cl_wd_caption=>new_caption( ).
      lr_caption->set_text( 'Sorting Bin' ).
      lr_table_column->set_header( lr_caption ).
      lr_column_group->add_column( lr_table_column ).
      lr_caption = cl_wd_caption=>new_caption( ).
      text = wa_comp_header-chip.
      lr_caption->set_text( text ).
      lr_column_group->set_header( lr_caption ).
      lr_table->add_grouped_column( lr_column_group ).
    ENDLOOP.
Sub product
    lr_column_group = cl_wd_table_column_group=>new_table_column_group( ).
    lr_table_column = cl_wd_table_column=>new_table_column( ).
    lr_table_column->set_table_cell_editor( lr_input ).
    lr_caption = cl_wd_caption=>new_caption( ).
    lr_caption->set_text( 'Sub Product' ).
    lr_table_column->set_header( lr_caption ).
    lr_column_group->add_column( lr_table_column ).
    lr_table->add_grouped_column( lr_column_group ).
Remarks
    lr_column_group = cl_wd_table_column_group=>new_table_column_group( ).
    lr_table_column = cl_wd_table_column=>new_table_column( ).
    lr_table_column->set_table_cell_editor( lr_input ).
    lr_caption = cl_wd_caption=>new_caption( ).
    lr_caption->set_text( 'Remarks' ).
    lr_table_column->set_header( lr_caption ).
    lr_column_group->add_column( lr_table_column ).
    lr_table->add_grouped_column( lr_column_group ).

Similar Messages

  • Assigning Column Headers Dynamically in ALV output

    Hello Experts,
    I have to create dynamic column headers based on the user input on the selection-screen. Basically users enter the period and the ALV output has to create the column headers dynamically for that along with some standard columns.
    For eg, The selection screen is like this:
    From:  'Q4' '2009'
    To      'Q2'  '2011'.
    Then I have to create 12 columns for the months and rest for the Quarters.
    Then the output will be like this:
    Material, Description,10/09, 11/09, 12/09, 01/10, 02/10, 03/10, 04/10, 05/10, 06/10, 07/10, 08/10, 09/10, Q4/10, Q1/11, Q2/11
    I have built the logic to determine the number of colums for the periods based on input.
    By reading other posts, I have learnt that I have to use call method cl_alv_table_create=>create_dynamic_table to get the functionality.
    I have also looked at program BCALV_TABLE_CREATE for some help. It only has column headers in increasing order. But I am not able to understand How to pass the Column Header Label (for eg 10/09 or Q1/10) to the fieldcat dynamically.
    Is there any blog/sample prog close to my req? Can anybody please please help me. I grealy appreciate it.
    Thanks.

    Hi Lope,
    You need to filll column heading based on dynamic internal table column names.
    In your final internal table, you will have some column names like '1009, 1109, 1209' .
    While filling fieldcatalog you need to put your logic for column heading text.
    If column name is 1009, concatenate '10 '  '/'   '09', or calculate the quarter 10 falls into ,and display Q4/09.
    Regards,
    Nisha Vengal.

  • Need to display COlumn headers dynamically in ALG Grid

    Hello,
    I need to display column headers dynamically in alv grid Display with its corresponding value.
    Column headers should be picked from a field in Final Internal table and its corresponding field will also need to pick from the same table.
    T_final... Suppose Field STCTS - (To pick coulmn headers)
                                      CCNGN - (To pick appropriate value for that column)
    Can anybody explain me how i can pass these values to ALV Grid using
    CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
      EXPORTING
        IT_FIELDCATALOG           = Y_I_FCAT
      IMPORTING
        EP_TABLE                  = DY_TABLE.
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
               WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Any suggestions will be appreciated....
    Regards,
    Kittu

    Hi,
    Go thru this link, and the code of Mr.Dev Parbutteea
    Re: Probelm with Using Field Symbol in FM
    thanks
    Mahesh

  • How create grouped column in DataGrid ?

    Hi all,
         I can create grouped column in AdvancedDataGrid. So in DataGrid, how I create grouped column ?
    Thanks.

    I have a problem that no anyone can help me to now. Sometime, I think that it's bug of ADG.
    My goal same as from http://blogs.adobe.com/aharui/BlinkWhenChanged/dg.swf . But if I use ADG and with a scroll ! And when scroll up or down background color change not right.
    It's a big problem ! Yep, when I use ADG, I can create group columns but ADG, I can't !
    Is there any ways for me?

  • Getting column headers dynamically from input parameters in alv.

    Hi all,
    I am new to abap, can any one help me in getting column header dynamically through parameters in alv ?
    Eg:-
    i Have parametars for days field ,
    user inputs days as 10 20 30 40.
    Now I want to display in alv column headers as:-
    1st column-  'FROM 0 TO 10'
    2nd column- 'FROM 10 TO 20 '
    3rd column- 'FROM 20 TO 30'
    4th column- 'FROM 30 TO 40'
    5th column- 'FROM 40 TO 50'
    6th column- 'FROM 50 TO 60'
    thanks in advance........

    Check this code snippet:
    Step 1: Create a dynamic table based on the input in the selection screen.
    TYPE-POOLS: abap.
    DATA:
      lr_structdescr    TYPE REF TO cl_abap_structdescr,
      lr_tabledescr     TYPE REF TO cl_abap_tabledescr,
      lr_datadescr      TYPE REF TO cl_abap_datadescr,
      lt_components     TYPE abap_component_tab,
      ls_component      TYPE abap_componentdescr,
      lr_wa             TYPE REF TO data,
      lr_tab            TYPE REF TO data.
    DATA: lv_index TYPE sy-index.
    DATA: lv_index_num(5) TYPE n.
    DATA: lv_index_char(5) TYPE c,
          lv_iter TYPE i,
          lv_low TYPE numc2 VALUE 0,
          lv_high TYPE numc2 VALUE 10.
    DATA: lr_alv TYPE REF TO cl_salv_table.
    FIELD-SYMBOLS: <fs_field> TYPE ANY.
    FIELD-SYMBOLS: <fs_wa> TYPE ANY.
    FIELD-SYMBOLS: <fs_tab> TYPE table.
    PARAMETERS p_numcol(2) TYPE n DEFAULT 50.
    START-OF-SELECTION.
      lv_iter = p_numcol DIV 10.
      DO lv_iter TIMES.
        IF sy-index > 1.
          lv_low = lv_low + 10.
          lv_high = lv_high + 10.
        ENDIF.
        lv_index_num = sy-index.
        lv_index_char = lv_index_num.
        CONCATENATE 'FROM' lv_low 'TO' lv_high INTO ls_component-name
        SEPARATED BY '_'.
        ls_component-type =
        cl_abap_elemdescr=>get_p( p_length = 10 p_decimals = 2 ).
        INSERT ls_component INTO TABLE lt_components.
      ENDDO.
    * get structure descriptor -> lr_STRUCTDESCR
      lr_structdescr
      = cl_abap_structdescr=>create( p_components = lt_components
                                     p_strict = space ).
    * create work area of structure lr_STRUCTDESCR -> lr_WA
      CREATE DATA lr_wa TYPE HANDLE lr_structdescr.
      ASSIGN lr_wa->* TO <fs_wa>.
      lr_datadescr = lr_structdescr.
      lr_tabledescr
      = cl_abap_tabledescr=>create( lr_datadescr ).
    * Create dynamic internal table
      CREATE DATA lr_tab TYPE HANDLE lr_tabledescr.
      ASSIGN lr_tab->* TO <fs_tab>.
    * Populate the internal table
      DO 10 TIMES.
        DO.
          lv_index = sy-index.
          ASSIGN COMPONENT  lv_index  OF STRUCTURE <fs_wa> TO <fs_field>.
          IF sy-subrc <> 0.
            EXIT.
          ENDIF.
          <fs_field> = sy-index.
        ENDDO.
        APPEND <fs_wa> TO <fs_tab>.
      ENDDO.

  • Change column headers dynamically in OBIEE

    hey guys.
    We are working on a BI module for Finance. The data mart captures data for Actuals/Forecasts and Budgets for entire year by months (for example Jan2008 will have Actual/Forecast value and Budget value & similarly for other months of the year) .
    Now while displaying on the dashboard reports the column header for the current month should read as Actual and for coming months it should read as Forecast.
    Any suggestions as to where we can implement this business rule so as to make the column header dynamic.
    Thanks
    OBIEE_user

    Seems like you don't know Venkat yet...
    http://oraclebizint.wordpress.com/2008/01/25/oracle-bi-ee-101332-dynamic-column-headers-using-presentation-variables-sets-and-conditional-formatting/

  • How Do I cahnge lables(column headers) dynamically?

    Hi,
    Dynamically, how do I change column headers based on some other value is the report?
    Thanks

    If the value you want as the column header is in the XML use the element.
    If you want different column headers based on a particular element in the XML then use conditional logic (if or when) wrapped around the column headers to do the selection at run time. See the user guide for examples of conditional processing in the template.
    cheers,
    Dave

  • Problem in Dynamically create Group ui element

    Hi everyone,
    I was trying to create group UI element  dynamically in Webdynpro ABAP. I was getting Error :Access via 'NULL' object reference not possible.
    I have gone through the following procedure
    Create component with window and view
    In view layout Method: WDDOMODIFYVIEW and done the following code
      Source Code
    if first_time  = ABAP_TRUE.
    data:lr_container type REF TO CL_WD_UIELEMENT_CONTAINER,
          lr_flowdata TYPE REF TO cl_wd_flow_data,
          lr_group TYPE REF TO cl_wd_group,
          object type REF TO IF_WD_VIEW_ELEMENT.
    CALL METHOD view->get_root_element
       receiving
         root_view_element = object.
    lr_container ?= object.
    CALL METHOD cl_wd_group=>new_group
       EXPORTING
         design                   = 01
         enabled                  = ABAP_TRUE
         has_content_padding      = ABAP_TRUE
         id                       = 'GRP1'
         view                     = VIEW
         visible                  = 02
       receiving
         control                  = lr_group.
    CALL METHOD lr_container->add_child
       EXPORTING
         the_child = lr_group.
    CALL METHOD cl_wd_flow_data=>new_flow_data
       EXPORTING
         element     = lr_group
       receiving
         control     = lr_flowdata.
    endif.
    To get Group ui element dynamically what i have to do rather than the above code
    Thanks in Advance
    Sreenivas P

    Hi Sreenivas,
    Try to debug and find what line the error occurs and return it to us.
    If the error occurs in
    CALL METHOD view->get_root_element
       receiving
         root_view_element = object.
    or in
    lr_container ?= object.
    you will need to check content of object.
    Best regards

  • How to create  some columns dynamically in the report designer depending upon the input selection

    Post Author: ekta
    CA Forum: Crystal Reports
    how  to create  some columns dynamically in the report designer depending upon the input selection 
    how  export  this dynamic  report in (pdf , xls,doc and rtf format)
    report format is as below:
    Element Codes
    1
    16
    14
    11
    19
    10
    2
    3
    Employee nos.
    Employee Name
    Normal
    RDO
    WC
    Breveavement
    LWOP
    Sick
    Carers leave
    AL
    O/T 1.5
    O/T 2.0
    Total Hours
    000004
    PHAN , Hanh Huynh
    68.40
    7.60
    76.00
    000010
    I , Jungue
    68.40
    7.60
    2.00
    5.00
    76.00
    000022
    GARFINKEL , Hersch
    66.30
    7.60
    2.10
    76.00
    In the above report first column and the last columns are fixed and the other columns are dynamic depending upon the input selection:
    if input selection is Normal and RDO then only 2 columns w'd be created and the other 2 fixed columns.
    Can anybody help me how do I design such report....
    Thanks

    Hi Developer life,
    According to your description that you want to dynamically increase and decrease the numbers of the columns in the table, right?
    As Jason A Long mentioned that we can use the matrix to do this and put the year field in the column group, amount fields(Numric  values) in the details,  add  an filter to filter the data base on this column group, but if
    the data in the DB not suitable to add to the matrix directly, you can use the unpivot function to turn the column name of year to a single row and then you can add it in the column group.
    If there are too many columns in the column group, it will fit the page size automatically and display the extra columns in the next page.
    Similar threads with details steps for your reference:
    https://social.technet.microsoft.com/Forums/en-US/339965a1-8cca-41d8-83ef-c2548050799a/ssrs-dataset-column-metadata-dynamic-update?forum=sqlreportings 
    If your still have any problem, please try to provide us more details information, such as the data structure in the DB and the table structure you are currently designing.
    Any question, please feel free to let me know.
    Best Regards
    Vicky Liu

  • How to create table columns dynamically ?

    Hi All,
    I am working on an SSRS report that will show sales in the past 5 years. If the user selected to view sales of past 3 years he will only see 3 columns. so How can I create table columns dynamically at run time and how can I make sure that their dimensions
    will adjust to fit the report page size.

    Hi Developer life,
    According to your description that you want to dynamically increase and decrease the numbers of the columns in the table, right?
    As Jason A Long mentioned that we can use the matrix to do this and put the year field in the column group, amount fields(Numric  values) in the details,  add  an filter to filter the data base on this column group, but if
    the data in the DB not suitable to add to the matrix directly, you can use the unpivot function to turn the column name of year to a single row and then you can add it in the column group.
    If there are too many columns in the column group, it will fit the page size automatically and display the extra columns in the next page.
    Similar threads with details steps for your reference:
    https://social.technet.microsoft.com/Forums/en-US/339965a1-8cca-41d8-83ef-c2548050799a/ssrs-dataset-column-metadata-dynamic-update?forum=sqlreportings 
    If your still have any problem, please try to provide us more details information, such as the data structure in the DB and the table structure you are currently designing.
    Any question, please feel free to let me know.
    Best Regards
    Vicky Liu

  • Setting column count dynamically for a Group

    Hi Experts,
    i want to set the column count dynamically for a group.
    Thnks,
    Ramani.

    You probably mean you want to change the colCount value for a GridLayout (assigned to a Group), right?
    To change this property from a view controller method, you can
    - create a boolean context attribute "changeColCount" and set it to true in the controller method
    - check this flag in method wdDoModifyView(), access the GridLayout instance and change the colCount value
    - reset the flag afterwards
    Armin

  • List View - Remove Group By Headers - Column Names

    I have a List View web part using Group By. However, when you do that, it uses the Actual column name with a colon in the visual representation.
    Also, there is a bar with the name of the column showing.
    I don't want to have either of these showing. I have found pages on the net that tell you how to do this using SPD, but because that causes unghosting, we don't use SPD.
    Also, I found this, using Javascript:
    http://amitphule.blogspot.com/2011/10/hiding-group-headers-from-sharepoint.html
    This works. However, it removes the Editing components of the ribbon also - you can't go back later and do any editing.
    Does anyone have any other ideas on this?

    Hi,
    According to your post, my understanding is that you wanted to remove Group By Headers in the List View web part.
    I try to reproduce the issue using the code you provided, however, I can edit the items.
    The initial status:
    The final status:
    Best Regards,
    Linda Li
    Linda Li
    TechNet Community Support

  • Creating group dynamically in active directory depending on their role

    Hi,
    I have sycn oid and active directory using directory integration platform. Now the scenario is We have one system says hr system which take care of entering all the user information. Once it submit that information it goes to oid. Now we want that when we import all that user from oid to active directory it didn't duplicate any user as well as depending on their role it should create groups dynamically in active directory. For e.g: If user belong to Trainee category or manager category it must create Trainee group & Manager group & respective person should go into that group. I don't know whether my question is placed in right group or not. I am using filter to do this task but not able to write proper condition in "source matching filter" and "destination matching rule". Any help will be appreciated.
    Thanks,
    Sonya Sharma

    Thanks Tamim. To clear your thought, i will explain again. I have sync oid and active directory through Directory integration platform. I have created user in oid.(cn=users,dc=mycompany,dc=com). It get sync in active directory properly. Now i have created two group in active directory say for e.g Trainees and Manager. There is a field name position in oid which is a custom attribute. When i fill the information of user in oid, I have to fill "Position" attribute also. So my question is that, if i fill Trainee as a value in Position attribute and click on submit it should go in Trainee Group In active directory and not in user group. Same for manager. How can we achieve this? Can we do it through filter? Or any other way? It's needed desperately. Please help me in resolving this issue.
    Regards,
    Sunil

  • Create column headers in report based on data entered in Form

    Hi,
    I have a form with following fields being entered into a table: -- a start date for a project and then projected hours required on a monthly basis for X months
    Start Date mnth1_resource mnth2_resource mnth3_resource ...
    2/12/2011 30 20 80 ...
    6/3/2011 80 30 70
    3/12/2011 50 70 60
    4/10/2011 40 120 90
    I would like to create a report (interactive or otherwise) that will provide headers for the actual months of the calendar showing the full range of months to cover the dates included in the data: e.g. if the above data was the only data entered then:
    Feb Mar Apr May Jun Jul Aug Sept
    30 20 80
    50 70 60
    40 120 90
    80 30 70
    Where mnth1 is the month of the start of the project--
    Would appreciate any hints on how to accomplish this.
    Thanks,
    Pat

    Hi,
    Thanks for the response. I see how a crosstab type report works great for data that is static and all in the table, however, in my case the issue is that the columns will vary depending on the start date of the project. So even though the user is only entering 12 months of projection, the total number of columns will depend on the start date of the latest project. For example, if a project does not start till June of 2011 and goes out 12 months, the actual column headers will need to go out to May 2012. Likewise the first column will be dependent on the earliest start date month-- like Feb 2011 in the sample data.
    Pat

  • How to create a datatable with row headers and column headers

    Hi,
    I am trying to create a two dimensional datatable which has both column headers and row headers. using <h:datatable> i could create a datatable with only column headers.
    Thanks in advance

    Are you saying that you want a column with only th's? You could also just apply some CSS on that specific column that its rows look like headers.

Maybe you are looking for