代码如下:
REPORT z_jason_test_f4 .
TABLES: s031.
PARAMETER p_spmon TYPE spmon DEFAULT sy-datum+0(6) OBLIGATORY.
SELECT-OPTIONS s_spmon FOR s031-spmon DEFAULT sy-datum+0(6) OBLIGATORY.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_spmon.PERFORM monat_f4.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_spmon-low.PERFORM monat_f4.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_spmon-high.PERFORM monat_f4.
FORM monat_f4.DATA: BEGIN OF mf_dynpfields OCCURS 1.INCLUDE STRUCTURE dynpread.DATA: END OF mf_dynpfields.DATA: mf_returncode LIKE sy-subrc,mf_monat LIKE isellist-month,mf_hlp_repid LIKE sy-repid.FIELD-SYMBOLS: <mf_feld>.GET CURSOR FIELD mf_dynpfields-fieldname.APPEND mf_dynpfields.mf_hlp_repid = sy-repid.DO 2 TIMES.CALL FUNCTION 'DYNP_VALUES_READ'EXPORTINGdyname = mf_hlp_repiddynumb = sy-dynnrTABLESdynpfields = mf_dynpfieldsEXCEPTIONSinvalid_abapworkarea = 01invalid_dynprofield = 02invalid_dynproname = 03invalid_dynpronummer = 04invalid_request = 05no_fielddescription = 06undefind_error = 07.IF sy-subrc = 3.mf_hlp_repid = 'SAPLALDB'.ELSE.READ TABLE mf_dynpfields INDEX 1.TRANSLATE mf_dynpfields-fieldvalue USING '_ '.EXIT.ENDIF.ENDDO.IF sy-subrc = 0.CALL FUNCTION 'CONVERSION_EXIT_PERI_INPUT'EXPORTINGinput = mf_dynpfields-fieldvalueIMPORTINGoutput = mf_monatEXCEPTIONSerror_message = 1.IF mf_monat IS INITIAL.mf_monat = sy-datlo(6).ENDIF.CALL FUNCTION 'POPUP_TO_SELECT_MONTH'EXPORTINGactual_month = mf_monatIMPORTINGselected_month = mf_monatreturn_code = mf_returncodeEXCEPTIONSfactory_calendar_not_found = 01holiday_calendar_not_found = 02month_not_found = 03.IF sy-subrc = 0 AND mf_returncode = 0.CALL FUNCTION 'CONVERSION_EXIT_PERI_OUTPUT'EXPORTINGinput = mf_monatIMPORTINGoutput = mf_dynpfields-fieldvalue.COLLECT mf_dynpfields.CALL FUNCTION 'DYNP_VALUES_UPDATE'EXPORTINGdyname = mf_hlp_repiddynumb = sy-dynnrTABLESdynpfields = mf_dynpfieldsEXCEPTIONSinvalid_abapworkarea = 01invalid_dynprofield = 02invalid_dynproname = 03invalid_dynpronummer = 04invalid_request = 05no_fielddescription = 06undefind_error = 07.ENDIF.ENDIF.
ENDFORM.