<?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 internal table problem in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-problem/m-p/7653654#M1573395</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How are you populating the components table LT_TOT_COMP? This is what you should be doing:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
    TRY .
        lo_elemdescr =
          cl_abap_elemdescr=&amp;gt;get_p( p_length = 16 p_decimals = 3 ).
      CATCH cx_parameter_invalid_range.
        RAISE ex_dyntab_creation_falied.
    ENDTRY.

    lwa_struc_comp-name = gc_profile_heading-col3.
    lwa_struc_comp-type = lo_elemdescr.
    APPEND lwa_struc_comp TO lt_struc_comp.
    CLEAR: lwa_struc_comp-name.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My suggestion to you is while dealing with dynamic tables, structure make use of the RTTC classes. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CL_ALV_TABLE_CREATE=&amp;gt;CREATE_DYNAMIC_TABLE use the GENERATE SUBROUTINE POOL method to create the dynamic tables. SAP doesn't recommend using this technique, &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt; ... GENERATE SUBROUTINE POOL should only be used in exceptional cases in application programs. ABAP offers many other methods for dynamic programming, which generally render the creation of source code unnecessary (see the list under processing dynamic programs) ... &lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR,&lt;/P&gt;&lt;P&gt;Suhas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 21 Feb 2011 06:32:11 GMT</pubDate>
    <dc:creator>SuhaSaha</dc:creator>
    <dc:date>2011-02-21T06:32:11Z</dc:date>
    <item>
      <title>dynamic internal table problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-problem/m-p/7653653#M1573394</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;my requirement is i should calculate the variance and should display. and also in the result display i should provide 17 buttons (represents fields in a table). when the user clicks any button it should include that field and should calculate variance again and should display the result.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;iam able to create the dynamic internal table and able to display using the following method&lt;/P&gt;&lt;P&gt;cl_alv_table_create=&amp;gt;create_dynamic_table (this method is creating quan field having 17 with 3 decimals with P(16) 3 decimals)&lt;/P&gt;&lt;P&gt;but the problem is it is going to dump(generate subroutine directory full) some where around 14th button since there are 17 buttons&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i didnt use the below method&lt;/P&gt;&lt;P&gt;lo_new_type = cl_abap_structdescr=&amp;gt;create( lt_tot_comp ).&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;4. New Table type&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  lo_new_tab = cl_abap_tabledescr=&amp;gt;create(&lt;/P&gt;&lt;P&gt;                  p_line_type  = lo_new_type&lt;/P&gt;&lt;P&gt;                  p_table_kind = cl_abap_tabledescr=&amp;gt;tablekind_std&lt;/P&gt;&lt;P&gt;                  p_unique     = abap_false ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;above method is creating the quan field with P(9) 3 decimels but the field which i have to create has QUAN 17 with 3 decimals.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone help me regarding the above.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Feb 2011 06:06:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-problem/m-p/7653653#M1573394</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-02-21T06:06:48Z</dc:date>
    </item>
    <item>
      <title>Re: dynamic internal table problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-problem/m-p/7653654#M1573395</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How are you populating the components table LT_TOT_COMP? This is what you should be doing:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
    TRY .
        lo_elemdescr =
          cl_abap_elemdescr=&amp;gt;get_p( p_length = 16 p_decimals = 3 ).
      CATCH cx_parameter_invalid_range.
        RAISE ex_dyntab_creation_falied.
    ENDTRY.

    lwa_struc_comp-name = gc_profile_heading-col3.
    lwa_struc_comp-type = lo_elemdescr.
    APPEND lwa_struc_comp TO lt_struc_comp.
    CLEAR: lwa_struc_comp-name.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My suggestion to you is while dealing with dynamic tables, structure make use of the RTTC classes. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CL_ALV_TABLE_CREATE=&amp;gt;CREATE_DYNAMIC_TABLE use the GENERATE SUBROUTINE POOL method to create the dynamic tables. SAP doesn't recommend using this technique, &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt; ... GENERATE SUBROUTINE POOL should only be used in exceptional cases in application programs. ABAP offers many other methods for dynamic programming, which generally render the creation of source code unnecessary (see the list under processing dynamic programs) ... &lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR,&lt;/P&gt;&lt;P&gt;Suhas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Feb 2011 06:32:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-problem/m-p/7653654#M1573395</guid>
      <dc:creator>SuhaSaha</dc:creator>
      <dc:date>2011-02-21T06:32:11Z</dc:date>
    </item>
    <item>
      <title>Re: dynamic internal table problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-problem/m-p/7653655#M1573396</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Suhas,&lt;/P&gt;&lt;P&gt;I have written the code in the following way&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES: BEGIN OF ty_kstar,&lt;/P&gt;&lt;P&gt;       /BIC/GPRODGRP TYPE /BIC/OIGPRODGRP,&lt;/P&gt;&lt;P&gt;  /BIC/ZOGORDDMD type /BIC/AZDPLAWEK00-/BIC/ZOGORDDMD,     " QUAN field with 17 and 3 decimals&lt;/P&gt;&lt;P&gt;/BIC/ZSTATFCST type /BIC/AZDPLAWEK00-/BIC/ZSTATFCST,            " QUAN field with 17 and 3 decimals&lt;/P&gt;&lt;P&gt;/BIC/ZENCHFCST TYPE /BIC/AZDPLAMON00-/BIC/ZENCHFCST,          " QUAN field with 17 and 3 decimals&lt;/P&gt;&lt;P&gt;/BIC/ZUCTDMD   TYPE /BIC/AZDPLAMON00-/BIC/ZUCTDMD,               " QUAN field with 17 and 3 decimals&lt;/P&gt;&lt;P&gt;       END   OF ty_kstar.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;START-OF-SELECTION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;lo_struct ?= cl_abap_typedescr=&amp;gt;describe_by_name( 'TY_KSTAR' ).&lt;/P&gt;&lt;P&gt;  lt_comp  = lo_struct-&amp;gt;get_components( ).&lt;/P&gt;&lt;P&gt;  APPEND LINES OF lt_comp TO lt_tot_comp.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;lo_new_type = cl_abap_structdescr=&amp;gt;create( lt_tot_comp ).&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;4. New Table type&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  lo_new_tab = cl_abap_tabledescr=&amp;gt;create(&lt;/P&gt;&lt;P&gt;                  p_line_type  = lo_new_type&lt;/P&gt;&lt;P&gt;                  p_table_kind = cl_abap_tabledescr=&amp;gt;tablekind_std&lt;/P&gt;&lt;P&gt;                  p_unique     = abap_false ).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Feb 2011 06:49:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-problem/m-p/7653655#M1573396</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-02-21T06:49:23Z</dc:date>
    </item>
    <item>
      <title>Re: dynamic internal table problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-problem/m-p/7653656#M1573397</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Shankar,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Looks like there is a limitation while creating TYPE p elements having Length &amp;gt; 16 in the runtime using RTTC classes!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to use the RTTC classes you need to use this workaround:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
  FIELD-SYMBOLS &amp;lt;lwa_comp&amp;gt;  TYPE cl_abap_structdescr=&amp;gt;component.

  lo_struct ?= cl_abap_typedescr=&amp;gt;describe_by_name( 'TY_KSTAR' ).
  lt_comp = lo_struct-&amp;gt;get_components( ).

  LOOP AT lt_comp ASSIGNING &amp;lt;lwa_comp&amp;gt;
    WHERE name = '/BIC/ZOGORDDMD' OR
          name = '/BIC/ZSTATFCST' OR
          name = '/BIC/ZENCHFCST' OR
          name = '/BIC/ZUCTDMD'.
    CLEAR &amp;lt;lwa_comp&amp;gt;-type.
    TRY .
        &amp;lt;lwa_comp&amp;gt;-type =
          cl_abap_elemdescr=&amp;gt;get_p( p_length = 16 p_decimals = 3 ).
      CATCH cx_parameter_invalid_range.
    ENDTRY.
  ENDLOOP.

  APPEND LINES OF lt_comp TO lt_tot_comp.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me know if you've any questions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR,&lt;/P&gt;&lt;P&gt;Suhas&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PS: I remember using this workaround myself &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Feb 2011 07:28:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-problem/m-p/7653656#M1573397</guid>
      <dc:creator>SuhaSaha</dc:creator>
      <dc:date>2011-02-21T07:28:01Z</dc:date>
    </item>
    <item>
      <title>Re: dynamic internal table problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-problem/m-p/7653657#M1573398</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for providing the useful information which is helpful&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Aug 2011 12:12:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-problem/m-p/7653657#M1573398</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-08-05T12:12:37Z</dc:date>
    </item>
  </channel>
</rss>

