cancel
Showing results for 
Search instead for 
Did you mean: 

How to pass parameter in porrtal navigation

Former Member
0 Kudos

Hi

I need to pass parameter from one component to another through portal navigation. I know cannot use assistance class as it looses values in the new iview.


DATA lr_port_manager TYPE REF TO if_wd_portal_integration.
  DATA lr_componentcontroller TYPE REF TO ig_componentcontroller .
  DATA l_api_componentcontroller TYPE REF TO if_wd_component.
  DATA:lt_para type table of WDY_KEY_VALUE,
       ls_para type WDY_KEY_VALUE.
 
  lr_componentcontroller = wd_this->;get_componentcontroller_ctr( ).
  l_api_componentcontroller = lr_componentcontroller->;wd_get_api( ).
  lr_port_manager = l_api_componentcontroller->;get_portal_manager( ).
 
  target = 'ROLES://portal_content/com.test/test'.
 
  ls_para-key = 'ZTEST'.
  ls_para-value = ls_wbs-wbselement.
  APPEND ls_para to lt_para.
 
  CALL METHOD lr_port_manager->;navigate_absolute
    EXPORTING
      navigation_target = target
*        navigation_mode     = navigation_data-navigation_mode
*        window_features     = navigation_data-window_features
*        window_name         = navigation_data-window_name
*        history_mode        = navigation_data-history_mode
*        target_title        = navigation_data-target_title
*        context_url         = navigation_data-context_url
         post_parameters     = 'X'
*        use_sap_launcher    = abap_true
         business_parameters = lt_para
*        launcher_parameters = launcher_parameter_list.

I cannot use this code as it goes to the handledefault event handler and I want the data in the doinit method of the default view.

Can anyone help me out.

Regards

Prashant Chauhan

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Rahul/Kris

Do I need to declare the application parameters in the application window? Or would I automatically get the parameter that I want to pass through portal navigation, when I write the code given by Kris.

Sorry for asking such silly questions. Please bare with me and help me out.

Regards

Prashant Chauhan

saravanan_narayanan
Active Contributor
0 Kudos

Hello Prashant,

I'm not sure whether the solution suggested by Rahul and Kris will work. What I understood about your requirement is that you want pass some context node values from WDA to flex and initialise the flex component accordingly. Whether you populate your context in view's INIT or Window's event handler method it doesnt matter.

the initalising of Flex component and context sharing from WDA to Flex is asynchronous. So in the FLEX, if you want to change/load some components based on the context data then you should listen the for the FlashIsland.EVENT_END_UPDATE_DATASOURCES event. this event will be fired immediately after the context data is passed/updated on to the FLEX. So my suggestion would be the following

1. Create a context node in Component controller

2. map this context to window controller context as well as to the view controller context

3. receive the application parameter in hte Window's default event handler and populate the Component's context which is mapped to the window;s controller

4. in the flex, while registering hte FlashIsland, create a event handler method for EVENT_END_UPDATE_DATASOURCES

FlashIsland.addEventListener(FlashIsland.EVENT_END_UPDATE_DATASOURCES, setInitialValues) 

5. In the event handler method (setInitialValues) check for the context value and perform your logic.

Note: the event EVENT_END_UPDATE_DATASOURCES will be fired during each server roundtrip. If you intially your flex component only once, then declare a boolean variable notFirstTime and in the setInitialValues method check whether this is set or not and perform your logic accordingly.


public function setInitialValue(event:Event):void
 {
     if ( notFirstTime == false )
     {
         //your logic
     }
     notFirstTime = true;
}

Hope this helps.

BR, Saravanan

Former Member
0 Kudos

Hi Saravanan

Thanks a lot for the reply. But I think you misunderstood my question.

Anyways it got resolved.

Thanks again !!

Regards

Prashant Chauhan

saravanan_narayanan
Active Contributor
0 Kudos

Hello Prashant,

the flow is like that.

first view' INIT will be called

second window's default event handler will be called

third view's modify view

What you can do this receive the parameter in the window's event handler ( map the values to the components context )

then in the view's modify view(first_time call), you can write your logic.

BR, Saravanan

Former Member
0 Kudos

Hi

Thanks for the reply. But I have a doubt. I have attached my flex file in the view. And I want to send some values to flex application after which the flex decides what to do next. But since the control in WD first goes to the init and then to window default handler where I'm get those values which I need. So when the control goes to init, it does not have any value.

So how should i achieve the functionality (passing parameter in portal navigation) and get the values in init method ?

Feel free to suggest an alternative procedure.

Regards

Prashant Chauhan

Former Member
0 Kudos

Check following alternate:

1. first get the component reference IF_WD_COMPONENT in wdinit method of componentcontroller

2. Using component call the method GET_APPLICATION to get the reference of application

3. GET_APPLICATION will return you the reference of application type IF_WD_APPLICATION

4. using IF_WD_APPLICATION call the method GET_APPLICATION_INFO

5. GET_APPLICATION_INFO will return you the variable of type IF_WD_RR_APPLICATION

6. using reference of IF_WD_RR_APPLICATION called the method GET_APPLICATION_PARAMETERS

Step 6 will return you the name and value pair for all application parameters.

Former Member
0 Kudos

Hi

So do you mean to say that the business parameters that I send from wd app1 to wd app2 will be set as application parameter of wd app2? If so, could you please tell me exactly how will the get the parameter with the help of IF_WD_RR_APPLICATION.

If this is not what you meant, then please elaborate.

Regards

Prashant Chauhan

Former Member
0 Kudos

Hi Prasanth,

You can get parameters from application using get_application_parameters method.

data: l_cmp_api           type ref to if_wd_component,
  l_application_api    type ref to if_wd_application,
  l_application_info    type ref to if_wd_rr_application. 
  l_component_api = wd_this->wd_get_api( ).
  l_application_api  = l_api->get_application( ).
  l_application_info = l_application_api->get_application_info( ).

  data lt_appl_params type wdrr_application_parameters.
  lt_appl_params = lo_appl_info->get_application_parameters( ).

Cheers,

Kris.

Former Member
0 Kudos

Thanks a lot Rahul & Kris for the reply !!!