Difference between revisions of "SAP ABAP REPORT"

From SapWiki
Line 30: Line 30:
 
                                           WHERE pernr = @p_pernr .
 
                                           WHERE pernr = @p_pernr .
  
     SELECT pernr INTO TABLE @DATA(lt_pernr2) FROM pa0002 UP TO 100 ROWS
+
     SELECT * INTO TABLE @DATA(lt_pernr2) FROM pa0002 UP TO 100 ROWS
 
                                           WHERE vorna IN @s_vorna .
 
                                           WHERE vorna IN @s_vorna .
     LOOP AT lt_pernr2 INTO DATA(ls_pernr).
+
     TRY.
      WRITE:/ ls_pernr.
+
        cl_salv_table=>factory( IMPORTING r_salv_table = DATA(gr_table)
     ENDLOOP.
+
                                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.
 
   ENDMETHOD.

Revision as of 20:47, 11 April 2020

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( ).