<?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: Appending Internal Table Data to a String in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/appending-internal-table-data-to-a-string/m-p/1478621#M224198</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Maybe i didn't explain the problem clearly, here is the complete code of the function i'm creating:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
FUNCTION z3_hr_get_anniversaries.
*"----------------------------------------------------------------------
*"*"Interface local:
*"  EXPORTING
*"     REFERENCE(OUTPUT) TYPE  STRING
*"----------------------------------------------------------------------
  DATA: w_pa0002 TYPE pa0002.

  DATA: t_pa0002 LIKE TABLE OF w_pa0002.

  DATA: first_day TYPE sy-datum,
        last_day  TYPE sy-datum,
        last_date TYPE sy-datum.

  CALL FUNCTION 'GET_WEEK_INFO_BASED_ON_DATE'
   EXPORTING
     date          = sy-datum
   IMPORTING
*     week          =
     monday        = first_day
     sunday        = last_day
            .

  PERFORM go_back_days CHANGING first_day.

  PERFORM go_back_days CHANGING last_day.

  SELECT * FROM pa0002
           INTO TABLE t_pa0002
             ORDER BY gbdat.

  LOOP AT t_pa0002 INTO w_pa0002.
    CONCATENATE sy-datum(4) w_pa0002-gbdat+4(2) w_pa0002-gbdat+6(2)
           INTO w_pa0002-gbdat.

    CHECK w_pa0002-gbdat GE first_day AND w_pa0002-gbdat LE last_day.

* Append to string field GBDAT to my output String

  ENDLOOP.
ENDFUNCTION.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to pick-up field w_pa0002-gbdat and append it to my output which is a only one string with all the data from the table on it... Example of the String &amp;lt;b&amp;gt;&amp;lt;w_pa0002-gbdat[1]&amp;gt;|&amp;lt;w_pa0002-gbdat[2]&amp;gt;|...&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Resuming... What i really want is one output. A String (output) with all the fields i want (GBDAT) from the internal table concatenated one after another.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank You.&lt;/P&gt;&lt;P&gt;Pedro Gaspar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 17 Aug 2006 11:54:10 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-08-17T11:54:10Z</dc:date>
    <item>
      <title>Appending Internal Table Data to a String</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/appending-internal-table-data-to-a-string/m-p/1478616#M224193</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Good Morning,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a internal table and i want to append each of the internal table lines to a String. How can i do that?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Code follows:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
*"----------------------------------------------------------------------
*"*"Interface local:
*"  EXPORTING
*"     REFERENCE(OUTPUT) TYPE  STRING
*"----------------------------------------------------------------------

SELECT * FROM pa0002
           INTO TABLE t_pa0002
             ORDER BY gbdat.

  LOOP AT t_pa0002 INTO w_pa0002.
    CONCATENATE sy-datum(4) w_pa0002-gbdat+4(2) w_pa0002-gbdat+6(2)
           INTO w_pa0002-gbdat.

    CHECK w_pa0002-gbdat GE first_day AND w_pa0002-gbdat LE last_day.

* I need to append the line to the String!!!

  ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Pedro Gaspar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Aug 2006 11:32:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/appending-internal-table-data-to-a-string/m-p/1478616#M224193</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-17T11:32:54Z</dc:date>
    </item>
    <item>
      <title>Re: Appending Internal Table Data to a String</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/appending-internal-table-data-to-a-string/m-p/1478617#M224194</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Pedro,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Declare one itab like this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF ITAB OCCURS 0,&lt;/P&gt;&lt;P&gt;        STRING TYPE STRING,&lt;/P&gt;&lt;P&gt;      END OF ITAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * FROM pa0002           INTO TABLE t_pa0002             ORDER BY gbdat.  LOOP AT t_pa0002 INTO w_pa0002.    CONCATENATE sy-datum(4) w_pa0002-gbdat&lt;EM&gt;4(2) w_pa0002-gbdat&lt;/EM&gt;6(2)           INTO w_pa0002-gbdat.    CHECK w_pa0002-gbdat GE first_day AND w_pa0002-gbdat LE last_day.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;I need to append the line to the String!!!  &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;lt;b&amp;gt;MOVE w_pa0002 to itab.&lt;/P&gt;&lt;P&gt;append ITAB.&lt;/P&gt;&lt;P&gt;CLEAR ITAB&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note the bold marks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Vasanth&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Aug 2006 11:37:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/appending-internal-table-data-to-a-string/m-p/1478617#M224194</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-17T11:37:27Z</dc:date>
    </item>
    <item>
      <title>Re: Appending Internal Table Data to a String</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/appending-internal-table-data-to-a-string/m-p/1478618#M224195</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;try this..&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
