Friday, November 23, 2007

ABAP function to convert Current Date to Current Period

* Written by : SAP Basis, ABAP Programming and Other IMG Stuff

*
* Find current period of your Company based on current date
*
REPORT ZPERIOD.

DATA: X_PERIOD LIKE T009B-POPER,
X_YEAR LIKE CSSL-GJAHR.

CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
EXPORTING
I_DATE = SY-DATUM
* I_MONMIT = 00
I_PERIV = 'K4'
IMPORTING
E_BUPER = X_PERIOD
E_GJAHR = X_YEAR
EXCEPTIONS
INPUT_FALSE = 1
T009_NOTFOUND = 2
T009B_NOTFOUND = 3
OTHERS = 4.

WRITE: / 'Your Company Current Period', X_PERIOD, X_YEAR.

*-- End of Program

No comments:

Blog Archive