cancel
Showing results for 
Search instead for 
Did you mean: 

Get current browse window url

prathamesh_gandhi
Participant
0 Kudos

Hi All,

I want to read the Currently open windows URL ?? should i look into WDR_TASK class as we are using this for reading the URL parameter.

Thanks In Advance.

P$G

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

To find URL first get the application name and then pass this to method CONSTRUCT_WD_URL

of class CL_WD_UTILITIES to get the URL.

To get Applicatioon name follow this:

In IF_WD_COMPONENT~GET_APPLICATION returns the application object of type IF_WD_APPLICATION. Use IF_WD_APPLICATION~GET_APPLICATION_INFO that returns object of type IF_WD_RR_APPLICATION and user IF_WD_RR_APPLICATION~GET_NAME method to get the application name.

To get URL from application name:

CALL METHOD cl_wd_utilities=>construct_wd_url
EXPORTING
application_name = 'APPLICATION NAME'
in_protocol      = 'HTTPS'
IMPORTING
out_absolute_url = url_string.  "url_string has your URL

prathamesh_gandhi
Participant
0 Kudos

Hi Harshith,

thanks for your reply. but the method you have specified will give me only static URL for specified Application.

In my case-- I am opening external window B from A (Parent window). and the window B's URL is dynamically changes according to Parameters.

and i want read the URL of window B in that window itself.

is there any other method for this or any other way to achieve this ??

Thanks In Advance

P$G

Former Member
0 Kudos

Hi,

That is the reason i have mentioned to find the application name first.

First find the application name in external window and then pass it to that mathod.

prathamesh_gandhi
Participant
0 Kudos

Hi Harshit,

I have written below code. how can i create the instance of these ? it gives me dump as Null Reference . can you please edit and make it correct ???

DATA : LO_COM TYPE REF TO IF_WD_COMPONENT,

          LO_APP TYPE REF TO IF_WD_APPLICATION,

          LO_APP_INFO TYPE REF TO IF_WD_RR_APPLICATION,

          LV_NAME TYPE STRING,

          LV_URL TYPE STRING.

   CALL METHOD LO_COM->GET_APPLICATION

     RECEIVING

       RESULT = LO_APP.

   CALL METHOD LO_APP->GET_APPLICATION_INFO

     RECEIVING

       RESULT = LO_APP_INFO.

   CALL METHOD LO_APP_INFO->GET_NAME

     RECEIVING

       RESULT = LV_NAME.

  

  

   CALL METHOD CL_WD_UTILITIES=>CONSTRUCT_WD_URL

     EXPORTING

       APPLICATION_NAME = LV_NAME

       IN_PROTOCOL      = 'HTTPS'

     IMPORTING

       OUT_ABSOLUTE_URL = LV_URL.

Former Member
0 Kudos

Hi ,

Add the following code to get the object for IF_WD_COMPONENT.

You will have wd_comp_controller attribute in attributes tab of your view.

Data : lo_comp type ref to if_wd_component.

lo_comp = wd_comp_controller->wd_get_api().

Hope this should solve the issue.

chengalarayulu
Active Contributor
0 Kudos

Hi Pratham,

Below is the modified code, please check.

DATA : LO_COM TYPE REF TO IF_WD_COMPONENT,

          LO_APP TYPE REF TO IF_WD_APPLICATION,

          LO_APP_INFO TYPE REF TO IF_WD_RR_APPLICATION,

          LV_NAME TYPE STRING,

          LV_URL TYPE STRING.

***************

LO_COM = WD_COMP_CONTROLLER->WD_GET_API( ).

******************

   CALL METHOD LO_COM->GET_APPLICATION

     RECEIVING

       RESULT = LO_APP.

   CALL METHOD LO_APP->GET_APPLICATION_INFO

     RECEIVING

       RESULT = LO_APP_INFO.

   CALL METHOD LO_APP_INFO->GET_NAME

     RECEIVING

       RESULT = LV_NAME.

     

   CALL METHOD CL_WD_UTILITIES=>CONSTRUCT_WD_URL

     EXPORTING

       APPLICATION_NAME = LV_NAME

       IN_PROTOCOL      = 'HTTPS'

     IMPORTING

       OUT_ABSOLUTE_URL = LV_URL.

prathamesh_gandhi
Participant
0 Kudos

Hi Chengalarayulu,

The code provided by the Harshit is also working fine. but its not meet my requirement..

Explanation:- i think we don't need to write all this code because this gives the same application we create in SE80. so we can directly pass the same to the CONSTRUCT_WD_URL method.

Now, I have 2 components lets say A & B, from component A i am calling component B as external window (URL). using method CONSTRUCT_WD_URL i am constructing the URL and same time I am adding few parameter to the original URL.

e.g Original URL--- /sap/bc/webdynpro/z_appln

After Adding Parameter--- /sap/bc/webdynpro/z_appln?EKORG=AB01&BUKRS=1000

Now in Component B, i want to read the URL which is generated after adding the parameters i.e. Currently open window's B URL.

Thanks In Advance

P$G.

chengalarayulu
Active Contributor
0 Kudos

Hi Pratham,

Just create an interface node in component A, and define component usage of component A in B, and set the URL which you have generated in Component A to interface node's attribute and read the same in Component  B.

Entire new URL will be available in Component B now.