data w_str type string.
SELECT * FROM pa0002
           INTO TABLE t_pa0002
             ORDER BY gbdat.
 
  LOOP AT t_pa0002 INTO w_pa0002.
    CONCATENATE sy-datum(4) w_pa0002-gbdat+4(2) w_pa0002-gbdat+6(2)
           INTO w_pa0002-gbdat.
 
    CHECK w_pa0002-gbdat GE first_day AND w_pa0002-gbdat LE last_day.
 
* I need to append the line to the String!!!
 concatenate w_str w_pa0002-gbdat into w_str.
  ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;~Suresh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Aug 2006 11:40:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/appending-internal-table-data-to-a-string/m-p/1478618#M224195</guid>
      <dc:creator>suresh_datti</dc:creator>
      <dc:date>2006-08-17T11:40:04Z</dc:date>
    </item>
    <item>
      <title>Re: Appending Internal Table Data to a String</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/appending-internal-table-data-to-a-string/m-p/1478619#M224196</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT t_pa0002 INTO w_pa0002. 
   CONCATENATE sy-datum(4) w_pa0002-gbdat+4(2) w_pa0002-gbdat+6(2)           INTO w_pa0002-gbdat.   
 CHECK w_pa0002-gbdat GE first_day AND 
       w_pa0002-gbdat LE last_day.
* I need to append the line to the String!!!
&amp;lt;b&amp;gt;*--    move all those fields to a variable V_CHAR(100)
   CONCATENATE V_STRING
               V_CHAR
               INTO V_STRING.&amp;lt;/b&amp;gt; 
 ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Aug 2006 11:43:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/appending-internal-table-data-to-a-string/m-p/1478619#M224196</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-17T11:43:40Z</dc:date>
    </item>
    <item>
      <title>Re: Appending Internal Table Data to a String</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/appending-internal-table-data-to-a-string/m-p/1478620#M224197</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;use field-symbols&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and abap command assign component:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data str type string.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;loop...
free str.
do.
assign component sy-index of structure w_pa0002 to &amp;lt;f&amp;gt;.
if sy-subrc &amp;lt;&amp;gt; 0. 
 exit.
endif.

 concatenate str &amp;lt;f&amp;gt; into str.
enddo.

transfer str to file.

endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Aug 2006 11:50:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/appending-internal-table-data-to-a-string/m-p/1478620#M224197</guid>
      <dc:creator>andreas_mann3</dc:creator>
      <dc:date>2006-08-17T11:50:35Z</dc:date>
    </item>
    <item>
      <title>Re: Appending Internal Table Data to a String</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/appending-internal-table-data-to-a-string/m-p/1478621#M224198</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Maybe i didn't explain the problem clearly, here is the complete code of the function i'm creating:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
FUNCTION z3_hr_get_anniversaries.
*"----------------------------------------------------------------------
*"*"Interface local:
*"  EXPORTING
*"     REFERENCE(OUTPUT) TYPE  STRING
*"----------------------------------------------------------------------
  DATA: w_pa0002 TYPE pa0002.

  DATA: t_pa0002 LIKE TABLE OF w_pa0002.

  DATA: first_day TYPE sy-datum,
        last_day  TYPE sy-datum,
        last_date TYPE sy-datum.

  CALL FUNCTION 'GET_WEEK_INFO_BASED_ON_DATE'
   EXPORTING
     date          = sy-datum
   IMPORTING
*     week          =
     monday        = first_day
     sunday        = last_day
            .

  PERFORM go_back_days CHANGING first_day.

  PERFORM go_back_days CHANGING last_day.

  SELECT * FROM pa0002
           INTO TABLE t_pa0002
             ORDER BY gbdat.

  LOOP AT t_pa0002 INTO w_pa0002.
    CONCATENATE sy-datum(4) w_pa0002-gbdat+4(2) w_pa0002-gbdat+6(2)
           INTO w_pa0002-gbdat.

    CHECK w_pa0002-gbdat GE first_day AND w_pa0002-gbdat LE last_day.

