<?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: moving data from two itabs into 1 dynamic itab in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/moving-data-from-two-itabs-into-1-dynamic-itab/m-p/875136#M50548</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thanks guys,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was in the process of looking up the assign component when the second tip came in. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It all makes perfect sense now! Many thanks. I think that this is going to come in very handy in the future for me.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 05 Apr 2005 15:29:01 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2005-04-05T15:29:01Z</dc:date>
    <item>
      <title>moving data from two itabs into 1 dynamic itab</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/moving-data-from-two-itabs-into-1-dynamic-itab/m-p/875130#M50542</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;I've been looking at the other threads on the subject of dynamic internal tables including the weblog of Subramanian V.  I think I am close, but can't apply the logic to solve this particular scenario. Can anyone help?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have two internal tables the first itab1 has a number of fields in it including matnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I then have a itab2 which has two fields matnr and a field containg an alternative material name (call it altmatnr).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For any material there may be 'x' number of alternative material names and so 'x' number of lines for that material in itab2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I want to do is check itab2 and find out what the maximum number of alternate lines is for any one material and then create a new internal table 'itab3'. Itab 3 will have all the fields from itab1 but also additional fields altmatnr1, altmatnr2, altmatnr..n, depending on how many altmatnrs are needed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Finally I want to loop through itab1 writing the data to itab3, and for each line of itab1 loop around itab2 anf fill the fields altmatnr1, altmatnr2, to altmatnr..n as required.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone help with the logic for this? I've put down what I think is all the info. Hopefully this makes sense, if not please shout and I will try to explain. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Phil.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Apr 2005 13:45:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/moving-data-from-two-itabs-into-1-dynamic-itab/m-p/875130#M50542</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-04-05T13:45:01Z</dc:date>
    </item>
    <item>
      <title>Re: moving data from two itabs into 1 dynamic itab</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/moving-data-from-two-itabs-into-1-dynamic-itab/m-p/875131#M50543</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Phil,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;here's an approach:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="317567"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Andreas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Apr 2005 14:15:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/moving-data-from-two-itabs-into-1-dynamic-itab/m-p/875131#M50543</guid>
      <dc:creator>andreas_mann3</dc:creator>
      <dc:date>2005-04-05T14:15:05Z</dc:date>
    </item>
    <item>
      <title>Re: moving data from two itabs into 1 dynamic itab</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/moving-data-from-two-itabs-into-1-dynamic-itab/m-p/875132#M50544</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Andreas, thanks for this. Unfortunately I'm having difficulty still applying that solution across and  a little confused. Can you expand on this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;many thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Apr 2005 14:36:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/moving-data-from-two-itabs-into-1-dynamic-itab/m-p/875132#M50544</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-04-05T14:36:12Z</dc:date>
    </item>
    <item>
      <title>Re: moving data from two itabs into 1 dynamic itab</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/moving-data-from-two-itabs-into-1-dynamic-itab/m-p/875133#M50545</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Actually - I have the first part cracked I think. I have used some of the code found elsewhere on this sight. Many thanks to those who have inadvetantly helped me! &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I'm stuck on is once I have created my table dymanically  how do i fill it. This isn't obvious to me from the examples given (my lack of understanding probably). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is what I have so far - please excuse my bad code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;calculate what the maximum number of partnumber variations there are&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;sort t_partnos by matnr. &lt;/P&gt;&lt;P&gt;&amp;lt;i&amp;gt;"t_partnos conatins fields matnr and mfgpart &lt;/P&gt;&lt;P&gt;i.e. matnr1  - xxxx&lt;/P&gt;&lt;P&gt;     matnr1  - yyyy&lt;/P&gt;&lt;P&gt;     matnr2  - aaaa&lt;/P&gt;&lt;P&gt;     matnr3  - jjjj&lt;/P&gt;&lt;P&gt;     matnr3  - hhhh&amp;lt;/i&amp;gt;     &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;calculate what the maximum number of partnumber variations there are&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  SORT t_partnos BY matnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  LOOP AT t_partnos INTO wa_partnos.&lt;/P&gt;&lt;P&gt;    AT NEW matnr.&lt;/P&gt;&lt;P&gt;      l_index = 0.&lt;/P&gt;&lt;P&gt;    ENDAT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    ADD 1 TO l_index.&lt;/P&gt;&lt;P&gt;    AT END OF matnr.&lt;/P&gt;&lt;P&gt;      IF l_index GT l_maxidx.&lt;/P&gt;&lt;P&gt;        MOVE l_index TO l_maxidx.&lt;/P&gt;&lt;P&gt;      ENDIF.&lt;/P&gt;&lt;P&gt;    ENDAT.&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;fill fieldcat&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  DEFINE fill_fieldcat.&lt;/P&gt;&lt;P&gt;    move &amp;amp;1 to ls_fieldcatalog-fieldname.&lt;/P&gt;&lt;P&gt;    move &amp;amp;2 to ls_fieldcatalog-inttype.&lt;/P&gt;&lt;P&gt;    append ls_fieldcatalog to lt_fieldcatalog.&lt;/P&gt;&lt;P&gt;  END-OF-DEFINITION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  fill_fieldcat 'IDNRK' 'C'.&lt;/P&gt;&lt;P&gt;  l_index = 0.&lt;/P&gt;&lt;P&gt;  DO l_maxidx TIMES.&lt;/P&gt;&lt;P&gt;    ADD 1 TO l_index.&lt;/P&gt;&lt;P&gt;    MOVE l_index TO l_indexc.&lt;/P&gt;&lt;P&gt;    CONCATENATE 'MGFPART' l_indexc INTO l_mfgpart.&lt;/P&gt;&lt;P&gt;    CONDENSE l_mfgpart.&lt;/P&gt;&lt;P&gt;    fill_fieldcat l_mfgpart 'C'.&lt;/P&gt;&lt;P&gt;  ENDDO.&lt;/P&gt;&lt;P&gt;  fill_fieldcat 'MATMK' 'C'.&lt;/P&gt;&lt;P&gt;  fill_fieldcat 'OJTXP' 'C'.&lt;/P&gt;&lt;P&gt;  fill_fieldcat 'MEINS' 'C'.&lt;/P&gt;&lt;P&gt;  fill_fieldcat 'LABST' 'C'.&lt;/P&gt;&lt;P&gt;  fill_fieldcat 'VERPR' 'C'.&lt;/P&gt;&lt;P&gt;  fill_fieldcat 'PLIFZ' 'C'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  ASSIGN lt_data TO &amp;lt;fs_data&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CALL METHOD cl_alv_table_create=&amp;gt;create_dynamic_table&lt;/P&gt;&lt;P&gt;       EXPORTING&lt;/P&gt;&lt;P&gt;         it_fieldcatalog = lt_fieldcatalog&lt;/P&gt;&lt;P&gt;       IMPORTING&lt;/P&gt;&lt;P&gt;         ep_table = &amp;lt;fs_data&amp;gt;&lt;/P&gt;&lt;P&gt;       EXCEPTIONS&lt;/P&gt;&lt;P&gt;         generate_subpool_dir_full = 1&lt;/P&gt;&lt;P&gt;         OTHERS = 2&lt;/P&gt;&lt;P&gt;  		.&lt;/P&gt;&lt;P&gt;  IF sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="3" type="ul"&gt;&lt;P&gt;So &amp;lt;FS_1&amp;gt; now points to our dynamic internal table.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  ASSIGN &amp;lt;fs_data&amp;gt;-&amp;gt;* TO &amp;lt;fs_1&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="3" type="ul"&gt;&lt;P&gt;Next step is to create a work area for our dynamic internal table.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CREATE DATA new_line LIKE LINE OF &amp;lt;fs_1&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="3" type="ul"&gt;&lt;P&gt;A field-symbol to access that work area&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;  ASSIGN new_line-&amp;gt;*  TO &amp;lt;fs_2&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now I want to loop at my main itab (itab1) and write the fields to the corresponding fields of my dynamic itab. For each line of itab1 I also want to loop around t_partnos and write the mfgpart field from this table to mfgpart1, mfgpart2 etc depending on how many lines exist.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps. Can you advise?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Apr 2005 14:50:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/moving-data-from-two-itabs-into-1-dynamic-itab/m-p/875133#M50545</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-04-05T14:50:09Z</dc:date>
    </item>
    <item>
      <title>Re: moving data from two itabs into 1 dynamic itab</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/moving-data-from-two-itabs-into-1-dynamic-itab/m-p/875134#M50546</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Take at look at the ASSIGN COMPONENT command.  This will allow you to access the fields in your structure that &amp;lt;fs_2&amp;gt; points to.  You can access the fields by their name or by their position.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Apr 2005 15:12:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/moving-data-from-two-itabs-into-1-dynamic-itab/m-p/875134#M50546</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-04-05T15:12:25Z</dc:date>
    </item>
    <item>
      <title>Re: moving data from two itabs into 1 dynamic itab</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/moving-data-from-two-itabs-into-1-dynamic-itab/m-p/875135#M50547</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try something like the following:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
