Skip to Content
0
Former Member
Sep 12, 2007 at 06:58 PM

Derive first calendar day of the fiscal period

29 Views

Hello,

I have an unusual problem. The requirement is that user keys in the fiscal period and we need to derive the first calendar day from the previous fiscal period.

For example User enter 02/2007 as fiscal period so the customer exit should get the first day from the previous fiscal period. The code i wrote in the customer exit seems to work ok with the text variables but in the keyfigures it doesnt show any value. I have a restricted keyfigure based on qty and Customer exit variable(first day of previous period). When i run the report it runs but doesnt show any value. When i debug the query, i see that the first day of previous fiscal period is returned from the function module but problem is when the report runs it doesnt show the qty on that day. Please give your suggestions.

CASE I_VNAM.

  • Here ZFDAY1FP is the customer exit variable to derive first day of previous fiscal *period.

WHEN 'ZFDAY1FP'.

IF I_STEP = 2. "after the popup

LOOP AT I_T_VAR_RANGE INTO L_S_VAR

WHERE VNAM = '0RMA_FIP'.

YEAR = L_S_VAR-LOW+0(4) .

PER = L_S_VAR-LOW+4(3).

  • Deriving previous fiscal period

PER = PER - 1.

CALL FUNCTION 'FIRST_DAY_IN_PERIOD_GET'

EXPORTING

I_GJAHR = YEAR

  • I_MONMIT = 00

I_PERIV = 'Z1'

I_POPER = PER

IMPORTING

E_DATE = FDAY.

  • EXCEPTIONS

  • INPUT_FALSE = 1

  • T009_NOTFOUND = 2

  • T009B_NOTFOUND = 3

  • OTHERS = 4

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

  • FDAY is the value returned from the FM. It is the first day of the prev. fiscal *period.

L_S_RANGE-LOW = FDAY.

L_S_RANGE-SIGN = 'I'.

L_S_RANGE-OPT = 'EQ'.

APPEND L_S_RANGE TO E_T_RANGE.

EXIT.

ENDLOOP.

ENDIF.

  • CLEAR L_S_RANGE.

ENDCASE.

Thanks

Laura.