cancel
Showing results for 
Search instead for 
Did you mean: 

Reading url parameter in HANDLEDEFAULT method

Former Member
0 Kudos

Hi,

May be I am doing something very silly but I am trying to read URL parameter in my HANDLEDEFAULT method of MAIN window , and I am trying to define URL paramter as Method parameters but its gives me run time exception every time 'The ASSERT condition was violated.'

my simple paramter is like this HEADER_ID TYPE importing associated type STRING

Can any body help me why this error happens.

Regards,

Gaurav

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

just add &HEADER_ID=value in the url in the browser.

Former Member
0 Kudos

Hi,

have you also declared the parameter HEADER_ID in your WD Application ?

Regards

Michael

Former Member
0 Kudos

No I have not. I tried by chaging this name to other name but I keep getting same error. Is it nessacary that URL from which I am calling this application should have this Paramter otherwise It will give error?

Regards,

Gaurav

Former Member
0 Kudos

Hello, Gaurav,

Have you tried something like this:


  DATA: l_url_parameters          TYPE tihttpnvp,
        l_url_parameter           TYPE ihttpnvp.
 
  wdevent->get_data( EXPORTING name  = if_wd_application=>all_url_parameters
                     IMPORTING value = l_url_parameters ).
 
  READ TABLE l_url_parameters WITH KEY name = 'parameter_name'
                              INTO l_url_parameter.
 
  IF sy-subrc EQ 0.
 
*    your value treatment here
 
  ENDIF.

There's no need to declare your parameters as method parameters.

Regards,

Andre

former_member215843
Active Participant
0 Kudos

The parameter must be filled either as an application parameter or as a URL parameter. The recommended solution is to define the parameter in the application with some appropriate default value, and then you can redefine it with a URL parameter.

In the future parameters can be declared as optional, but currently this is not possible

Ciao Regina

Former Member
0 Kudos

Regina,

Using the code above, I can read any parameters, even those that are not declared in my application. I believe that's a good approach, specially if you have optional parameters.

Regards,

Andre