cancel
Showing results for 
Search instead for 
Did you mean: 

I want to capture the remainder of a division operation

Former Member
0 Kudos

Hi,

I need to capture the remainder of a division operation. Ex : 33/9 remainder is 6. I want to know the way to capture the remainder. Can any body help me out.

Regards,

Srinivas

Accepted Solutions (0)

Answers (6)

Answers (6)

Former Member
0 Kudos

answered

Former Member
0 Kudos

does MOD function work in Object dependencies?

Former Member
0 Kudos

Hi,


MOD : Integer remainder of the division of the left by the right operand 


Syntax 
[COMPUTE] result = [+|-] operand1 
                   [{+|-|*|/|DIV|MOD|**} [+|-] operand2 
                   [{+|-|*|/|DIV|MOD|**} [+|-] operand3 
                   ... ]]. 

In an arithmetic expression, you can use arithmetic operators to link an operand operand1 with one or more operands operand2, operand3, and so on; parentheses are possible. Arithmetic expressions can only be used in the COMPUTE statement. Each arithmetic expression has a calculation type.

Arunima

Former Member
0 Kudos

Hi srinivas,


   Use mod operator to get remender.
    
rem = a mod b.

Thanks,

Krishna

former_member480923
Active Contributor
0 Kudos


REPORT  zselect_sample.


DATA: gw_mod_val TYPE gjahr,
      gw_div_val TYPE gjahr VALUE '39',
      gw_res_val TYPE gjahr VALUE '6',
      gc_error   TYPE REF TO cx_root,
      gw_etext   TYPE string.


TRY.
    gw_mod_val =   gw_div_val MOD gw_res_val .
    WRITE gw_mod_val.
  CATCH cx_root INTO gc_error.
    gw_etext = gc_error->get_text( ).
ENDTRY.

Hope That Helps

Anirban M.

Former Member
0 Kudos

G1 = 25.

G2 = 2.

G3 = G1 MOD G2.

G3 = 1.

Former Member
0 Kudos

Hi

Use MOD stmt

Regards

Winnie