Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Function module used to check if the data is numeric or alphanumeric

Former Member
0 Likes
1,928

Hi

Kindly let me know which fumction module is used to check if the data is numeric of alpha numeric ?.

Thanks

Akanksha

1 ACCEPTED SOLUTION
Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,543

Hello,

Try this:


IF V_DATA CO '0123456789'.
WRITE: 'NUMERIC'.
ELSEIF V_DATA CO SYABCDE.
WRITE: 'ALPHABETS ONLY'.
ELSE.
WRITE: 'ALPHANUMERIC'.
ENDIF.

As per other posts, you cannot determine if V_DATA contains only alphabets !!!

BR,

Suhas

11 REPLIES 11
Read only

Former Member
0 Likes
1,543

Hi Akanksha,

simply check..

IF wa_var CO '0123456789'

"numeric

ELSE.

"alphanumeric or char only

ENDIF.

Read only

Former Member
0 Likes
1,543

Hi,

If its a field or variable you can use CO..

ex:

variable CO '0123456789'

then its numeric

else not.

regards

vivek

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,544

Hello,

Try this:


IF V_DATA CO '0123456789'.
WRITE: 'NUMERIC'.
ELSEIF V_DATA CO SYABCDE.
WRITE: 'ALPHABETS ONLY'.
ELSE.
WRITE: 'ALPHANUMERIC'.
ENDIF.

As per other posts, you cannot determine if V_DATA contains only alphabets !!!

BR,

Suhas

Read only

Former Member
0 Likes
1,543

Hi Guys

Thanks a Lot !!!!!!

Now when i ve found out that its alpha numeric , i need to remove the preceeding zero's from the alphanumeric data .

Can u please help me out how can i do it ??

Regards

Akanksha

Read only

0 Likes
1,543

Try this way:

WHILE p_no CN '123456789 '.
    p_no+sy-fdpos(1) = space.
  ENDWHILE.
  CONDENSE p_no NO-GAPS.

Read only

Former Member
0 Likes
1,543

Hi

its not working with CONDENSE .

Can you suggest me something else .

Regards

AKanksha

Read only

Former Member
0 Likes
1,543

>

> Now when i ve found out that its alpha numeric

Mark the appropriate rewards for this help.

i need to remove the preceeding zero's from the alphanumeric data .

Search in SCN for this.

Read only

0 Likes
1,543
DATA: p_no(10) TYPE n VALUE '000012345'.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
  EXPORTING
    input  = p_no
  IMPORTING
    output = p_no.
Read only

Former Member
0 Likes
1,543

data: numfld(10)   type c value '0000012345'.

shift numfld left deleting leading '0'.

* if you need it back to right justified within the field.... 
shift numfld right deleting trailing space.

write numfld.
Read only

Former Member
0 Likes
1,543

Hi All

Thanks a Lot for your help !!!!

Read only

0 Likes
1,543

There are options of 6 and 10 points also.

P.S Also please dont cross post.