cancel
Showing results for 
Search instead for 
Did you mean: 

Reg : Two WD components communication.

Former Member
0 Kudos

hi ,

I have created 2 Wd components Flights and Bookings.

Flights WD component is using Bookings component as USED component .

Iam calling 2nd WD Bookings component in an external window.

METHOD onactioncall .

DATA : lv_url TYPE string.

CALL METHOD cl_wd_utilities=>construct_wd_url

EXPORTING

application_name = 'Z187442_ALV1'

IMPORTING

out_absolute_url = lv_url.

DATA lo_window_manager TYPE REF TO if_wd_window_manager.

DATA lo_api_component TYPE REF TO if_wd_component.

DATA lo_window TYPE REF TO if_wd_window.

lo_api_component = wd_comp_controller->wd_get_api( ).

lo_window_manager = lo_api_component->get_window_manager( ).

CALL METHOD lo_window_manager->create_external_window

EXPORTING

url = lv_url

RECEIVING

window = lo_window.

lo_window->open( ).

ENDMETHOD.

here my req is : I want the selected values from first component FLIGHTS .....to be exported to second component BOOKINGS...SO that I can write a select statement based on values imported from 1st component .

Select * from sbbok into table it_bookings where carrid = (here carrid value should be the one which is selected from the first application lead index)

Connid =(here connid value should be the one which is selected from the first application lead index)

any ideas ?

regards

Arjun

Accepted Solutions (1)

Accepted Solutions (1)

uday_gubbala2
Active Contributor
0 Kudos

Hi Arjun,

I had created my application so that up on lead selection in the 1st application the corresponding SFLIGHT details would get passed to the 2nd WDA and it would display the relevant details from SBOOK. I created an action for the lead selection & within this method am appending the CARRID, CONNID & FLDATE values to the 2nd applications URL.

CALL METHOD cl_wd_utilities=>construct_wd_url
    EXPORTING
      application_name = 'Z187442_MAIN1_SUBCOMPONEN'
    IMPORTING
      out_absolute_url = lv_url.

  concatenate lv_url '?' 'CARRID=' wa_data-carrid '&'
                         'CONNID=' wa_data-connid '&'
                         'FLDATE=' wa_data-fldate into lv_url.

So now when you call the 2nd application even the required parameters would have been passed on to it.

Now within the 2nd application you would have to receive these passed parameters and code your SELECT so that it would fetch the desired data and bind it to your context node.

1) Go to the inbound plug (which should be DEFAULT generally unless you have renamed it) & double click on it

2) Within the event handler method HANDLEDEFAULT put the desired coding like shown below

METHOD handledefault .
  DATA: lr_node TYPE REF TO if_wd_context_node,
        lt_data TYPE ig_componentcontroller=>elements_sbook.

  select * from sbook into corresponding fields of table lt_data
          where carrid = carrid and connid = connid and fldate = fldate.

  lr_node = wd_context->get_child_node( name = 'SBOOK' ).
  lr_node->bind_table( new_items = lt_data ).
ENDMETHOD.

I have tried it out this way and its working fine. But yes you would be able to see the values being passed in the URLu2026

Regards,

Uday

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

Pls refer the [Tutorial|https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/2e71ce83-0b01-0010-11a4-98c28a33195f]. u can get an Idea about Component Usage.

Regards.

Padmam.

Former Member
0 Kudos

Hello Arjun,

I understand that, You want to send the Carrid/Connid values(should be the one which is selected from the first component) from first component to second component?

Solution:

Create a Interface method in the 2nd component with two importing paramters and call this method in the first component --> then these parameter becomes exporting for the first component -->pass the required values to second component using these parameters --> now your second component will have these data.

Interface method means --> In 2nd component component controller when u create a method make it as interface(check the checkbox).

All the interface methods and interface nodes of the reused component(2nd) can be accessed by main component(1st).

Thanks,

Bharath.K

Edited by: Bharath Komarapalem on Dec 12, 2008 1:41 PM