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

Former Member
0 Likes
1,084

Hi Experts,

I am new to Object orientedABAP.

Can any body tell me how to call a built-in class and method in to my ABAP report with some example?

Regards

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,049

go to pattern and choose ABAP object patterns.

Enter object name,method name and class name.

To call object

enter class name and object name.

Reward points if helpful.

Naveen

12 REPLIES 12
Read only

Former Member
0 Likes
1,049

You should simply look at one of the BCEDIT programs.

1. Create the object for the class

2. Call the method of the class using the object created. You can use the pattern button of the ABAP Editor.

Here is a example.

Regards,

Ravi

Note : Please mark all the helpful answers

Read only

0 Likes
1,049

Hi Thanks.

Points are given.

Whare to create object for the class?

After creating object for that calss we need to call that method by clicking Pattern button?

Read only

0 Likes
1,049

You can create the object/instance of the class in the program (report / dialog program) where you want to make that call. Even the CREATE OBJECT also can be done using the pattern

Once that is done use the instnace name and the class name to get the pattern of the method.

Regards,

Ravi

Read only

0 Likes
1,049

Hi Ravi,

This is how u can create object!!

DATA: container TYPE REF TO cl_gui_custom_container,

tree TYPE REF TO cl_gui_simple_tree.

CREATE OBJECT container

EXPORTING

container_name = 'CUSTOM'.

IF sy-subrc <> 0.

MESSAGE e009(zvikalp).

ENDIF.

CREATE OBJECT tree

EXPORTING

parent = container

node_selection_mode = cl_gui_simple_tree=>node_sel_mode_single.

IF sy-subrc <> 0.

MESSAGE e014(zvikalp).

ENDIF.

Other than this u also need to register events. and define the calss in the top include as shown-

----


  • CLASS lcl_tree DEFINITION

----


  • ........ *

----


CLASS lcl_tree DEFINITION.

PUBLIC SECTION.

CLASS-METHODS : catch_dbl FOR EVENT node_double_click OF

cl_gui_simple_tree IMPORTING node_key.

ENDCLASS.

----


  • CLASS lcl_tree IMPLEMENTATION

----


  • ........ *

----


CLASS lcl_tree IMPLEMENTATION.

METHOD catch_dbl.

g_event = 'NODE_DOUBLE_CLICK'.

g_node_key = node_key.

ENDMETHOD.

ENDCLASS.

Hope this helps u.

Regards,

Seema.

Read only

Former Member
0 Likes
1,049

hi,

Tcode -> SE24. Give the class name cl_http_client->

Display. You will find a list of methods that are implemented in that class.

call method cl_http_client=>create_by_url

exporting

url = wf_string

importing

client = http_client

exceptions

argument_not_found = 1

plugin_not_active = 2

internal_error = 3

others = 4.

create_by_url is a <b> STATIC </b> method. So, we used => as operator. If we want to access <b>INSTANCE</b> methods, we have to use -> operator.

Regards,

Sailaja.

Read only

Former Member
0 Likes
1,050

go to pattern and choose ABAP object patterns.

Enter object name,method name and class name.

To call object

enter class name and object name.

Reward points if helpful.

Naveen

Read only

Former Member
0 Likes
1,049

Ref : http://help.sap.com/saphelp_nw2004s/helpdata/en/c3/225b5654f411d194a60000e8353423/content.htm

you could find examples as well. In se38 also you could find it. or SE24 => where used list.

rgds,

TM.

Read only

Former Member
0 Likes
1,049

Hi Ravi,

In Object Oriented There is you 1st make local class define all the and then implement event in it than in PBO set handler. and the class is:

Classes describe objects. From a technical point of view, objects are runtime instances of a class. In theory, you can create any number of objects based on a single class. Each instance (object) of a class has a unique identity and its own set of values for its attributes.

Object References

Read only

Former Member
0 Likes
1,049

Hi,

Please check the transaction ABAPDOCU...wherein u will have all the things in the ABAP Objects folder.

Or else go to the transaction DWDM for demo of many examples. Take any example and look the source code. You will come to know.

Regs,

Venkat Ramanan N

Read only

Former Member
0 Likes
1,049

check the Program <b>" BCALV_GRID_VERIFY"</b>

it will be helpfull for u.

Read only

Former Member
0 Likes
1,049

Hi,

If it solves your problem award with maximu points.

Regs,

Venkat Ramanan N