Example documentationProgrammed Method Call Locate this document in the navigation structure

 

Call (fictitious) method Print of object type VBAK (sales document). The method receives the parameters Paper Format and Printer Type as input.

Syntax Syntax

  1. * Aufruf der Methode Print des Objekttyps VBAK
    ***************************************************
    * Datendeklarationen
    ***************************************************
    DATA: VBAK_REF TYPE SWC_OBJECT. SWC_CONTAINER CONTAINER.
    * Objektreferenz auf Verkaufsbeleg erzeugen
    *************************************************
    SWC_CREATE_OBJECT VBAK_REF 'VBAK' <SchlüsselVerkaufsbeleg>
    * Eingabeparameter füllen
    ***************************************************
    SWC_CREATE_CONTAINER CONTAINER.
    SWC_SET_ELEMENT CONTAINER 'Paperformat' 'A4'.
    SWC_SET_ELEMENT CONTAINER 'Printertype' 'Lineprinter'.
    
    * Aufruf der Print-Methode
    ***************************************************
    SWC_CALL_METHOD VBAK_REF 'Print' CONTAINER.
    * Fehlerbehandlung
    IF SY-SUBRC NE 0.
       .....
    ENDIF.
End of the code.