<?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: creating table in side a internal table by using identifier in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/creating-table-in-side-a-internal-table-by-using-identifier/m-p/4266000#M1017863</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There are many ways to do it, they key thing is just keeping your code well organized otherwise you'll get lost.  Here is an example from one of my programs where I've got a table as part of another table and also inside that it has a data type that is a reference to another field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Basically this peice of code is keeping a list of unique postal codes and a reference to the fields in the structure of another internal table that contain those values so that in a later part of the program I can do a mass update via this one to many relationship for each postal code (example, change all records with postal code X to now be postal code Y.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;~Ian&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example type decleration:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Types:&lt;/P&gt;&lt;P&gt;  begin of t_PostalCodeRef,&lt;/P&gt;&lt;P&gt;    ref type ref to Z1CED_INB_CONFIG-ATWRT,&lt;/P&gt;&lt;P&gt;  end of t_PostalCodeRef,&lt;/P&gt;&lt;P&gt;  t_table_PostalCodeRef type table of t_PostalCodeRef with non-unique default key,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  begin of t_PostalCode,&lt;/P&gt;&lt;P&gt;    PostalCode type Z1CED_INB_CONFIG-ATWRT,&lt;/P&gt;&lt;P&gt;    Refs type t_Table_PostalCodeRef,&lt;/P&gt;&lt;P&gt;  end of t_PostalCode,&lt;/P&gt;&lt;P&gt;  t_table_PostalCode type table of t_PostalCode with non-unique default key.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example usage to populate:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  field-symbols:&lt;/P&gt;&lt;P&gt;                 &amp;lt;PostalCode&amp;gt; type t_PostalCode.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  data:&lt;/P&gt;&lt;P&gt;        l_Tabix type sy-Tabix,&lt;/P&gt;&lt;P&gt;        l_PostalCode type t_PostalCode,&lt;/P&gt;&lt;P&gt;        l_PostalCodeRef type t_PostalCodeRef.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  if ( ( l_Z1CED_INB_CONFIG-ATINN = 'OP' ) or&lt;/P&gt;&lt;P&gt;       ( l_Z1CED_INB_CONFIG-ATINN = 'OC ) ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    read table l_PostalCodes&lt;/P&gt;&lt;P&gt;    assigning &amp;lt;PostalCode&amp;gt;&lt;/P&gt;&lt;P&gt;    with key PostalCode = l_INB_CONFIG-ATWRT&lt;/P&gt;&lt;P&gt;    binary search.&lt;/P&gt;&lt;P&gt;    l_Tabix = sy-Tabix.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    if ( sy-Subrc = 0 ).&lt;/P&gt;&lt;P&gt;      clear l_PostalCodeRef.&lt;/P&gt;&lt;P&gt;      get reference of l_INB_CONFIG-ATWRT into l_PostalCodeRef-Ref.&lt;/P&gt;&lt;P&gt;      append l_PostalCodeRef to &amp;lt;PostalCode&amp;gt;-Refs.&lt;/P&gt;&lt;P&gt;    else.&lt;/P&gt;&lt;P&gt;      clear l_PostalCode.&lt;/P&gt;&lt;P&gt;      l_PostalCode-PostalCode = l_INB_CONFIG-ATWRT.&lt;/P&gt;&lt;P&gt;      clear l_PostalCodeRef.&lt;/P&gt;&lt;P&gt;      get reference of l_INB_CONFIG-ATWRT into l_PostalCodeRef-Ref.&lt;/P&gt;&lt;P&gt;      append l_PostalCodeRef to l_PostalCode-Refs.&lt;/P&gt;&lt;P&gt;      insert l_PostalCode into l_PostalCodes index l_Tabix.&lt;/P&gt;&lt;P&gt;    endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example of usage to process:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    loop at l_PostalCodes assigning &amp;lt;PostalCode&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      s_Tabix = s_Tabix + 1.&lt;/P&gt;&lt;P&gt;      if ( s_Tabix &amp;gt; s_Count ).&lt;/P&gt;&lt;P&gt;        s_Tabix = 1.&lt;/P&gt;&lt;P&gt;      endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      read table s_ADRPSTCODE&lt;/P&gt;&lt;P&gt;      assigning &amp;lt;NewPostalCode&amp;gt;&lt;/P&gt;&lt;P&gt;      index s_Tabix.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      loop at &amp;lt;PostalCode&amp;gt;-Refs assigning &amp;lt;PostalCodeRef&amp;gt;.&lt;/P&gt;&lt;P&gt;        assign &amp;lt;PostalCodeRef&amp;gt;-Ref-&amp;gt;* to &amp;lt;PostalCodeValue&amp;gt;.&lt;/P&gt;&lt;P&gt;        &amp;lt;PostalCodeValue&amp;gt; = &amp;lt;NewPostalCode&amp;gt;-PostalCode.&lt;/P&gt;&lt;P&gt;      endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    endloop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 01 Aug 2008 19:10:47 GMT</pubDate>
    <dc:creator>ian_maxwell2</dc:creator>
    <dc:date>2008-08-01T19:10:47Z</dc:date>
    <item>
      <title>creating table in side a internal table by using identifier</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/creating-table-in-side-a-internal-table-by-using-identifier/m-p/4265998#M1017861</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi friends..&lt;/P&gt;&lt;P&gt;i need to create a table which consistes of more 3 sub tables as IDENTIFIERS..&lt;/P&gt;&lt;P&gt;so please try to help me by giving procedure with suitable examples..&lt;/P&gt;&lt;P&gt;its too urgent for me&lt;/P&gt;&lt;P&gt;i need to submit  by monday morning..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks in advance&lt;/P&gt;&lt;P&gt;kranthi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Aug 2008 18:46:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/creating-table-in-side-a-internal-table-by-using-identifier/m-p/4265998#M1017861</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-01T18:46:35Z</dc:date>
    </item>
    <item>
      <title>Re: creating table in side a internal table by using identifier</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/creating-table-in-side-a-internal-table-by-using-identifier/m-p/4265999#M1017862</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;I assume you need to understand how &lt;STRONG&gt;complex&lt;/STRONG&gt; itabs are handled. I try to give an example using the following standard tables:&lt;/P&gt;&lt;P&gt;KNB1 (customer) -&amp;gt; has n records in KNVV (sales areas per customer)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
