<?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: Help on ABAP code in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-on-abap-code/m-p/3415690#M820361</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry, because of the slow Internet, I put the same message again.&lt;/P&gt;&lt;P&gt;And I have a question: How to insert a picture into a message in this forum?&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;feng.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: feng zhang on Feb 26, 2008 10:17 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 26 Feb 2008 02:06:54 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-02-26T02:06:54Z</dc:date>
    <item>
      <title>Help on ABAP code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-on-abap-code/m-p/3415687#M820358</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;Lets say I have a table with 2 columns. Lets call this table IT_2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Column 1 - Value is either a space or *&lt;/P&gt;&lt;P&gt;Column 2 - Text&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So here is what I need to do, looping into a new table (Call it IT_3).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Loop at IT_2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When Column 1 = *.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Create a new line with the value of column 2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When Column 1 = space&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Add the current column 2 text to the column 2 text of the previous row.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help. This is very important and I am unsure as to how to implement this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;John&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Feb 2008 00:52:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-on-abap-code/m-p/3415687#M820358</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-26T00:52:46Z</dc:date>
    </item>
    <item>
      <title>Re: Help on ABAP code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-on-abap-code/m-p/3415688#M820359</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN __default_attr="blue" __jive_macro_name="color"&gt;&lt;SPAN __default_attr="sylfaen" __jive_macro_name="font"&gt;&lt;SPAN __default_attr="15" __jive_macro_name="size"&gt;
Hi John,

Try as below:
&lt;PRE&gt;&lt;CODE&gt;data: l_str type string,
      i_str type table of string.

loop at it_2.

   if it_2-column1 = '*' and sy-tabix ne 1.
      append l_str to i_str.
      clear: l_str.
      move it_2-column2 to l_str.
   else.
      concantenate l_str it_2-column2 into l_str.
   endif.
   
   at last.
      append l_str to i_str.
   endat.
   
endloop.&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN __default_attr="maroon" __jive_macro_name="color"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Feb 2008 01:34:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-on-abap-code/m-p/3415688#M820359</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-26T01:34:09Z</dc:date>
    </item>
    <item>
      <title>Re: Help on ABAP code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-on-abap-code/m-p/3415689#M820360</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, John Damion.&lt;/P&gt;&lt;P&gt;Try this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
TYPES: BEGIN OF TYP_IT_2,
         COLUMN1 TYPE C,
         COLUMN2 TYPE C LENGTH 10,
       END OF TYP_IT_2.

TYPES: BEGIN OF TYP_IT_3,
         COLUMN1 TYPE C,
         COLUMN2 TYPE C LENGTH 100,
       END OF TYP_IT_3.

DATA: IT_2    TYPE STANDARD TABLE OF TYP_IT_2,
      WA_IT_2 TYPE TYP_IT_2,
      IT_3    TYPE STANDARD TABLE OF TYP_IT_3,
      WA_IT_3 TYPE TYP_IT_3,
      WA_IT   TYPE TYP_IT_3.

WA_IT_2-COLUMN1 = '*'.
WA_IT_2-COLUMN2 = 'A'.
APPEND WA_IT_2 TO IT_2.

WA_IT_2-COLUMN1 = ' '.
WA_IT_2-COLUMN2 = 'B'.
APPEND WA_IT_2 TO IT_2.

WA_IT_2-COLUMN1 = '*'.
WA_IT_2-COLUMN2 = 'C'.
APPEND WA_IT_2 TO IT_2.

WA_IT_2-COLUMN1 = ' '.
WA_IT_2-COLUMN2 = 'D'.
APPEND WA_IT_2 TO IT_2.

WA_IT_2-COLUMN1 = ' '.
WA_IT_2-COLUMN2 = 'E'.
APPEND WA_IT_2 TO IT_2.

WRITE 'IT_2:'.
LOOP AT IT_2 INTO WA_IT_2.
  WRITE: / WA_IT_2-COLUMN1,
           WA_IT_2-COLUMN2.
ENDLOOP.

READ TABLE IT_2 INTO WA_IT INDEX 1.
LOOP AT IT_2 INTO WA_IT_2 FROM 2.
  IF WA_IT_2-COLUMN1 = ' '.
    CONCATENATE WA_IT-COLUMN2 WA_IT_2 INTO WA_IT-COLUMN2.
  ELSE.
    APPEND WA_IT TO IT_3.
    WA_IT = WA_IT_2.
  ENDIF.
ENDLOOP.
APPEND WA_IT TO IT_3.

WRITE / 'IT_3:'.
LOOP AT IT_3 INTO WA_IT.
  WRITE: / WA_IT-COLUMN1,
           WA_IT-COLUMN2.
ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;And the result is:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
IT_2:
* A
  B
* C
  D
  E
IT_3:
* A B
* C D E
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I hope this can help you.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;feng.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Feb 2008 02:06:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-on-abap-code/m-p/3415689#M820360</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-26T02:06:09Z</dc:date>
    </item>
    <item>
      <title>Re: Help on ABAP code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-on-abap-code/m-p/3415690#M820361</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry, because of the slow Internet, I put the same message again.&lt;/P&gt;&lt;P&gt;And I have a question: How to insert a picture into a message in this forum?&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;feng.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: feng zhang on Feb 26, 2008 10:17 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Feb 2008 02:06:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-on-abap-code/m-p/3415690#M820361</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-26T02:06:54Z</dc:date>
    </item>
    <item>
      <title>Re: Help on ABAP code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-on-abap-code/m-p/3415691#M820362</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi John &lt;/P&gt;&lt;P&gt;It is very simple , You need to take a temp variable and keep storing of column 2 value till it gets to an end . it seems that you want to use IT_3 as result table .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sample code for you &lt;/P&gt;&lt;P&gt;Data l_text(20) type c.&lt;/P&gt;&lt;P&gt;Data it_2_lines type I. &lt;/P&gt;&lt;P&gt;Clear l_text .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Describe  table it_2 lines it_2_lines.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Loop at it_2.&lt;/P&gt;&lt;P&gt;If it_2-column1 = &amp;#145;*&amp;#146;.&lt;/P&gt;&lt;P&gt;      Move-corresponding it_2 to it_3.&lt;/P&gt;&lt;P&gt;     Append it_3.&lt;/P&gt;&lt;P&gt;Endif.&lt;/P&gt;&lt;P&gt;If it_2-column1 =  space .&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;    Concantenate l_text it_2-column2 into l_text &lt;/P&gt;&lt;P&gt;     Move l_text to it_3-column2.&lt;/P&gt;&lt;P&gt;     Append it_3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Note&lt;/STRONG&gt; : I didn't execute the code in sap system so it might give some syntax error . Please let me know if you stuck in nay more problem I will provide you the solution after executing the code .  Rewards if helpful&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Feb 2008 02:09:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-on-abap-code/m-p/3415691#M820362</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-26T02:09:51Z</dc:date>
    </item>
  </channel>
</rss>

