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

bpawanchand
Active Contributor
0 Kudos

Hi

PARAMETERS :

p_num TYPE i.

DATA :

w_temp TYPE i.

w_temp = p_num MOD 10.

IF w_temp NE 0.

MESSAGE 'ERROR' TYPE 'E'.

else.

write : ' The number is multiple of 10'.

ENDIF.

Regards

Pavan

6 REPLIES 6

bpawanchand
Active Contributor
0 Kudos

Hi

PARAMETERS :

p_num TYPE i.

DATA :

w_temp TYPE i.

w_temp = p_num MOD 10.

IF w_temp NE 0.

MESSAGE 'ERROR' TYPE 'E'.

else.

write : ' The number is multiple of 10'.

ENDIF.

Regards

Pavan

Former Member
0 Kudos

hi,

you can try this.

modvar = p_num mod 10.

if modvar NE 0.

error message.

endif.

regards

Sumit Agarwal

former_member188685
Active Contributor
0 Kudos

using mod we can find that.

data: val type i.

parameters in type i.
val = in mod 10.
if val ne 0.
"errror.
write 'error'.
endif.

Former Member
0 Kudos

Hi,

Check out this code.


REPORT z_sdn.


PARAMETERS:
  p_num TYPE i.

DATA:
  w_num TYPE i.

AT SELECTION-SCREEN.

  w_num = p_num MOD 10.


  IF w_num NE 0.
    MESSAGE 'Please enter a value which is multiple of 10' TYPE 'E'.
  ELSE.
    MESSAGE 'You can proceed further' TYPE 'I'.
  ENDIF.


START-OF-SELECTION.

WRITE:
  p_num.

Regards

Abhijeet

Former Member
0 Kudos

Hi,


Parameter:
  p_num type i.
Data:
   w_num type i.
At selection-screen.

w_num = p_num mod 10.

if  w_num ne 0.
  message e001(msg_class).
endif.

start of selection.
  *your code*

Regards

Sunil Kumar Mutyala.

Former Member
0 Kudos

report .

Parameter: p_num type i.

Data:v_num type p decimals 2 ,

v_num1(15) type c ,

v_test(13) type c ,

v_test1(2) type c.

v_num = p_num / 10.

v_num1 = v_num .

split v_num1 at '.' into v_test v_test1 .

if v_test1 ne 0 .

message i001(00) with 'enter a value which is multiples of 10'.

endif.