2021 Jan 15 2:27 AM
Here's coding of F4 to select only year and month.
Now to calculate, I want the variable of number of months on select options, how to do it?
Thanks a lot!
FORM FRM_GET_F4 USING VALUE (PVF_DYNPRO FIELD).
Data LDF_MONAT TYPE ISELLIST-MONTH.
FIELD-SYMBOLS <FS_FIELD> TYPE ANY.
LDF_MONAT = SY-DATUM + 0(6).
CALL FUNCTION 'POPUP_TO_SELECT_MONTH'
EXPORTING
ACTUAL_MONTH = LDF_MONAT
IMPORTING
SELECTED_MONTH = LDF_MONAT
EXCEPTIONS
~
IF SY-SUBRC = 0.
CHECK LDF_MONAT <> '000000'.
ASSIGN (PVF_DYNPROFIELD) TO <FS_FIELD>.
IF <FS_FIELD> IS ASSIGNED.
<FS_FIELD> = LDF_MONAT.
UNASSIGNED <FS_FIELD>.
ENDIF.
ENDIF.
2021 Jan 15 4:58 AM
Do you mean how to get year from date? Please use class CL_RECA_DATE.
Please be informed that this is not an officially provided API. See the usage and discussion around the same in below blog post - https://blogs.sap.com/2020/12/29/safe-dating-in-abap/
Gaurav
2021 Jan 15 8:15 AM
Hello,
Please check below code.
TABLES : s001.
DATA : _date_range TYPE RANGE OF mseg-budat_mkpf,
_start_day TYPE mseg-budat_mkpf,
_last_day TYPE mseg-budat_mkpf,
_actual_month TYPE isellist-month,
_selected_month TYPE isellist-month.
SELECT-OPTIONS : s_monyr FOR s001-spmon NO INTERVALS OBLIGATORY.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_monyr-low.
IF s_monyr[] IS INITIAL.
s_monyr-sign = 'I'.
s_monyr-option = 'EQ'.
s_monyr-low = sy-datum+0(6).
APPEND s_monyr.
ENDIF.
TRY.
_actual_month = s_monyr[ 1 ]-low+0(6).
CATCH cx_sy_itab_line_not_found.
ENDTRY.
CALL FUNCTION 'POPUP_TO_SELECT_MONTH'
EXPORTING
actual_month = _actual_month
IMPORTING
selected_month = _selected_month
EXCEPTIONS
factory_calendar_not_found = 1
holiday_calendar_not_found = 2
month_not_found = 3
OTHERS = 4.
IF sy-subrc IS INITIAL.
ASSIGN s_monyr[ 1 ] TO FIELD-SYMBOL(<fs_monyr>).
IF <fs_monyr> IS ASSIGNED.
<fs_monyr>-low = s_monyr-low = _selected_month.
ENDIF.
ENDIF.
START-OF-SELECTION.
* Your Processing Logic
Also please check the Perform MONAT_F4 in Include: RMCS00SO of Report: RMCV0100
Best Regards, Manish Shankar.