cancel
Showing results for 
Search instead for 
Did you mean: 

linktoaction calling popup window of another webdynpro component

Former Member
0 Kudos

Hi Experts,

I have a scenario in which the linktoaction on a table( not ALV ) cell should trigger a popup window which is totally a different webdynpro component(let say- compB)

for eg: Output of comA

emp no emp name time

911034 roger 8

890123 kathey 8

So the linktoaction is for the emp no column. So when they click on 911034 a poupup window should open which is a different webdynpro component(compB)

layout of comB looks like below table(not ALV)

emp no: leave

911034 vacation

1.how do I link the compB with compA as a popup?

I know that comB can be assigned as a usage component in compA.

In a normal popup you create a view and a window in comA and while calling the popup you assign this new window.

But here its a popup from a different component comB.

Can you please explain the approach.

2.If its linked how to get the data of the table row on which the linktoaction is present to the compB to pull the concerned data.

Thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi, Amol :

According to your descriptive requirement, i'd suggest you, and you can try the followings:

<1>.If you just want to open the window of "Comp B".Remember: the window of "Comp B" plays like "Pop-up" to your main window of "Comp A". You can try this:

(1).Add "Comp B" as used-component in "Comp A".Remember: add it in the property tab of "Component Controller" and "View" which has your Link-to-Action UI element.

(2).In your link-to-action handler, you can use:


data:
    lo_window_manager     type  REF TO  if_wd_window_manager,
    lo_api_comp           type  REF TO  if_wd_component,
    lo_view_ctrl          type  REF TO  if_wd_view_controller,
    lo_window             type  REF TO  if_wd_window.

*1. the first method to get the window
    "1-1. get the view-controller, as we are in "View"
    lo_view_ctrl = wd_this->wd_get_api( ).
    "1-2. get the view's component
    lo_api_comp = lo_view_ctrl->IF_WD_CONTROLLER~GET_COMPONENT( ).

    "Or, you can also get the Component Controller API
    "lo_api_comp = WD_COMP_CONTROLLER->wd_get_api( ).


*2. get the component's window manager
    lo_window_manager = lo_api_comp->get_window_manager( ).

*3. create the  window
    CALL METHOD lo_window_manager->CREATE_WINDOW_FOR_CMP_USAGE
      EXPORTING
        INTERFACE_VIEW_NAME  = 'W_MAIN'      "Your "Comp B"'s window name
        COMPONENT_USAGE_NAME =  'DIALOG'   "Your Component usage name in "Comp A"
*        TITLE                =
*        CLOSE_IN_ANY_CASE    = ABAP_TRUE
*        MESSAGE_DISPLAY_MODE =
*        IS_RESIZABLE         = ABAP_TRUE
      RECEIVING
        WINDOW               = lo_window
        .

*4. open the window
     lo_window->open( ).

(3).In your window inbound plug(Type: start. Name: Default) handler of "Comp B", you can make use of the parameter "WINDOW_DESCR" to do things, such as describing event to the buttons, etc...

(4).About how to pass the value from "Comp A" to "Comp B", as well as pass back the value from "Comp B" to "Comp A",. You can use the "Interface method" or "Interface context", and "Event" if necessary, i think you can get more detail info by searching these topics. Here, sorry not to paste the example coding..

<2>.If you want to open the window of "Comp B" in a complete new IE Browser. You can try this:

(1).In your "Comp A"'s link to action, you can:


DATA:     
        lw_url       type  string,
     lo_window_mg TYPE REF TO if_wd_window_manager,
     lo_api_comp  TYPE REF TO if_wd_component,
     lo_window    TYPE REF TO if_wd_window.

* get the URL of the called application
  CALL METHOD CL_WD_UTILITIES=>CONSTRUCT_WD_URL
    EXPORTING
      APPLICATION_NAME              = 'Comp B' ""Comp B's application name
    IMPORTING
      OUT_ABSOLUTE_URL              = lw_url.
* add the parameters
  CALL METHOD CL_HTTP_SERVER=>IF_HTTP_SERVER~APPEND_FIELD_URL
    EXPORTING
      NAME   = ''parameter Name'
      VALUE  =  "Here, you can add your wanted passed parameter
    CHANGING
      URL    = lw_url.
  CALL METHOD CL_HTTP_SERVER=>IF_HTTP_SERVER~APPEND_FIELD_URL
    EXPORTING
      NAME   = ''parameter Name'
      VALUE  =  "Here, you can add your wanted passed parameter
    CHANGING
      URL    = lw_url.

* opent the external pop-up window
  lo_api_comp = wd_comp_controller->wd_get_api( ).
  lo_window_mg = lo_api_comp->get_window_manager( ).
  lo_window = lo_window_mg->create_external_window( url = lw_url ).
  lo_window->open( ).

