<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Dynamic Table - Deep Structure in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-table-deep-structure/m-p/867698#M49268</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Have you tried building a field catalog to pass to method create_dynamic_table, setting the last field to dictionary type lvc_t_scol?  If so, did you get an error?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If this works, you will need a field catalog without this field to pass to your ALV call.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let us know how it goes.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 29 Jan 2005 00:10:48 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2005-01-29T00:10:48Z</dc:date>
    <item>
      <title>Dynamic Table - Deep Structure</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-table-deep-structure/m-p/867696#M49266</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Gurus,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this is my first posting, so be patient!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to create a deep structure dynamic table via method&lt;/P&gt;&lt;P&gt;cl_alv_table_create=&amp;gt;create_dynamic_table, is this possible? Are there tricks to make it happen?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Background: i wanna create an alv with dynamic fieldcatalalog, in this case i want to colour special fields, which is done by lvc_s_layo-?csp_fieldname? in combination with a field in my internal table which is typed ?lvc_t_scol?. Is this possible under 6.2.43&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanxs for your replies&lt;/P&gt;&lt;P&gt;juergen&lt;/P&gt;&lt;P&gt;- ?i dont actually know by rote the correct fieldnames of lvc_xxxxx?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Jan 2005 20:34:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-table-deep-structure/m-p/867696#M49266</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-01-28T20:34:55Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Table - Deep Structure</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-table-deep-structure/m-p/867697#M49267</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jürgen&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;At the end if you aim to build an ALV Grid list, I could not understand your requirement to have a dynamic field catalog. That is because, field catalog holds metadata and its structure is predefined. You can change its contents and reflect it to your ALV Grid (using the method "&lt;EM&gt;set_frontend_fieldcatalog&lt;/EM&gt;") at any instance of runtime.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If your requirement is to create your data table dynamically, then it is insignificant whether you can create a deep-structured internal table since ALV Grid does only support flat structured (except special style table usage) data tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope I have understood your question right...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*--Serdar&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Jan 2005 21:31:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-table-deep-structure/m-p/867697#M49267</guid>
      <dc:creator>ssimsekler</dc:creator>
      <dc:date>2005-01-28T21:31:05Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Table - Deep Structure</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-table-deep-structure/m-p/867698#M49268</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Have you tried building a field catalog to pass to method create_dynamic_table, setting the last field to dictionary type lvc_t_scol?  If so, did you get an error?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If this works, you will need a field catalog without this field to pass to your ALV call.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let us know how it goes.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 29 Jan 2005 00:10:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-table-deep-structure/m-p/867698#M49268</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-01-29T00:10:48Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Table - Deep Structure</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-table-deep-structure/m-p/867699#M49269</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Look if this weblog gives you any help for creating a deep structure dynamic table. If  you are successful, do let us know. I am quite eager to find out how you did and the venture looks interesting.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/people/subramanian.venkateswaran2/blog/2004/11/19/dynamic-internal-table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Subramanian v.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 29 Jan 2005 05:28:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-table-deep-structure/m-p/867699#M49269</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-01-29T05:28:33Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Table - Deep Structure</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-table-deep-structure/m-p/867700#M49270</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the purpose of the program is just to count different values.&lt;/P&gt;&lt;P&gt;The user can decide which values by filling a select-options on the selection screen, there are ~2000 different values possible, mostly there are 5 to 10 relevant&lt;/P&gt;&lt;P&gt;the values can be active or inactive&lt;/P&gt;&lt;P&gt;the user can decide what he wants to count&lt;/P&gt;&lt;P&gt;-&amp;gt; so i build up a fieldcatalog with the deranged select-options like it's described in the very interesting weblog of Subramanian,&lt;/P&gt;&lt;P&gt;then i create the table dynamically with the fieldcatalog,&lt;/P&gt;&lt;P&gt;then i count,&lt;/P&gt;&lt;P&gt;then i pass the data to REUSE_ALV_GRID with the fieldcatalog,&lt;/P&gt;&lt;P&gt;all that workes fine,&lt;/P&gt;&lt;P&gt;now i wonder if i coud colour fields like i described above, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;looks like i can't put the colour table field into the dynamic table&lt;/P&gt;&lt;P&gt;overall it's just to know what's possible.&lt;/P&gt;&lt;P&gt;thank you for your input&lt;/P&gt;&lt;P&gt;Jürgen&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Feb 2005 17:03:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-table-deep-structure/m-p/867700#M49270</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-02-01T17:03:23Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Table - Deep Structure</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-table-deep-structure/m-p/867701#M49271</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;To know about colouring individual cells, I suggest you refer to this tutorial authored by Serdar Simsekler. An excellent tutorial, referred almost daily.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/documents/a1-8-4/an" target="test_blank"&gt;https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/documents/a1-8-4/an&lt;/A&gt; easy reference for alv grid control.pdf&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Subramanian V.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Feb 2005 03:16:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-table-deep-structure/m-p/867701#M49271</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-02-02T03:16:36Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Table - Deep Structure</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-table-deep-structure/m-p/867702#M49272</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jurgen, I took on the challenge.  This program provides a dynamic table with the ability to set the colors of the cells.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Create the structure ZCDF_CELL_COLOR in the dictionary as described in the program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Create screen 100 as empty, with next screen set to 0, and the following flow logic:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;PROCESS BEFORE OUTPUT.
  MODULE initialization.

