SAP ABAP REPORT
From SapWiki
Contents
Obtener vía F4 archivo y directorio en un reporte
F4 en reporte
Agregar botones en la pantalla de selección de un Reporte
Datos de selección (select-options, parameters) en dynpro
REPORT ydemo_sel. DATA wa_pa0002 TYPE pa0002. SELECTION-SCREEN BEGIN OF SCREEN 100. PARAMETERS p_pernr TYPE p0001-pernr. SELECT-OPTIONS s_vorna FOR wa_pa0002-vorna. SELECTION-SCREEN END OF SCREEN 100. AT SELECTION-SCREEN OUTPUT. SET PARAMETER ID 'RID' FIELD 'TEST_PROGRAM'. CLASS start DEFINITION. PUBLIC SECTION. CLASS-METHODS main. ENDCLASS. CLASS start IMPLEMENTATION. METHOD main. CALL SELECTION-SCREEN 100. " STARTING AT 10 10. IF sy-subrc <> 0. RETURN. ENDIF. SELECT pernr INTO TABLE @DATA(lt_pernr) FROM pa0001 UP TO 100 ROWS WHERE pernr = @p_pernr . SELECT * INTO TABLE @DATA(lt_pernr2) FROM pa0002 UP TO 100 ROWS WHERE vorna IN @s_vorna . TRY. cl_salv_table=>factory( IMPORTING r_salv_table = DATA(gr_table) CHANGING t_table = lt_pernr2 ). CATCH cx_salv_msg. ENDTRY. *... Enable Generic ALV functions DATA(gr_functions) = gr_table->get_functions( ). gr_functions->set_all( ). *... Display table gr_table->display( ). ENDMETHOD. ENDCLASS. START-OF-SELECTION. start=>main( ).
Restricciones en select-options
Ejemplo de select-options que solo permite valores individuales
REPORT ydemo_sel2. DATA p0014 TYPE p0014. SELECT-OPTIONS s_lgart FOR p0014-lgart NO INTERVALS. *--------------------------------------------------------------------* INITIALIZATION. *--------------------------------------------------------------------* DATA: restrict TYPE sscr_restrict, opt_list TYPE sscr_opt_list_tab WITH HEADER LINE, sscr_ass TYPE sscr_ass_tab WITH HEADER LINE. * restrict selection option for function to single value CLEAR opt_list. MOVE 'EQ' TO opt_list-name. MOVE 'X' TO opt_list-options-eq. APPEND opt_list TO restrict-opt_list_tab. CLEAR sscr_ass. MOVE: 'S' TO sscr_ass-kind, 'S_LGART' TO sscr_ass-name, 'I' TO sscr_ass-sg_main, ' ' TO sscr_ass-sg_addy, 'EQ' TO sscr_ass-op_main, 'EQ' TO sscr_ass-op_addy. APPEND sscr_ass TO restrict-ass_tab. CALL FUNCTION 'SELECT_OPTIONS_RESTRICT' EXPORTING restriction = restrict.