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

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

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:

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.

what do i have to do?

any help?

thanks in advance

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 Jul 10, 2007 at 01:33 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      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

  • author's profile photo Former Member
    Former Member
    Posted on Jul 10, 2007 at 12:48 PM

    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

    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.