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

Using OO Abap programming optimally

Former Member
0 Likes
717

Dear experts,

I developed a report purely on Object Oriented concepts.It works really fine.

Now my requirement is that in one of my module pool program i want to retrieve some data from that report itself

and show in my Input help. I deliberately made this report OO as i had anticipated that it will be required to me in future.

Now time has come.I want to call some method of the defined class.It is at this point that i am ignorant how to do.

Methodi want to call from different program is that

fetch_lc_info ()

Let me explain you the structure of program which i am willing to call.

[code]

report zsammrp01.

include zdata_definitions. //I definitions

include zselect_lc_params. // selection screen

start-of-selection.

include zmainlc. //main logic

                  • Class Declarations

data : ob_get_all_lcinfo type ref to get_lc_details.

data: ob_alv_print type ref to alvprint.

                  • Perform functionalities

end-of-selection.

create object ob_get_all_lcinfo.

ob_get_all_lcinfo->fetch_lc_info( ).

create object ob_alv_print.

ob_alv_print->print_details( ).

end-of-selection.

[/code]

Let me show the zmainlc where i defined classes.

[code]

class get_lc_details definition.

public section.

methods: fetch_lc_info.

endclass.

class get_lc_details implementation.

method fetch_lc_info.

select aebeln aebelp bekgrp awerks amenge ameins

bbedat amatnr atxz01 anetwr bwaers bwkurs anetpr azztest azzlcbt blifnr

from ekko as b inner join ekpo as a on

( aebeln = bebeln ) into table t_all_lcs where b~bsart like 'IM%'.

some other manipulation on this table done..............

endmehod.

[/code]

5 REPLIES 5
Read only

jrg_wulf
Active Contributor
0 Likes
675

Hi Aditya,

from your explanation, i get that you defined and implemented your classes locally.

To use local classes from outside their context is not supported, (though not impossible).

Instead, you can convert your local classes to global ones by accessing them by SE24 , using the import feature from the menu. Once they are globally defined, you can use them with every Program you like.

regards

Jörg

(Besides, there is an OO Forum)

Read only

Former Member
0 Likes
675

if not impossible plz tell me that way as i am not interested to create any Z object in my system.Its prohibited.

Read only

jrg_wulf
Active Contributor
0 Likes
675

Hi Aditya,

the issue has been discussed in the OO forum. Take a look here

[]

Regards

Jörg

Read only

jrg_wulf
Active Contributor
0 Likes
675

In addition, it would be wise to put your classes into separate includes, so you'd just have to include them to ypour prog. This is the original idea of includes, to reuse them elesewhere.

regards

Jörg

Read only

Former Member
0 Likes
675

Thanx for your suggestions and link is highly useful at this hour.