cancel
Showing results for 
Search instead for 
Did you mean: 

how to open a popup and get some data from a model class

Former Member
0 Kudos
86

Hi experts,

mi problem is the next.

I am opening a popup from a view that is controlled by a controller named identificador.do, the controller class is z_identity_cl.

the window that is opened is other view controlled by nocupentes.do, with a controller class, z_nocupantes_cl.

In the do_init event of the z_nocupantes class i have added the next code:

<i> DATA: cl_parent TYPE REF TO Z_IDENTtity_CL.

  • Recuperamos el atributo parent

cl_parent ?= me->m_parent.

  • model is the class i want to recover, it is defined in the attibutes of the class z_identity_cl

model ?= cl_parent->get_model( 'mo' ).</i>

When i open the popup i get the next error:

<i>BSP exception : the object numero_ocup.htm(this is the page i want to open) in URL sap/ZHR_PDWEB_GDPT/numero_ocup.htm is a view. Initialize the controller.</i>

what do i have to do?

any help?

thanks in advance

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Eduardo,

you should be calling the Controller in the URL not the View. after calling the controlles in the URL create the view in the DO_REQUEST of the Controller. This should resolve the issue.

In the the DO_INIT define the Parent class of the Controller.

METHOD do_init.
  DATA: lr_my_parent TYPE REF TO zcl_hr_main_control.


* set (MVC) model
  lr_my_parent ?= me->m_parent.
  set_model( model_instance = lr_my_parent->model

                   model_id = 'Z' ).
  me->model = lr_my_parent->model.
ENDMETHOD.



method DO_REQUEST.

* datadeclaration
  DATA: abs      TYPE REF TO if_bsp_page.

* if input is available, dispatch this input to subcomponent.
* this call is only necessary for toplevel controllers.
  dispatch_input( ).

* if any of the controllers has requested a navigation,
* do not try to display, but leave current processing
  IF is_navigation_requested( ) IS NOT INITIAL.
    RETURN.
  ENDIF.

* output current view (create, set attibutes, and call)
  abs = create_view( view_name = 'to_disp.htm' ).

* set attribute model if needed
  abs->set_attribute( name = 'model' value = model ).

* call master views
  call_view( abs ). "calls itself

endmethod.

Cheers

Amandeep

Former Member
0 Kudos

Hi Amandeep ,

You were right with the call to the controller, i was calling the page instead of the controller.

Now, my problem is the next:

when in the class controller of the view, in the DO_INIT, I make the assignation:

  • set (MVC) model

lr_my_parent ?= me->m_parent.

me->m_parent hasn't got anything, the reference is null, why can this happen?

Thanks alot!!!

Eduardo

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

first of all you need a controller for your view,

and register him to your main application

have a look at <a href="/people/koen.labie2/blog/2006/11/17/showhelp-functionality-with-pop-up--part2 weblog</a>,

maybe it will help, I pass model to popup

grtz,

Koen

Message was edited by:

Koen Labie