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

class builder

Former Member
0 Likes
435

hi,

i hv a doubt in a class builder.

i tried to to use static attribute inside a method.but that attribute couldnt store the last value when again it used in another method .hw can i solve this problem.

3 REPLIES 3
Read only

Former Member
0 Likes
399

hi

hope it will help you.

Reward if help.

Classes and Interfaces

This section describes the definition of classes and interfaces and of their components. Classes and interfaces form the basis for ABAP Objects, the object-oriented part of the ABAP language. Classes and interfaces can be defined in ABAP programs of the following program types:

In a class pool, you use the Class Builder tool of the ABAP Workbench to define exactly one global class of the class library, which can then be used in all other ABAP programs. In the global declaration section of a class pool, you can individually define local data types, classes and interfaces to tbe used in the class pool and make type groups known. Apart from the TYPES and TYPE-POOLS statements, in class pools no other statements are allowed outside of classes and interfaces.

In an interface pool, you use the Class Builder tool of the ABAP Workbench to define exactly one global interface of the class library to be used in all other ABAP programs. In the global declaration section of an interface pool, you are not allowed to define local data types, classes and interfaces. You can declare type groups. Apart from the statement TYPE-POOLS, in interface pools no other statements are allowed outside of the global interfaces.

In all other ABAP programs, except type groups, you can define local classes and interfaces to be used in the program itself.

Apart from the TYPES and TYPE-POOLS statements, in class and interface pools no other statements are allowed outside of CLASS - ENDCLASS or INTERFACE - ENDINTERFACE.

Read only

Former Member
0 Likes
399

Roy,

Static Attributes

The contents of static attributes define the state of the class that is valid for all instances of the class. Static attributes exist once for each class. You declare them using the CLASS-DATA statement. They are accessible for the entire runtime of the class.

All of the objects in a class can access its static attributes. If you change a static attribute in an object, the change is visible in all other objects in the class.

Pls. reward if useful...

Read only

0 Likes
399

hi,

In class builder,inside that attribute tab i put my static variable as, for example 'count ' and delcaration of level as static attribute,visibility as public and type as I.

scenario.

method M1

count = count + 1.

method M2

count = count + 1.

write : count.

expected o/p is 2.

but i got it as 1.

wat can i do for the proper output.?