Based on Posting Date(0PSTNG_DATE) field we need to find the last date of the month. Posting Date can be any day of the month. But when loading into the cube it should be transformed into the last date of the month.
Here is the sample code used in the update rules.
data: ls_sdate like comm_structure-PSTNG_DATE,
ls_edate like sy-datum.
CALL FUNCTION 'SLS_MISC_GET_LAST_DAY_OF_MONTH'
EXPORTING
DAY_IN = LS_SDATE
IMPORTING
LAST_DAY_OF_MONTH = LS_EDATE
* EXCEPTIONS
* DAY_IN_NOT_VALID = 1
* OTHERS = 2
.
IF SY-SUBRC <> 0.
RESULT = LS_EDATE.
Note:
- You can use the above sample code to find last date of the month from any date filed.
- You can use this code in transfer rules by replacing comm_structure with tran_structure.
- For BI 7 users replace comm_structure with SOURCE_FIELDS.
No comments:
Post a Comment