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

Validation of float

Former Member
0 Likes
1,293

Hi Experts,

I have an input field in module pool programming. In that I am getting floating point value, which is of currency type.

Is there any function module which will validate floating point value? It means that I should not have any value other than 1 2 3 4 5 6 7 8 9 0 and .(dot). It should not have more than one dot also.

Thanks and regards,

Venkat

Hi Experts,

I have an input field in module pool programming. In that I am getting floating point value, which is of currency type.

Is there any function module which will validate floating point value? It means that I should not have any value other than 1 2 3 4 5 6 7 8 9 0 and .(dot). It should not have more than one dot also.

Thanks and regards,

Venkat

4 REPLIES 4
Read only

Former Member
0 Likes
889

hi venkat,

i guess there is no such function module .....

but you can do this inside your abap code

convert the current floating currency into type p with decimal places 2

DATA: X TYPE P DECIMALS 3 VALUE '1.267',

or

Move the value to interger type variable. Move interger type variable toCharacter type, and move charater type variable to date type variable.You'll get the desired value. Hope it helps ........

Read only

Former Member
0 Likes
889

Hi,

Use this FM "CHECK_AND_CONVERT_NUMERICS" .

Hope this will help you.

Regards,

Smart Varghese.

Read only

Former Member
0 Likes
889

Hi Venkat,

It's possible without writing code also..

Just go to the screen painter (Change Mode)

take one Input/OutPut Field

and keep it on Screen...

Now Double Click on that Input Output Field so you will get Screen Painter Attributes Dialog Box..

In that Specify the Name Parameter as KONV-KAWRT <== this is for example.. U can take any other Data Dictionary field according to your need of type CURR

and at below in the Attributes

Dict Tab..

Check the Check box From Dict

Now go ahead with your process...

I won't accept any other char except 0 to 9 and , and .

Hope it will solve your problem..

Thanks & Regards

ilesh 24x7

ilesh Nandaniya

Read only

MarcinPciak
Active Contributor
0 Likes
889

Hi Venkat,

It is not possible to have input field of type f . You must have it type with P (and this one is also used for currency values).

You don't need to check the conversion yourself. The format will be checked automatically providing you do the following:

- go to the screen and double click you input field

- choose Format as DEC

- type in Text field and edit mask like ________.__ this will enforce format of 8 digits, then dot '.' and then two decimal places. You can set it whatever you like.

- now run the program and notice that you are able to enter only digits (0-9) , one dot and two decimal places; if you are not following the format, system will show an error message with the correct one

That's all you need

Regards

Marcin