PROCESS AFTER INPUT.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT  zcdf_dynamic_table.

* Dynamic ALV Grid with Cell Coloring

DATA:
  r_dyn_table      TYPE REF TO data,
  r_wa_dyn_table   TYPE REF TO data,
  r_dock_ctnr      TYPE REF TO cl_gui_docking_container,
  r_alv_grid       TYPE REF TO cl_gui_alv_grid,

  t_fieldcat1      TYPE lvc_t_fcat, "with cell color
  t_fieldcat2      TYPE lvc_t_fcat, "without cell color

  wa_fieldcat      LIKE LINE OF t_fieldcat1,
  wa_cellcolors    TYPE LINE OF lvc_t_scol,
  wa_is_layout     TYPE lvc_s_layo.

FIELD-SYMBOLS:
  &amp;lt;t_dyn_table&amp;gt;    TYPE STANDARD TABLE,
  &amp;lt;wa_dyn_table&amp;gt;   TYPE ANY,
  &amp;lt;t_cellcolors&amp;gt;   TYPE lvc_t_scol,
  &amp;lt;w_field&amp;gt;        TYPE ANY.

START-OF-SELECTION.

* Build field catalog based on your criteria.

  wa_fieldcat-fieldname = 'FIELD1'.
  wa_fieldcat-inttype   = 'C'.
  wa_fieldcat-outputlen = '10'.
  wa_fieldcat-coltext   = 'My Field 1'.
  wa_fieldcat-seltext   = wa_fieldcat-coltext.

  APPEND wa_fieldcat TO t_fieldcat1.

  wa_fieldcat-fieldname = 'FIELD2'.
  wa_fieldcat-inttype   = 'C'.
  wa_fieldcat-outputlen = '10'.
  wa_fieldcat-coltext   = 'My Field 2'.
  wa_fieldcat-seltext   = wa_fieldcat-coltext.

  APPEND wa_fieldcat TO t_fieldcat1.

* Before adding cell color table, 
*  save fieldcatalog to pass
*  to ALV call.

  t_fieldcat2[] = t_fieldcat1[].

* Add cell color table.
*  ZCDF_CELL_COLOR is a structure in the 
*   dictionary with one
*   field called T_CELL_COLOR of type LVC_T_SCOL.

  wa_fieldcat-fieldname = 'T_CELLCOLORS'.
  wa_fieldcat-ref_field = 'T_CELL_COLOR'.
  wa_fieldcat-ref_table = 'ZCDF_CELL_COLOR'.

  APPEND wa_fieldcat TO t_fieldcat1.

* Create dynamic table.

  CALL METHOD cl_alv_table_create=&amp;gt;create_dynamic_table
    EXPORTING
      it_fieldcatalog           = t_fieldcat1
    IMPORTING
      ep_table                  = r_dyn_table
    EXCEPTIONS
      generate_subpool_dir_full = 1
      OTHERS                    = 2.

  IF sy-subrc &amp;lt;&amp;gt; 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
               WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.

* Get access to new table using field symbol.

  ASSIGN r_dyn_table-&amp;gt;* TO &amp;lt;t_dyn_table&amp;gt;.

* Create work area for new table.

  CREATE DATA r_wa_dyn_table LIKE LINE OF &amp;lt;t_dyn_table&amp;gt;.

* Get access to new work area using field symbol.

  ASSIGN r_wa_dyn_table-&amp;gt;* TO &amp;lt;wa_dyn_table&amp;gt;.

