<?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: Convert variable in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/convert-variable/m-p/911062#M57076</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Christian,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Obviously the comment that I have made put in the code (for the WHERE clause of the SELECT statement) in my explanation above was not articulate enough. I &amp;lt;b&amp;gt;did&amp;lt;/b&amp;gt; mean that LIFNR would have to be a &amp;lt;i&amp;gt;numeric&amp;lt;/i&amp;gt; value for the logic to work. But yes, the where condition is not &amp;lt;u&amp;gt;&amp;lt;i&amp;gt;sufficient&amp;lt;/i&amp;gt;&amp;lt;/u&amp;gt; to discard the alpha-numeric values for LIFNR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Secondly, though &amp;lt;i&amp;gt;possible&amp;lt;/i&amp;gt;, I did not consider it &amp;lt;i&amp;gt;likely&amp;lt;/i&amp;gt; that LIFNR would have an alpha-numeric value (in which case I should've probably omitted the WHERE clause altogether, you say?:-)).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Anand Mandalika.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 10 Feb 2005 10:43:16 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2005-02-10T10:43:16Z</dc:date>
    <item>
      <title>Convert variable</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/convert-variable/m-p/911055#M57069</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 need to convert a variabel.&lt;/P&gt;&lt;P&gt;p_lifnr is now 123999.&lt;/P&gt;&lt;P&gt;I need it to be 0000123999.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there any FM that can fix this ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select * from EKKO where lifnr = p_lifnr. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//Martin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Feb 2005 07:40:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/convert-variable/m-p/911055#M57069</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-02-10T07:40:55Z</dc:date>
    </item>
    <item>
      <title>Re: Convert variable</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/convert-variable/m-p/911056#M57070</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Martin,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data l_lifnr(10) type n.
move p_lifnr to l_lifnr.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now &amp;lt;b&amp;gt;l_lifnr&amp;lt;/b&amp;gt; will contain the data in the format that you require.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Anand Mandalika.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Feb 2005 07:43:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/convert-variable/m-p/911056#M57070</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-02-10T07:43:30Z</dc:date>
    </item>
    <item>
      <title>Re: Convert variable</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/convert-variable/m-p/911057#M57071</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;there's a form routine:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PERFORM ALPHAFORMAT(SAPFS000) USING p_lifnr p_lifnr .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards Andreas&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Andreas Mann&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Feb 2005 07:48:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/convert-variable/m-p/911057#M57071</guid>
      <dc:creator>andreas_mann3</dc:creator>
      <dc:date>2005-02-10T07:48:25Z</dc:date>
    </item>
    <item>
      <title>Re: Convert variable</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/convert-variable/m-p/911058#M57072</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If LIFNR is defined as type: char, then FM CONVERSION_EXIT_ALPHA_INPUT will pad the variable with leading zeros.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards, Murugesh AS&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Feb 2005 08:01:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/convert-variable/m-p/911058#M57072</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-02-10T08:01:10Z</dc:date>
    </item>
    <item>
      <title>Re: Convert variable</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/convert-variable/m-p/911059#M57073</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Martin,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There's one thing that you need to observe. If you are talking about the SAP standard field LIFNR, then the field will already contain the zeroes prefixed. The only thing is that you don't get to see it when you display it, say for example on the list. Just look at the following example, which might be a bit amusing to you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data : p_lifnr type lifnr.

select single lifnr
  from lfa1
  into p_lifnr
 where lifnr gt 1. " Just to make sure that you select a numeric value"


write p_lifnr.

skip 2.
* We know thast LIFNR is 10 characters long.
do 10 times.
  write : / p_lifnr+0(sy-index).
