Solução : Vamos utilizar Field Symbols e as classes cl_gui_docking_container, cl_gui_alv_grid para alcançarmos nosso objetivo, e neste caso o ALV deve ser gerado na mesma tela dos parametros de seleção.
Veja Abaixo:
REPORT ZRR_SAMPLE.
*-----------------------------------------------------------------------
* | I.N.T.E.R.N.A.L T.A.B.L.E.S D.E.C.L.A.R.A.T.I.O.N.S.
*-----------------------------------------------------------------------
DATA : it_zcorvc001 TYPE STANDARD TABLE OF zcorvc001,
it_zcorvc002 TYPE STANDARD TABLE OF zcorvc002,
it_zcorvc003 TYPE STANDARD TABLE OF zcorvc003,
it_zcorvc004 TYPE STANDARD TABLE OF zcorvc004.
*-----------------------------------------------------------------------
* | W.O.R.K.A.R.E.A.S D.E.C.L.A.R.A.T.I.O.N.S.
*-----------------------------------------------------------------------
DATA : wa_zcorvc001 TYPE zcorvc001,
wa_zcorvc002 TYPE zcorvc002,
wa_zcorvc003 TYPE zcorvc003,
wa_zcorvc004 TYPE zcorvc004.
*-----------------------------------------------------------------------
* | F.I.E.L.D S.Y.M.B.O.L.S D.E.C.L.A.R.A.T.I.O.N.S.
*-----------------------------------------------------------------------
FIELD-SYMBOLS :TYPE ANY,
TYPE STANDARD TABLE.
*-----------------------------------------------------------------------
* | C.L.A.S.S O.B.J.E.C.T.S D.E.C.L.A.R.A.T.I.O.N.S.
*-----------------------------------------------------------------------
DATA : oref_dock TYPE REF TO cl_gui_docking_container,
oref_alv TYPE REF TO cl_gui_alv_grid.
*-----------------------------------------------------------------------
* | V.A.R.I.A.B.L.E.S D.E.C.L.A.R.A.T.I.O.N.S.
*-----------------------------------------------------------------------
DATA : i_exclude TYPE TABLE OF syucomm.
*-----------------------------------------------------------------------
* | S.C.R.E.E.N E.L.E.M.E.N.T.S D.E.F.I.N.I.T.I.O.N.
*-----------------------------------------------------------------------
SELECTION-SCREEN BEGIN OF BLOCK block1 WITH FRAME TITLE text-001.
SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(10) text-002 FOR FIELD p_tab1.
PARAMETERS p_tab1 RADIOBUTTON GROUP gp01 USER-COMMAND change.
SELECTION-SCREEN COMMENT 20(10) text-003 FOR FIELD p_tab2.
PARAMETERS p_tab2 RADIOBUTTON GROUP gp01.
SELECTION-SCREEN COMMENT 40(10) text-004 FOR FIELD p_tab3.
PARAMETERS p_tab3 RADIOBUTTON GROUP gp01.
SELECTION-SCREEN COMMENT 60(10) text-005 FOR FIELD p_tab4.
PARAMETERS p_tab4 RADIOBUTTON GROUP gp01.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK block1.
*-----------------------------------------------------------------------
* | I.N.I.T.I.A.L.I.Z.A.T.I.O.N
*-----------------------------------------------------------------------
INITIALIZATION.
p_tab1 = 'X'.
sy-ucomm = 'CHANGE'.
PERFORM f_load_data_from_table.
*-----------------------------------------------------------------------
* | A.T S.E.L.E.C.T.I.O.N-S.C.R.E.E.N O.U.T.P.U.T
*-----------------------------------------------------------------------
AT SELECTION-SCREEN OUTPUT.
APPEND 'ONLI' TO i_exclude.
APPEND 'SJOB' TO i_exclude.
APPEND 'PRIN' TO i_exclude.
CALL FUNCTION 'RS_SET_SELSCREEN_STATUS'
EXPORTING
p_status = sy-pfkey
p_program = sy-repid
TABLES
p_exclude = i_exclude.
*-----------------------------------------------------------------------
* | A.T S.E.L.E.C.T.I.O.N-S.C.R.E.E.N
*-----------------------------------------------------------------------
AT SELECTION-SCREEN.
PERFORM f_load_data_from_table.
*-----------------------------------------------------------------------
* | Form : F_LOAD_DATA_FROM_TABLE
*-----------------------------------------------------------------------
* | Text : BIND DATA INTO INTERNAL TABLES
*-----------------------------------------------------------------------
FORM f_load_data_from_table .
IF sy-ucomm EQ 'CHANGE'.
IF p_tab1 IS NOT INITIAL.
SELECT * FROM zcorvc001 INTO TABLE it_zcorvc001.
ASSIGN : 'ZCORVC001' TO,
it_zcorvc001 TO.
ENDIF.
IF p_tab2 IS NOT INITIAL.
SELECT * FROM zcorvc002 INTO TABLE it_zcorvc002.
ASSIGN : 'ZCORVC002' TO,
it_zcorvc002 TO.
ENDIF.
IF p_tab3 IS NOT INITIAL.
SELECT * FROM zcorvc003 INTO TABLE it_zcorvc003.
ASSIGN : 'ZCORVC003' TO,
it_zcorvc003 TO.
ENDIF.
IF p_tab4 IS NOT INITIAL.
SELECT * FROM zcorvc004 INTO TABLE it_zcorvc004.
ASSIGN : 'ZCORVC004' TO,
it_zcorvc004 TO.
ENDIF.
ENDIF.
IF sy-subrc = 0.
IF oref_dock IS NOT BOUND.
CREATE OBJECT oref_dock
EXPORTING
repid = sy-repid
dynnr = '1000'
side = cl_gui_docking_container=>dock_at_bottom
ratio = 80
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
OTHERS = 6.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDIF.
IF oref_alv IS NOT BOUND.
CHECK oref_dock IS BOUND.
CREATE OBJECT oref_alv
EXPORTING
i_parent = oref_dock
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDIF.
CHECK oref_alv IS BOUND.
CALL METHOD oref_alv->set_table_for_first_display
EXPORTING
i_structure_name =
CHANGING
it_outtab =
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDIF.
ENDFORM. " F_LOAD_DATA_FROM_TABLE
Queridão, criar um twitter p vc, e posta quando vc atualizar o blog :)
ResponderExcluir