cancel
Showing results for 
Search instead for 
Did you mean: 

Copy Function between dates

former_member210674
Participant
0 Kudos

Hi Experts,

I have a requirement to copy data of one date (0CALDAY) to all dates of the month. I have tried below fox code. But the copy is not working. Could you please help me is there any way to solve this issue.

DATA LAST_DAY TYPE 0CALDAY.

DATA FIRST_DAY TYPE 0CALDAY.

DATA VAR_DAY TYPE 0CALDAY.

DATA LAST_PREV_DAY TYPE 0CALDAY.

.

.

.

.

.

IF NOT { KFBA_DLZ,LAST_PREV_DAY} = { KFBA_DLZ,LAST_DAY}.

IF NOT VAR_DAY = LAST_DAY.

KFBA = { KFBA_DLZ,LAST_DAY}.

{ KFBA_DLZ,VAR_DAY} = KFBA.

KFCO = { KFCOUNT,LAST_DAY}.

{ KFCOUNT,VAR_DAY } = KFCO.

BREAK-POINT.

VAR_DAY = TMVL(VAR_DAY,1).

KFBA = 0.

KFCO = 0.

ENDIF.

ENDIF.

Especially offset of calday ()inside IF condition is not working.

Thanks,

Gopi R

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Gopi,

Normally your below logic should be looped either with DO....ENDDO or FOREACH 0CALDAY....

For example WITH DO...ENDOO :

DATA LAST_DAY TYPE 0CALDAY.

DATA FIRST_DAY TYPE 0CALDAY.

DATA VAR_DAY TYPE 0CALDAY.

DATA LAST_PREV_DAY TYPE 0CALDAY.

.

.

.

.

.

DO.

IF NOT { KFBA_DLZ,LAST_PREV_DAY} = { KFBA_DLZ,LAST_DAY}.

IF VAR_DAY = LAST_DAY.

EXIT.

ENDIF.

VAR_DAY = LAST_DAY.

KFBA = { KFBA_DLZ,LAST_DAY}.

{ KFBA_DLZ,VAR_DAY} = KFBA.

KFCO = { KFCOUNT,LAST_DAY}.

{ KFCOUNT,VAR_DAY } = KFCO.

BREAK-POINT.

VAR_DAY = TMVL(VAR_DAY,1).

KFBA = 0.

KFCO = 0.

ENDIF.

ENDDO.

Function Module '/OSP/GET_DAYS_IN_MONTH' can return the number of days in a month by a date ,and by using this you can also use the DO n TIMES....ENDDO loop.

Regards,

Eitan.

former_member210674
Participant
0 Kudos

Hi Eitan,

Thanks for your input.

I have tried the loop also. But my problem is that the increment of date is not working inside the loop.

ie the statement VAR_DAY = TMVL(VAR_DAY,1). is not working. will that be the function of the statement inside loop ?

Thanks,

Gopi R

Former Member
0 Kudos

Gopi,

Try to change the interval to a variable type integer

DATA INTERVAL TYPE I.

INTERVAL = 1.

VAR_DAY = TMVL(VAR_DAY,INTERVAL).

Eitan.

former_member210674
Participant
0 Kudos

Hi Eitan,

Thanks for your help...I tried that option too but not working. I debugged the fox and found the increment is working fine outside the loop but not inside. Let me give you some more information on my requirement as below

User will upload flat file contain record for one day in a month followed by this fox copy function to other days.when executing fox formula Planning sequence user will give the Calendar month as input. Can you please tell me incremental operation for time characteristics will work inside loop?

Thanks

Gopi R

Former Member
0 Kudos

Hi Gopi,

If the TMVL is working out side the loop ,then the question is how many loop passes occures,check if 0 times occures then 0 times the TMVL will work.

Regards,

Eitan.

former_member210674
Participant
0 Kudos

Hi Eitan,

Thanks for your inputs. I solved the issues. The solution is I have to use TMVL (TMVL())

I have changed the formula as below

DO.

IF NOT { KFBA_DLZ,LAST_PREV_DAY} = { KFBA_DLZ,LAST_DAY}.

IF VAR_DAY = LAST_DAY.

EXIT.

ENDIF.

VAR_DAY = LAST_DAY.

KFBA = { KFBA_DLZ,LAST_DAY}.

{ KFBA_DLZ,VAR_DAY} = KFBA.

KFCO = { KFCOUNT,LAST_DAY}.

{ KFCOUNT,VAR_DAY } = KFCO.

BREAK-POINT.

VAR_DAY = TMVL(TMVL(FIRST_DAY,INDEX),0).

KFBA = 0.

KFCO = 0.

ENDIF.

ENDDO.

Points assigned

Thanks,

Gopi R