Docsity

Calling Methods - E-Commerce - Lecture Slides, Slides of Fundamentals of E-Commerce

Partial preview of the text

Download Calling Methods - E-Commerce - Lecture Slides and more Slides Fundamentals of E-Commerce in PDF only on Docsity!

Spring 2011 Enterprise Programming

ABAP OBJECTS, PART 2

Discussion Topics

 Working with static method and attributes

 Object Instantiation

Docsity.com

Working with classes in programs

Classes, when instantiated, become objects.

Not all classes need to be instantiated to be used within programs.

Static attributes (CLASS-DATA) Static methods (CLASS-METHODS)

To reference a static public attribute:

classname=>attributename myvar = classname=>attributename

To call a static method: CALL METHOD classname=>methodname. "traditional classname=>methodname( ). "as of Web AS 6.

Static vs. instance: Static uses => Instance uses -> Other syntax elements are the same.

Calling methods

Cannot be a space before opening parenthesis. Must be one after.

If only one importing parameter in method definition, list the actual parameter in the parenthesis by listing data object name only. class=>method( data1 ).

If several importing parameters, parameters must be listed in pairs: formal parameter = actual parameter. class=>method( par1 = data1 par2 = data2 ).

If there are parameters of types other than importing , the type of parameter passing must be listed. class=>method( EXPORTING p1 = d1 p2 = d IMPORTING par3 = data CHANGING par4 = data4 ).

Docsity.com

Let's Practice

Static Rules

Static methods can only access static attributes.

Static method may define local data objects.

Instance methods can access static and instance attributes.

Docsity.com