<?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: Creating character variable with dynamic length in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/creating-character-variable-with-dynamic-length/m-p/7048119#M1501653</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is correct approach to create dynamic char variable of string length. For proof execute the below&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA: r_cdata TYPE REF TO data,
      l_len TYPE i,
      l_string TYPE string.

l_string = 'asdfghjklz'.
l_len = STRLEN( l_string ).
WRITE: 'String lenght', l_len.

CREATE DATA r_cdata TYPE c LENGTH l_len.
FIELD-SYMBOLS &amp;lt;cdata&amp;gt; TYPE ANY.
ASSIGN r_cdata-&amp;gt;* TO &amp;lt;cdata&amp;gt;.

WRITE: / 'Character length:', l_len.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Anyhow I am curious why you need that in char variable. Usually string should be converted to table string, which can be achieved by &lt;STRONG&gt;SCMS_STRING_TO_FTEXT&lt;/STRONG&gt; . Then you can pass such table further.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Marcin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 24 Jul 2010 14:20:19 GMT</pubDate>
    <dc:creator>MarcinPciak</dc:creator>
    <dc:date>2010-07-24T14:20:19Z</dc:date>
    <item>
      <title>Creating character variable with dynamic length</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/creating-character-variable-with-dynamic-length/m-p/7048118#M1501652</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to send contents of an internal table via FTP in character mode,&lt;/P&gt;&lt;P&gt;the entire contents of a internal table is concatenated in a string(v_string) which needs to be moved to the character variable of same size say l_count = strlen( v_string ).&lt;/P&gt;&lt;P&gt;can anyone help me to define the character variable say of length l_count.&lt;/P&gt;&lt;P&gt;I have already tried creating a dynamic character variable using CREATE DATA.&lt;/P&gt;&lt;P&gt;eg   DATA: dref TYPE REF TO DATA.&lt;/P&gt;&lt;P&gt;  CREATE DATA dref TYPE c LENGTH l_count.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but this is not working.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any response will be helpful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards,&lt;/P&gt;&lt;P&gt;Sumukh Kapoor.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 24 Jul 2010 10:29:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/creating-character-variable-with-dynamic-length/m-p/7048118#M1501652</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-07-24T10:29:09Z</dc:date>
    </item>
    <item>
      <title>Re: Creating character variable with dynamic length</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/creating-character-variable-with-dynamic-length/m-p/7048119#M1501653</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is correct approach to create dynamic char variable of string length. For proof execute the below&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA: r_cdata TYPE REF TO data,
      l_len TYPE i,
      l_string TYPE string.

l_string = 'asdfghjklz'.
l_len = STRLEN( l_string ).
WRITE: 'String lenght', l_len.

CREATE DATA r_cdata TYPE c LENGTH l_len.
FIELD-SYMBOLS &amp;lt;cdata&amp;gt; TYPE ANY.
ASSIGN r_cdata-&amp;gt;* TO &amp;lt;cdata&amp;gt;.

WRITE: / 'Character length:', l_len.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Anyhow I am curious why you need that in char variable. Usually string should be converted to table string, which can be achieved by &lt;STRONG&gt;SCMS_STRING_TO_FTEXT&lt;/STRONG&gt; . Then you can pass such table further.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Marcin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 24 Jul 2010 14:20:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/creating-character-variable-with-dynamic-length/m-p/7048119#M1501653</guid>
      <dc:creator>MarcinPciak</dc:creator>
      <dc:date>2010-07-24T14:20:19Z</dc:date>
    </item>
    <item>
      <title>Re: Creating character variable with dynamic length</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/creating-character-variable-with-dynamic-length/m-p/7048120#M1501654</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Marcin,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your response,&lt;/P&gt;&lt;P&gt;Reason i need character variable of dynamic length is because the requirement is to send data to client's Windows terminal . We already have FTP code in place and suddenly client has asked to send us data of an internal table in a single line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have concatenated the entire table into a string and then thought of moving the entire data from string to that character.. as the size in character goes beyond 60000 characters in many cases....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It seems this is not possible as the string cannot be converted to the data type of variable newly declared.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;anyways your input was of great help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks  &amp;amp; Regards,&lt;/P&gt;&lt;P&gt;Sumukh Kapoor.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Sumukh Kapoor on Jul 26, 2010 7:56 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Jul 2010 05:56:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/creating-character-variable-with-dynamic-length/m-p/7048120#M1501654</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-07-26T05:56:18Z</dc:date>
    </item>
  </channel>
</rss>

