Code: Alles auswählen.
INCLUDE z_pp_payrolltop.
INCLUDE z_pp_payrollc01.
INCLUDE z_pp_payrollf01.
DATA go_event TYPE REF TO lcl_event.
DATA go_controller TYPE REF TO lcl_controller.
*----------------------------------------------------------------------*
* INITIALIZATION
*----------------------------------------------------------------------*
INITIALIZATION.
zcl_utilities=>initialize( ).
zcl_utilities=>load_variant( ).
*----------------------------------------------------------------------*
* CREATE DROPDOWN MENU FOR MONTH SELECTION
*----------------------------------------------------------------------*
AT SELECTION-SCREEN OUTPUT.
PERFORM fill_dropdown_pmonat.
*----------------------------------------------------------------------*
* START-OF-SELECTION
*----------------------------------------------------------------------*
START-OF-SELECTION.
zcl_utilities=>set_runtime( 1 ).
PERFORM process_selected_month.
...
CREATE OBJECT go_event.
CREATE OBJECT go_controller.
go_controller->main( ).
*----------------------------------------------------------------------*
*----------------------------------------------------------------------*
* FORM DROPDOWN MENU
*----------------------------------------------------------------------*
FORM fill_dropdown_pmonat.
DATA: gt_vrm TYPE vrm_values,
gt_vrm_sorted TYPE TABLE OF vrm_value,
gs_vrm TYPE vrm_value,
gv_month TYPE d,
gv_year TYPE char4,
gv_text TYPE char15,
gv_months TYPE t5a4a-dlymo,
gv_sort_key TYPE char6,
gv_index TYPE sytabix.
CLEAR gt_vrm.
CLEAR gt_vrm_sorted.
gv_date = sy-datum.
gv_months = -1.
DO 12 TIMES.
gv_month = gv_date+4(2).
gv_year = gv_date(4).
CALL FUNCTION 'Z_GET_MONTH_NAME'
EXPORTING
month = gv_month
IMPORTING
month_name_char = gv_text.
CONCATENATE gv_year gv_month INTO gv_sort_key.
gs_vrm-key = gv_sort_key.
gs_vrm-text = gv_text.
INSERT gs_vrm INTO TABLE gt_vrm.
CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'
EXPORTING
date = gv_date
days = 0
months = gv_months
years = 0
signum = '-'
IMPORTING
calc_date = gv_date.
ENDDO.
SORT gt_vrm BY key ASCENDING.
LOOP AT gt_vrm INTO gs_vrm.
gv_index = sy-tabix.
gs_vrm-key = gs_vrm-key(4).
MODIFY gt_vrm FROM gs_vrm INDEX gv_index.
ENDLOOP.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = 'P_MONAT'
values = gt_vrm.
ENDFORM. "fill_dropdown_pmonat
*----------------------------------------------------------------------*
* FORM PROCESS SELECTED MONTH
*----------------------------------------------------------------------*
FORM process_selected_month.
DATA: gv_year TYPE char4,
gv_month_name TYPE char15,
gv_month TYPE d,
gv_start TYPE sy-datum,
gv_end TYPE sy-datum.
SPLIT p_monat AT space INTO gv_year gv_month_name.
CALL FUNCTION 'Z_GET_MONTH_NUMBER'
EXPORTING
month_name_char = gv_month_name
IMPORTING
month = gv_month.
CONCATENATE gv_year gv_month '01' INTO gv_start.
CALL FUNCTION 'RP_LAST_DAY_OF_MONTHS'
EXPORTING
day_in = gv_start
IMPORTING
last_day_of_month = gv_end.
gv_start_date = gv_start.
gv_end_date = gv_end.
ENDFORM. "process_selected_month