(2).In the Comp B, you can use the following code to PARSE the URL parameter


* get the value from the calling application
  lw_string = wdr_task=>client_window->IF_WDR_CLIENT_INFO_OBJECT~GET_PARAMETER( 'Parameter name' ).
  lw_carrid = lw_string.
  clear: lw_string.
  lw_string = wdr_task=>client_window->IF_WDR_CLIENT_INFO_OBJECT~GET_PARAMETER( 'Parameter ' ).
  lw_connid = lw_string.

Hope it can help you a little

Best wishes.

Former Member
0 Kudos

Hi Can & Aditya,

Thanks for your suggestions.

I have two requirement with the same solution.

One requirement is for table(not ALV) and the other with ALV.

The one with ALV:

I don't have the context nodes to go for interface node.

I have dynamic nodes and the data is filled dynamically.

eg:

  • now the nodeinfo is created

lo_node_alv_info = lo_node_alv_info->add_new_child_node(

name = 'ALV_DATA'

is_mandatory = abap_true

is_multiple = abap_true

static_element_rtti = struct_type

is_static = abap_false ).

lr_node = wd_context->get_child_node( 'ALV_DATA' ).

IF <lt_table> IS NOT INITIAL.

lr_node->bind_table( <lt_table> ).

ENDIF.

Is there any way that I can get the data of the the table row on which the linktoaction is set.Like when they click on 9110234 I get the information of that table row to the popup window of other webdynpro component compB.

This is because I need to read the data based on their selection data.

I need to get the data of the table row selected to compB window to display the data in compB

Can you please explain in detail.

Thanks in advance.

Edited by: Amol Ghatuk on Oct 14, 2010 7:53 PM

Former Member
0 Kudos

off course, you can get your table(table & ALV) data no matter your context node is created statically or dynamically..

You can check, in the Link-to-action handler, there is one Parameter Named "WDEVENT".There is one inside parameter of "WDEVENT" named "context_element".Also, you can debug at runtime, then you will find it..

The parameter "context_element" is just you selected link-to-action row...

Hope it can help a little.

Best wishes.

Former Member
0 Kudos

Hi Can,

In r_param and wdevent I get only the cell on which I click that is 922105 but not the table row

for eg:

pernr leave

922105 vacation

986574 sick

I want both 922105 and also vacation(in the next column but the same row) that is the table row because i use both of these criteria to pull the data in the popup.

I still didnt get how to send these details to the compB popup from compA ONCLICK EVENT where I trigger the popup.

Thanks in advance.

Former Member
0 Kudos

Okay..

You said you can get the column "pernr" value..Now, why cannot you get the whole row?..There are so many methods to get the whole row columns by using the Context Node bound to your table, for example:


*1. get the all the context elements of the context node bound to your table
  lt_elmes = lo_node->get_elements( )..
*2. loop the lt_elments then get the right elmenent which contains the "pernr" value
  loop at lt_elmens into lo_elem.
     lo_elem->get_attribute( 
         exporting
              name = 'pernr'
          importing
              value = lw_pernr
    ).
     if  lw_pernr = the "pernr" value you have already got.
       " now you can get the *right* Context elemenet.
     endif.
   endloop.

In addition, i said:

About how to pass the value from "Comp A" to "Comp B", as well as pass back the value from "Comp B" to "Comp A",. You can use the "Interface method" or "Interface context", and "Event" if necessary, i think you can get more detail info by searching these topics. Here, sorry not to paste the example coding..

One example clue:

in your Comp B, pls design one interface method named "get_if_paras" which has 2 parameters : pernr and leave.


method get_if_paras.
   "use the 2 parameters to set  to the Context Node in Comp B
endmethod.

Then, in your Comp A, you can call this Interface method to pass your pernr and leave to Comp B. For example:


* Get reference to component interface of instance Comp B
  l_ref_interfacecontroller = wd_this->wd_cpifc_child( ).

* Call method CHILD_METHOD of instance CHILD
  l_ref_interfacecontroller->get_if_paras(
    pernr   = 
   leave = ).

These is just one EXAMPLE.

In detail,you can search them in Google or SDN.

Hope it can help you a little.

Best wishes.

Former Member
0 Kudos

Hi Can,

Appreciate your help.

Below is the method on click in compA.

DATA:lw_url type string,

lo_window_mg TYPE REF TO if_wd_window_manager,

lo_api_comp TYPE REF TO if_wd_component,

lo_window TYPE REF TO if_wd_window.

DATA: lo_INTERFACECONTROLLER TYPE REF TO ZIWCI_Z_SAMPLE,

l_pernr_dummy TYPE string.

field-symbols: <l_value> type DATA.

assign r_param->value->* to <l_value>.

  • get the URL of the called application

CALL METHOD CL_WD_UTILITIES=>CONSTRUCT_WD_URL

