<?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: How do I do a data type check? in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-do-i-do-a-data-type-check/m-p/3019160#M713698</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;changes&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 12 Nov 2007 08:04:04 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-11-12T08:04:04Z</dc:date>
    <item>
      <title>How do I do a data type check?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-do-i-do-a-data-type-check/m-p/3019156#M713694</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 was trying to do a hashtotal for a table column. It is necessary that the table column only contains numeric values. Is there a way to do a data type check, before I compute the hashtotal value? Thanks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;******************************************&lt;/P&gt;&lt;P&gt;LOOP AT itab INTO hash_value.&lt;/P&gt;&lt;P&gt;  IF hash_value = NUMC. " (==&amp;gt; Cannot)&lt;/P&gt;&lt;P&gt;    hash_total = hash_total + hash_value.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="42" type="ul"&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Nov 2007 03:38:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-do-i-do-a-data-type-check/m-p/3019156#M713694</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-12T03:38:09Z</dc:date>
    </item>
    <item>
      <title>Re: How do I do a data type check?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-do-i-do-a-data-type-check/m-p/3019157#M713695</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kian,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this&lt;/P&gt;&lt;P&gt;If hash_value CA sy-abcde.&lt;/P&gt;&lt;P&gt;***Error.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Atish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Nov 2007 03:40:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-do-i-do-a-data-type-check/m-p/3019157#M713695</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-12T03:40:30Z</dc:date>
    </item>
    <item>
      <title>Re: How do I do a data type check?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-do-i-do-a-data-type-check/m-p/3019158#M713696</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would do it:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;IF hash_value CO '0123456789.'.  "&amp;lt;=== Includes decimal
  hash_total = hash_total + hash_value.
ENDIF.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This avoids problems with special characters (#$@, etc). You may want to exclude the decimal point and/or check for only one or none of them.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Nov 2007 04:17:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-do-i-do-a-data-type-check/m-p/3019158#M713696</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-12T04:17:26Z</dc:date>
    </item>
    <item>
      <title>Re: How do I do a data type check?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-do-i-do-a-data-type-check/m-p/3019159#M713697</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Kian&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The prevous postings provided reasonable answers to your question.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you need to check for the type of an (itab) field then there is a specific statement available (&amp;gt;= 6.20 release):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA:
  ld_type(1)     TYPE c.

DESCRIBE FIELD ld_field TYPE ld_type.
IF ( ld_type = 'N' ).  " numeric type
...
ELSE.
...
ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For more details please refer to the ABAP keyword documentation for DESCRIBE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;  Uwe&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Nov 2007 04:34:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-do-i-do-a-data-type-check/m-p/3019159#M713697</guid>
      <dc:creator>uwe_schieferstein</dc:creator>
      <dc:date>2007-11-12T04:34:01Z</dc:date>
    </item>
    <item>
      <title>Re: How do I do a data type check?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-do-i-do-a-data-type-check/m-p/3019160#M713698</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;changes&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Nov 2007 08:04:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-do-i-do-a-data-type-check/m-p/3019160#M713698</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-12T08:04:04Z</dc:date>
    </item>
    <item>
      <title>Re: How do I do a data type check?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-do-i-do-a-data-type-check/m-p/3019161#M713699</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you can try this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
data : text(50),
       dtyp like DD01V-DATATYPE,
       bef(15),
       aft(15).
data : dtype(1).
text = '1,234.60'.

if text co '0123456789.,'.

write : / 'numeric'.
endif.

split text at '.' into bef aft.
replace all occurrences of ',' in bef with space.
condense bef.

CALL FUNCTION 'NUMERIC_CHECK'
  EXPORTING
    STRING_IN        = bef
 IMPORTING
*   STRING_OUT       =
   HTYPE            = dtyp
          .

if dtyp cs 'NUMC'.
write : / 'Befor decimal Numeric'.
else.
write : / 'Befor decimal Character'.
endif.

clear dtyp.

CALL FUNCTION 'NUMERIC_CHECK'
  EXPORTING
    STRING_IN        = aft
 IMPORTING
*   STRING_OUT       =
   HTYPE            = dtyp
          .

if dtyp cs 'NUMC'.
write : / 'After decimal Numeric'.
else.
write : / 'After decimal Character'.
endif.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;shiba dutta&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Nov 2007 08:07:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-do-i-do-a-data-type-check/m-p/3019161#M713699</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-12T08:07:57Z</dc:date>
    </item>
  </channel>
</rss>

