Wednesday, May 2, 2012

Helpful ABAP Routines


How to derive 0FISCYEAR, 0FISCPER & 0FISCPER3 from 0CALMONTH?
Use formulas in the update rules which are avilable under TIME CHARs.
Go to your update Rules > select Time Chars
Code For 0FISCPER
* fill the internal table "MONITOR", to make monitor entries
data: l_fiscper type rsfiscper.
call function 'FISCPER_FROM_CALMONTH_CALC'
exporting
iv_calmonth = COMM_STRUCTURE-calmonth
iv_periv = 'K4'
importing
ev_fiscper = l_fiscper.
* result value of the routine
RESULT = l_fiscper.
Code for 0FISCPER3
data: l_fiscper3 type t009b-poper.
call function 'FISCPER_FROM_CALMONTH_CALC'
exporting
iv_calmonth = COMM_STRUCTURE-calmonth
iv_periv = 'K4'
importing
ev_fiscper3 = l_fiscper3.
* result value of the routine
RESULT = l_fiscper3.
Code for 0FISCYEAR
data: l_fiscyear type t009b-bdatj.
call function 'FISCPER_FROM_CALMONTH_CALC'
exporting
iv_calmonth = COMM_STRUCTURE-calmonth
iv_periv = 'K4'
importing
ev_fiscyear = l_fiscyear.
* result value of the routine
RESULT = l_fiscyear.
Just copy and paste the code in your system. 
Note: K4 is the Variant. Change Variant according to your requirement.

No comments:

Post a Comment