cancel
Showing results for 
Search instead for 
Did you mean: 

Want to find calling component name

Former Member
0 Kudos

I have 2 components as below.

component A : in component A have used component B and also embed view of component B in view containner in component A

component B : have only layout for display data

I'd like to know if i want to get the name of component A at the runtime in method of component B, How i can get it ?

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

Pass the calling component name to the called component at the time of calling. Use the sample code below.

DATA:w_url TYPE string,

w_value TYPE string.

*-- Get the URL of the called application

CALL METHOD cl_wd_utilities=>construct_wd_url

EXPORTING

application_name = "called_application_name"

IMPORTING

out_absolute_url = w_url.

**-- make the Value type compatible that has to be passed with the URL

w_value = "Calling_component_name"

  • Attach the parameters and its value with the URL that

  • have to be passed to the 2nd application

CALL METHOD cl_http_server=>append_field_url

EXPORTING

name = 'VARIABLE_NAME'

value = w_value

CHANGING

url = w_url.nerate a popup window for the 2nd application with the above 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( ).

lo_window = lo_window_manager->create_external_window(

url = w_url ).

lo_window->open( ).

And in the called application window handledefault you can retrieve the calling component name.

In the window handedefault of called component make the VARIABLE_NAME as importing paramater, so that you will the varibale_name value in the handledefault code.

Revert for any queries.

Regards,

Simi A M

Former Member
0 Kudos

Hai,

The method name that you use to find out the component name at runtime is called:

CL_WDY_WB_NAMING_SERVICE=>GET_COMPONENT_BY_CLASSNAME

Former Member
0 Kudos

Hi Ravi,

Could you pls give me the example ?