* Get data into table from somewhere.  Field names are
*  known at this point because field catalog is already
*  built.  Read field names from the field catalog or use
*  COMPONENT &amp;lt;number&amp;gt; in a DO loop to access the fields.  
*  A simpler hard coded approach is used here.

  ASSIGN COMPONENT 'FIELD1' OF STRUCTURE &amp;lt;wa_dyn_table&amp;gt;
    TO &amp;lt;w_field&amp;gt;.

  &amp;lt;w_field&amp;gt; = 'ABC'.

  ASSIGN COMPONENT 'FIELD2' OF STRUCTURE &amp;lt;wa_dyn_table&amp;gt; 
    TO &amp;lt;w_field&amp;gt;.

  &amp;lt;w_field&amp;gt; = 'XYZ'.

  APPEND &amp;lt;wa_dyn_table&amp;gt; TO &amp;lt;t_dyn_table&amp;gt;.

  ASSIGN COMPONENT 'FIELD1' OF STRUCTURE &amp;lt;wa_dyn_table&amp;gt;
    TO &amp;lt;w_field&amp;gt;.

  &amp;lt;w_field&amp;gt; = 'TUV'.

  ASSIGN COMPONENT 'FIELD2' OF STRUCTURE &amp;lt;wa_dyn_table&amp;gt;
    TO &amp;lt;w_field&amp;gt;.

  &amp;lt;w_field&amp;gt; = 'DEF'.

  APPEND &amp;lt;wa_dyn_table&amp;gt; TO &amp;lt;t_dyn_table&amp;gt;.

* Color cells based on your criteria.  
*  In this example, a test on
*  FIELD2 is used to decide on color.

  LOOP AT &amp;lt;t_dyn_table&amp;gt; INTO &amp;lt;wa_dyn_table&amp;gt;.

    ASSIGN COMPONENT 'FIELD2' OF STRUCTURE &amp;lt;wa_dyn_table&amp;gt;
      TO &amp;lt;w_field&amp;gt;.

    ASSIGN COMPONENT 'T_CELLCOLORS' 
      OF STRUCTURE &amp;lt;wa_dyn_table&amp;gt; TO &amp;lt;t_cellcolors&amp;gt;.

    CLEAR wa_cellcolors.
    wa_cellcolors-fname     = 'FIELD2'.

    IF &amp;lt;w_field&amp;gt; = 'DEF'.
      wa_cellcolors-color-col = '7'.
    ELSE.
      wa_cellcolors-color-col = '5'.
    ENDIF.

    APPEND wa_cellcolors TO &amp;lt;t_cellcolors&amp;gt;.
    MODIFY &amp;lt;t_dyn_table&amp;gt; FROM &amp;lt;wa_dyn_table&amp;gt;.

  ENDLOOP.

  CALL SCREEN 100.

*-------------------------------------------------------*
*  MODULE initialization OUTPUT
*-------------------------------------------------------*

MODULE initialization OUTPUT.

* Set up for ALV display.

  IF r_dock_ctnr IS INITIAL.

    CREATE OBJECT r_dock_ctnr
           EXPORTING
              side  =   
                cl_gui_docking_container=&amp;gt;dock_at_left
              ratio = '90'.

    CREATE OBJECT r_alv_grid
           EXPORTING i_parent = r_dock_ctnr.

*   Set ALV controls.

    wa_is_layout-ctab_fname = 'T_CELLCOLORS'.

*   Display.

    CALL METHOD r_alv_grid-&amp;gt;set_table_for_first_display
      EXPORTING
        is_layout       = wa_is_layout
      CHANGING
        it_outtab       = &amp;lt;t_dyn_table&amp;gt;
        it_fieldcatalog = t_fieldcat2.

  ELSE.     "grids already prepared

*   Refresh display.

    CALL METHOD r_alv_grid-&amp;gt;refresh_table_display
      EXPORTING
        i_soft_refresh = ' '
      EXCEPTIONS
        finished       = 1
        OTHERS         = 2.

  ENDIF.

ENDMODULE.                 " initialization  OUTPUT&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Feb 2005 04:26:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-table-deep-structure/m-p/867702#M49272</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-02-02T04:26:06Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Table - Deep Structure</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-table-deep-structure/m-p/867703#M49273</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Charles,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;chapeau! and all respect,&lt;/P&gt;&lt;P&gt;this is the solution,&lt;/P&gt;&lt;P&gt;i didn't use an own structure for the color table, there are many SAPones in my system&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thank you&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Feb 2005 11:17:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-table-deep-structure/m-p/867703#M49273</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-02-02T11:17:35Z</dc:date>
    </item>
  </channel>
</rss>

