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
894

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

bpawanchand
Active Contributor
0 Likes
868

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

bpawanchand
Active Contributor
0 Likes
869

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

Read only

Former Member
0 Likes
868

hi,

you can try this.

modvar = p_num mod 10.

if modvar NE 0.

error message.

endif.

regards

Sumit Agarwal

Read only

Former Member
0 Likes
868

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.

Read only

Former Member
0 Likes
868

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

Read only

Former Member
0 Likes
868

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.

Read only

Former Member
0 Likes
868

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.