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

doubts in class-data

Former Member
0 Likes
587

hi ppl,

Isit mandatory to declare a class component for a class-data.

1 ACCEPTED SOLUTION
Read only

marcelo_ramos1
SAP Mentor
SAP Mentor
0 Likes
568

Hi Priyank,

Uwe wrote:

If your class contains only attributes which make sense in the context of a specific instance then you do not need any static attributes.

However, if you want to provide "generic" data which are independent of a given instance but useful to all instances then it makes sense to have static attributes.

What Uwe wrote is absolutely correct !

Have a look at [ABAP Objects - Creating your First Local Class - Defining Components|https://wiki.sdn.sap.com/wiki/display/Snippets/ABAPObjects-CreatingyourFirstLocalClass-DefiningComponents], It explain how to Define Instance and Static component in a Class.

Regards,

Marcelo Ramos

4 REPLIES 4
Read only

uwe_schieferstein
Active Contributor
0 Likes
568

Hello Priyank

If your class contains only attributes which make sense in the context of a specific instance then you do not need any static attributes.

However, if you want to provide "generic" data which are independent of a given instance but useful to all instances then it makes sense to have static attributes.

Regards

Uwe

Read only

marcelo_ramos1
SAP Mentor
SAP Mentor
0 Likes
569

Hi Priyank,

Uwe wrote:

If your class contains only attributes which make sense in the context of a specific instance then you do not need any static attributes.

However, if you want to provide "generic" data which are independent of a given instance but useful to all instances then it makes sense to have static attributes.

What Uwe wrote is absolutely correct !

Have a look at [ABAP Objects - Creating your First Local Class - Defining Components|https://wiki.sdn.sap.com/wiki/display/Snippets/ABAPObjects-CreatingyourFirstLocalClass-DefiningComponents], It explain how to Define Instance and Static component in a Class.

Regards,

Marcelo Ramos

Read only

Former Member
0 Likes
568

Hi Priyank dev,

It is not mandatory to use calss-data in declaring a class.This class-data is coming into picture

when you want to declare static data(instance free data).

Normally, we are using data as instance wise in class context.If you want to use data instance free that is available to all the instances.

if you have any doubts , raise your questions.

Thank you,

Prasad GVK.

Read only

Former Member
0 Likes
568

hi thank u all..its a very vital information for me.thanks a lot.