Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

static

Former Member
0 Likes
616

Is there any concept of staic,non-static blocks in abap-oops,if so can any body send some detailed information regarding it.I will be very thankfull to those who have done it

3 REPLIES 3
Read only

Former Member
0 Likes
578

Hi,

we will use only static class methods not static blocks as in java,

to use static methods please see the following link you it might help you in resolving your query

http://help.sap.com/saphelp_nw2004s/helpdata/en/c3/225b5c54f411d194a60000e8353423/frameset.htm

http://help.sap.com/saphelp_nw04/helpdata/en/08/d27c03b81011d194f60000e8353423/content.htm

*******please reward points if the information is helpful to you**********

Read only

Former Member
0 Likes
578

Hi,

We do not have static blocks in abap. However, we have static components(variables and methods) in abap.

Abstract class can only be accessed using its static components or its subclasses.

The public and protected static components (methods + attributes) of the super class are visible in the subclass.

Public static components can be accessed through the class component selector used with any class in the respective path of inheritance tree.

The redefinition of static constructor works similarly to instance constructor.

When an static constructor is redefined then REDEFINITION addition is not required.

No parameter interface is possible for static constructor ( with or without inheritance)

The runtime environment automatically ensures that the static constructors are called in the right order, so it is not required to call the static constructor of the super class explicitly.

The first time a subclass is addressed in a program, the run time environment reaches for the next highest super class whose static constructor has not yet been executed. This static constructor is executed first, followed by constructors down the path until the addressed subclass is reached.

The static type of the reference variable is the type with which it was declared.

In assignments of reference variables , static type of a reference variable is always more general than the dynamic type.

When static type of the target variable is more general than the static type of the source variable, since the dynamic type of the source variable at run time can only be more specialized than its static type, this can be checked during the syntax check. This is known as narrowing cast.

When static type of the target variable is more specialized than the static type of the source variable. This is known as widening cast.

Regards,

Kate

Read only

arvind_aj
Product and Topic Expert
Product and Topic Expert
0 Likes
578

Static method can be access as:

<class name>=>static_method.

Object is not required to invoke a static method.

Note: Static method cannot be redefined in subclass !!!