cancel
Showing results for 
Search instead for 
Did you mean: 

Calling method in supcontroller from main controller.

Former Member
0 Kudos

I want to call a public method in a supcontroller from a main controller. It is no problem to call a method that is standard defined in the class CL_BSP_CONTROLLER2, but wen tryin to call one that I have defined my self it dumps.

DATA: sup_ctr TYPE REF TO cl_bsp_controller2,

w_username TYPE string.

  • Call from MAIN controller.

CALL METHOD me->get_controller

EXPORTING

controller_id = 'USER'

RECEIVING

controller_instance = sup_ctr.

  • Call own defined method (this goes wrong).

CALL METHOD sup_ctr->get_username.

Accepted Solutions (1)

Accepted Solutions (1)

shiva_suvarna
Participant
0 Kudos

Hi Micheal

try to take SUP_CTR type ref to as your child controller class name not cl_bsp_controller2.

Former Member
0 Kudos

Thanks Shiva, that worked.


DATA:  sup_ctr TYPE REF TO cl_bsp_controller2,
       user_ctr TYPE REF TO z_cl_c_z0020_user,
       w_username TYPE string.

  • Call from MAIN controller.

CALL METHOD me->get_controller
    EXPORTING
      controller_id = 'USER'
    RECEIVING
      controller_instance = sup_ctr.

  user_ctr ?= sup_ctr.

  • Call own defined method.

CALL METHOD user_ctr->get_username
   IMPORTING
     user = w_username.

Regards Michael

Answers (0)