cancel
Showing results for 
Search instead for 
Did you mean: 

how to pass a value from one component to another component in webdynpro

Former Member
0 Kudos

I have created component which consists of alv display and in the alv table  I have created pernr has link and when I click that pernr the second webdypro component opens which I have created . now in the second component I want that pernr value. based on that I want to fetch some data.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Ashiq,

You can send parameter by appending through URL. Jus follow the steps below . It worked for me.

DATA:FIELD-SYMBOLS: <l_value> TYPE ANY.
          ASSIGN r_param->value->* TO <l_value>.

  DATA : str  TYPE string,
           l_window    TYPE REF TO if_wd_window_manager,
           l_cmp_api   TYPE REF TO if_wd_component,
           result TYPE REF TO if_wd_window.


  DATA text TYPE string.   **here I copied field symbol to string
  text = <l_value>.

 

  CALL METHOD cl_wd_utilities=>construct_wd_url
    EXPORTING
      application_name = 'Your second component name'


    IMPORTING
      out_absolute_url = str.

  CALL METHOD cl_http_server=>append_field_url
  EXPORTING
    name   = 'PERNR'
    value  = text
  changing
    url    = str
    .

* Below code is used for popup of second component.

  l_cmp_api = wd_comp_controller->wd_get_api( ).
  l_window = l_cmp_api->get_window_manager( ).

  result = l_window->create_external_window( url = str ).

  result->open( ).

*write below code in second component.


data: lv_pernr1 type string,
lv_pernr type pernr-pernr.
lv_pernr1 = wdr_task=>client_window->get_parameter( 'PERNR' ).
lv_pernr = lv_pernr1.

thanks ,

Vivek Shetty.

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi Ashiq,

Check this below thread's if it might be helpful to you.

Thread1

Thread2

Thread3

Thanks

KH

Former Member
0 Kudos

Hi Katrice Hawkins,

Thank u for the reply.

Former Member
0 Kudos

This message was moderated.

Former Member
0 Kudos

Hi Ozgun,

Thank u for the reply

I went through the document which u sent but it is data transfer using  lead lead selection .

but in my component I have made pernr as a link and when click on that pernr it opens the component in separate tab which I have developed .

I want the value of the pernr which I have clicked on the first component.

naveenvishal
Contributor
0 Kudos

Hi Ashiq,

If you want to one way transfer the data from one component to another, use Plugs.

But if you want to transfer both ways, the data between the components use Context Node.

Hope this helps.

Regards,

Naveen

former_member183073
Active Participant
0 Kudos

Naveen Sir,

Can you tell me how to use plugs for calling another Component?

Apart from calling the parameterised URL i think we can use is declare an Interface method in second Component and pass the values but not sure how to pass values using Plugs.

First thing is how are we going to map the plugs of two different Components.

Message was edited by: Syed Ghulam Ali

former_member183073
Active Participant
0 Kudos

sir this is with in the same component, how will map a plug in one component with another component's Plug? that cannot happen I am sure..

former_member183073
Active Participant
0 Kudos

How are you calling the second Component and also please move the discussion to WebDynPro ABAP

If you calling using the URL of the component then add Parameters to second Component and Concatenate the parameter values in the URL before calling the window.

Former Member
0 Kudos

Hi Syed,

I am calling my second component using the URL .

I tried to concatenate in the URL but I was not able to do it ..

can u just explain in detail so it would be helpful.

Thanks and Regards

Ashiq S A

former_member183073
Active Participant
0 Kudos

See i have this code for example which calls the browser with concatenated URL:


CONSTANTS: l_c_url_part1 TYPE string VALUE '?sap-system-login-basic_auth=X&sap-client=',
                     l_c_url_part2 TYPE string VALUE '&sap-language=EN',
                     l_c_url_part3 TYPE string VALUE '&PARAMETER1=',
                     l_c_url_part4 TYPE string VALUE '&PARAMETER2='.


CALL METHOD cl_wd_utilities=>construct_wd_url
               EXPORTING
                 application_name = 'ZTEST'
               IMPORTING
                 out_absolute_url = l_v_url.

             CONCATENATE l_v_url  l_c_url_part1
                         sy-mandt l_c_url_part2
l_c_url_part3 'VALUE1' l_c_url_part4 'VALUE2' INTO l_v_url.


             CALL FUNCTION 'CALL_BROWSER'
                 EXPORTING
                   url                           = l_v_url1
                   new_window             = 'X'
                 EXCEPTIONS
                   frontend_not_supported = 1
                   frontend_error         = 2
                   prog_not_found         = 3
                   no_batch               = 4
                   unspecified_error      = 5
                   OTHERS                 = 6.
               IF sy-subrc <> 0.
                 MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                         WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
               ENDIF.

Former Member
0 Kudos

Hi Syed,

Thank u for the reply.