enddo.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I shall leave the reasoning to you, coz I trust it's good fun &amp;lt;i&amp;gt;trying&amp;lt;/i&amp;gt; to discover what happens &amp;lt;i&amp;gt;behind the screens..&amp;lt;/i&amp;gt; Just see if you can make sense out of it. And get back if you have some doubts.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Anand Mandlaika.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;P.S: BTW, if you already know how this whole thing works, then I'm sorry for assuming that you may not have known it &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Feb 2005 08:07:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/convert-variable/m-p/911059#M57073</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-02-10T08:07:36Z</dc:date>
    </item>
    <item>
      <title>Re: Convert variable</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/convert-variable/m-p/911060#M57074</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everybody,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You *&lt;STRONG&gt;all&lt;/STRONG&gt;* are right. I only try to make my tiny contribution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Generally speaking, every domain (associated to a data element, associated to a field of a table) can have its own conversion routine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For instance, take a look into domain LIFNR (thru transaction SE12). At frame "Output characteristics", pls watch field "Conversion routine". In this case, it shows "ALPHA". That means there should be (at least) two function modules, one for input-&amp;gt;output, the other one for output-&amp;gt;input. In fact, if you double-click onto this field, you will get a matchcode with such function modules.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I personally use these function modules instead of filling out with zeroes manually.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please let us know if it helped. Best regards,&lt;/P&gt;&lt;P&gt;Alvaro&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Feb 2005 08:09:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/convert-variable/m-p/911060#M57074</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-02-10T08:09:23Z</dc:date>
    </item>
    <item>
      <title>Re: Convert variable</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/convert-variable/m-p/911061#M57075</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;Unfortunately you're &amp;lt;b&amp;gt;NOT&amp;lt;/b&amp;gt; all right.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If lifnr contains at least one character (not only numbers), then NO leading zeros will be added by conversion_exit_alpha_input. That's the only correct handling, approach with variable type n is not working for all circumstances.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Christian&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Feb 2005 08:36:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/convert-variable/m-p/911061#M57075</guid>
      <dc:creator>christian_wohlfahrt</dc:creator>
      <dc:date>2005-02-10T08:36:42Z</dc:date>
    </item>
    <item>
      <title>Re: Convert variable</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/convert-variable/m-p/911062#M57076</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Christian,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Obviously the comment that I have made put in the code (for the WHERE clause of the SELECT statement) in my explanation above was not articulate enough. I &amp;lt;b&amp;gt;did&amp;lt;/b&amp;gt; mean that LIFNR would have to be a &amp;lt;i&amp;gt;numeric&amp;lt;/i&amp;gt; value for the logic to work. But yes, the where condition is not &amp;lt;u&amp;gt;&amp;lt;i&amp;gt;sufficient&amp;lt;/i&amp;gt;&amp;lt;/u&amp;gt; to discard the alpha-numeric values for LIFNR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Secondly, though &amp;lt;i&amp;gt;possible&amp;lt;/i&amp;gt;, I did not consider it &amp;lt;i&amp;gt;likely&amp;lt;/i&amp;gt; that LIFNR would have an alpha-numeric value (in which case I should've probably omitted the WHERE clause altogether, you say?:-)).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Anand Mandalika.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Feb 2005 10:43:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/convert-variable/m-p/911062#M57076</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-02-10T10:43:16Z</dc:date>
    </item>
    <item>
      <title>Re: Convert variable</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/convert-variable/m-p/911063#M57077</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Anand,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I guess, I made my sentence to short:&lt;/P&gt;&lt;P&gt;instead of 'not all right' -&amp;gt; 'not everyone was right' (or something like this) - I like to direct your focus on cases with characters.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example code of Anand can be extended by using no where-clause - but who wants to write 20 000 vendors.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To show some examples:&lt;/P&gt;&lt;P&gt;Internal     External&lt;/P&gt;&lt;P&gt;'1-001     ' '1-001     '&lt;/P&gt;&lt;P&gt;'30A001    ' '30A001    '&lt;/P&gt;&lt;P&gt;'0000000001' '1         '&lt;/P&gt;&lt;P&gt;'0000001001' '1001      '&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Like Alvaro already mentioned: a lot of fields follow conversion rule alpha (e.g. mara-matnr). There will be customers, which use combinations of chars and nums; be careful (in general, not just Anand &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;By the way: FM CONVERSION_EXIT_ALPHA_INPUT calls immediatly a system function (C-routine), so performance should be very good.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Christian&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;P.S.: I didn't mean to offend you&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Feb 2005 13:31:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/convert-variable/m-p/911063#M57077</guid>
      <dc:creator>christian_wohlfahrt</dc:creator>
      <dc:date>2005-02-10T13:31:16Z</dc:date>
    </item>
  </channel>
</rss>

