REPORT z_barry_test NO STANDARD PAGE HEADING .
TYPE-POOLS: slis.
DATA: gd_fieldcat TYPE slis_t_fieldcat_alv.
DATA: sla TYPE slis_layout_alv ,
ivariant LIKE disvariant,
i_repid LIKE sy-repid .
DATA: tcode(10) TYPE c.
DATA: BEGIN OF itab OCCURS 0,
f1(10) TYPE c,
f2(10) TYPE c,
END OF itab.
START-OF-SELECTION.
PERFORM getdata.
PERFORM outdata.
AT LINE-SELECTION.
CALL TRANSACTION tcode.
*&---------------------------------------------------------------------*
*& Form GETDATA
*&---------------------------------------------------------------------*
FORM getdata.
itab-f1 = 'ALV Line 1'.
APPEND itab.
ENDFORM. " GETDATA
*&---------------------------------------------------------------------*
*& Form outdata
*&---------------------------------------------------------------------*
FORM outdata.
PERFORM fieldcat_init .
i_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = i_repid
it_fieldcat = gd_fieldcat[]
is_layout = sla
i_callback_user_command = 'USER_COMMAND'
TABLES
t_outtab = itab
EXCEPTIONS
program_error = 1
OTHERS = 2.
ENDFORM. " outdata
*---------------------------------------------------------------------*
* FORM fieldcat_init *
*---------------------------------------------------------------------*
FORM fieldcat_init .
PERFORM frm_catlg_set USING: 'F1' 'F1' ,
'F2' 'F2'.
ENDFORM. "fieldcat_init
*---------------------------------------------------------------------*
* FORM frm_catlg_set *
*---------------------------------------------------------------------*
FORM frm_catlg_set USING p_field p_text.
DATA: ls_fieldcat TYPE slis_fieldcat_alv.
ls_fieldcat-fieldname = p_field.
ls_fieldcat-seltext_l = p_text.
ls_fieldcat-outputlen = 20 .
APPEND ls_fieldcat TO gd_fieldcat .
CLEAR ls_fieldcat .
ENDFORM. "frm_catlg_set
*&--------------------------------------------------------------------*
*& Form user_command
*&--------------------------------------------------------------------*
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
READ TABLE itab INDEX rs_selfield-tabindex.
CASE r_ucomm.
WHEN '&IC1'.
CALL SCREEN 100.
WHEN 'EXIT'.
LEAVE PROGRAM.
ENDCASE.
ENDFORM. "user_com
*&---------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
MODULE status_0100 OUTPUT.
SUPPRESS DIALOG.
LEAVE TO LIST-PROCESSING AND RETURN TO SCREEN 0.
SET PF-STATUS space.
tcode = 'SE11'.
WRITE 'SE11'. HIDE tcode.
tcode = 'SE37'.
WRITE / 'SE37'. HIDE tcode.
ENDMODULE. " STATUS_0100 OUTP
阅读(6038) | 评论(0) | 转发(0) |