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

Logic

Former Member
0 Likes
632

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
Read only

Former Member
0 Likes
611

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
Read only

Former Member
0 Likes
612

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

Read only

Former Member
0 Likes
611

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

Read only

Former Member
0 Likes
611

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.

Read only

Former Member
0 Likes
611

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