DATA: WA1 like LINE OF C_T_RANGE,
WA2 like LINE OF I_T_VAR_RANGE,
ZINITIALDT TYPE SY-DATUM,
ZENDDT TYPE SY-DATUM,
ZCYEAR TYPE N LENGTH 4,
ZPYEAR TYPE N LENGTH 4,
ZCMONTH TYPE N LENGTH 2,
ZPMONTH TYPE N LENGTH 2,
ZCDAYS TYPE N LENGTH 2,
ZPDAYS TYPE N LENGTH 2,
ZVAR type N LENGTH 8.
CASE I_VNAM.
* For Current Month to Date varriable
WHEN 'ZVC_DT_MTD'.
I_STEP = 1.
ZINITIALDT = sy-datum.
ZINITIALDT+6(2) = '01'.
ZENDDT = sy-datum.
WA1-sign = 'I'.
WA1-opt = 'BT'.
WA1-LOW = ZINITIALDT.
WA1-HIGH = ZENDDT.
APPEND WA1 TO C_T_RANGE.
CLEAR WA1.
* For Current Year to Date varriable
WHEN 'ZVC_DT_YTD'.
I_STEP = 1.
ZINITIALDT = sy-datum.
ZINITIALDT+4(2) = '01'.
ZINITIALDT+6(2) = '01'.
ZENDDT = sy-datum.
WA1-sign = 'I'.
WA1-opt = 'BT'.
WA1-LOW = ZINITIALDT.
WA1-HIGH = ZENDDT.
APPEND WA1 TO C_T_RANGE.
CLEAR WA1.
* For Previous Year Current Month to Date varriable
WHEN 'ZVC_DT_PYMTD'.
I_STEP = 1.
ZINITIALDT = sy-datum.
ZCDAYS = ZINITIALDT+6(2).
ZCMONTH = ZINITIALDT+4(2).
ZCYEAR = ZINITIALDT+0(4).
ZPYEAR = ZCYEAR - 1.
CONCATENATE ZPYEAR ZCMONTH '01' INTO ZINITIALDT.
CONCATENATE ZPYEAR ZCMONTH ZCDAYS INTO ZENDDT.
WA1-sign = 'I'.
WA1-opt = 'BT'.
WA1-LOW = ZINITIALDT.
WA1-HIGH = ZENDDT.
APPEND WA1 TO C_T_RANGE.
CLEAR WA1.
* For Previous Year to Current Date PYYTD varriable
WHEN 'ZVC_DT_PYYTD'.
I_STEP = 1.
ZINITIALDT = sy-datum.
ZCDAYS = ZINITIALDT+6(2).
ZCMONTH = ZINITIALDT+4(2).
ZPMONTH = '01'.
ZCYEAR = ZINITIALDT+0(4).
ZPYEAR = ZCYEAR - 1.
CONCATENATE ZPYEAR ZPMONTH '01' INTO ZINITIALDT.
CONCATENATE ZPYEAR ZCMONTH ZCDAYS INTO ZENDDT.
ZENDDT = sy-datum.
WA1-sign = 'I'.
WA1-opt = 'BT'.
WA1-LOW = ZINITIALDT.
WA1-HIGH = ZENDDT.
APPEND WA1 TO C_T_RANGE.
CLEAR WA1.
* For varriable Same Month data till the user input date.
* ZVI_DATE is a single input date varriable
WHEN 'ZVC_FDATE'.
I_STEP = 2.
READ TABLE I_T_VAR_RANGE INTO WA2 WITH KEY VNAM = 'ZVI_DATE'.
ZENDDT = WA2-LOW.
ZCYEAR = ZENDDT+0(4).
ZCMONTH = ZENDDT+4(2).
ZCDAYS = ZENDDT+6(2).
CONCATENATE ZCYEAR ZCMONTH '01' INTO ZVAR.
WA1-sign = 'I'.
WA1-opt = 'BT'.
WA1-LOW = ZVAR.
WA1-HIGH = ZENDDT.
APPEND WA1 TO C_T_RANGE.
CLEAR WA1.
* ZVI_DATE is a Single input date varriable.
WHEN 'ZVC_PDATE'.
I_STEP = 2.
READ TABLE I_T_VAR_RANGE INTO WA2 WITH KEY VNAM = 'ZVI_DATE'.
ZENDDT = WA2-LOW.
ZCYEAR = ZENDDT+0(4).
ZCMONTH = '01'.
ZCDAYS = ZENDDT+6(2).
CONCATENATE ZCYEAR ZCMONTH '01' INTO ZVAR.
WA1-sign = 'I'.
WA1-opt = 'BT'.
WA1-LOW = ZVAR.
WA1-HIGH = ZENDDT.
APPEND WA1 TO C_T_RANGE.
CLEAR WA1.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
10 | |
9 | |
7 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 | |
3 |