<?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: Explicit type conversion functions in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/explicit-type-conversion-functions/m-p/905794#M56082</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Zahid,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm slightly surprised with this question. Look at this code snippet.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data : integer type i,
       string  type string.

move '12345' to string.

write string.

integer = string.
write : / integer.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the character string is convertible to an integer, there will be no problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But if you have some like  - &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data : integer type i,
       string  type string.

move '12A345' to string.

write string.

integer = string.
write : / integer.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You will get a short dump, because 123A45 cannot be converted to an integer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Of course, you can handle this runtime error by using the CATCH...ENDCATCH block for exception handling in ABAP .&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, 28 Apr 2005 05:12:28 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2005-04-28T05:12:28Z</dc:date>
    <item>
      <title>Explicit type conversion functions</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/explicit-type-conversion-functions/m-p/905793#M56081</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I need to convert a char value returned by the select query to number. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select max(to_number(child_id))&lt;/P&gt;&lt;P&gt;from table . . ..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i don't know what function is used in Minisap for this conversion of character to Number. Remember i am using Minisap that is i think 46C or 46D. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I find out a function NUM(a) from SAP help portal but that doesnot work with the release i am using.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can any body help me plz.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Zahid&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Apr 2005 04:38:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/explicit-type-conversion-functions/m-p/905793#M56081</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-04-28T04:38:21Z</dc:date>
    </item>
    <item>
      <title>Re: Explicit type conversion functions</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/explicit-type-conversion-functions/m-p/905794#M56082</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Zahid,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm slightly surprised with this question. Look at this code snippet.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data : integer type i,
       string  type string.

move '12345' to string.

write string.

integer = string.
write : / integer.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the character string is convertible to an integer, there will be no problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But if you have some like  - &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data : integer type i,
       string  type string.

move '12A345' to string.

write string.

