‎2008 Jul 09 8:48 PM
Hi,
i learning abap objects and i wont to sample for using private and protected and public definitions .
until now i use Fm and for that i have function group
in top i declare all the global variables and i use it for all the fm in the group what is change.
Regards
‎2008 Jul 10 4:44 AM
Hello Ricardo
For an instance of a class all attributes, irrespective of whether they are public, protected or private, are global.
In general I would say that most of the class attributes (>70 %) should be either private or protected.
When do I use public attributes?
1) I want to make certain properties of the instance (e.g. a key like MATNR or details like MARA for a material related class) available for the outside. However, these public attributes should be defined as read-only because it makes absolutely no sense that you can change the key of an instance (like MATNR) from outside.
2) Recently I learned about a SAP standard interface (BAdI) for a user-exit where the attribute for an ALV fieldcatalog itab was public and changeable. Here the intention is to give the user of this BAdI an easy way to manipulate the ALV fieldcatalog.
Regards
Uwe
‎2008 Jul 10 12:24 AM
Check standard reports in SAP with names starting with BCALV_* they will provide you ample amount of information for learning.
‎2008 Jul 10 4:44 AM
Hello Ricardo
For an instance of a class all attributes, irrespective of whether they are public, protected or private, are global.
In general I would say that most of the class attributes (>70 %) should be either private or protected.
When do I use public attributes?
1) I want to make certain properties of the instance (e.g. a key like MATNR or details like MARA for a material related class) available for the outside. However, these public attributes should be defined as read-only because it makes absolutely no sense that you can change the key of an instance (like MATNR) from outside.
2) Recently I learned about a SAP standard interface (BAdI) for a user-exit where the attribute for an ALV fieldcatalog itab was public and changeable. Here the intention is to give the user of this BAdI an easy way to manipulate the ALV fieldcatalog.
Regards
Uwe
‎2008 Jul 10 9:47 AM
Hi Uwe Schieferstein
thanks ,
maybe u can give me simple example it help me a lot.
Regards
‎2008 Jul 10 10:46 AM
Hi,
refer to these links
abap oops material
1) http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCABA/BCABA.pdf -- Page no: 1291
2) http://esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt
3) http://esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
4) http://esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf
5) http://esnips.com/doc/92be4457-1b6e-4061-92e5-8e4b3a6e3239/Object-Oriented-ABAP.ppt
6) http://esnips.com/doc/448e8302-68b1-4046-9fef-8fa8808caee0/abap-objects-by-helen.pdf
7) http://esnips.com/doc/39fdc647-1aed-4b40-a476-4d3042b6ec28/class_builder.ppt
😎 http://www.amazon.com/gp/explorer/0201750805/2/ref=pd_lpo_ase/102-9378020-8749710?ie=UTF8
1) http://www.erpgenie.com/sap/abap/OO/index.htm
2) http://help.sap.com/saphelp_nw04/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
‎2008 Jul 10 11:55 AM
Hiii!
Check out this link. This link will guide you on ABAP OBJECTS
Regards
Abhijeet Kulshreshtha
‎2008 Jul 10 3:24 PM
Refer to some tutorials online..
Check out [www.abaplearning.com|www.abaplearning.com]
‎2008 Jul 10 4:13 PM
Hi Ricardo,
The Uwe's explanation is correct, you can also take a loo at [ABAP Objects Wiki page|https://wiki.sdn.sap.com/wiki/x/o5k] and [ABAP Objects Examples|https://wiki.sdn.sap.com/wiki/x/Aq] where you can see some examples includind [Visibility Definitions|https://wiki.sdn.sap.com/wiki/x/D60] and [Components Definitions|https://wiki.sdn.sap.com/wiki/x/OKg].
I hope this examples help you !
'Boa Sorte !'
Greetings,
Marcelo Ramos
‎2008 Jul 14 7:41 AM