<?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 operations in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/string-operations/m-p/1816613#M349571</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Neo,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;probably you are handling material numbers, they have 18 digits &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;000000000000888888&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thats means, you have 10, 11 or 12 leading zeroes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can use the conversion method like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;replace:&lt;/P&gt;&lt;P&gt;  '000000000000'  with '000000000006' in &amp;lt;matnr&amp;gt;.&lt;/P&gt;&lt;P&gt;check sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;  '00000000000'  with '00000000006' in &amp;lt;matnr&amp;gt;.&lt;/P&gt;&lt;P&gt;check sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;  '0000000000'  with '0000000006' in &amp;lt;matnr&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is pattern-based: If the first replacement fails because there are no 12 leading zeroes, the second will try to replace 11 leading zeroes, if this fails, the third statement should find 10 leading zeroes. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;You did not mention where you want to do the replacement: If this is planned for SAP standard tables then you should be aware that you do not know where else the numbers may be referenced - sales, purchases, storage, archive: Everything may be involved.&lt;/P&gt;&lt;P&gt;&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Clemens&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 27 Jan 2007 12:16:38 GMT</pubDate>
    <dc:creator>Clemenss</dc:creator>
    <dc:date>2007-01-27T12:16:38Z</dc:date>
    <item>
      <title>string operations</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/string-operations/m-p/1816609#M349567</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I have a requirement where in if the value of the variable is between 888888 to 88888888 a ' 6 ' should be padded in front of it. So now the variable value would be like 6888888 to 688888888. The problem is the value gets stored in the database  with zeros appended to it. i.e if the length of the variable is 18, 888888 will be stored as 000000000000888888 in the database and from this it has to be converted into 000000000006888888.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any inputs on how this can be done.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Neo.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 27 Jan 2007 11:17:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/string-operations/m-p/1816609#M349567</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-27T11:17:27Z</dc:date>
    </item>
    <item>
      <title>Re: string operations</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/string-operations/m-p/1816610#M349568</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi first fetch all the values into your internal table field&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then to remove the leading zeroes use the function module &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;convert_exit_alpha_output&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;otherwise u can use&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SHIFT VALUE LEFT DELETING LEADING '0'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;next comes to find ur value whether it between 888888 to 88888888&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for this use if condition&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if value &amp;lt; 88888888 and value &amp;gt; 888888.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;logic&amp;gt;&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;the ending would be ur logic, that is to append 6 in front of it&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;concatenate '6' value into value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this will solve ur problem , award points if found helpful&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 27 Jan 2007 11:35:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/string-operations/m-p/1816610#M349568</guid>
      <dc:creator>rahulkavuri</dc:creator>
      <dc:date>2007-01-27T11:35:31Z</dc:date>
    </item>
    <item>
      <title>Re: string operations</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/string-operations/m-p/1816611#M349569</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;U can try something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;PARAMETERS: P(18) TYPE C
.
DATA: VAL1(18) VALUE  '888888',
      VAL2(18) VALUE  '88888888'.


IF P =&amp;gt; VAL1 AND P &amp;lt;= VAL2.  
 PERFORM CONVERT_DATA USING P.
ENDIF.

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  CONVERT_DATA
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      --&amp;gt;P_VAL  text
*----------------------------------------------------------------------*
FORM CONVERT_DATA USING    P_VAL.
  DATA: VAL(18).

  DATA: LEN TYPE I.

  LEN = STRLEN( P_VAL ).


  VAL(1) = '6'.
  VAL+1 = P_VAL(LEN).

  CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
       EXPORTING
            INPUT  = VAL
       IMPORTING
            OUTPUT = P_VAL.

  WRITE:/ P_VAL.
ENDFORM.                    " CONVERT_DATA&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Max&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 27 Jan 2007 11:37:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/string-operations/m-p/1816611#M349569</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-27T11:37:19Z</dc:date>
    </item>
    <item>
      <title>Re: string operations</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/string-operations/m-p/1816612#M349570</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Neo,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following code will help you out.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  text = '000000000000888888'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  SHIFT text LEFT DELETING LEADING '0'.&lt;/P&gt;&lt;P&gt;  CONDENSE text NO-GAPS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward points if helped.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards&lt;/P&gt;&lt;P&gt;Renjan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 27 Jan 2007 11:56:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/string-operations/m-p/1816612#M349570</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-27T11:56:46Z</dc:date>
    </item>
    <item>
      <title>Re: string operations</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/string-operations/m-p/1816613#M349571</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Neo,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;probably you are handling material numbers, they have 18 digits &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;000000000000888888&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thats means, you have 10, 11 or 12 leading zeroes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can use the conversion method like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;replace:&lt;/P&gt;&lt;P&gt;  '000000000000'  with '000000000006' in &amp;lt;matnr&amp;gt;.&lt;/P&gt;&lt;P&gt;check sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;  '00000000000'  with '00000000006' in &amp;lt;matnr&amp;gt;.&lt;/P&gt;&lt;P&gt;check sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;  '0000000000'  with '0000000006' in &amp;lt;matnr&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is pattern-based: If the first replacement fails because there are no 12 leading zeroes, the second will try to replace 11 leading zeroes, if this fails, the third statement should find 10 leading zeroes. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;You did not mention where you want to do the replacement: If this is planned for SAP standard tables then you should be aware that you do not know where else the numbers may be referenced - sales, purchases, storage, archive: Everything may be involved.&lt;/P&gt;&lt;P&gt;&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Clemens&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 27 Jan 2007 12:16:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/string-operations/m-p/1816613#M349571</guid>
      <dc:creator>Clemenss</dc:creator>
      <dc:date>2007-01-27T12:16:38Z</dc:date>
    </item>
  </channel>
</rss>

