<?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 Parallel cursors? in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/parallel-cursors/m-p/5014159#M1166905</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm looking to loop through 3 itabs of different sizes simultaneously and print the results side by side. I've looked into parallel cursors but I'm not sure if it applies to my example. Take the following piece of code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: it_a TYPE STANDARD TABLE OF c WITH DEFAULT KEY.
DATA: it_b TYPE STANDARD TABLE OF c WITH DEFAULT KEY.
DATA: it_c TYPE STANDARD TABLE OF c WITH DEFAULT KEY.
DATA: l_index1 TYPE sytabix,
      l_index2 TYPE sytabix.

APPEND '1' TO it_a.
APPEND '2' TO it_a.
APPEND '3' TO it_a.

APPEND 'x' TO it_b.
APPEND 'y' TO it_b.

APPEND '*' TO it_c.
APPEND '+' TO it_c.
APPEND '-' TO it_c.
APPEND '#' TO it_c.

FIELD-SYMBOLS: &amp;lt;fa&amp;gt; LIKE LINE OF it_a,
               &amp;lt;fb&amp;gt; LIKE LINE OF it_b,
               &amp;lt;fc&amp;gt; LIKE LINE OF it_c.


LOOP AT it_a ASSIGNING &amp;lt;fa&amp;gt;.
  LOOP AT it_b ASSIGNING &amp;lt;fb&amp;gt; FROM l_index1.
    LOOP AT it_c ASSIGNING &amp;lt;fc&amp;gt; FROM l_index2.
    l_index1 = sy-tabix.
    l_index2 = sy-tabix.

    WRITE: / &amp;lt;fa&amp;gt;, ' - ', &amp;lt;fb&amp;gt;, ' - ', &amp;lt;fc&amp;gt;.
    
    ENDLOOP.
  ENDLOOP.
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;What I'm looking for is the following output:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;1   x   *
2   y   +
3       -
        #&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 13 Jan 2009 14:20:17 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-01-13T14:20:17Z</dc:date>
    <item>
      <title>Parallel cursors?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/parallel-cursors/m-p/5014159#M1166905</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm looking to loop through 3 itabs of different sizes simultaneously and print the results side by side. I've looked into parallel cursors but I'm not sure if it applies to my example. Take the following piece of code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: it_a TYPE STANDARD TABLE OF c WITH DEFAULT KEY.
DATA: it_b TYPE STANDARD TABLE OF c WITH DEFAULT KEY.
DATA: it_c TYPE STANDARD TABLE OF c WITH DEFAULT KEY.
DATA: l_index1 TYPE sytabix,
      l_index2 TYPE sytabix.

APPEND '1' TO it_a.
APPEND '2' TO it_a.
APPEND '3' TO it_a.

APPEND 'x' TO it_b.
APPEND 'y' TO it_b.

APPEND '*' TO it_c.
APPEND '+' TO it_c.
APPEND '-' TO it_c.
APPEND '#' TO it_c.

FIELD-SYMBOLS: &amp;lt;fa&amp;gt; LIKE LINE OF it_a,
               &amp;lt;fb&amp;gt; LIKE LINE OF it_b,
               &amp;lt;fc&amp;gt; LIKE LINE OF it_c.


LOOP AT it_a ASSIGNING &amp;lt;fa&amp;gt;.
  LOOP AT it_b ASSIGNING &amp;lt;fb&amp;gt; FROM l_index1.
    LOOP AT it_c ASSIGNING &amp;lt;fc&amp;gt; FROM l_index2.
    l_index1 = sy-tabix.
    l_index2 = sy-tabix.

    WRITE: / &amp;lt;fa&amp;gt;, ' - ', &amp;lt;fb&amp;gt;, ' - ', &amp;lt;fc&amp;gt;.
    
    ENDLOOP.
  ENDLOOP.
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;What I'm looking for is the following output:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;1   x   *
2   y   +
3       -
        #&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Jan 2009 14:20:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/parallel-cursors/m-p/5014159#M1166905</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-01-13T14:20:17Z</dc:date>
    </item>
    <item>
      <title>Re: Parallel cursors?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/parallel-cursors/m-p/5014160#M1166906</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;Parallel cursor does not work for the given requirement by you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For your logic data will print inthis way...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;1   x   *
2   y   +
3&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Jan 2009 14:27:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/parallel-cursors/m-p/5014160#M1166906</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-01-13T14:27:40Z</dc:date>
    </item>
    <item>
      <title>Re: Parallel cursors?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/parallel-cursors/m-p/5014161#M1166907</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please have a look at:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[Performance of Nested Loops|/people/rob.burbank/blog/2006/02/07/performance-of-nested-loops]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This discusses the parallel cursor method.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Jan 2009 14:28:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/parallel-cursors/m-p/5014161#M1166907</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-01-13T14:28:21Z</dc:date>
    </item>
    <item>
      <title>Re: Parallel cursors?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/parallel-cursors/m-p/5014162#M1166908</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;l_index = 1.
