cancel
Showing results for 
Search instead for 
Did you mean: 

0CALQUARTER populating wrongly for August

Former Member
0 Kudos

Dear experts,

I applied the below logic, in the expert routine, to get 0CALQUARTER from 0CALDAY and it is working fine for any day in April and July months. However, for any day in the month of August, wrong value is populated(as 20134).

For April 0CALQUARTER displays 20132

For July  0CALQUARTER displays 20133

whereas, for August  0CALQUARTER displays 20134 as opposed to 20133.

a = ( Source_pkg-calday+4(2) ) / 3 ) + 1 .     " Quarter



      b ( Source_pkg-calday+0(4) ).                  " Year



      If a <> 0

      OR a <= 0.



        concatenate b a into result_pkg-CALQUARTER.



      ENDIF.

Accepted Solutions (1)

Accepted Solutions (1)

former_member182470
Active Contributor
0 Kudos

HI,

You can simply use a standard transformation formula to convert calday to quarter. No expert routine is required.

DATE_QUARTER

Regards,

Suman

Former Member
0 Kudos

Suman,

Thanks very much. Unfortunately, I cannot avoid the existing expert routine. I applied this FM and it is working fine.

CALL FUNCTION 'RSARCH_DATE_CONVERT'

   EXPORTING

       I_DATE     = source_pkg-CALDAY

IMPORTING

  E_CALQUARTER       = result_pkg-CALQUARTER.

MGrob
Active Contributor
0 Kudos

just change

"a type n" to "a type I" and your number is 3 instead of 3.66 which gets translated to 4...

martin

former_member182470
Active Contributor
0 Kudos

Although you may not be able to remove the expert routine. My suggestion is to avoid expert routine. Because, you cannot create any transformation rules between source and target when you use expert routine. This is a draw back.

Why don't you simply use the formula which i suggested? Your Aug problem also will be resolved. It is a standard formula which will work perfectly in any case.

Answers (1)

Answers (1)

MGrob
Active Contributor
0 Kudos

Hi

How is the variable a defined? make sure it say a type I.

If its a float or anything else 3.66 will turn to 4

that should solve it

Martin