Application Development 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: 

Logic

Former Member
0 Kudos

Hi all

I have a requirement such that the user has to enter only the multiples of 10....like 10,20,30,40,50...If he enters 1,2,3,5,6, or anything that is not a multiple of 10.I need to give a error message.I wud be happy if u can write logic below.Please let me know.How to?

Vijay

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Write this way-


Parameters:
    p_num type i.

Data: w_num type i.


At SELECTION-SCREEN.

w_num = p_num MOD 10.


If w_num NE 0.  "Error
 Message 'Wrong Entry' Type 'E'.
Endif.

START-OF-SELECTION.

Write: P_num.

Regards,

Sujit

4 REPLIES 4

Former Member
0 Kudos

Hi,

Write this way-


Parameters:
    p_num type i.

Data: w_num type i.


At SELECTION-SCREEN.

w_num = p_num MOD 10.


If w_num NE 0.  "Error
 Message 'Wrong Entry' Type 'E'.
Endif.

START-OF-SELECTION.

Write: P_num.

Regards,

Sujit

Former Member
0 Kudos

Hi,

Let your field of input be p_input.

So you have to set validation condition on this field in AT SELECTION-SCREEN ON p_input event. follow the code

Parameters:
    p_input type i.
 
Data: 
   w_rem type i.
 
 
AT SELECTION-SCREEN on p_input.
 
w_rem  = p_input MOD 10.
 
 
If w_num NE 0.        " that is not a multiple of 10

 Message 'Enter only multiple of 10'Type 'E'.
Endif.

then go with your logic.

Regards,

anirban

Former Member
0 Kudos

Hi,

do it this way,

Parameters: field type i.

data:
  w_field type i.

w_field = p_field mod 10.

at selection-screen on field.
 if w_field <> 0.
  
   message..........'enter mutiply og 10'.
 endif.

with luck,

Pritam.

Former Member
0 Kudos

Vijay,

Please stop double-posting between ABAP General and ABAP Dictionary!

It is against [the rules|https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/rulesofEngagement].

Cheers,

Julius