<?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: Nested dynamic table in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/nested-dynamic-table/m-p/12076437#M1970477</link>
    <description>&lt;P&gt;Hi Sandra Rossi,&lt;/P&gt;&lt;P&gt;Below is types structure.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;TYPES: BEGIN OF ts_str,
         CARRID type	S_CARR_ID,
         CARRNAME type	S_CARRNAME,
         CURRCODE type	S_CURRCODE,
         URL type	S_CARRURL,
         nested_table TYPE STANDARD TABLE OF scarr WITH EMPTY KEY,
       END OF ts_str,

       tt_str type standard table of ts_scarr,
       

       begin of ts_deep,
       nested_str type char30,
       tab type standard table of ts_str,
       end of ts_deep,

       tt_deep TYPE STANDARD TABLE OF ts_deep WITH EMPTY KEY.&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;in above types TT_STR i want to create dynamically in run time.&lt;/P&gt;&lt;P&gt;and using TT_STR want to create dynamic deep structure TT_DEEP.&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
    <pubDate>Fri, 03 Jan 2020 03:36:24 GMT</pubDate>
    <dc:creator>former_member209807</dc:creator>
    <dc:date>2020-01-03T03:36:24Z</dc:date>
    <item>
      <title>Nested dynamic table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/nested-dynamic-table/m-p/12076432#M1970472</link>
      <description>&lt;P&gt;Hello Experts,&lt;/P&gt;
  &lt;P&gt;I have a requirement for creating nested dynamic table.&lt;/P&gt;
  &lt;P&gt;Example - &lt;/P&gt;
  &lt;P&gt;create dynamic table(&amp;lt;TAB1&amp;gt;)&lt;/P&gt;
  &lt;P&gt;using above created dynamic table create a nested dynamic table (&amp;lt;TAB2&amp;gt;).&lt;/P&gt;
  &lt;P&gt;i tried with below code but unable to create nested dynamic table.&lt;/P&gt;
  &lt;P&gt;let me know if there is any other process to create nested dynamic table.&lt;/P&gt;
  &lt;P&gt;Thanks in advance.&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;DATA:
      lt_comptab         TYPE cl_abap_structdescr=&amp;gt;component_table,
      ls_comp            LIKE LINE OF lt_comptab,
      lt_comptab2         TYPE cl_abap_structdescr=&amp;gt;component_table,
      ls_comp2            LIKE LINE OF lt_comptab,
      lref_newstr        TYPE REF TO cl_abap_structdescr,
      lref_tab_type      TYPE REF TO cl_abap_tabledescr,
      lt_fcat            TYPE lvc_t_fcat,
      ls_fcat            TYPE lvc_s_fcat,
      ls_dd03p           TYPE dd03p,
      lt_data            type ref to data,
      lt_data2            type ref to data.
field-symbols: &amp;lt;fs_table&amp;gt; type standard table.
field-symbols: &amp;lt;fs_table2&amp;gt; type standard table.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
  EXPORTING
    i_structure_name       = 'SCARR'
  CHANGING
    ct_fieldcat            = lt_fcat
  EXCEPTIONS
    inconsistent_interface = 1
    program_error          = 2
    OTHERS                 = 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.


LOOP AT lt_fcat INTO ls_fcat.
  IF ls_fcat-ref_table IS NOT INITIAL.
    CLEAR ls_dd03p.
    CALL FUNCTION 'BUS_DDFIELD_GET'
      EXPORTING
        i_tabnm         = ls_fcat-ref_table
        i_fldnm         = ls_fcat-fieldname
      IMPORTING
        e_dd03p         = ls_dd03p
      EXCEPTIONS
        field_not_found = 1
        OTHERS          = 2.
    IF sy-subrc EQ 0.
      ls_comp-name = ls_fcat-fieldname.
      ls_comp-type ?= cl_abap_datadescr=&amp;gt;describe_by_name( ls_dd03p-rollname ).
      APPEND ls_comp TO lt_comptab.
      CLEAR ls_comp.
    ENDIF.
  ELSE.
    ls_comp-name = ls_fcat-fieldname.
    ls_comp-type ?= cl_abap_datadescr=&amp;gt;describe_by_name( ls_fcat-rollname ).
    APPEND ls_comp TO lt_comptab.
    CLEAR ls_comp.
  ENDIF.
ENDLOOP.


CLEAR ls_fcat.

lref_newstr = cl_abap_structdescr=&amp;gt;create( lt_comptab ).
lref_tab_type = cl_abap_tabledescr=&amp;gt;create( lref_newstr ).