TYPES: BEGIN OF ty_s_data.
TYPES: kunnr            TYPE kunnr.
TYPES  salesarea      TYPE STANDARD TABLE OF knvv.
TYPES: END OF ty_s_data.
TYPES: ty_t_data       TYPE STANDARD TABLE ty_s_data
                                 WITH DEFAULT KEY.

DATA:
  gt_list           TYPE ty_s_data,
  gs_list           TYPE ty_s_list.


  SELECT * FROM knb1 INTO TABLE gt_knb1.
  SELECT * FROM knvv INTO TABLE gt_knvv
    FOR ALL ENTRIES IN gt_knb1
    WHERE kunnr = gt_knb1-kunnr.

  LOOP AT gt_knb1 INTO gs_knb1.
    CLEAR: gs_list.
    gs_list-kunnr = gs_knb1-kunnr.

    LOOP AT gt_knvv INTO gs_knvv
              WHERE ( kunnr = gs_knb1-kunnr ).
      APPEND gs_knvv TO gs_list-salesarea.
    ENDLOOP.

  ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;  Uwe&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Aug 2008 19:09:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/creating-table-in-side-a-internal-table-by-using-identifier/m-p/4265999#M1017862</guid>
      <dc:creator>uwe_schieferstein</dc:creator>
      <dc:date>2008-08-01T19:09:20Z</dc:date>
    </item>
    <item>
      <title>Re: creating table in side a internal table by using identifier</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/creating-table-in-side-a-internal-table-by-using-identifier/m-p/4266000#M1017863</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There are many ways to do it, they key thing is just keeping your code well organized otherwise you'll get lost.  Here is an example from one of my programs where I've got a table as part of another table and also inside that it has a data type that is a reference to another field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Basically this peice of code is keeping a list of unique postal codes and a reference to the fields in the structure of another internal table that contain those values so that in a later part of the program I can do a mass update via this one to many relationship for each postal code (example, change all records with postal code X to now be postal code Y.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;~Ian&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example type decleration:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Types:&lt;/P&gt;&lt;P&gt;  begin of t_PostalCodeRef,&lt;/P&gt;&lt;P&gt;    ref type ref to Z1CED_INB_CONFIG-ATWRT,&lt;/P&gt;&lt;P&gt;  end of t_PostalCodeRef,&lt;/P&gt;&lt;P&gt;  t_table_PostalCodeRef type table of t_PostalCodeRef with non-unique default key,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  begin of t_PostalCode,&lt;/P&gt;&lt;P&gt;    PostalCode type Z1CED_INB_CONFIG-ATWRT,&lt;/P&gt;&lt;P&gt;    Refs type t_Table_PostalCodeRef,&lt;/P&gt;&lt;P&gt;  end of t_PostalCode,&lt;/P&gt;&lt;P&gt;  t_table_PostalCode type table of t_PostalCode with non-unique default key.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example usage to populate:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  field-symbols:&lt;/P&gt;&lt;P&gt;                 &amp;lt;PostalCode&amp;gt; type t_PostalCode.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  data:&lt;/P&gt;&lt;P&gt;        l_Tabix type sy-Tabix,&lt;/P&gt;&lt;P&gt;        l_PostalCode type t_PostalCode,&lt;/P&gt;&lt;P&gt;        l_PostalCodeRef type t_PostalCodeRef.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  if ( ( l_Z1CED_INB_CONFIG-ATINN = 'OP' ) or&lt;/P&gt;&lt;P&gt;       ( l_Z1CED_INB_CONFIG-ATINN = 'OC ) ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    read table l_PostalCodes&lt;/P&gt;&lt;P&gt;    assigning &amp;lt;PostalCode&amp;gt;&lt;/P&gt;&lt;P&gt;    with key PostalCode = l_INB_CONFIG-ATWRT&lt;/P&gt;&lt;P&gt;    binary search.&lt;/P&gt;&lt;P&gt;    l_Tabix = sy-Tabix.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    if ( sy-Subrc = 0 ).&lt;/P&gt;&lt;P&gt;      clear l_PostalCodeRef.&lt;/P&gt;&lt;P&gt;      get reference of l_INB_CONFIG-ATWRT into l_PostalCodeRef-Ref.&lt;/P&gt;&lt;P&gt;      append l_PostalCodeRef to &amp;lt;PostalCode&amp;gt;-Refs.&lt;/P&gt;&lt;P&gt;    else.&lt;/P&gt;&lt;P&gt;      clear l_PostalCode.&lt;/P&gt;&lt;P&gt;      l_PostalCode-PostalCode = l_INB_CONFIG-ATWRT.&lt;/P&gt;&lt;P&gt;      clear l_PostalCodeRef.&lt;/P&gt;&lt;P&gt;      get reference of l_INB_CONFIG-ATWRT into l_PostalCodeRef-Ref.&lt;/P&gt;&lt;P&gt;      append l_PostalCodeRef to l_PostalCode-Refs.&lt;/P&gt;&lt;P&gt;      insert l_PostalCode into l_PostalCodes index l_Tabix.&lt;/P&gt;&lt;P&gt;    endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example of usage to process:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    loop at l_PostalCodes assigning &amp;lt;PostalCode&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      s_Tabix = s_Tabix + 1.&lt;/P&gt;&lt;P&gt;      if ( s_Tabix &amp;gt; s_Count ).&lt;/P&gt;&lt;P&gt;        s_Tabix = 1.&lt;/P&gt;&lt;P&gt;      endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      read table s_ADRPSTCODE&lt;/P&gt;&lt;P&gt;      assigning &amp;lt;NewPostalCode&amp;gt;&lt;/P&gt;&lt;P&gt;      index s_Tabix.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      loop at &amp;lt;PostalCode&amp;gt;-Refs assigning &amp;lt;PostalCodeRef&amp;gt;.&lt;/P&gt;&lt;P&gt;        assign &amp;lt;PostalCodeRef&amp;gt;-Ref-&amp;gt;* to &amp;lt;PostalCodeValue&amp;gt;.&lt;/P&gt;&lt;P&gt;        &amp;lt;PostalCodeValue&amp;gt; = &amp;lt;NewPostalCode&amp;gt;-PostalCode.&lt;/P&gt;&lt;P&gt;      endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    endloop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Aug 2008 19:10:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/creating-table-in-side-a-internal-table-by-using-identifier/m-p/4266000#M1017863</guid>
      <dc:creator>ian_maxwell2</dc:creator>
      <dc:date>2008-08-01T19:10:47Z</dc:date>
    </item>
  </channel>
</rss>