DO.
  READ TABLE it_a INDEX l_index ASSIGNING &amp;lt;fa&amp;gt;.
  IF sy-subrc IS NOT INITIAL.
    UNASSIGN &amp;lt;fa&amp;gt;.
  ENDIF.
  READ TABLE it_b INDEX l_index ASSIGNING &amp;lt;fb&amp;gt;.
  IF sy-subrc IS NOT INITIAL.
    UNASSIGN &amp;lt;fb&amp;gt;.
  ENDIF.
  READ TABLE it_c INDEX l_index ASSIGNING &amp;lt;fc&amp;gt;.
  IF sy-subrc IS NOT INITIAL.
    UNASSIGN &amp;lt;fc&amp;gt;.
  ENDIF.
  IF &amp;lt;fa&amp;gt; IS NOT ASSIGNED AND &amp;lt;fb&amp;gt; IS NOT ASSIGNED AND &amp;lt;fc&amp;gt; IS NOT ASSIGNED.
    EXIT.
  ENDIF.
  IF &amp;lt;fa&amp;gt; IS ASSIGNED.
    WRITE: /1 &amp;lt;fa&amp;gt;.
  ELSE.
    WRITE /1 space.
  ENDIF.
  WRITE AT 10 '-'.
  IF &amp;lt;fb&amp;gt; IS ASSIGNED.
    WRITE AT 12 &amp;lt;fb&amp;gt;.
  ELSE.
    WRITE  AT 12 space.
  ENDIF.
  WRITE AT 22  '-'.
  IF &amp;lt;fc&amp;gt; IS ASSIGNED.
    WRITE AT 34 &amp;lt;fc&amp;gt;.
  ELSE.
    WRITE  AT 34 space.
  ENDIF.
  ADD 1 TO l_index.
ENDDO.&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Jan 2009 14:30:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/parallel-cursors/m-p/5014162#M1166908</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2009-01-13T14:30:38Z</dc:date>
    </item>
    <item>
      <title>Re: Parallel cursors?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/parallel-cursors/m-p/5014163#M1166909</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;You can do this with parallel cursor. If you first find which table has the most number of records, then insert missing records using &lt;STRONG&gt;append initial line&lt;/STRONG&gt; in the other tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In your case it_c has 4 lines so you need to append 1 initial line to it_a and 2 initial lines to it_b.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then simply loop at it_a and read the it_b and it_c at sy-tabix of it_a.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA: it_a TYPE STANDARD TABLE OF c WITH DEFAULT KEY.
DATA: it_b TYPE STANDARD TABLE OF c WITH DEFAULT KEY.
DATA: it_c TYPE STANDARD TABLE OF c WITH DEFAULT KEY.
DATA: l_index1 TYPE sytabix VALUE 1,
      l_index2 TYPE sytabix VALUE 1.

APPEND '1' TO it_a.
APPEND '2' TO it_a.
APPEND '3' TO it_a.
APPEND INITIAL LINE TO it_a.

APPEND 'x' TO it_b.
APPEND 'y' TO it_b.
APPEND INITIAL LINE TO it_b.
APPEND INITIAL LINE TO it_b.

APPEND '*' TO it_c.
APPEND '+' TO it_c.
APPEND '-' TO it_c.
APPEND '#' TO it_c.

FIELD-SYMBOLS: &amp;lt;fa&amp;gt; LIKE LINE OF it_a,
               &amp;lt;fb&amp;gt; LIKE LINE OF it_b,
               &amp;lt;fc&amp;gt; LIKE LINE OF it_c.


LOOP AT it_a ASSIGNING &amp;lt;fa&amp;gt;.
  READ TABLE it_b ASSIGNING &amp;lt;fb&amp;gt; INDEX sy-tabix.
  READ TABLE it_c ASSIGNING &amp;lt;fc&amp;gt; INDEX sy-tabix.
  WRITE: / &amp;lt;fa&amp;gt;, ' - ', &amp;lt;fb&amp;gt;, ' - ', &amp;lt;fc&amp;gt;.
ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The only task that remains for you is to find out which of the itab has max number of records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Advait&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Jan 2009 14:47:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/parallel-cursors/m-p/5014163#M1166909</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-01-13T14:47:51Z</dc:date>
    </item>
  </channel>
</rss>

