Application Development 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: 

Step by Step Procedure For defining/Implementing a Local Class

Former Member
0 Kudos
158

Hi!

I need simple step-by-step procedure for defining a local class ( having 1 function only) in ABAP

5 REPLIES 5

Sm1tje
Active Contributor
0 Kudos
78

----


  • CLASS lcl_class DEFINITION

----


*

----


CLASS lcl_class DEFINITION.

PUBLIC SECTION.

METHODS fm.

ENDCLASS. "lcl_class DEFINITION

----


  • CLASS lcl_implementation DEFINITION

----


*

----


CLASS lcl_class IMPLEMENTATION.

METHOD fm.

CALL FUNCTION 'FM'.

ENDMETHOD. "fm

ENDCLASS. "lcl_implementation DEFINITION

This is basic structure, which can be defined in an include (top include for data declaration), or some where local in your report / method.

You can use this class be instantiating it (CREATE OBJECT) and then call the method via the instance like this:

DATA: lr_object TYPE REF TO lcl_class.

START-OF-SELECTION.

CREATE OBJECT lr_object.

CALL METHOD lr_object->fm.

Former Member
0 Kudos
78

hi

you can also look here

[http://help.sap.com/saphelp_nw70/helpdata/en/c3/225b6554f411d194a60000e8353423/frameset.htm]

regards

Former Member
0 Kudos
78

--


CLASS DEFINITION--

CLASS zclass_floc DEFINITION .

PUBLIC SECTION .

CLASS-METHODS : handle_double_click

FOR EVENT double_click OF cl_gui_alv_grid

IMPORTING e_row e_column .

ENDCLASS .

--


CLASS IMPLEMENTATION--

CLASS zclass_floc IMPLEMENTATION .

METHOD handle_double_click .

PERFORM handle_double_click USING e_row e_column e_row_number .

ENDMETHOD .

ENDCLASS .

reward if useful

regards,

preet

marcelo_ramos
Active Contributor
0 Kudos
78

Hi Noman,

Look at [ABAP Objects Examples Wiki Page|https://wiki.sdn.sap.com/wiki/x/Aq] on [ABAP Objects Wiki Section|https://wiki.sdn.sap.com/wiki/x/o5k],

there is a lot of useful stuff like [ABAP Objects - Creating your First Local Class - Defining Components|https://wiki.sdn.sap.com/wiki/x/OKg].

Also Look at [ABAP Objects Library|https://www.sdn.sap.com/irj/sdn/advancedsearch?query=abap+objects&cat=sdn_all] there is a lot of samples.

Don't forget to close this Thread when your question be answered !

Regards,

Marcelo Ramos

Former Member
0 Kudos
78

hi,

go througghthis link , with screen shots.

http://saptechnical.com/Tutorials/OOPS/GlobalCopies/FromLocalClass.htm

Do Reward Points If Usefull to u.

Regards

Fareedas