效果图:
*&---------------------------------------------------------------------* *& Report YCX_024 *&---------------------------------------------------------------------* *& *&---------------------------------------------------------------------* REPORT ycx_024. TABLES: MARC. DATA: gv_start_date TYPE sy-datum, gv_end_date TYPE sy-datum. *----------------------------------------------------------------------* * SELECTION SCREEN *----------------------------------------------------------------------* SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE TEXT-t01. SELECT-OPTIONS: s_werks FOR marc-werks NO INTERVALS."no-EXTENSION PARAMETERS: p_buper TYPE char07. "buper. SELECTION-SCREEN END OF BLOCK b1. INITIALIZATION. *--------------------------------------------------------------- * AT SELECTION-SCREEN :选择屏幕运行时触发,建立字段搜索帮助 *--------------------------------------------------------------- AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_buper. "* F4 for buper PERFORM frm_month_f4. *&---------------------------------------------------------------------* *& Form FRM_MONTH_F4 *&---------------------------------------------------------------------* *& text *&---------------------------------------------------------------------* *& --> p1 text *& <-- p2 text *&---------------------------------------------------------------------* FORM frm_month_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. GET CURSOR FIELD mf_dynpfields-fieldname. APPEND mf_dynpfields. mf_hlp_repid = sy-repid. DO 2 TIMES. CALL FUNCTION 'DYNP_VALUES_READ' EXPORTING dyname = mf_hlp_repid dynumb = sy-dynnr TABLES dynpfields = mf_dynpfields EXCEPTIONS invalid_abapworkarea = 01 invalid_dynprofield = 02 invalid_dynproname = 03 invalid_dynpronummer = 04 invalid_request = 05 no_fielddescription = 06 undefind_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' EXPORTING input = mf_dynpfields-fieldvalue IMPORTING output = mf_monat EXCEPTIONS error_message = 1. IF mf_monat IS INITIAL. mf_monat = sy-datlo(6). ENDIF. CALL FUNCTION 'POPUP_TO_SELECT_MONTH' EXPORTING actual_month = mf_monat IMPORTING selected_month = mf_monat return_code = mf_returncode EXCEPTIONS factory_calendar_not_found = 01 holiday_calendar_not_found = 02 month_not_found = 03. IF sy-subrc = 0 AND mf_returncode = 0. CALL FUNCTION 'CONVERSION_EXIT_PERI_OUTPUT' EXPORTING input = mf_monat IMPORTING output = mf_dynpfields-fieldvalue. COLLECT mf_dynpfields. CALL FUNCTION 'DYNP_VALUES_UPDATE' EXPORTING dyname = mf_hlp_repid dynumb = sy-dynnr TABLES dynpfields = mf_dynpfields EXCEPTIONS invalid_abapworkarea = 01 invalid_dynprofield = 02 invalid_dynproname = 03 invalid_dynpronummer = 04 invalid_request = 05 no_fielddescription = 06 undefind_error = 07. ENDIF. ENDIF. ENDFORM.