create data lt_data type handle lref_tab_type.
assign lt_data-&amp;gt;* to &amp;lt;fs_table&amp;gt;.


ls_fcat-fieldname  = 'NESTED_TABLE'.
*ls_fcat-inttype    = 'CHAR'.
*ls_fcat-intlen     = 000006.
ls_fcat-rollname    = &amp;lt;fs_table&amp;gt;. "For SFLIGHT
APPEND ls_fcat TO lt_fcat.


ls_comp2-name = ls_fcat-fieldname.
ls_comp2-type ?= cl_abap_datadescr=&amp;gt;describe_by_name( ls_fcat-rollname ).


APPEND ls_comp2 to lt_comptab2.


DATA(lref_newstr2) = cl_abap_structdescr=&amp;gt;create( lt_comptab ).
DATA(lref_tab_type2) = cl_abap_tabledescr=&amp;gt;create( lref_newstr2 ).


create data lt_data2 type handle lref_tab_type2.
assign lt_data2-&amp;gt;* to &amp;lt;fs_table2&amp;gt;.
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 01 Jan 2020 13:59:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/nested-dynamic-table/m-p/12076432#M1970472</guid>
      <dc:creator>former_member209807</dc:creator>
      <dc:date>2020-01-01T13:59:27Z</dc:date>
    </item>
    <item>
      <title>Re: Nested dynamic table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/nested-dynamic-table/m-p/12076433#M1970473</link>
      <description>&lt;P&gt;I'm not sure to understand what type you want to obtain (I see SCARR fields, NESTED_TABLE, SFLIGHT fields), and what is the issue you are facing, so it's difficult to answer precisely. Can you show roughly what type you want to obtain with TYPES statements?&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jan 2020 16:03:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/nested-dynamic-table/m-p/12076433#M1970473</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2020-01-01T16:03:23Z</dc:date>
    </item>
    <item>
      <title>Re: Nested dynamic table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/nested-dynamic-table/m-p/12076434#M1970474</link>
      <description>&lt;P&gt;Hi Sandra Rossi,&lt;/P&gt;&lt;P&gt;Thanks for responding to my query.&lt;/P&gt;&lt;P&gt;Below is detailed explanation of my requirement.&lt;/P&gt;&lt;P&gt;with fields from SCARR structure i have created dynamic internal table &amp;lt;FS_TABLE&amp;gt;.&lt;/P&gt;&lt;P&gt;now I want to created deep dynamic table&amp;lt;FS_TABLE2&amp;gt; using dynamic table &amp;lt;FS_TABLE&amp;gt;.&lt;/P&gt;&lt;P&gt; below is structure of dynamic deep table.&lt;/P&gt;
 
 
  Nested_table
  &amp;lt;FS_TABLE&amp;gt;
 
 
  1
  table data&lt;P&gt;Thanks in advance&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jan 2020 06:25:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/nested-dynamic-table/m-p/12076434#M1970474</guid>
      <dc:creator>former_member209807</dc:creator>
      <dc:date>2020-01-02T06:25:41Z</dc:date>
    </item>
    <item>
      <title>Re: Nested dynamic table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/nested-dynamic-table/m-p/12076435#M1970475</link>
      <description>&lt;P&gt;Please don't "answer", instead use the "Comment" button.&lt;/P&gt;&lt;H3&gt;Before answering&lt;/H3&gt;&lt;P&gt;You should only submit an &lt;STRONG&gt;answer &lt;/STRONG&gt;when you are proposing a solution to the poster's problem.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jan 2020 08:05:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/nested-dynamic-table/m-p/12076435#M1970475</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2020-01-02T08:05:39Z</dc:date>
    </item>
    <item>
      <title>Re: Nested dynamic table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/nested-dynamic-table/m-p/12076436#M1970476</link>
      <description>&lt;P&gt;Sorry, I still REALLY don't understand. Why did you mention SFLIGHT in the comments of your initial code? Please provide the type you want with TYPES.&lt;/P&gt;&lt;P&gt;Let me help you, please update this code as you wish:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;TYPES: BEGIN OF ts_deep,
         nested_table TYPE STANDARD TABLE OF scarr WITH EMPTY KEY,
       END OF ts_deep,
       tt_deep TYPE STANDARD TABLE OF ts_deep WITH EMPTY KEY.&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 02 Jan 2020 08:11:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/nested-dynamic-table/m-p/12076436#M1970476</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2020-01-02T08:11:39Z</dc:date>
    </item>
    <item>
      <title>Re: Nested dynamic table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/nested-dynamic-table/m-p/12076437#M1970477</link>
      <description>&lt;P&gt;Hi Sandra Rossi,&lt;/P&gt;&lt;P&gt;Below is types structure.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;TYPES: BEGIN OF ts_str,
         CARRID type	S_CARR_ID,
         CARRNAME type	S_CARRNAME,
         CURRCODE type	S_CURRCODE,
         URL type	S_CARRURL,
         nested_table TYPE STANDARD TABLE OF scarr WITH EMPTY KEY,
       END OF ts_str,

       tt_str type standard table of ts_scarr,
       

       begin of ts_deep,
       nested_str type char30,
       tab type standard table of ts_str,
       end of ts_deep,

       tt_deep TYPE STANDARD TABLE OF ts_deep WITH EMPTY KEY.&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;in above types TT_STR i want to create dynamically in run time.&lt;/P&gt;&lt;P&gt;and using TT_STR want to create dynamic deep structure TT_DEEP.&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jan 2020 03:36:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/nested-dynamic-table/m-p/12076437#M1970477</guid>
      <dc:creator>former_member209807</dc:creator>
      <dc:date>2020-01-03T03:36:24Z</dc:date>
    </item>
    <item>
      <title>Re: Nested dynamic table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/nested-dynamic-table/m-p/12076438#M1970478</link>
      <description>&lt;P&gt;Thank you, I will answer in a moment.&lt;/P&gt;&lt;P&gt;NB: please use Comment, don't use "Answer"/button "Submit the answer", as SAP says:&lt;/P&gt;&lt;H3&gt;Before answering&lt;/H3&gt;&lt;P&gt;You should only submit an answer when you are proposing a solution to the poster's problem&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jan 2020 08:03:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/nested-dynamic-table/m-p/12076438#M1970478</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2020-01-03T08:03:41Z</dc:date>
    </item>
    <item>
      <title>Re: Nested dynamic table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/nested-dynamic-table/m-p/12076439#M1970479</link>
      <description>&lt;P&gt;If you want to obtain dynamically the type TT_DEEP and all types used by it, so that it's equivalent to this static code (I used DEFAULT instead of EMPTY so that to shorten my answer):&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;TYPES: BEGIN OF ts_str,
         CARRID       type S_CARR_ID,
         CARRNAME     type S_CARRNAME,
         CURRCODE     type S_CURRCODE,
         URL          type S_CARRURL,
         nested_table TYPE STANDARD TABLE OF scarr WITH DEFAULT KEY,
       END OF ts_str,

       tt_str type standard table of ts_scarr WITH DEFAULT KEY,

       begin of ts_deep,
         nested_str type char30,
         tab        type tt_str,
       end of ts_deep,

       tt_deep TYPE STANDARD TABLE OF ts_deep WITH DEFAULT KEY.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;It corresponds to this &lt;STRONG&gt;pseudo code&lt;/STRONG&gt;:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data(rtts_tt_scarr) = CL_ABAP_TABLEDESCR=&amp;gt;get( p_line_type 
    = cast #( cl_abap_typedescr=&amp;gt;describe_by_name( 'SCARR' ) ) ).

data(rtts_ts_str) = CL_ABAP_STRUCTDESCR=&amp;gt;get( value #(
    ( name = 'CARRID'       type = cast #( cl_abap_typedescr=&amp;gt;describe_by_name( 'SCARR-CARRID' ) ) )
    " ...
    ( name = 'NESTED_TABLE' type = rtts_tt_scarr ) ) ).

data(rtts_tt_str) = CL_ABAP_TABLEDESCR=&amp;gt;get( p_line_type = rtts_ts_str ).

data(rtts_ts_deep) = CL_ABAP_STRUCTDESCR=&amp;gt;get( value #( 
    ( name = 'NESTED_STR' type = cast #( cl_abap_typedescr=&amp;gt;describe_by_name( 'CHAR30' ) ) )
    ( name = 'TAB'        type = rtts_tt_str ) ) ).

data(rtts_tt_deep) = CL_ABAP_TABLEDESCR=&amp;gt;get( p_line_type = rtts_ts_deep ).&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 03 Jan 2020 09:00:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/nested-dynamic-table/m-p/12076439#M1970479</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2020-01-03T09:00:35Z</dc:date>
    </item>
  </channel>
</rss>

