cancel
Showing results for 
Search instead for 
Did you mean: 

MVC: Tell a controller class which controller called it

daniel_humberg
Contributor
0 Kudos

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?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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

Answers (1)

Answers (1)

Former Member
0 Kudos

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