<?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 Array Processing in ABAP in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/array-processing-in-abap/m-p/3454469#M829908</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;&lt;/P&gt;&lt;P&gt;I am a total newbie in ABAP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to process an array in ABAP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If it was in .NET C#, it will be like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;String strArr = new String[5] { "A", "B", "C", "D", "E" };&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;int index = -1;&lt;/P&gt;&lt;P&gt;for (int i=0; i&amp;lt;strArr.length; i++)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;   if (myData.equals(strArr&amp;lt;i&amp;gt;))&lt;/P&gt;&lt;P&gt;   {&lt;/P&gt;&lt;P&gt;        index = i;&lt;/P&gt;&lt;P&gt;        break;&lt;/P&gt;&lt;P&gt;   }&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can someone please convert the above code into ABAP?&lt;/P&gt;&lt;P&gt;Urgent. Please help. &lt;STRONG&gt;&amp;lt;REMOVED BY MODERATOR&amp;gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;THank you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Alvaro Tejada Galindo on Feb 22, 2008 5:37 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 22 Feb 2008 06:48:29 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-02-22T06:48:29Z</dc:date>
    <item>
      <title>Array Processing in ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/array-processing-in-abap/m-p/3454469#M829908</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;&lt;/P&gt;&lt;P&gt;I am a total newbie in ABAP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to process an array in ABAP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If it was in .NET C#, it will be like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;String strArr = new String[5] { "A", "B", "C", "D", "E" };&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;int index = -1;&lt;/P&gt;&lt;P&gt;for (int i=0; i&amp;lt;strArr.length; i++)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;   if (myData.equals(strArr&amp;lt;i&amp;gt;))&lt;/P&gt;&lt;P&gt;   {&lt;/P&gt;&lt;P&gt;        index = i;&lt;/P&gt;&lt;P&gt;        break;&lt;/P&gt;&lt;P&gt;   }&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can someone please convert the above code into ABAP?&lt;/P&gt;&lt;P&gt;Urgent. Please help. &lt;STRONG&gt;&amp;lt;REMOVED BY MODERATOR&amp;gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;THank you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Alvaro Tejada Galindo on Feb 22, 2008 5:37 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Feb 2008 06:48:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/array-processing-in-abap/m-p/3454469#M829908</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-22T06:48:29Z</dc:date>
    </item>
    <item>
      <title>Re: Array Processing in ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/array-processing-in-abap/m-p/3454470#M829909</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;There is no concept of arrays in ABAP, we use internal tables to hold application data. U can use access internal tables with index.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Read table itab index l_index this is same as u do in case of arrrays a(l_index)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Instead use an Internal table to &lt;/P&gt;&lt;P&gt;populate the values and read them ..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;say your Internal table has a field F1 ..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
itab-f1 = 10.
append itab.
clear itab.

itab-f1 = 20.
append itab.
clear itab.

itab-f1 = 30.
append itab.
clear itab.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now internal table has 3 values ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
use loop ... endloop to get the values ..

loop at itab.
write :/ itab-f1.
endloop.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also you can do this way:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IT IS POSSIBLE TO DECLARE THE ONE -DIMENSIONAL ARRAY IN ABAP BY USING INTERNAL TABLES.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EX.)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA: BEGIN OF IT1 OCCURS 10,
VAR1 TYPE I,
END OF IT1.
IT1-VAR1 = 10.
APPEND IT1.
IT1-VAR1 = 20.
APPEND IT1.
IT1-VAR1 = 30.
APPEND IT1.
LOOP AT IT1.
WRITE:/ IT1-VAR1 COLOR 5.
END LOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;lt;REMOVED BY MODERATOR&amp;gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Cheers,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Chandra Sekhar.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Alvaro Tejada Galindo on Feb 22, 2008 5:38 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Feb 2008 06:57:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/array-processing-in-abap/m-p/3454470#M829909</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-22T06:57:34Z</dc:date>
    </item>
    <item>
      <title>Re: Array Processing in ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/array-processing-in-abap/m-p/3454471#M829910</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;the previous post is principally right, but uses a form of internal table (internal table with header line) that is depreciated. as a matter of fact it is even forbidden in an ABAP OO context.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the closest you can get to an array:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
data: itab type standard table of i, "standard table of integer -&amp;gt; array of integer
        var type i. "variable of type integer

i = 1.
append i to itab.
i = 2.
append i to itab
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now you have the two values in your "array". you have to ways of accessing in a very perfomant way using field symbols.&lt;/P&gt;&lt;P&gt;a) directly by index&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
data: itab type standard table of i, "standard table of integer -&amp;gt; array of integer
        var type i. "variable of type integer
field-symbols:
        &amp;lt;fs&amp;gt; type i.

read table itab index 1 assigning &amp;lt;fs&amp;gt;.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;b) looping at the whole table&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
data: itab type standard table of i, "standard table of integer -&amp;gt; array of integer
        var type i. "variable of type integer
field-symbols:
        &amp;lt;fs&amp;gt; type i.

loop at table itab assigning &amp;lt;fs&amp;gt;.
  "do something
endloop.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 23 Feb 2008 01:33:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/array-processing-in-abap/m-p/3454471#M829910</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-23T01:33:22Z</dc:date>
    </item>
  </channel>
</rss>

