Skip to Content
0

Customer Exit on Calday to get (From) Current Date - (To) previous month's last day

Dec 12, 2016 at 07:27 AM

49

avatar image

Hi, My Requirement is like this. User will enter From/To date on CALDAY and i have to write Exit like this that it will keep "From Date" as it is and "To Date" will be previous month's Last date.

Ex: If user enter like below

Below is the code:

IF I_STEP = 2.

DATA: YYYY TYPE SY-DATUM,
CMM TYPE SY-DATUM,
PMM TYPE SY-DATUM,
YPMM TYPE SY-DATUM,
NYPMM TYPE SY-DATUM.

CASE I_VNAM.
WHEN 'ZLAST_MONTH'.


LOOP AT I_T_VAR_RANGE INTO LOC_VAR_RANGE
WHERE VNAM = 'ZLSTMNT'.
*CLEAR L_S_RANGE.

YYYY = LOC_VAR_RANGE-HIGH(4).
CMM = LOC_VAR_RANGE-HIGH+4(2).

IF

CMM = '01'.
PMM = '12'.
YYYY = YYYY - 1.

ELSE.

PMM = CMM - 1.

ENDIF.

CONCATENATE YYYY PMM '01' INTO YPMM.


CALL FUNCTION 'SLS_MISC_GET_LAST_DAY_OF_MONTH'
EXPORTING
DAY_IN = YPMM
IMPORTING
LAST_DAY_OF_MONTH = NYPMM.


L_S_RANGE-SIGN = 'I'.
L_S_RANGE-OPT = 'BT'.
L_S_RANGE-HIGH = NYPMM.
APPEND L_S_RANGE TO E_T_RANGE.
ENDLOOP.
ENDCASE.
ENDIF.

Kindly explain also L_S_RANGE-HIGH & L_S_RANGE-LOW concept. i am new to it.

capture6.png (4.6 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

0 Answers