EXPORTING

APPLICATION_NAME = 'ZZ_SAMPLE'

IMPORTING

OUT_ABSOLUTE_URL = lw_url.

lo_INTERFACECONTROLLER = wd_this->wd_cpifc_sample( ). "SAMPLE IS comB

lo_interfacecontroller->get_data(

l_pernr_parent = l_pernr_dummy " string

).

  • opent the external pop-up window

lo_api_comp = wd_comp_controller->wd_get_api( ).

lo_window_mg = lo_api_comp->get_window_manager( ).

lo_window = lo_window_mg->create_external_window( url = lw_url ).

lo_window->open( ).

endmethod.

When it executes it give a dump at

lo_INTERFACECONTROLLER = wd_this->wd_cpifc_sample( ). "SAMPLE IS comB

The dump says:Component Usage SAMPLE Does Not Have an Active Component

In ST22 it says: Runtime Errors UNCAUGHT_EXCEPTION

Exception CX_WDR_RT_EXCEPTION

Error analysis

An exception occurred which is explained in detail below.

The exception, which is assigned to class 'CX_WDR_RT_EXCEPTION', was not caught

and

therefore caused a runtime error.

The reason for the exception is:

Component Usage SAMPLE Does Not Have an Active Component

Can you please explain how can I resolve this.

Thanks in advance.

Former Member
0 Kudos

hi,Amol..

Sorry for reply late, as i just see the thread..

okay, from your shared coding, i find some miss, and show some suggestion:

(1).Add Comp B as used component in Comp A

In "Property" tab of Component controller of Comp A, create the Comp B as used component.

In addition, if you want to use Comp B in any other View, you also should add it as used component in the View.

About this, i think you have already done right!

(2).In coding, when you want to call the Controller of Comp B, You can use the coding directly just as what you wrote:


lo_INTERFACECONTROLLER = wd_this->wd_cpifc_sample( ). "SAMPLE IS comB

Pls remember, in "property" tab of component controller, you just DECLARE the Comp B, you still didn't CREATE or INSTANTIATE the comp B. So, instead, you should use:


lo_INTERFACECONTROLLER = wd_this->wd_cpifc_sample( ). "SAMPLE IS comB
IF LO_INTERFACCONTROLLER->HAS_ACTIVE_COMPONENT( ) IS INITIAL.
    LO_INTERFACCONTROLLER->CREATE_COMPONENT( ).
ENDIF.

"then you can call the interface controller

In addition, off course, you should active Comp B firstly..

Hope it can help you a little.

Best wishes.

Former Member
0 Kudos

Hi Can,

I have solved that issue

LO_INTERFACCONTROLLER = wd_this->wd_cpuse_sample( ). "need to add this too

IF LO_INTERFACCONTROLLER->HAS_ACTIVE_COMPONENT( ) IS INITIAL.

LO_INTERFACCONTROLLER->CREATE_COMPONENT( ).

ENDIF.

so here I am trying to pass the parameter from compA to an interface method (get_data) of comB.

lo_INTERFACECONTROLLER = wd_this->wd_cpifc_sample( ).

lo_interfacecontroller->get_data(

l_pernr_parent = <l_value> " data

).

In compB in the interface method (get_data) of the component controller II have the importing parameter 'l_pernr_parent' .

I am getting the value from compA to the parameter 'l_pernr_parent' but the problem is when I try to set that attribute in the context it doesn't accept the value means it doesn't show up in the result .But when i put the same code in wddoinit Its shows the value i tested it by hard coding a value.

But the problem here is:

How to send this 'l_pernr_parent' value to wddoinit.

Is there any way I can bind the value to the context in the interface method itself.

Below is the code I tried to bind the data in to the context node in the interface method (get_data) it didn't work and not updating the view.

data l_pernr type string.

l_pernr = l_pernr_parent.

*DATA: lo_nd_info TYPE REF TO if_wd_context_node,

  • lo_el_info TYPE REF TO if_wd_context_element.

  • lo_nd_info = wd_context->path_get_node( path = `HEADER` ).

  • lo_el_info = lo_nd_info->get_element( ).

*

  • lo_el_info->set_attribute( name = 'PERNR' value = l_pernr ).

Only if the code is in wddoinit it accepts the value but there i don't have the value which I am getting from comA.

Can you please help.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi ,

create a component usage of the component A in component B.

In the handler of linkToAction , generate the code to raise pop-up using wizard . In the wizard , select the whichever window you want to raise as a pop-up.

Now to pass data , you can use interface nodes .

Create an interface node in component A (you can access this from component B also), now on click of the link , before raising the pop-up , set the interface node (node from component A) with the values (say emp number in your case).

In the component A , you can now access the table data in WDODOINIT of the view and process further.

Also look at the thread [thread|] for more info on interface node.

thanks.

aditya.