cancel
Showing results for 
Search instead for 
Did you mean: 

To get value from URL

Former Member
0 Kudos

Hi All,

Am working on a project where we are creating Jernal Entries involving 2 webdynpro components. One is for requester and the other is for approver.

The requester will input JE field values in the screen input fields and click on Submit button. A request number will be generated on clicking submit.

Once the submit is clicked a mail will be sent to approver inbox which will have the URL for approver component + the request number created. i.e, say the URL for approver component is https://approver.com and the request number of the jernal entry request created by the requester is 1000, then the URL that is sent to approver by mail will be https://approver.com/1000.

Now when the approver clicks on the URL that he has got in mail, I need to capture the value of the request number that is there in the URL and bind to the context of approver component and show the approver the jernal entry screen with JE values populated for the corresponding request number captured.

Pls let me know if there is a solution.

Thanks,

Subathra

Accepted Solutions (0)

Answers (5)

Answers (5)

uday_gubbala2
Active Contributor
0 Kudos

Hi Subathra,

If you would like to have a document to read about this concept then you can try go through [section 3.1 of this free sample ebook|http://www.google.co.in/url?q=http://www.sap-press.de/download/dateien/1079/sappress_web_dynpro_for_abap.pdf&ei=7zZoSsC0DIOHkQXT1PC5Cw&sa=X&oi=spellmeleon_result&resnum=2&ct=result&usg=AFQjCNEcYevDfbEmZKmCGviRkNRgHth6FA] of Ulli Hoffman's Web Dynpro For ABAP. He explains with an example as to how you can transfer parameters through URL.

Regards,

Uday

Former Member
0 Kudos

Hi Radhika,

Am new to this parameter passing concept.

If I need to capture a value(say Request_id) from the application URL(say https://adobeforms.com?Request_id=1234) and populate the corresponding application's UI elements with values corresponding to the request_id 1234 - what all should be declared where(in which window or view - methods) & what logic to be written.

Thanks in advance for the help.

Thanks,

Subathra

Former Member
0 Kudos

Hi,

Did you try placing the code provided in my previous reply in the DefaultHandle Method of the Window? OR another approach would be as follows, 1. Define Request_Id in the application parameters; Click on the application->parameters->give Request_Id 2. In the HANDLEDEFAULT also define the same parameter Request_id. Now request_id is directly accesible in that method. You will directly get the value in the Request_id . Regards, Radhika.

Former Member
0 Kudos

Hi Subhatra,

It is very simple just follow the lines below.

You can do in 2 ways

Method 1:

a.Go to HANDLEDEFAULT method of your window and in interface declare request_id(Name should be same as the name given in URL).

b. When the control came to the above method the value will be populated automatically and you write your logic to get other values for ui elements and bind the values to nodes/attributes.

Method2:

data: lv_param type string.

lv_param = wdr_task=>client_window->get_parameter( 'REQUEST_ID' ).

here you will get value into variable lv_param then proceed with your logic to get remaining values.

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

>lv_param = wdr_task=>client_window->get_parameter( 'REQUEST_ID' ).

You shouldn't access WDR_TASK directly. It is an API object and using it to get the URL parameters is not approved for customer/partner usage.

You should use the approach already suggested and linked from the online help of using the handledefault of the inbound plug:

http://help.sap.com/saphelp_nw70ehp1/helpdata/en/45/2233b60c21072ce10000000a155369/frameset.htm

Although the parameter mapping of putting the named parameters as imports does work, it should be avoided in this case. It is primarily a feature for event parameter mapping. If you do use it, be sure and marke the import parameter as optional or you could get short dumps if the URL parameter isn't present.

Former Member
0 Kudos

Hi Subatra,

Please find the code below. Even I used same code for the same requirement.

FIELD-SYMBOLS: <fs_data> TYPE tihttpnvp,

<ls_data> TYPE ihttpnvp,

data ls_parameter type LIKE LINE OF wdevent->parameters.

READ TABLE wdevent->parameters INTO ls_parameter WITH KEY name = '_ALL_URL_PARAMETERS'.

if sy-subrc eq 0.

LOOP AT <fs_data> ASSIGNING <ls_data>

WHERE name = 'PERNR'.

IF <ls_data>-name = 'EMPID'.

lv_pernr = <ls_data>-value.

ELSEIF <ls_data>-name = 'CLNO'.

lv_claimno = <ls_data>-value.

ENDIF.

ENDLOOP.

endif.

Former Member
0 Kudos

Hi,

Can you please explain the steps in detail. I have used the below code in the inbound plug of my window. But not able to capture the value.

wdevent->get_data( EXPORTING name = '_ALL_URL_PARAMETERS'

IMPORTING value = lt_all_url_param ).

It will be of great help if any of you code give a step-by-step procedure.

Thanks,

Subathra

Former Member
0 Kudos

Hi Subathra, Are you performing this logic from within the Startup Plug of the Window? You need to call this in the HANDLEDEFAULT eventhandler method of the Window. Check this link [http://help.sap.com/saphelp_nw70ehp1/helpdata/en/45/2233b60c21072ce10000000a155369/frameset.htm] Regards, Radhika.

Former Member
0 Kudos

Hi, You would need to call this from within the inbound plug of your window.

wdevent->get_data( EXPORTING name = '_ALL_URL_PARAMETERS'
                             IMPORTING value  = lt_all_url_param ).
"WDEVENT is a default parameter for the DEFAULT inbound plug. 
Check these threads too; Regards, Radhika.

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

Be careful hardcoding '_ALL_URL_PARAMETERS' directly. You should really use the SAP provided interface constant (if_wd_application=>all_url_parameters) instead.