* Append to string field GBDAT to my output String

  ENDLOOP.
ENDFUNCTION.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to pick-up field w_pa0002-gbdat and append it to my output which is a only one string with all the data from the table on it... Example of the String &amp;lt;b&amp;gt;&amp;lt;w_pa0002-gbdat[1]&amp;gt;|&amp;lt;w_pa0002-gbdat[2]&amp;gt;|...&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Resuming... What i really want is one output. A String (output) with all the fields i want (GBDAT) from the internal table concatenated one after another.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank You.&lt;/P&gt;&lt;P&gt;Pedro Gaspar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Aug 2006 11:54:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/appending-internal-table-data-to-a-string/m-p/1478621#M224198</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-17T11:54:10Z</dc:date>
    </item>
    <item>
      <title>Re: Appending Internal Table Data to a String</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/appending-internal-table-data-to-a-string/m-p/1478622#M224199</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;
 FUNCTION z3_hr_get_anniversaries.
 *"----------------------------------------------------
 ------------------
 *"*"Interface local:
 *"  EXPORTING
 *"     REFERENCE(OUTPUT) TYPE  STRING
 *"----------------------------------------------------
 ------------------
   DATA: w_pa0002 TYPE pa0002.
 
   DATA: t_pa0002 LIKE TABLE OF w_pa0002.
 
   DATA: first_day TYPE sy-datum,
         last_day  TYPE sy-datum,
         last_date TYPE sy-datum.
   DATA: l_out TYPE string.
 
   CALL FUNCTION 'GET_WEEK_INFO_BASED_ON_DATE'
    EXPORTING
      date          = sy-datum
    IMPORTING
 *     week          =
      monday        = first_day
      sunday        = last_day
            .
 
   PERFORM go_back_days CHANGING first_day.

   PERFORM go_back_days CHANGING last_day.
 
   SELECT * FROM pa0002
            INTO TABLE t_pa0002
              ORDER BY gbdat.
 
   LOOP AT t_pa0002 INTO w_pa0002.
 CONCATENATE sy-datum(4) w_pa0002-gbdat+4(2)
 4(2) w_pa0002-gbdat+6(2)
            INTO w_pa0002-gbdat.
 
 CHECK w_pa0002-gbdat GE first_day AND
 AND w_pa0002-gbdat LE last_day.
 
 * Append to string field GBDAT to my output String
   IF NOT l_out is initial.
      CONCATENATE l_out '|' into l_out.
   ENDIF.
   CONCATENATE l_out w_pa0002-gbdat into l_out.
 
   ENDLOOP.
 ENDFUNCTION.

 &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind Regards&lt;/P&gt;&lt;P&gt;Eswar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Aug 2006 12:01:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/appending-internal-table-data-to-a-string/m-p/1478622#M224199</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-17T12:01:38Z</dc:date>
    </item>
    <item>
      <title>Re: Appending Internal Table Data to a String</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/appending-internal-table-data-to-a-string/m-p/1478623#M224200</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Basic...&lt;/P&gt;&lt;P&gt;(This is not one of my days...)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank You All. Points Rewarded!&lt;/P&gt;&lt;P&gt;Eswar... I could not give you the Solved Problem Reward Points since there was a answer before yours that was also the solution, so i've rewarded chronologically.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Pedro Gaspar&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Aug 2006 12:10:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/appending-internal-table-data-to-a-string/m-p/1478623#M224200</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-17T12:10:32Z</dc:date>
    </item>
    <item>
      <title>Re: Appending Internal Table Data to a String</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/appending-internal-table-data-to-a-string/m-p/1478624#M224201</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No Probs. Pedro. Glad that we could help you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind Regards&lt;/P&gt;&lt;P&gt;Eswar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Aug 2006 12:13:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/appending-internal-table-data-to-a-string/m-p/1478624#M224201</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-17T12:13:41Z</dc:date>
    </item>
  </channel>
</rss>

