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 on currency

Former Member
0 Likes
519

hiii

i have a field of 18char where i input a currency value.

This field is used to be put in a field of currency 9 and 2DP. if ever a user put more that is expected a dump of overflow will occur . i was thinking of checking the STRLEN to be not more than 12.

If there another way of doing so instead of STRLEN check.

Edited by: Matt on Jan 20, 2009 10:06 AM - don't use "hi" in the subject!

hiii

i have a field of 18char where i input a currency value.

This field is used to be put in a field of currency 9 and 2DP. if ever a user put more that is expected a dump of overflow will occur . i was thinking of checking the STRLEN to be not more than 12.

If there another way of doing so instead of STRLEN check.

Edited by: Matt on Jan 20, 2009 10:06 AM - don't use "hi" in the subject!

2 REPLIES 2
Read only

Former Member
0 Likes
484

Hi,

Instead of using STRLEN, you can directly use OFFSET to move only 11 character to the decimal value.

REPORT  ztest_ram.

DATA: l_char TYPE CHAR18,
      l_dec(9) TYPE p DECIMALS 2.

l_char = '1234567890123456'.
l_dec = l_char+0(11).

WRITE: 'DECIMAL VALUE', l_dec.

Best Regards,

Ram.

Read only

Former Member
0 Likes
484

think u can directly declare the field of type and length that u need to exactly enter according to ur requirement. this will avoid the validation too.