cancel
Showing results for 
Search instead for 
Did you mean: 

INTERFACES if_oo_adt_classrun .

12-15-2020 7:54 AM
Dave_Sharma Explorer
13866 views 3 comments Go to solution
SAP Managed Tags
Subscribe

I am just curious to know how instance of "out" of interface if_00_adt_classrun able to call write method that is implemented in cl_oo_adt_res_classrun. I debugged the below code but not clear how the system knows which class and method it needs to call. What is the benefit of class pool?

CLASS zds_rap_basic1 DEFINITION PUBLIC FINAL CREATE PUBLIC . PUBLIC SECTION. INTERFACES if_oo_adt_classrun . PROTECTED SECTION. PRIVATE SECTION. ENDCLASS. CLASS zds_rap_basic1 IMPLEMENTATION. METHOD if_oo_adt_classrun~main. select * from zrap002_booking into table @data(lt_data). out->write( EXPORTING data = lt_data name = 'Table display'). ENDMETHOD. ENDCLASS.

Accepted Solutions (1)

Accepted Solutions (1)

maheshpalavalli
Active Contributor

1. When you run the application from eclipse, the class name ZCL_ABAP_ADT"your custom class which implements if_oo_adt_classrun" is sent as a parameter to the service "ADT"(from SICF) as a HTTP request.

2. Now the URI of the class that you are running is also important, when we run the class, the URI will be like this: "/oo/classrun/ZCL_ABAP_ADT", this will be sent from Eclipse I guess.

3. There is a class "CL_OO_ADT_RES_APP", which has a method : register_resources, this has all the URl patterns and their respective classes., in our case "CL_OO_ADT_RES_CLASSRUN" for our URI from step 2.

4. Now in the above URI matched class method, there is a variable of type if_oo_adt_classrun, which will be instantiated with your custom class type "ZCL_ABAP_ADT" from step1. (check how interfaces works if you don't understand this step)

5. Now they will call that variable instance method "main", which holds our custom class instance, so it will call ZCL_ABAP_ADT->main,

6. Then we pass output to "out" parameter, this will be used and sent back as the response and will be shown in the Eclipse ABAP console.

Sijin_Chandran
Active Contributor
0 Likes

Hi Mahesh,

I am also having the same question which op here has, but I have one doubt here. I could understand till step 5. Now considering Method if_oo_adt_classrun~main (kindly consider this as zcl_abap_adt~main Method as in case here) inside this we are calling out->write( 'Hello World' ), for showing our output in console.

How 'out' variable is getting instantiated, which is again of type Interface 'if_oo_adt_classrun_out' only is my question, in this case.

Thanks,

Sijin

Answers (0)