on 08-08-2019 10:26 PM
Dear Abap Experts,
i should need a one Customer-Exit for my query.
Manuel Input Variable: ZKSUJ (from 0CALMONTH)
Output: if input is actual month, output should be previous day. else last day from previous month..
Example :
Input : 08.2019 (Manuel input) (today= 08.08.2019)
Output : 07.08.2019
or
Input : 07.2019 (Manuel input)
Output : 31.07.2019
i tried it, my code look like this; i got it last month last day but doenst previous day.. Any help?
WHEN 'ZKSUJ'.
IF i_step EQ 2.
READ TABLE i_t_var_range INTO h_t_var_range
WITH KEY vnam = '0PCALMON'
iobjnm = '0CALMONTH'.
MOVE h_t_var_range-low(4) TO hyear.
MOVE h_t_var_range-low+4(2) TO hmonth.
IF hmonth = '01'.
hmonth = '12'.
hyear = hyear - 1.
ELSE.
hmonth = hmonth - 1.
ENDIF.
* hday = sy-datum - 1.
CONCATENATE hjyear hmonth '01' INTO hday.
CLEAR hperiode.
CALL FUNCTION 'FIMA_END_OF_MONTH_DETERMINE'
EXPORTING
i_date = hday
IMPORTING
e_days_of_month = hperiode.
l_s_range-sign = 'I'.
l_s_range-opt = 'EQ'.
CONCATENATE hyear hmonth hperiode INTO l_s_range-low.
APPEND l_s_range TO e_t_range.
ENDIF.
Thanks alot for your help.
Regards..
Hi Sacha,
You need to check the user entered month with current month. If yes, then populate the previous day of the current month. Else, populate the last day of the user inputted month. Am I right in understanding the requirement. If yes, then chnage the code as below.
Declare cmonth variable as like hmonth and pday as sy-datum.
WHEN 'ZKSUJ'.
IF i_step EQ 2.
Data: pday type sy-datum,
Hmonth type /BI0/calmonth,
Cmonth type /BI0/calmonth,
Hday type sy-datum,
Hyear type /bi0/fiscyear.
READ TABLE i_t_var_range INTO h_t_var_range
WITH KEY vnam = '0PCALMON'
iobjnm = '0CALMONTH'.
MOVE h_t_var_range-low(4) TO hyear.
MOVE h_t_var_range-low+4(2) TO hmonth.
cmonth = sy_datum+4(2).
If hmonth = cmonth.
Hday = sy_datum-1.
Else.
Concatenate hyear hmonth '01' into hday.
** Use function module to get the last day of the month.
CALL FUNCTION
'SLS_MISC_GET_LAST_DAY_OF_MONTH'
Exporting
Dayin = hday
Importing
Last_day_of_month = pday.
Hday = pday.
Endif.
** Move hday to e_t_range
l_s_range-sign = 'I'.
l_s_range-opt = 'EQ'.
CONCATENATE hyear hmonth hperiode INTO l_s_range-low.
APPEND l_s_range TO e_t_range.
ENDIF.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
77 | |
9 | |
8 | |
6 | |
6 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.