‎2013 Jan 06 1:28 PM
Dear abapers,
Create object abc
Type
Xyz
Exporting
Abc = xxxx
Xxxx = abc.
above code can we make through 'pattern' button in abap editor with out mention class in the radio button 'create object'?
‎2013 Jan 06 2:20 PM
Hi,
You need to specify the class name. If you always want a static patter as like in your post, you can create a custom pattern in Abap Editor -> utilities -> more utilities -> edit pattern -> create pattern.
Regards,
Kiran
‎2013 Jan 06 3:23 PM
If you are not going to mention class, how would editor know which object to create?
‎2013 Jan 07 2:07 AM
What chinm told is the correct point . Without mentioning class name you can not add object . That is where main difference between procedural programming and object oriented programming too. In functions you can directly add function module name here with out mentioning function group.
Regards,
Praveen chitturi.
‎2013 Jan 07 2:47 AM
thanks for quick reply
as per this link
http://zevolving.com/2011/10/abap-objects-design-patterns-decorator/
through 'pattern' button on editor how to create object?
‎2013 Jan 07 5:36 PM
Hi,
When You click on Pattern button in abap editor, you can see ABAP Objects pattern. select the radio button corresponding to ABAP Objects pattern and click on OK button(or press enter), then in the following screen, you can select 'Create Object' pattern there.
Hope this helps u.,
Regards,
Kiran
‎2013 Jan 08 3:46 AM
thanks kiran,
but for the following code snippet what you said is not working creating object 'lo_decorator'
for the decorator pattern, which class has to mention after clicking on create object radio button
plz go through the following link once
http://zevolving.com/2011/10/abap-objects-design-patterns-decorator/
‎2013 Jan 09 5:55 AM
Hi,
Follow the steps provided by Amy. You need to give OP_PDF which is the class name as well as instance name.
But As it is a local class, you will not get the pattern. If it is a Global class once you give the Class name and instance name it will search in the repository and generate the pattern. whereas for local classes it wont find the class name and hence you will not get the pattern.
Hope this helps u.,
Regards,
Kiran
‎2013 Jan 08 2:19 PM
Hi,
Since it looks like you want to create a PDF output object, the class you want is OP_PDF.
If you still want to create a custom pattern to avoid having to provide the class name, take a look at these documents to learn how to create your own pattern. Keep in mind though that each class' constructor (potentially) has different parameters, which is the reason the create object pattern requires the name of the class.
Cheers,
Amy
‎2013 Jan 08 2:52 PM
A very nice and step-by-step guide for creating a pattern. Many thanks Amy .
‎2013 Feb 05 5:02 PM
I guess you got totally confused by the "Pattern" button in the Editor and the "Design Patterns".
Patterns button creates "raw" code for you so, you don't need to write everything. They are referred as the Statement Patterns.
Design Patterns are the building blocks you create within your ABAP development. These design patterns solves lot of complex problems and make the objects/classes more reusable. There are many design patterns e.g. Singleton, Mode View Controller, Iterator, Decorator (as you mentioned) , Facade, Composite etc. They have different degree of complexity as well as flexibility.
Like the decorator provides you the flexibility to add different flavors at runtime, provided you have successfully implemented Decorator Design pattern.
Like Composite lets you to only worry about the main object. As long as you do that operation. Composite would make sure that the operation would be carried over to all the objects within it. Same as achieved in HTML in ABAP utility where the method GET_HTML is composite, which keep on generating HTML for all of it children, and its children and so on and so forth.
Hope it helps to clear the doubt.
Regards,
Naimesh Patel