<?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: Transporting an internal table in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/transporting-an-internal-table/m-p/1238455#M141440</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
LOOP AT it_global_data INTO wa_global_data.
  condense wa_global_data.
  TRANSFER wa_global_data TO txt_out.
ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This will get rid of most spaces, but leave one between fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 02 Mar 2006 21:36:06 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-03-02T21:36:06Z</dc:date>
    <item>
      <title>Transporting an internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/transporting-an-internal-table/m-p/1238454#M141439</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'm trying to write the contents of an internal table to the application server, this is my code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  OPEN DATASET txt_out&lt;/P&gt;&lt;P&gt;    FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    LOOP AT it_global_data INTO wa_global_data.&lt;/P&gt;&lt;P&gt;      TRANSFER wa_global_data TO txt_out.&lt;/P&gt;&lt;P&gt;    ENDLOOP.&lt;/P&gt;&lt;P&gt;    WRITE: / 'data was written to ', txt_out.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  ELSE.&lt;/P&gt;&lt;P&gt;    WRITE: / 'Error, sy-subrc is: ', sy-subrc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CLOSE DATASET txt_out.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now, I want to do 2 things:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) Remove all the unnecessary spaces after each field (is there a function to do that?)&lt;/P&gt;&lt;P&gt;2) Between each field I want to have a ';' in my output file&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The trick is performance is a big issue because the file can be huge (200,000+ lines) so I don't think parsing each field and manually placing a ';' after it will be very fast.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Mar 2006 21:26:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/transporting-an-internal-table/m-p/1238454#M141439</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-02T21:26:47Z</dc:date>
    </item>
    <item>
      <title>Re: Transporting an internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/transporting-an-internal-table/m-p/1238455#M141440</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
LOOP AT it_global_data INTO wa_global_data.
  condense wa_global_data.
  TRANSFER wa_global_data TO txt_out.
ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This will get rid of most spaces, but leave one between fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Mar 2006 21:36:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/transporting-an-internal-table/m-p/1238455#M141440</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-02T21:36:06Z</dc:date>
    </item>
    <item>
      <title>Re: Transporting an internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/transporting-an-internal-table/m-p/1238456#M141441</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Nice, it works great! Now all I need is to put a ';' between each field, is there a quick way to do it?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Mar 2006 21:42:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/transporting-an-internal-table/m-p/1238456#M141441</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-02T21:42:37Z</dc:date>
    </item>
    <item>
      <title>Re: Transporting an internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/transporting-an-internal-table/m-p/1238457#M141442</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When you are writing the file out, you are already doing a loop. All you have to do is this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Define another variable that has a length as that of the internal table record, say mystring(1000). Then inside your loop, all you have to do is&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