integer = string.
write : / integer.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You will get a short dump, because 123A45 cannot be converted to an integer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Of course, you can handle this runtime error by using the CATCH...ENDCATCH block for exception handling in ABAP .&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, 28 Apr 2005 05:12:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/explicit-type-conversion-functions/m-p/905794#M56082</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-04-28T05:12:28Z</dc:date>
    </item>
    <item>
      <title>Re: Explicit type conversion functions</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/explicit-type-conversion-functions/m-p/905795#M56083</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Anand!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i knew all this but u don't understand what i asked. what you are suggesting is implicit conversion, but unfortunately that does not help in my situation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in fact i have a character column "CHILD_ID" in the table "ZTOPIC". now i want to get the maximium child_id entered in the table. The values in the child_id column are:&lt;/P&gt;&lt;P&gt;1&lt;/P&gt;&lt;P&gt;2&lt;/P&gt;&lt;P&gt;3&lt;/P&gt;&lt;P&gt;4&lt;/P&gt;&lt;P&gt;5&lt;/P&gt;&lt;P&gt;6&lt;/P&gt;&lt;P&gt;7&lt;/P&gt;&lt;P&gt;8&lt;/P&gt;&lt;P&gt;9&lt;/P&gt;&lt;P&gt;10&lt;/P&gt;&lt;P&gt;11&lt;/P&gt;&lt;P&gt;12 &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This query does help&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select max( child_id )&lt;/P&gt;&lt;P&gt;into ...&lt;/P&gt;&lt;P&gt;from ... &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The maximum should give me 12 but it gives me 9 because its a character column.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now my problem could be solved by converting the child_id to number first and then apply the max function over it . . i did this hundreds of times in oracle like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select max(to_number(child_id))&lt;/P&gt;&lt;P&gt;into ...&lt;/P&gt;&lt;P&gt;from ....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the to_number function first converts the column values to number and then the max function is applied over those values.&lt;/P&gt;&lt;P&gt;My question is is there any function for Char to Number explicit conversion.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Zahid.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Apr 2005 05:49:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/explicit-type-conversion-functions/m-p/905795#M56083</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-04-28T05:49:40Z</dc:date>
    </item>
    <item>
      <title>Re: Explicit type conversion functions</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/explicit-type-conversion-functions/m-p/905796#M56084</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Zahid,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm sorry for misunderstanding your question. But there's something that I must say here. Obviously, ZTOPIC is a custom table and it has been designed poorly. It has not been anticipated that a user could possible issue an &amp;lt;i&amp;gt;arithmetic&amp;lt;/i&amp;gt; query on these fields. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this case, it is the MAX( ) that you're using in the SELECT query. The field here is expected to be numeric in nature. And unfortunately, within Open SQL you simply cannot use the kind of explicit run-time type conversion that you are talkling about.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Even if you get the data in an internal table, you will have to do some processing to get the right result.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But it appears that there's a (permanent) solution that you can use for this problem. Change the type of the field in the dictionary to NUMC. and you will get the desired result. the database will not allow you to do it directly - you have to use the database utility for that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you don't want to do this, then select all the data into an internal table (in which this field is declared with type N ), sort by this field and get your answer.&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, 28 Apr 2005 06:29:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/explicit-type-conversion-functions/m-p/905796#M56084</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-04-28T06:29:10Z</dc:date>
    </item>
    <item>
      <title>Re: Explicit type conversion functions</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/explicit-type-conversion-functions/m-p/905797#M56085</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 use this function module &lt;/P&gt;&lt;P&gt;data: numc TYPE C.&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'CHAR_NUMC_CONVERSION'&lt;/P&gt;&lt;P&gt; EXPORTING&lt;/P&gt;&lt;P&gt;   INPUT         = 6&lt;/P&gt;&lt;P&gt; IMPORTING&lt;/P&gt;&lt;P&gt;   NUMCSTR       = numc&lt;/P&gt;&lt;P&gt;          .&lt;/P&gt;&lt;P&gt;This will convert char to numc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Again if u want to convert it into char use &lt;/P&gt;&lt;P&gt;CALL FUNCTION 'COC1_CONVERT_VALUES_TO_CHAR'&lt;/P&gt;&lt;P&gt; EXPORTING&lt;/P&gt;&lt;P&gt;   CHARACTERISTIC_VALUE             = ' '&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  CHARACTERISTIC_VALUE_FLOAT       = ' '&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  FORMAT                           = 'CHAR'&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt; IMPORTING&lt;/P&gt;&lt;P&gt;   CHARACTERISTIC_VALUE_CHAR        =&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;EXCEPTIONS&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  FORMAT_NOT_VALID                 = 1&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  OTHERS                           = 2.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards,&lt;/P&gt;&lt;P&gt;Judith.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Apr 2005 06:46:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/explicit-type-conversion-functions/m-p/905797#M56085</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-04-28T06:46:40Z</dc:date>
    </item>
    <item>
      <title>Re: Explicit type conversion functions</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/explicit-type-conversion-functions/m-p/905798#M56086</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;can we use a function module in a select statement ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Apr 2005 04:16:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/explicit-type-conversion-functions/m-p/905798#M56086</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-04-29T04:16:53Z</dc:date>
    </item>
    <item>
      <title>Re: Explicit type conversion functions</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/explicit-type-conversion-functions/m-p/905799#M56087</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Apr 2005 05:04:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/explicit-type-conversion-functions/m-p/905799#M56087</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-04-29T05:04:44Z</dc:date>
    </item>
    <item>
      <title>Re: Explicit type conversion functions</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/explicit-type-conversion-functions/m-p/905800#M56088</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You have got a pretty nice smiling face.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;should i reward you 10 points for this smile?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Apr 2005 05:18:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/explicit-type-conversion-functions/m-p/905800#M56088</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-04-29T05:18:24Z</dc:date>
    </item>
    <item>
      <title>Re: Explicit type conversion functions</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/explicit-type-conversion-functions/m-p/905801#M56089</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks (for the compliment), but no thanks (for your 10 points).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It does all of us a lot of good to have some humour in life, doesn't it ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Apr 2005 06:47:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/explicit-type-conversion-functions/m-p/905801#M56089</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-04-29T06:47:15Z</dc:date>
    </item>
    <item>
      <title>Re: Explicit type conversion functions</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/explicit-type-conversion-functions/m-p/905802#M56090</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Zahid,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Basically you are stuck on this one.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With OPEN SQL you can't introduce ABAP functions into the select statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you really wanted to do this in SQL you could use your oracle statement within an EXEC SQL. ENDEXEC. pairing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Otherwise, you are going to have to redefine your ZTOPIC table to make CHILD_ID numeric, or load all the data into an ABAP internal table and work out the maximum value there.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Not sure this is the answer you want to hear, but I don't see another way around it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Brad&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Apr 2005 08:52:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/explicit-type-conversion-functions/m-p/905802#M56090</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-04-29T08:52:04Z</dc:date>
    </item>
  </channel>
</rss>

