Skip to Content

MVC: Tell a controller class which controller called it

I have to controller pages (page1.do and page2.do) that both shall use the same controller class (CL_CTR).

Can I tell in DO_REQUEST of the controller class whether page1.do or page2.do called the controller class?

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Oct 11, 2005 at 08:28 AM

    hi,

    you can find out name of the calling controller by attribute value: controller_name

    it is a super class CL_BSP_CONTROLLER2 variable and is availabe in all controller class.

    Regards,

    Hemendra

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 11, 2005 at 07:52 AM

    Hi Daniel,

    To call page1(2).do's from do_request you first put the following in DO_INIT.

    data: page1details type ref to cl_bsp_controller2.

    page1details ?= create_controller( controller_name = 'page1details.do'

    controller_id = 'subcntlr1_id' ).

    similarly you should do the same for page2.

    Then in DO_REQUEST.

    data: subcontroller1 type ref to cl_bsp_controller2.

    subcontroller1 ?= get_controller( controller_id = 'subcntlr1_id' ).

    call_controller( subcontroller1 ).

    I hope this helps.

    If it doesn't work let me know.

    Regards

    Amit

    Message was edited by: amit kumar

    Add a comment
    10|10000 characters needed characters exceeded

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.