<?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: String Length in File. in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/string-length-in-file/m-p/4719098#M1108087</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try it this way:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data: BEGIN OF IT_DOWNLOAD OCCURS 0,
        QMNUM TYPE QMNUM,   
        LTEXT(5000),
        DUMMY(1),
      END OF IT_DOWNLOAD.

data: l_text type string.
" Code to populate data in IT_DOWNLOAD

check not it_download[] is initial.
open dataset &amp;lt;p_file&amp;gt; for output in textmode encoding default.
if sy-subrc ne 0.
  message e001(00) with 'Error Opening file:' &amp;lt;p_file&amp;gt;.
else.
  loop at it_download.
     clear: l_text.
     l_text(12) = it_download-qmnum.
     l_text+12(5000) = it_download-ltext.
     l_text+5012(1) = it_download-dummy.
     transfer l_text to &amp;lt;p_file&amp;gt;.
  endloop.
  close dataset &amp;lt;p_file.
endif.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you are using dummy character in the table just for the length, you can do it using below method as well:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;types: begin of t_down,
        qmnum type qmnum,    " Length 12
        ltext(5000) type c, " Length 5000
       endif.
data: i_down type table of t_down,
      wa_down type t_down.
      
" Code to populate i_down

check not i_down[] is initial.
open dataset &amp;lt;p_file&amp;gt; for output in textmode encoding default.
if sy-subrc ne 0.
  message e001(00) with 'Error Opening file:' &amp;lt;p_file&amp;gt;.
else.
  loop at i_down into wa_down.
    transfer wa_down to &amp;lt;p_file&amp;gt; length 5012.
  endloop.
  close dataset &amp;lt;p_file&amp;gt;
endif.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;~Eswar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 31 Oct 2008 02:54:08 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-10-31T02:54:08Z</dc:date>
    <item>
      <title>String Length in File.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/string-length-in-file/m-p/4719096#M1108085</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;I have to download a longtext from SAP into the Dev Server.&lt;STRONG&gt;I am using the  Opendataset concept.&lt;/STRONG&gt;The length of the longtext has to be fixed 5000 ie...Even if the length of the longtext from SAP is 1000 remaining 4000 spaces should get appended.&lt;/P&gt;&lt;P&gt;I am moving the long text into a variable l_line which I have declared in the following way L_LINE(5000).&lt;/P&gt;&lt;P&gt;But after moving the longtext into this variable it still shows the actual length of the longtext whereas I need 5000 fixed length.&lt;/P&gt;&lt;P&gt; &lt;STRONG&gt;When using Gui_download it works fine&lt;/STRONG&gt; coz I have used another dummy variable &lt;/P&gt;&lt;P&gt;after the long text in the internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ie..&lt;/P&gt;&lt;P&gt; BEGIN OF IT_DOWNLOAD OCCURS 0,&lt;/P&gt;&lt;P&gt;         QMNUM TYPE QMNUM,&lt;/P&gt;&lt;P&gt;         LTEXT(5000),&lt;/P&gt;&lt;P&gt;         DUMMY(1),&lt;/P&gt;&lt;P&gt;       END OF IT_DOWNLOAD.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How to solve it.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 31 Oct 2008 00:34:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/string-length-in-file/m-p/4719096#M1108085</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-31T00:34:10Z</dc:date>
    </item>
    <item>
      <title>Re: String Length in File.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/string-length-in-file/m-p/4719097#M1108086</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Renu,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try to open the dataset as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN DATASET file &lt;/P&gt;&lt;P&gt;FOR OUTPUT IN LEGACY BINARY MODE &lt;/P&gt;&lt;P&gt;ENCODING DEFAULT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Gajendra&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 31 Oct 2008 01:46:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/string-length-in-file/m-p/4719097#M1108086</guid>
      <dc:creator>former_member723628</dc:creator>
      <dc:date>2008-10-31T01:46:25Z</dc:date>
    </item>
    <item>
      <title>Re: String Length in File.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/string-length-in-file/m-p/4719098#M1108087</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try it this way:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data: BEGIN OF IT_DOWNLOAD OCCURS 0,
        QMNUM TYPE QMNUM,   
        LTEXT(5000),
        DUMMY(1),
      END OF IT_DOWNLOAD.

data: l_text type string.
" Code to populate data in IT_DOWNLOAD

check not it_download[] is initial.
open dataset &amp;lt;p_file&amp;gt; for output in textmode encoding default.
if sy-subrc ne 0.
  message e001(00) with 'Error Opening file:' &amp;lt;p_file&amp;gt;.
else.
  loop at it_download.
     clear: l_text.
     l_text(12) = it_download-qmnum.
     l_text+12(5000) = it_download-ltext.
     l_text+5012(1) = it_download-dummy.
     transfer l_text to &amp;lt;p_file&amp;gt;.
  endloop.
  close dataset &amp;lt;p_file.
endif.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you are using dummy character in the table just for the length, you can do it using below method as well:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;types: begin of t_down,
        qmnum type qmnum,    " Length 12
        ltext(5000) type c, " Length 5000
       endif.
data: i_down type table of t_down,
      wa_down type t_down.
      
" Code to populate i_down

check not i_down[] is initial.
open dataset &amp;lt;p_file&amp;gt; for output in textmode encoding default.
if sy-subrc ne 0.
  message e001(00) with 'Error Opening file:' &amp;lt;p_file&amp;gt;.
else.
  loop at i_down into wa_down.
    transfer wa_down to &amp;lt;p_file&amp;gt; length 5012.
  endloop.
  close dataset &amp;lt;p_file&amp;gt;
endif.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;~Eswar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 31 Oct 2008 02:54:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/string-length-in-file/m-p/4719098#M1108087</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-31T02:54:08Z</dc:date>
    </item>
  </channel>
</rss>

