Column Dynamic Table ( non ALV) visible - non visible

Hello
Using the dynmic table creation and I want to set some columns to invisible per default per
          ls_column->set_visible( 01 ).
But I want that the user can make this column visible, if necessary.
In ALV a user can use the standard personalization function to set the invisible columns to visible.
How can I do this with a normal table ?
     lo_table TYPE REF TO cl_wd_table,
Thanks and regards,
Carola

Hi,
You should bind your visibility property to your context, then you will be able to provide a personalization view to your user.
Regards,
Joseph BERTHE

Similar Messages

  • Show dynamic table in ALV grid

    Hi !
    how do I show a dynamic table in ALV GRID ?
    I used the following commands:
    call method cl_alv_table_create=>create_dynamic_table
      exporting
        it_fieldcatalog = it_fieldcat[]
      importing
        ep_table        = gt_new_table.
      assign gt_new_table->* to <l_table>.
      create data gs_new_line like line of <l_table>.
      assign gs_new_line->* to <l_line>.
    I added records into the table
    Now I got a dynamic table.
    How do I show it in ALV GRID ?
    thanks
      Adi

    Hi,
    Check these links
    Re: Dynamic table
    http://sap.ittoolbox.com/code/d.asp?a=s&d=3038
    http://www.sap4.com/codigo-138.html
    http://www.sapassist.com/code/d.asp?a=s&d=3365
    There is an example in the report BCALV_TABLE_CREATE
    report BCALV_TABLE_CREATE.
    data: ok_code like sy-ucomm,
         g_container type scrfname value 'BCALV_GRID_DEMO_0100_CONT1',
         grid1  type ref to cl_gui_alv_grid,
         g_custom_container type ref to cl_gui_custom_container.
    data: gt_fieldcat type lvc_t_fcat.
    data: gp_table type ref to data.
    field-symbols: <gt_table> type table.
    parameters: n type i.
    if n > 100.
    message a000(0k) with 'N <= 100'.
    endif.
    perform fieldcat_build.
    call method cl_alv_table_create=>create_dynamic_table
                            exporting it_fieldcatalog = gt_fieldcat
                            importing ep_table = gp_table.
    assign gp_table->* to <gt_table>.
    perform fill_table.
    call screen 100.

  • Making cell non editabale (of dynamic table) in alv

    Hi,
    I am working on a editable alv with a dynamic table <itab> .This table gets populated during runtime.Now I want to make few cell of this table not editabale (only few cell not the full columns) I knwo that the procedure is to
    declare my outtab like
    TYPES: BEGIN OF gs_outtab.
    TYPES: celltab TYPE lvc_t_styl.        "field to switch editability
            INCLUDE TYPE /npu/edmt_aa_eac.
    TYPES: END OF gs_outtab.
    and in the celltab i pass the information of cells which will be non editable...But the problem is as my outtab is a dynamic table I cannot INCLUDE IT IN ANOTHER types.
    Please help me how to do it???? Or is there any other way of doing it???

    Hi Priya
    Add the field of type lvc_t_styl while creating the field catalog.
    Now
    DATA lo_table TYPE REF TO data.
      cl_alv_table_create=>create_dynamic_table(
        EXPORTING
          it_fieldcatalog = lt_fieldcat  "the field catalog table
        IMPORTING
          ep_table = lo_table ). "the reference to the table gt_outtab with the style tab
    FIELD-SYMBOLS <tab> TYPE ANY TABLE.
    ASSIGN lo_table->* TO <tab> .
    Now you can fill your <tab>.
    Pushpraj

  • Dynamic Table in ALV

    Hello experts,
    is it possible to call an ALV via ( class cl_salv or fm REUSE_ALV_GRID_DISPLAY) with a dynamic table?
    This dynamic table has for example one fix column for the material number and dynamic colums for additional data.
    One material has 1 additional column, the other material has two additional columns.
    So i need an ALV with 3 columns material add_data1 add_data2 (add_data2 of material one is empty this is ok).
    To build an itab which can handle this is possible i know.

    Hello Benjamin,
    Maybe you already found a solution for this, but if not (or for others looking for a solution), here is a sample program that creates, fills, and displays a dynamic table:
    report ztpar_dynamic_salv.
    parameters: p_colnr type i default 3.
    start-of-selection.
      perform execute.
    form execute.
      data t_table type ref to data.
    ** create dynamic table
      perform create_dynamic_table using p_colnr
                                changing t_table.
    ** fill dynamic table
      perform fill_dynamic_table changing t_table.
    ** display dynamic table
      perform display_table using t_table.
    endform.
    form create_dynamic_table using colnr type i
                           changing table type ref to data.
      data: lo_field type ref to cl_abap_typedescr,
            lo_struct type ref to cl_abap_structdescr,
            lo_table type ref to cl_abap_tabledescr.
      data: t_comp type cl_abap_structdescr=>component_table,
            l_comp like line of t_comp.
      lo_field ?= cl_abap_typedescr=>describe_by_name( 'CHAR10' ).
      do p_colnr times.
        move sy-index to l_comp-name.
        concatenate 'COLUMN' l_comp-name into l_comp-name.
        condense l_comp-name no-gaps.
        l_comp-type ?= lo_field.
        append l_comp to t_comp.
      enddo.
      lo_struct = cl_abap_structdescr=>create( p_components = t_comp p_strict = space ).
      lo_table = cl_abap_tabledescr=>create( lo_struct ).
      create data table type handle lo_table.
    endform.
    form fill_dynamic_table changing table type ref to data.
      field-symbols: <fs_table> type standard table,
                     <fs_line> type any,
                     <fs_field> type any.
      assign table->* to <fs_table>.
      do 5 times.
        append initial line to <fs_table> assigning <fs_line>.
        do.
          assign component sy-index of structure <fs_line> to <fs_field>.
          if sy-subrc ne 0.
            exit.
          endif.
          <fs_field> = sy-index.
        enddo.
      enddo.
    endform.
    form display_table using i_table type ref to data.
      data lo_alv type ref to cl_salv_table.
      field-symbols <fs_tab> type any table.
      assign i_table->* to <fs_tab>.
      try.
          cl_salv_table=>factory(
            importing
              r_salv_table = lo_alv
            changing
              t_table      = <fs_tab> ).
        catch cx_salv_msg.
          message 'Cannot display result!' type 'E'.
      endtry.
      lo_alv->display( ).
    endform.
    Best regards,
    Tanguy

  • Dynamic table with alv rows & colums

    Hey,
    How to create dynamic internal table with alv grid rows & columns with data .

    TYPE-POOLS : abap.
    FIELD-SYMBOLS: <f_dyn_table> TYPE STANDARD TABLE,
                 <f_dyn_wa>.
    DATA: t_dy_table TYPE REF TO data,
          dy_line  TYPE REF TO data,
          wa_xfc TYPE lvc_s_fcat,
          t_ifc TYPE lvc_t_fcat.
    *get the structure
      DATA: $field        TYPE lvc_fname,
            $counter(2)   TYPE n.
      DATA: $output_field(25) TYPE c,
            $fld_len      TYPE i.
      FIELD-SYMBOLS: <f_out_field> TYPE ANY.
      DATA : $t_idetails  TYPE abap_compdescr_tab,
             $wa_xdetails TYPE abap_compdescr.
      DATA : $ref_table_des TYPE REF TO cl_abap_structdescr.
    get the structure of the table.*
      $ref_table_des ?=
          cl_abap_typedescr=>describe_by_name( c_struc ).
      $t_idetails[] = $ref_table_des->components[].
      LOOP AT $t_idetails INTO $wa_xdetails.
        CLEAR: wa_xfc, $output_field, $fld_len.
        wa_xfc-fieldname = $wa_xdetails-name .
        wa_xfc-datatype  = $wa_xdetails-type_kind.
        wa_xfc-inttype   = $wa_xdetails-type_kind.
        IF $wa_xdetails-type_kind EQ 'C'
           OR $wa_xdetails-type_kind EQ 'N'.
          CONCATENATE 'WA_OUTTAB' '-' $wa_xdetails-name
                                         INTO $output_field.
          ASSIGN ($output_field) TO <f_out_field>.
          IF <f_out_field> IS ASSIGNED.
            DESCRIBE FIELD <f_out_field> LENGTH $fld_len
                                           IN CHARACTER MODE.
            wa_xfc-intlen    = $fld_len.
          ENDIF.
        ELSE.
          wa_xfc-intlen    = $wa_xdetails-length.
        ENDIF.
        wa_xfc-decimals  = $wa_xdetails-decimals.
        APPEND wa_xfc TO t_ifc.
        CLEAR $wa_xdetails.
      ENDLOOP.
    here if you have any other fields to be added to the dynamic structure based on your requirement, you can add then and apped them to t_ifc. There is a special handling for unicode conversion- so for the numc and char fields the length is passed in a different mothed.
    create dynamic internal table and assign to fs*
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
          it_fieldcatalog           = t_ifc
          i_length_in_byte          = 'X'
        IMPORTING
          ep_table                  = t_dy_table
        EXCEPTIONS
          generate_subpool_dir_full = 1
          OTHERS                    = 2.
      IF sy-subrc <> 0.
      ELSE.
        ASSIGN t_dy_table->* TO <f_dyn_table>.
    create dynamic work area and assign to fs
        CREATE DATA dy_line LIKE LINE OF <f_dyn_table>.
        ASSIGN dy_line->* TO <f_dyn_wa>.
      ENDIF.
    *move the data into <f_dyn_wa> and then append this to output table <f_dyn_table>.
    example:-
        IF <f_dyn_wa> IS ASSIGNED AND <f_dyn_table> IS ASSIGNED.
          MOVE-CORRESPONDING wa_outtab TO <f_dyn_wa>.
    APPEND <f_dyn_wa> TO <f_dyn_table>.
    endif.
    Edited by: Krishna Adabala on Dec 2, 2008 7:57 AM

  • Dynamic Table with ALV

    Hello.
    My WD Application should offer a editable ALV Table View.
    The structure and content of the table is only known at runtime. How can I use the ALV dynamically, so that I also can detemine the cells properties (dropdown, data type, ...) at runtime.
    Does anybody know some examples using ALV?
    Thanks and kind regards.
    Carola
    P.S: what are the advantages to use ALV instead of a table UI element?

    Hi Carola,
    Try going through this [thread|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/4c70444a-0801-0010-7688-9e4bd844b783] for info about using an ALV Table with Dynamic Context Nodes.
    The ALV provides many useful built in features without the need for any additional programming effort. These are:
    • Sorting
    • Filtering
    • Selecting rows
    • Scrolling up/down
    • Exporting to Microsoft Excel
    • Exporting to PDF
    The Settings link can be used to open a dialog box, which allows you to adapt
    additional settings:
    • Hiding columns
    • Defining sorting columns and sorting direction
    • Defining complex filters
    • Changing table display settings
    • Defining settings for PDF export
    These settings can be saved and used as the user's default display variant.If the Web Dynpro application is started in Customizing mode (adding sap-config-mode=X to the URL), the settings can be saved for all users. In addition, the settings can be added to a transport request using a Customizing task.
    Regards,
    Uday

  • ALV: Runtime error when calling only few columns of tables in ALV rpt

    Dear ABAP Gurus N Experts,
    I am new for ABAP.
    I am creating an ALV for fetching the data from ztable. It works fine, If I select all column than .
    SELECT * FROM zshipment01 INTO TABLE gi_zshipment01.
    But when I try to select only few column it gives an error. Runtime errors: DBIF_RSQL_INVALID_RSQL, Exception:  CX_SY_OPEN_SQL_DB
    SELECT container shipment_no bill_of_lad bl_date DATE_OF_PORT ARRIVAL_NO1 ED_TRUCKING
    FROM zshipment01 INTO TABLE gi_zshipment01.
    I am using following function:, which is called in program as PERFORM load_data_into_grid.
    FORM load_data_into_grid.
    SELECT * FROM zshipment01 INTO TABLE gi_zshipment01.
    Load data into the grid and display them
    CALL METHOD go_grid->set_table_for_first_display
           EXPORTING i_structure_name = 'zshipment01'
           CHANGING  it_outtab        = gi_zshipment01.
       ENDFORM.                    " load_data_into_grid
    Early response will be highly appreciated.
    With thanks,
    DSC
    Moderator Messge: Basic questions are not allowed. Search before you post.
    Edited by: kishan P on Feb 29, 2012 2:22 PM

    Hi Devendra,
    Try to use "corresponding" statement.
    SELECT field1 field1 etc FROM zshipment01 *INTO CORRESPONDING FIELD OF TABLE* gi_zshipment01.
    Regards,
    Dondi.
    Points unassigned
    Edited by: kishan P on Feb 29, 2012 2:22 PM

  • Dynamic table with field type table

    Hi,
    I´m using "cl_alv_table_create=>create_dynamic_table" to create a dynamic table for ALV Grid.
    But...I need to use colors in ALV, then I need to declare a field type LVC_S_SCOL in dynamic table from "cl_alv_table_create=>create_dynamic_table".
    How can I declare this in fieldcat?
    The code:
    Creating dynamic table
    DATA: table_agrup TYPE REF TO data,
            line_agrup  TYPE REF TO data.
    CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
          it_fieldcatalog           = t_fieldcat
        IMPORTING
          ep_table                  = table_agrup
        EXCEPTIONS
          generate_subpool_dir_full = 1
          OTHERS                    = 2.
        ASSIGN table_agrup->* TO .
    Printing ALV
      CALL METHOD obj_grid->set_table_for_first_display
        EXPORTING
          is_variant                    = w_variant
          i_save                        = 'A'
          is_layout                     = w_layout
        CHANGING
          it_outtab                     =
          it_fieldcatalog               = t_fieldcat
          it_sort                       = t_sort
        EXCEPTIONS
          invalid_parameter_combination = 1
          program_error                 = 2
          too_many_lines                = 3
          OTHERS                        = 4.
    Thanks.

    It is not possible with the  METHOD cl_alv_table_create=>create_dynamic_table to include another table inside that newly generated table.
    I have tried to do it with the code and I got the dynamic table created after at the end of the program.
    In the code,
    <DYN_TABLE> has same effect as your <table> variable
    <DYN_WA> has same effect as your <HEADER>
    REPORT  ZTEST_NP_DYNAMIC.
    DATA: DY_TABLE TYPE REF TO DATA,
          DY_LINE  TYPE REF TO DATA.
    FIELD-SYMBOLS: <DYN_TABLE> TYPE STANDARD TABLE,
                   <DYN_WA>,
                   <DYN_FIELD>.
    FIELD-SYMBOLS: <FS> TYPE ANY.
    * To generate the Dyanmic table with the COLOR
    DATA: LS_SOURCE TYPE STRING.
    DATA: LT_SOURCE LIKE STANDARD TABLE OF LS_SOURCE WITH HEADER LINE.
    DATA: L_NAME LIKE SY-REPID.
    DATA: L_MESSAGE(240) TYPE C,
          L_LINE TYPE I,
          L_WORD(72) TYPE C.
    DATA: L_FORM(30) TYPE C VALUE 'TABLE_CREATE'.
    LT_SOURCE = 'REPORT ZTEST_SUBROUTINE_POOL.'.
    APPEND LT_SOURCE.
    LT_SOURCE = 'FORM  TABLE_CREATE USING I_FS TYPE ANY.'.
    APPEND LT_SOURCE.
    LT_SOURCE = 'DATA: BEGIN OF LT_GENTAB OCCURS 0.'.
    APPEND LT_SOURCE.
    LT_SOURCE = 'DATA: BUKRS TYPE BUKRS. '.
    APPEND LT_SOURCE.
    LT_SOURCE = 'DATA: BKTXT TYPE BKTXT. '.
    APPEND LT_SOURCE.
    * you can add your fields here.....
    LT_SOURCE = 'DATA: COLOR TYPE lvc_t_scol. '.
    APPEND LT_SOURCE.
    LT_SOURCE = 'DATA: END OF LT_GENTAB.'.
    APPEND LT_SOURCE.
    LT_SOURCE = 'DATA: POINTER TYPE REF TO DATA.'.
    APPEND LT_SOURCE.
    LT_SOURCE = 'CREATE DATA POINTER LIKE STANDARD TABLE OF LT_GENTAB.'.
    APPEND LT_SOURCE.
    LT_SOURCE = 'I_FS = POINTER.'.
    APPEND LT_SOURCE.
    LT_SOURCE = 'ENDFORM. '.
    APPEND LT_SOURCE.
    L_NAME = 'ZTEST_SUBROUTINE_POOL'.
    CATCH SYSTEM-EXCEPTIONS GENERATE_SUBPOOL_DIR_FULL = 9.
      GENERATE SUBROUTINE POOL LT_SOURCE NAME L_NAME
               MESSAGE L_MESSAGE LINE L_LINE WORD L_WORD.  "#EC CI_GENERATE
    ENDCATCH.
    IF NOT L_MESSAGE IS INITIAL.
      MESSAGE E000(0K) WITH L_MESSAGE L_LINE L_WORD.
    ENDIF.
    ASSIGN DY_TABLE TO <FS>.
    PERFORM (L_FORM) IN PROGRAM (L_NAME) USING <FS>.
    ASSIGN DY_TABLE->* TO <DYN_TABLE>.
    * Create dynamic work area and assign to FS
    CREATE DATA DY_LINE LIKE LINE OF <DYN_TABLE>.
    ASSIGN DY_LINE->* TO <DYN_WA>.
    Write: 'bye'.
    Regards,
    Naimesh Patel

  • Dynamic tables with data driven visibility of columns (XML).

    Hi
    I am trying to make a template in LiveCycle Designer (XDP) with a dynamic table, and with dynamic visibility of columns.
    I want the column visibility to be driven by the xml input.
    (There is no user input.)
    I want the columns to visible in the table only if one or more of the rows has a data cell with value in a spesific column. If not the entire column should dissappear from the generated pdf.
    If that is not possible, my alternative is so set a value in th XML file to hide a tables column. But how?
    I have no problems of making dynamic tables, that is solved.
    I only want to hide unused columns in a table, defined in the xml source file.
    Can anyone help?
    Borge

    Hi,
    The link is not working..
    Please provide a valid link.

  • Internal table with Dynamic and Non dynamic fileds

    Hi Experts,
    How to get the internal table with Dynamic and Non-Dynamic Fields.
    Could u please help me.
    Thanks,
    Varun

    Hi,
       Execute the below sample code or analyze it there is appropriate description provided.
    *& Report  ZTEST_PRM_DYN_ALV
    REPORT  ZTEST_PRM_DYN_ALV.
    type-pools: slis.
    field-symbols: <dyn_table> type standard table,
    <dyn_wa>.
    data: alv_fldcat type slis_t_fieldcat_alv,
    it_fldcat type lvc_t_fcat.
    selection-screen begin of block b1 with frame title text-001.
    parameters: p_flds(5) type c.
    selection-screen end of block b1.
    start-of-selection.
    *build the dynamic internal table
    perform build_dyn_itab.
    *write 5 records to the alv grid
    do 5 times.
    perform build_report.
    enddo.
    *call the alv grid.
    perform call_alv.
    *Build_dyn_itab
    form build_dyn_itab.
    data: new_table type ref to data,
    new_line type ref to data,
    wa_it_fldcat type lvc_s_fcat.
    *Create fields .
    clear wa_it_fldcat.
    wa_it_fldcat-fieldname = 'name1'.
    wa_it_fldcat-datatype = 'mara-matnr'.
    wa_it_fldcat-intlen = 5.
    append wa_it_fldcat to it_fldcat .
    *clear wa_it_fldcat.
    wa_it_fldcat-fieldname = sy-index.
    wa_it_fldcat-datatype = 'CHAR'.
    wa_it_fldcat-intlen = 5.
    append wa_it_fldcat to it_fldcat .
    do p_flds times.
    clear wa_it_fldcat.
    wa_it_fldcat-fieldname = sy-index.
    wa_it_fldcat-datatype = 'CHAR'.
    wa_it_fldcat-intlen = 6.
    append wa_it_fldcat to it_fldcat .
    enddo.
    *Create dynamic internal table and assign to FS
    call method cl_alv_table_create=>create_dynamic_table
    exporting
    it_fieldcatalog = it_fldcat
    importing
    ep_table = new_table.
    assign new_table->* to <dyn_table>.
    *Create dynamic work area and assign to FS
    create data new_line like line of <dyn_table>.
    assign new_line->* to <dyn_wa>.
    endform.
    *Form build_report
    form build_report.
    data: fieldname(20) type c.
    data: fieldvalue(5) type c.
    data: index(3) type c.
    field-symbols: <fs1>.
    do p_flds times.
    index = sy-index.
    *Set up fieldvalue
    concatenate 'FLD' index into
    fieldvalue.
    condense fieldvalue no-gaps.
    assign component index of structure <dyn_wa> to <fs1>.
    <fs1> = fieldvalue.
    enddo.
    *Append to the dynamic internal table
    append <dyn_wa> to <dyn_table>.
    endform.
    *CALL_ALV
    form call_alv.
    data: wa_cat like line of alv_fldcat.
    *clear wa_cat.
    wa_cat-fieldname = 'matnr'.
    wa_cat-seltext_s = sy-index.
    wa_cat-outputlen = '10'.
    append wa_cat to alv_fldcat.
    do p_flds times.
    clear wa_cat.
    wa_cat-fieldname = sy-index.
    wa_cat-seltext_s = sy-index.
    wa_cat-outputlen = '6'.
    append wa_cat to alv_fldcat.
    enddo.
    *Call ABAP List Viewer (ALV)
    call function 'REUSE_ALV_GRID_DISPLAY'
    exporting
    it_fieldcat = alv_fldcat
    tables
    t_outtab = <dyn_table>.
    endform.
    Hope this will help, reward if found usefull.
    Cheers,
    Ram.

  • Dynamic Columns in table /ALV

    Hi ,
    I need to decide number of columns at run time out of fixed number of coulmn in  table.
    one way of doing it through ALV column hiding  but problem is what ever coloumns I hide programeticaly user can always to go ALV settings and unhide them and that defeats the purpose.
    is there any otherway I can determine my number of columns dynamicaly.
    It can be a  table or ALV table.
    Thanks
    Gaurav

    Hi gaurav,
    In d Do_init method ,
    read the table following table
    data : ls_function            TYPE        salv_wd_s_a_function_ref,
    Disable Setting on ALV
      READ TABLE wd_this->alv_config_table->
    if_salv_wd_function_settings~t_functions
         INTO ls_function
         WITH KEY id = 'SALV_WD_SETTINGS'.
      IF sy-subrc = 0.
        ls_function-r_function->set_visible( cl_wd_uielement=>e_visible-none ).
      ENDIF.
    reward If Usefull

  • Table with bith dynamic and non dynamic data

    Hi all,
    We have a report already developed. Now we need  add some fields from some table which is dynamic in feature to the final report which is already there.
    I need to know how come we can include the dynamic fields into the final internal table.
    I tried declaring fieldsymbols inside the data stmt of the final internal table but it shows some syntax error.
    Please help me.
    Thanks

    Check this sample code..
    REPORT  ztest_dynamic_code.
    DATA: BEGIN OF it_tab OCCURS 0,
           abc(3),
           xyz(3),
           pqr(3),
           item,
         END OF it_tab.
    DATA: it_fieldcatalog  TYPE lvc_t_fcat,
    wa_fieldcat TYPE lvc_s_fcat.
    DATA:  i_dyntab  TYPE REF TO data. " To create dyn.Itab
    DATA:
           w_dref TYPE REF TO data,
           ind(2) TYPE n,
           w_data TYPE REF TO data,
           w_text(5),
           w_grid TYPE REF TO cl_gui_alv_grid.
    DATA: grid TYPE REF TO cl_gui_alv_grid,
          cont TYPE REF TO cl_gui_custom_container.
    FIELD-SYMBOLS: <t_itab> TYPE STANDARD TABLE,
                   <fs_wa> TYPE ANY,<fs> TYPE ANY.
    DATA: in TYPE i.
    *Data population
    it_tab-abc = 'ABC'.
    it_tab-xyz = 'XYZ'.
    it_tab-pqr = 'PQR'.
    DO 9 TIMES.
      in = in + 1.
      it_tab-item = in.
      APPEND it_tab.
    ENDDO.
    *Field cat population.
    wa_fieldcat-fieldname = 'ABC'.
    wa_fieldcat-outputlen = 3.
    wa_fieldcat-coltext = 'abc'.
    APPEND wa_fieldcat TO it_fieldcatalog.
    wa_fieldcat-fieldname = 'XYZ'.
    wa_fieldcat-outputlen = 3.
    wa_fieldcat-coltext = 'XYZ'.
    APPEND wa_fieldcat TO it_fieldcatalog.
    wa_fieldcat-fieldname = 'PQR'.
    wa_fieldcat-outputlen = 3.
    wa_fieldcat-coltext = 'pqr'.
    APPEND wa_fieldcat TO it_fieldcatalog.
    wa_fieldcat-fieldname = 'COLOR'.
    wa_fieldcat-outputlen = 4.
    wa_fieldcat-coltext = 'col'.
    APPEND wa_fieldcat TO it_fieldcatalog.
    ind = 1.
    DO 9 TIMES.
      CONCATENATE 'ITEM' ind INTO wa_fieldcat-fieldname.
      CONCATENATE 'ITEM' ind INTO wa_fieldcat-coltext.
      wa_fieldcat-outputlen = 1.
      APPEND wa_fieldcat TO it_fieldcatalog.
      CLEAR wa_fieldcat .
      ind  = ind + 1.
    ENDDO.
    *-Dynamic Table creation
    CALL METHOD cl_alv_table_create=>create_dynamic_table
      EXPORTING
        it_fieldcatalog = it_fieldcatalog
      IMPORTING
        ep_table        = i_dyntab.
    ASSIGN i_dyntab->* TO <t_itab>.
    CREATE DATA w_data LIKE LINE OF <t_itab>.
    ASSIGN w_data->* TO <fs_wa>.
    SORT it_tab BY abc xyz pqr.
    CLEAR ind.
    ind = 4.
    *-Final Internal table as per Requirement
    do 10 times.
    LOOP AT it_tab.
      ASSIGN COMPONENT 1 OF STRUCTURE <fs_wa> TO <fs>.
      <fs> = it_tab-abc.
      ASSIGN COMPONENT 2 OF STRUCTURE <fs_wa> TO <fs>.
      <fs> = it_tab-xyz.
      UNASSIGN <fs>.
      ASSIGN COMPONENT 3 OF STRUCTURE <fs_wa> TO <fs>.
      <fs> = it_tab-pqr.
      UNASSIGN <fs>.
      ASSIGN COMPONENT 4 OF STRUCTURE <fs_wa> TO <fs>.
    *-You can assign the color conditionally also..
      if sy-index = 4.
      <fs> = 'C400'.
      else.
        <fs> = 'C600'.
      endif.
      UNASSIGN <fs>.
      ASSIGN COMPONENT ind OF STRUCTURE <fs_wa> TO <fs>.
      <fs> = it_tab-item.
      UNASSIGN <fs>.
      ind = ind + 1.
      AT END OF pqr.
        APPEND <fs_wa> TO <t_itab>.
    *    <fs_wa>-color = 'C600'.
        ind = 4.
        CLEAR <fs_wa>.
      ENDAT.
    ENDLOOP.
    enddo.
    *-Display
    CALL SCREEN 100.
    *&      Module  STATUS_0100  OUTPUT
    *       text
    MODULE status_0100 OUTPUT.
      DATA: layout TYPE lvc_s_layo.
      CREATE OBJECT cont
         EXPORTING
           container_name              = 'CONT'
         EXCEPTIONS
           cntl_error                  = 1
           cntl_system_error           = 2
           create_error                = 3
           lifetime_error              = 4
           lifetime_dynpro_dynpro_link = 5
           OTHERS                      = 6
      IF sy-subrc NE 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                   WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
      CREATE OBJECT grid
        EXPORTING
          i_parent          = cont
        EXCEPTIONS
          error_cntl_create = 1
          error_cntl_init   = 2
          error_cntl_link   = 3
          error_dp_create   = 4
          OTHERS            = 5
      IF sy-subrc NE 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                   WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
      layout-INFO_FNAME = 'COLOR'.
      grid->set_table_for_first_display(
         EXPORTING
           is_layout                      =  layout
         CHANGING
           it_outtab                     = <t_itab>
           it_fieldcatalog               = it_fieldcatalog
       EXCEPTIONS
         invalid_parameter_combination = 1
         program_error                 = 2
         too_many_lines                = 3
      IF sy-subrc  NE 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                   WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    ENDMODULE.                 " STATUS_0100  OUTPUT

  • Dynamic Table with two columns

    Hi!
    i have to create a Dynamic Table with two columns having 5-5 links each with some text...... three links r based on certain conditions....they r visible only if condition is true...
    if the links r not visible in this case another links take it's place & fill the cell.
    links/text is coming from database.
    i am using Struts with JSP IDE netbeans
    Please help me
    BuntyIndia

    i wanna do something like this
    <div class="box_d box_margin_right">
              <ul class="anchor-bullet">
              <c:forEach items="${data.faqList}" var="item" varStatus="status"
                        begin="0" end="${data.faqListSize/2-1}">
                        <li>${item}</li>
                   </c:forEach>
              </ul>
              </div>
              <div class="box_d">
              <ul class="anchor-bullet">
              <c:forEach items="${data.faqList}" var="item" varStatus="status"
                        begin="${data.faqListSize/2}" end="${data.faqListSize}">
                        <li>${item}</li>
                   </c:forEach>
              </ul>
              </div>
    wanna divide table in two columns....if one link got off due to condition other one take it's position...
    I have created a textorderedlist
    Bunty

  • Dynamic Table - Add rows and columns in same table

    Hi there,
    I wonder if someone could help please? I'm trying to create and table where a user can add both rows and columns (preferably with separate buttons) but am having trouble trying to figure out how to do this. Is it possible? If so how? I'm not familar with script but have found examples of seprate tables where you can add a row and then another table where you can add columns and essentailly want to merge the two but cannot make it work.
    Any help much appreciated!
    Thanks,
    Ken

    It is great example....you can learn the concepts there and apply....however you may have to think twice before you implement column adding dynamically....because the technique here is make copy of what we already have and reproduce it as a new item and this technique works great for rows as they all have every thing in common. But when it comes to columns it may have unique visible identity as column head and displaying repeatedly the same column head may not look good. Of-Course you can do few extra lines of code and change the column appearance based on users input each time. Situations where users need to add additional column is very unlikely (sure your requirement might be an exception).
    Key in allowing adding/removing instances is managing design mode settings under Object>>Binding>>....and select the checkbox "Repeat <subform/row/...> for Each Data Item" and then set Min, Max and Initial count values.
    Also you need to club your effots by using simple scipt with button clicks....
    for the example refered in URL you posted following is what I did to make the first table allow Adding/Removing Rows....
    1. Opened the form in LC designer.
    2. Add two buttons AddRow & RemoveRow right next to RemoveColumn
    3. For AddRow I used following JS code....
          Table1._Row1.addInstance(1);//that means any time this button is clicked a new instance of Row1 is added use _Row2 or Row3 based on your needs
          var fVersion = new Number(xfa.host.version); // this will be a floating point number like "7.05"
          if (fVersion < 8.0) // do this for Acrobat versions earlier than 8.0
           // make sure that the new instance is properly rendered
           xfa.layout.relayout();
    4.  For RemoveRow I used following JS code....
         Table1._Row1.removeInstance(1);//Syntax is...<objectReference>.removeInstance(<index of the repeating object that needs to be removed>); //in this case since we used 1 alwasys second object from top gets deleted.
          var fVersion = new Number(xfa.host.version); // this will be a floating point number like "7.05"
          if (fVersion < 8.0) // do this for Acrobat versions earlier than 8.0
           // make sure that the new instance is properly rendered
           xfa.layout.relayout();
    5. Now time to update settings at Object>>Binding tab and set "Repeat......" and also set Min, Max and Initial count as explained above.
         Those settings needs to be updated for Row1 (or your choice of row) of the table
    6. Set the Height to Expand of the Subform, where the table is housed....  this is done under Layout pallet
    7. Save the PDF as dynamic template and verify the results...
    If you still run into issues I can send you copy that works on my machine, but you need send me an email at n_varma(AT)lycos.com
    Good luck,

  • Is it possible to change nunmber of columns dynamically in table control

    Is it possible to change number of columns dynamically in table control? if so how it could be done?
    Thnaks in advance.
    Sounder

    You can update the table control in your program, the table control is a structure of the type CXTAB_CONTROL of TYPE-POOLS cxtab.
    There you can hide or display column the same way you do for fields in LOOP AT SCREEN. there you will ahve to LOOP AT <control>-COLS.
    TYPE-POOL CXTAB .                                                                               
    TYPES:                                                                               
    BEGIN OF CXTAB_COLUMN,                                                          
             SCREEN      LIKE SCREEN,     "Attributes struktur SCREEN                      
             INDEX       TYPE I,         "Position of a column on the screen               
             SELECTED(1) TYPE C,          "Indicator 'column selected'                     
             VISLENGTH   LIKE ICON-OLENG, "Visualised length of a column                   
             INVISIBLE(1) TYPE C,         "Indicator 'column invisible'                    
           END   OF CXTAB_COLUMN,                                                                               
    BEGIN OF CXTAB_CONTROL,                                                         
             FIXED_COLS    TYPE I, "Number of fixed columns                                
             LINES         TYPE I, "Number of lines to display                             
             TOP_LINE      TYPE I, "Top line during next PBO                               
             CURRENT_LINE  TYPE I, "Current line during LOOP/ENDLOOP                       
             LEFT_COL       TYPE I, "Fist scrollable column after fixed area               
             LINE_SEL_MODE    TYPE I, "Line-selection  : none(0), single(1),               
             COL_SEL_MODE     TYPE I, "Column-selection:        multiple(2)                
             LINE_SELECTOR(1) TYPE C, "Indicator: 'With line-selection col'                
             V_SCROLL(1) TYPE C,            "not used                                      
             H_GRID(1) TYPE C,        "Indicator: 'Horizontal  grid-lines'                 
             V_GRID(1) TYPE C,     "Indicator: 'Vertikal    grid-lines'                    
             COLS      TYPE STANDARD TABLE OF CXTAB_COLUMN                                 
                            WITH NON-UNIQUE DEFAULT KEY,                                   
             INVISIBLE(1) TYPE C,                                                          
           END   OF CXTAB_CONTROL,                                                         
    Regards

Maybe you are looking for