Report-Vorlage

Aus SAP-Wiki
Wechseln zu: Navigation, Suche

"Data & Types

****************
* DATA & TYPES *
****************
Types: begin of ty_itab,
       kunnr type kna1-kunnr,
       end of ty_itab.

Types: tty_itab type standard table of ty_itab. 

Data: gt_itab type Standard table of ty_itab.

Constants: true  type xfeld value 'X',
           false type xfeld value space.

Tables: vbak.

"Parameters

**************
* PARAMETERS *
**************
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.

PARAMETERS: p_vkorg TYPE vbak-vkorg.

SELECTION-SCREEN END OF BLOCK b1.

"Initialization

******************
* INITIALIZATION *
******************
INITIALIZATION.
 PERFORM initialization.

"At Selection-Screen

***********************
* AT SELECTION-SCREEN *
***********************
at selection-screen.

"Start-of-Selection

**********************
* START-OF-SELECTION *
**********************
start-of-selection.

************
* get data *
************
perform get_data
  changing gt_itab.

"Form initialization

*&---------------------------------------------------------------------*
*&      Form  INITIALIZATION
*&---------------------------------------------------------------------*
*       Default Routinen
*----------------------------------------------------------------------*
FORM initialization.
  DATA: lv_report  TYPE  rsvar-report,
        lv_variant TYPE  rsvar-variant.

* Variante STANDARD wird automatisch gezogen
  lv_report  = sy-repid.
  lv_variant = 'STANDARD'.

  CALL FUNCTION 'RS_SUPPORT_SELECTIONS'
    EXPORTING
      report               = lv_report
      variant              = lv_variant
    EXCEPTIONS
      variant_not_existent = 1
      variant_obsolete     = 2
      OTHERS               = 3.

  IF sy-subrc <> 0.
*   Variante & ist nicht vorhanden
    MESSAGE i809(00) WITH lv_variant.
  ENDIF.

ENDFORM.                    "INITIALIZATION

"Form get_data

*&---------------------------------------------------------------------*
*&      Form  GET_DATA
*&---------------------------------------------------------------------*
*       Lesen Daten
*----------------------------------------------------------------------*
FORM get_data
  CHANGING ct_itab type tty_itab.

ENDFORM.