LOOP AT it_global_data INTO wa_global_data.
  DO.
    ASSIGN COMPONENT sy-index OF STRUCTURE wa_global_data TO &amp;lt;fs&amp;gt;.
    IF sy-subrc &amp;lt;&amp;gt; 0.
      EXIT.
    ENDIF.
    CONCATENATE mystring
                &amp;lt;fs&amp;gt;
           INTO mystring SEPARATED BY SPACE.
  ENDDO.
  CONDENSE mystring.
  TRANSFER mystring TO txt_out.
ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Mar 2006 21:42:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/transporting-an-internal-table/m-p/1238457#M141442</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-02T21:42:52Z</dc:date>
    </item>
    <item>
      <title>Re: Transporting an internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/transporting-an-internal-table/m-p/1238458#M141443</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;1) No! I don't think because the problem is how to know which spaces  are unnecessary.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can try to do this: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MOVE wa_global_data TO STRING.&lt;/P&gt;&lt;P&gt;CONDENSE STRING NO-GAPS.&lt;/P&gt;&lt;P&gt;TRANSFER STRING TO &amp;lt;FILE&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But in this way all spaces'll be removed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) Try to use the fm SAP_CONVERT_TO_CSV_FORMAT: but this fm check the structure of your file and after each field insert ';', so I don't know if it's what you would like to do.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you don't want to insert "manually" ';' you should prepare the structure before transfering the data to file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example if my structure is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF ST_DATA,&lt;/P&gt;&lt;P&gt;        FIELD1,&lt;/P&gt;&lt;P&gt;        FIELD2,&lt;/P&gt;&lt;P&gt;        .......&lt;/P&gt;&lt;P&gt;        FIELDN,&lt;/P&gt;&lt;P&gt;      END   OF ST_DATA.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The structure for file should be:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF ST_FILE,&lt;/P&gt;&lt;P&gt;        FIELD1,&lt;/P&gt;&lt;P&gt;        FILL1,&lt;/P&gt;&lt;P&gt;        FIELD2,&lt;/P&gt;&lt;P&gt;        FILL2,&lt;/P&gt;&lt;P&gt;        .......&lt;/P&gt;&lt;P&gt;        FIELDN,&lt;/P&gt;&lt;P&gt;        FILLN,&lt;/P&gt;&lt;P&gt;      END   OF ST_FILE.&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;LOOP AT it_global_data INTO ST_DATA.&lt;/P&gt;&lt;P&gt;  CLEAR ST_FILE WITH ';'.&lt;/P&gt;&lt;P&gt;  MOVE-CORRESPONDING ST_DATA TO ST_FILE.&lt;/P&gt;&lt;P&gt;  CONDENSE ST_FILE NO-GAP.&lt;/P&gt;&lt;P&gt;  TRANSFER ST_FILE TO &amp;lt;FILE.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Max&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Mar 2006 21:44:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/transporting-an-internal-table/m-p/1238458#M141443</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-02T21:44:38Z</dc:date>
    </item>
    <item>
      <title>Re: Transporting an internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/transporting-an-internal-table/m-p/1238459#M141444</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your help guys, the SAP_CONVERT_TO_CSV_FORMAT technique takes too long on my table so unfortunately I can't use it. &lt;/P&gt;&lt;P&gt;I will try preparing my structure with the FILLs and then doing a condense to get rid of the spaces.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Mar 2006 22:02:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/transporting-an-internal-table/m-p/1238459#M141444</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-02T22:02:28Z</dc:date>
    </item>
    <item>
      <title>Re: Transporting an internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/transporting-an-internal-table/m-p/1238460#M141445</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can do like this:&lt;/P&gt;&lt;P&gt;Data: begin of int. table,&lt;/P&gt;&lt;P&gt;      field1,&lt;/P&gt;&lt;P&gt;      filler1 value ';',&lt;/P&gt;&lt;P&gt;      field2,&lt;/P&gt;&lt;P&gt;      filler2 value ';',&lt;/P&gt;&lt;P&gt;      ...&lt;/P&gt;&lt;P&gt;      ...&lt;/P&gt;&lt;P&gt;      end of itn. table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;after populating int. table, use&lt;/P&gt;&lt;P&gt;condense int. table no-gaps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now you can directly transfer the int. table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;condense&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Mar 2006 00:40:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/transporting-an-internal-table/m-p/1238460#M141445</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-03T00:40:24Z</dc:date>
    </item>
    <item>
      <title>Re: Transporting an internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/transporting-an-internal-table/m-p/1238461#M141446</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;You can first remove all spaces using CONDENSE and then replace the single spaces left with TRANSALTE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A sample code is given below:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT ZTMP .

DATA: WA_TXT(100) VALUE 'THE   MAGIC   OF   TRANSLATE',
      WA_CHANGE(2) VALUE ' ;',
      WA_LTH TYPE I.

CONDENSE WA_TXT.

* Get length of actual record after condensing
WA_LTH = STRLEN( WA_TXT ).

TRANSLATE WA_TXT USING WA_CHANGE.

* Delete trailing ; from the record
WA_TXT = WA_TXT+0(WA_LTH).
WRITE: / WA_TXT.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since this code is relatively simple, it should not result in performance issues.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps,&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Madhur&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NB: Please award points if found helpful&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Mar 2006 05:23:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/transporting-an-internal-table/m-p/1238461#M141446</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-03T05:23:17Z</dc:date>
    </item>
    <item>
      <title>Re: Transporting an internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/transporting-an-internal-table/m-p/1238462#M141447</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;Try following code..&lt;/P&gt;&lt;P&gt;data : lv_string(1000).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN DATASET txt_out&lt;/P&gt;&lt;P&gt;FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT it_global_data INTO wa_global_data.&lt;/P&gt;&lt;P&gt;concatenate wa_global_data-field1&lt;/P&gt;&lt;P&gt;            wa_global_data-field2&lt;/P&gt;&lt;P&gt;            .&lt;/P&gt;&lt;P&gt;            .&lt;/P&gt;&lt;P&gt;            wa_global_data-fieldn&lt;/P&gt;&lt;P&gt;into lv_string separated by ','.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;condense lv_string no-gaps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*TRANSFER wa_global_data TO txt_out.&lt;/P&gt;&lt;P&gt; TRANSFER lv_string to txt_out.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;WRITE: / 'data was written to ', txt_out.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ELSE.&lt;/P&gt;&lt;P&gt;WRITE: / 'Error, sy-subrc is: ', sy-subrc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLOSE DATASET txt_out.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All the fileds of wa_global_data should be of type c or string.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If not, then use the FM 'SO_STRUCT_TO_CHAR' &lt;/P&gt;&lt;P&gt;to convert it into charecter string and use above logic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this will help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Shashank&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Mar 2006 07:15:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/transporting-an-internal-table/m-p/1238462#M141447</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-03T07:15:09Z</dc:date>
    </item>
  </channel>
</rss>

