*&---------------------------------------------------------------------*
*& Report ZFIR0054
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT zfir0054.
TABLES:t001,isellist,lfa1,ekko.
TYPE-POOLS:slis,icon.
TABLES:sscrfields,icon,rlgrap..
DATA:gt_fieldcat TYPE lvc_t_fcat,
gw_fieldcat TYPE lvc_s_fcat,
gv_repid TYPE sy-repid,
gs_layout TYPE lvc_s_layo.
DATA:lth_functxt TYPE smp_dyntxt.
DATA:gv_budat TYPE budat.
DATA:gr_budat TYPE RANGE OF mkpf-budat.
TYPES:BEGIN OF tys_out,
bapi_mtype TYPE bapi_mtype,
bapi_msg TYPE bapi_msg,
status TYPE char10,
bukrs TYPE bukrs,
bsart TYPE ekko-bsart,
mjahr TYPE mjahr,
monat TYPE monat,
lifnr TYPE lifnr,
budat TYPE budat,
ebeln TYPE ebeln,
ebelp TYPE ebelp,
matnr TYPE matnr,
erfmg TYPE mseg-erfmg,
wrbtr TYPE ekbe-wrbtr,
bstme TYPE mseg-bstme,
menge TYPE menge_d,
meins TYPE meins,
mwskz TYPE mwskz,
waers TYPE waers,
webre TYPE ekpo-webre,
zterm TYPE ekko-zterm,
mblnr TYPE mblnr,
zeile TYPE mseg-zeile,
re_belnr TYPE re_belnr,
belnr TYPE belnr_d,
datum TYPE datum,
uzeit TYPE uzeit,
uname TYPE uname,
sel(1),
END OF tys_out.
DATA:gt_out TYPE TABLE OF tys_out.
SELECTION-SCREEN:BEGIN OF BLOCK b2 WITH FRAME TITLE TEXT-001.
PARAMETERS:p1 RADIOBUTTON GROUP g1 DEFAULT 'X' USER-COMMAND uex,
p2 RADIOBUTTON GROUP g1.
SELECTION-SCREEN:END OF BLOCK b2.
SELECTION-SCREEN:BEGIN OF BLOCK b1 WITH FRAME TITLE TEXT-002.
PARAMETERS:p_bukrs TYPE t001-bukrs OBLIGATORY DEFAULT '2300'.
PARAMETERS:p_ymonth TYPE isellist-month OBLIGATORY DEFAULT sy-datum+0(6).
SELECT-OPTIONS:s_lifnr FOR lfa1-lifnr,
s_ebeln FOR ekko-ebeln.
SELECTION-SCREEN:END OF BLOCK b1.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_ymonth.
PERFORM frm_ymonth_helpf4.
START-OF-SELECTION.
PERFORM frm_initial_data.
IF p1 = 'X'.
PERFORM frm_get_data.
ELSEIF p2 = 'X'.
PERFORM frm_get_rzdata.
ENDIF.
IF sy-batch = 'X'.
PERFORM frm_create_invoice.
ELSE.
PERFORM frm_display_alv.
ENDIF.
*&---------------------------------------------------------------------*
*& Form FRM_ymonth_HELPF4
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> p1 text
*& <-- p2 text
*&---------------------------------------------------------------------*
FORM frm_ymonth_helpf4 .
CALL FUNCTION 'POPUP_TO_SELECT_MONTH'
EXPORTING
actual_month = sy-datum+0(6)
* FACTORY_CALENDAR = ' '
* HOLIDAY_CALENDAR = ' '
* LANGUAGE = SY-LANGU
* START_COLUMN = 8
* START_ROW = 5
IMPORTING
selected_month = p_ymonth
* RETURN_CODE =
* EXCEPTIONS
* FACTORY_CALENDAR_NOT_FOUND = 1
* HOLIDAY_CALENDAR_NOT_FOUND = 2
* MONTH_NOT_FOUND = 3
* OTHERS = 4
.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form frm_display_alv
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> p1 text
*& <-- p2 text
*&---------------------------------------------------------------------*
FORM frm_display_alv .
DATA:g_repid TYPE sy-repid.
g_repid = sy-repid.
"g_layout-zebra = 'X' .
gs_layout-zebra = 'X'.
gs_layout-cwidth_opt = 'X'.
gs_layout-box_fname = 'SEL'.
CLEAR gt_fieldcat[].
PERFORM frm_generate_field_catalogu.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
EXPORTING
i_callback_program = sy-repid
i_callback_pf_status_set = 'SET_PF'
i_callback_user_command = 'USER_COM'
is_layout_lvc = gs_layout
it_fieldcat_lvc = gt_fieldcat
TABLES
t_outtab = gt_out
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form SET_PF
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM set_pf USING extab TYPE slis_t_extab.
REFRESH extab.
IF p2 = 'X'.
APPEND '&CREATE' TO extab.
ENDIF.
SET PF-STATUS 'STANDARD_FULLSCREEN' EXCLUDING extab.
ENDFORM. "SET_PF
*&---------------------------------------------------------------------*
*& Form user_com
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM user_com USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
DATA: lr_grid TYPE REF TO cl_gui_alv_grid.
DATA: gd_repid LIKE sy-repid,
ref_grid TYPE REF TO cl_gui_alv_grid.
DATA:lv_answer.
IF ref_grid IS INITIAL.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = ref_grid.
ENDIF.
IF NOT ref_grid IS INITIAL.
CALL METHOD ref_grid->check_changed_data.
ENDIF.
CASE r_ucomm.
WHEN '&BACK' OR '&EXI
标签:sy,&---------------------------------------------------------------------,PE
From: https://blog.csdn.net/twins622/article/details/145175932