SAP ABAP OBJECTS Tutorials

Template for calling a class

* Create reference to class lcl_airplane

DATA: airplane1 TYPE REF TO lcl_airplane.

START-OF-SELECTION.

* Create instance using parameters in the cosntructor method

CREATE OBJECT airplane1 exporting im_name = ‘Hansemand’

im_planetype = ‘Boing 747’.

*  Calling a method with parameters

CALL METHOD: airplane1->display_n_o_airplanes,

airplane1->display_attributes.

Subclass

CLASS xxx DEFINITION INHERITING FROM yyy.

Using af class as a parameter for a method

The class LCL_AIRPLANE is used as a parameter for method add_a_new_airplane:

METHODS:

add_a_new_airplane importing im_airplane TYPE REF to lcl_airplane.

Print Friendly, PDF & Email

[ FREE ] SUBSCRIBE
RECEIVE UPDATES & SAP ARTICLES RIGHT IN YOUR INBOX.