Programmed Method Call

Call (fictitious) method Print of object type VBAK (sales document). The method receives the parameters Paperformat and Printertype as input.

* Call method Print of object type VBAK
***************************************************

* Data declarations
***************************************************
DATA: VBAK_REF TYPE SWC_OBJECT.
SWC_CONTAINER CONTAINER.
* Create object reference to sales document
*************************************************
SWC_CREATE_OBJECT VBAK_REF 'VBAK' <KeySalesDoc>
* Fill input parameters
***************************************************
SWC_CREATE_CONTAINER CONTAINER.
SWC_SET_ELEMENT CONTAINER 'Paperformat' 'A4'.
SWC_SET_ELEMENT CONTAINER 'Printertype' 'Lineprinter'.

* Call Print method
***************************************************
SWC_CALL_METHOD VBAK_REF 'Print' CONTAINER.
* Error handling
IF SY-SUBRC NE 0.
   .....
ENDIF.