field-symbols &amp;lt;fs&amp;gt;.

loop at itab1 into wa_itab1.
  // do the next 2 statements for each field of itab1 you want in the new table
  ASSIGN COMPONENT 'MATERIAL' OF STRUCTURE &amp;lt;fs_2&amp;gt; TO &amp;lt;fs&amp;gt;.
  &amp;lt;fs&amp;gt; = wa_itab1-material.

  loop at itab2 into wa_itab2 where material = itab1-material.
    CONCATENATE 'MGFPART' sy-tabix INTO l_mfgpart.
    ASSIGN COMPONENT l_mfgpart of structure &amp;lt;fs_2&amp;gt; TO &amp;lt;fs&amp;gt;.
    &amp;lt;fs&amp;gt; = itab2-altmaterial.
  endloop.
  APPEND &amp;lt;fs_2&amp;gt; TO &amp;lt;fs_1&amp;gt;.
endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This code isn't tested, but it is the general idea of what to do.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Brian&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Apr 2005 15:22:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/moving-data-from-two-itabs-into-1-dynamic-itab/m-p/875135#M50547</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-04-05T15:22:22Z</dc:date>
    </item>
    <item>
      <title>Re: moving data from two itabs into 1 dynamic itab</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/moving-data-from-two-itabs-into-1-dynamic-itab/m-p/875136#M50548</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thanks guys,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was in the process of looking up the assign component when the second tip came in. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It all makes perfect sense now! Many thanks. I think that this is going to come in very handy in the future for me.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Apr 2005 15:29:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/moving-data-from-two-itabs-into-1-dynamic-itab/m-p/875136#M50548</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-04-05T15:29:01Z</dc:date>
    </item>
    <item>
      <title>Re: moving data from two itabs into 1 dynamic itab</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/moving-data-from-two-itabs-into-1-dynamic-itab/m-p/875137#M50549</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;final problem I think!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;fs_2&amp;gt; has my line of fields and values and I want to append it to &amp;lt;fs_1&amp;gt; my table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Doing an append gives me an error message that "append is not allowed with type  hashed or 'any table", and trying other methods seems to short dump when I run the program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;my field symbols are defined   &lt;/P&gt;&lt;P&gt;FIELD-SYMBOLS: &amp;lt;fs_data&amp;gt; TYPE REF TO data,&lt;/P&gt;&lt;P&gt;                 &amp;lt;fs_1&amp;gt; TYPE ANY TABLE,&lt;/P&gt;&lt;P&gt;                 &amp;lt;fs_2&amp;gt;,&lt;/P&gt;&lt;P&gt;                 &amp;lt;fs_3&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;can you put me straight on this final step?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Apr 2005 09:36:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/moving-data-from-two-itabs-into-1-dynamic-itab/m-p/875137#M50549</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-04-06T09:36:13Z</dc:date>
    </item>
    <item>
      <title>Re: moving data from two itabs into 1 dynamic itab</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/moving-data-from-two-itabs-into-1-dynamic-itab/m-p/875138#M50550</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Define &amp;lt;fs_1&amp;gt; like:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
FIELD-SYMBOLS: &amp;lt;fs_1&amp;gt; TYPE STANDARD TABLE.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Brian&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Apr 2005 12:08:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/moving-data-from-two-itabs-into-1-dynamic-itab/m-p/875138#M50550</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-04-06T12:08:00Z</dc:date>
    </item>
    <item>
      <title>Re: moving data from two itabs into 1 dynamic itab</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/moving-data-from-two-itabs-into-1-dynamic-itab/m-p/875139#M50551</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Brian, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think I changed everything but that declaration!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Apr 2005 12:28:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/moving-data-from-two-itabs-into-1-dynamic-itab/m-p/875139#M50551</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-04-06T12:28:58Z</dc:date>
    </item>
  </channel>
</rss>

