cancel
Showing results for 
Search instead for 
Did you mean: 

MOD operation in time evaluation

former_member193652
Active Contributor
0 Kudos
771

Hi everybody,

I need to use Mod operation in a calculation of PT PCR but I could not find any solution. You know 1391 Mod 4 is 3. I need a operation to do this in time evaluation PCR for me.

Although I can develop this operation by ABAP but I expect this basic operation provide by SAP. Do you have any idea for this issue?

Regards,

Omid

Accepted Solutions (0)

Answers (3)

Answers (3)

lubarrera
Explorer
0 Kudos

I have an option in Payroll. If I want to know when a month is a birthday month from hire date. That is PAYROLL MONTH MOD 12 = 0, then it is a birthday month

NUM=FC M

PRINT

NUM$12

PRINT

NUM*12

ADDWT&RES

NUM=FC M

NUM- &RES

then NUM has the modulus operation result. Like in time managment you don't have $ (integral division) you must round down with ROUND operator

former_member274797
Active Participant
0 Kudos

Hi Omid,

Below might work. Give it a try.

From your example A = 1391 B = 4

HRS=A

HRS/B

ROUNDHR23 (Round Down to nearest whole number)

HRS*B

HRS-A

HRS*-1

Include error handling when A is less than B.

Hope it helps.

Thanks.

Regards

Sairam

former_member193652
Active Contributor
0 Kudos

No any idea? Should I develop a small function by ABAP?

former_member184702
Active Contributor
0 Kudos

Hi Omid,

Could you please share me your requirement ??

please check in pe04 for further documentation.

Query :-  VARST

MOD A       MODIF T554C

MOD D       DAYMO T510S

MOD L       GRBAL T559P

MOD Q      QUOMO T559L

MOD S      DYTPE T552W

MOD T      MODIF T555Z

MOD W    ORGMO T510S

Thanks

Siva

former_member193652
Active Contributor
0 Kudos

Hi Siva,

This is not the same MOD I am looking for. I need MOD as mathematics operation. Please look my question again.

5 mod 4 is equal 1. Means if you divide 5 to 4 the remain part is 1. In programing languages we write it like this 5 \  4 which equals to 1 but 5 / 4 is equal to 1.25

Regards,

Omid

former_member193652
Active Contributor
0 Kudos

By the way I need it in a PCR of time management. I would to write like this:

HRS=5

HRS\4

but I could not find any operation same as "\" in other programing languages.

Regards,

Omid

Former Member
0 Kudos

Just throwing a stone!!

what if we use a ROUND operation to round the decimal value to 0?

former_member184702
Active Contributor
0 Kudos

Hi Omid,

Try as per below:

HRS=CZZ001  (ZZ001 is the constant value)

HRS/4 ( 5/4 = 1.25)

ROUND NN (if u want round the value use this, nn represents the 2-character rounding number from the "Rounding Rules" view (T559R)

ADDDBZ001Z (add the time type)

Thanks

Siva

former_member193652
Active Contributor
0 Kudos

Hi,

As I said I would have it in time evaluation PCR. Round operation works just on time pairs not HRS.

I tried by H (ROUNDH) but it didn't work

If you trace the code you will see how system evaluate.

In my sample HRS is 1.25 (5 / 4) then system times it by 3600 and it will be 4500. As you see in below system divide it to 600 and times to 600 and the result is 4200 which in return it change to 1.167 (4200 / 3600)

I need something like "div" in ABAP to use in Time PCR

Regards,

Omid