on 01-07-2012 6:59 AM
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
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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
User | Count |
---|---|
84 | |
25 | |
12 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.