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

How to check the data type dynamically

Former Member
0 Likes
975

hi all

my requirement is like this in one screen field which is of character type user is inputing data .

now while saving to the database i have to apply one external check for this data if it is integer type or not

as this data on the screen is refrenced to the database so i can not change the data type on the screen itself .

i have to check it externally from PAI ....... would any one please help on this

Thanks and regards

Papps

8 REPLIES 8
Read only

Former Member
0 Likes
924

Hi,

Try

If w_field co '0123456789 '.
* Numeric
else.
* Non Numeric
endif.

Darren

Read only

0 Likes
924

Hi Thanks for your Solution i have tried it but your proposed solution is not working

even if am providing all integers like 123 still it is giving me the error message .

its always showing the error message is there any other way ...

Read only

0 Likes
924

Have you included a space in the string '0123456789 '?

Space is required in the checking string, because your field will have space apartform digits.

Regards,

Naimesh Patel

Read only

0 Likes
924

Hi

Thanks again you are right i missed the space one ..

but Now another problem...

I have tried that but in that case even user can input data by mistake like this

123 4 but this is not an integer it should also give error as this is also not a correct integer ...

as par asi think . we have to aain check if there is any spaces in the data provided i guess or

is there any other procedure ?

Read only

0 Likes
924

I would use condense and don't worry about it

Read only

0 Likes
924

Okay

Anyway thanks for your suggessions i have also added the points for you as its almost solved the problem.

Read only

ian_maxwell2
Active Participant
0 Likes
924

Try out the ABAP Runtime Type Services (RTTS). This service lets you do all kinds of things dynamically at runtime. Refer to the class "cl_abap_structdescr"

For information and examples search the SDN on RTTS or RTTI.

~Ian

Read only

Former Member