Skip to Content
author's profile photo Former Member
Former Member

Calling method in supcontroller from main controller.

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.

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    Posted on Sep 30, 2005 at 04:23 PM

    Hi Micheal

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

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      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

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.