<?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 to character conversion in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/string-to-character-conversion/m-p/12424739#M1997489</link>
    <description>&lt;P&gt;The answer is in the error message.&lt;/P&gt;&lt;P&gt;Why don't you want to use a constant?&lt;/P&gt;</description>
    <pubDate>Wed, 23 Jun 2021 15:33:30 GMT</pubDate>
    <dc:creator>Sandra_Rossi</dc:creator>
    <dc:date>2021-06-23T15:33:30Z</dc:date>
    <item>
      <title>string to character conversion</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/string-to-character-conversion/m-p/12424736#M1997486</link>
      <description>&lt;P&gt;data : text type string value 'rain'.&lt;/P&gt;
  &lt;P&gt;&lt;BR /&gt;data: str type i.&lt;BR /&gt;&lt;BR /&gt;str = STRLEN( text ).&lt;BR /&gt;&lt;BR /&gt;data text2 type c LENGTH str.&lt;BR /&gt;&lt;BR /&gt;text2 = text.&lt;BR /&gt;&lt;BR /&gt;write : str.&lt;BR /&gt;&lt;BR /&gt;write: text2.&lt;/P&gt;
  &lt;P&gt;I'M GETTING THIS ERROR : "STR" IS NOT A CONSTANT .&lt;/P&gt;
  &lt;P&gt;PLEASE HELP&lt;/P&gt;</description>
      <pubDate>Wed, 23 Jun 2021 14:25:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/string-to-character-conversion/m-p/12424736#M1997486</guid>
      <dc:creator>akshayd1998</dc:creator>
      <dc:date>2021-06-23T14:25:38Z</dc:date>
    </item>
    <item>
      <title>Re: string to character conversion</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/string-to-character-conversion/m-p/12424737#M1997487</link>
      <description>&lt;P&gt;Thank you for
visiting SAP Community to get answers to your questions. Since this is your
first question, I recommend that you familiarize yourself with: &lt;A href="https://community.sap.com/resources/questions-and-answers"&gt;https://community.sap.com/resources/questions-and-answers&lt;/A&gt;,
as the overview provides tips for preparing questions that draw responses from
our members.&lt;/P&gt;&lt;P&gt;
&lt;BR /&gt;
Should you wish, you can revise your question by selecting Actions, then Edit.
&lt;BR /&gt;
&lt;BR /&gt;
By adding a picture to your profile you encourage readers to respond: &lt;A href="https://www.youtube.com/watch?v=46bt1juWUUM"&gt;https://www.youtube.com/watch?v=46bt1juWUUM&lt;/A&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Keep in mind, when you receive an answer that was helpful to you, accept it as
best answer. &lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;Your SAP Community
moderator&lt;/P&gt;</description>
      <pubDate>Wed, 23 Jun 2021 14:25:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/string-to-character-conversion/m-p/12424737#M1997487</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2021-06-23T14:25:50Z</dc:date>
    </item>
    <item>
      <title>Re: string to character conversion</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/string-to-character-conversion/m-p/12424738#M1997488</link>
      <description>&lt;P&gt;In ABAP, the length of character data should be specified statically. So, for your requirement, you should do like this. You should try like this.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA:
  lv_string TYPE string,
  lv_strlen TYPE i,
  lv_char   TYPE c LENGTH 255.

DATA:
  lr_char  TYPE REF TO data,
  lo_descr TYPE REF TO cl_abap_elemdescr.

FIELD-SYMBOLS:
   &amp;lt;fs_data&amp;gt; TYPE any.

"Assign value to string variable
lv_string = 'Hello word'.

lv_char = lv_string.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;If you still want to declare the length of char data type dynamically, it will more advance technic. You can use below code to achieve this. This uses the concept of data reference, RTTS and field symbol. If you are new to SAP no need to focus on these topic as these are pretty advance. So you can use the above code to specify the length of char data type statically.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA:
  lv_string TYPE string,
  lv_strlen TYPE i.

DATA:
  lr_char  TYPE REF TO data,
  lo_descr TYPE REF TO cl_abap_elemdescr.

FIELD-SYMBOLS:
   &amp;lt;fs_data&amp;gt; TYPE any.

"Assign value to string variable
lv_string = 'Hello word'.

"Get length of string variable
lv_strlen = strlen( lv_string ).

"Create a character data type of length of string
lo_descr = cl_abap_elemdescr=&amp;gt;get_c( p_length = lv_strlen ).

"Create variable -&amp;gt; Data referece
CREATE DATA lr_char TYPE HANDLE lo_descr.

"assign to field symbol
ASSIGN lr_char-&amp;gt;* to &amp;lt;fs_data&amp;gt;.

"Assign value to new character varible
&amp;lt;fs_data&amp;gt; = lv_string.

"Print the value
 WRITE:/ &amp;lt;fs_data&amp;gt;.&amp;lt;br&amp;gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 23 Jun 2021 14:46:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/string-to-character-conversion/m-p/12424738#M1997488</guid>
      <dc:creator>Gourab_Dey</dc:creator>
      <dc:date>2021-06-23T14:46:40Z</dc:date>
    </item>
    <item>
      <title>Re: string to character conversion</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/string-to-character-conversion/m-p/12424739#M1997489</link>
      <description>&lt;P&gt;The answer is in the error message.&lt;/P&gt;&lt;P&gt;Why don't you want to use a constant?&lt;/P&gt;</description>
      <pubDate>Wed, 23 Jun 2021 15:33:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/string-to-character-conversion/m-p/12424739#M1997489</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2021-06-23T15:33:30Z</dc:date>
    </item>
  </channel>
</rss>

