Morning All,
I've searched the Forum and the blogs but can't find an answer to this hence posting the question...
Question, within the OnInitialisation Event of a page can I make a redirect/forced reload of the same page and including a Url parameter - from my experience I get Page Not Found when I try the reload of the same page with a Url parameter included, but if I put a different page name in the redirect it works fine - except I want to redirect back to this page and have a different layout triggered by the parameter in the Url ?
I have a page, a.htm
in the OnInitialisation Event I have a re-direct:
if my condition is met...
navigation->goto_page( '../notes_private/a.htm?error1=10' ).
when I execute this I get Not Found in the browser
I have also tried:
navigation->set_parameter( name = 'error1' value = '10' ).
navigation->goto_page( '../notes_private/a.htm' ).
still get the same, page Not Found
if I set it to a different page it works perfectly though, like:
navigation->goto_page( '../notes_private/b.htm' ).
But I want to keep this neat and tidy and redirect/reload this page with the Url parameter acting as a trigger for a change in the Layout.
Does anyone have any ideas how I can solve this.
Thanks,
Tomas.
Hi, I have already done redirection to the same page several times. I did it in the oninputprocessing though.
And I didn't specify any page, so it'll remain in the same page anyway.
I don't understand some things in your example.
What is the main purpose? If it's only to set some variables (depending on some conditions or not) for setting a correct layout, I wouldn't redirect at all. Just set the variables. Redirecting is less performant anyway.
Secondly, you don't need to set a path if you refer to the same page. I wouldn't set any paths as long you stay within the same BSP app.
If you still need to redirect, don't forget to set your page attributes as auto (in case you didn't). That doesn't solve your page not found though;-)
Give some more details if you need some more info.
Hi Tomas,
I have never done a redirect so I build my own example:
Layout:
<%@page language="abap"%>
<%@extension name="htmlb" prefix="htmlb"%>
<htmlb:content design="design2003">
<htmlb:page title = "Urlparametertest ">
<htmlb:form>
<htmlb:textView text = "Parameter: <%= urlparameter %>"
design = "EMPHASIZED" />
<br>
test.htm?error=10">link1
<br>
test.htm?error=30">link2+parameter
</htmlb:form>
</htmlb:page>
</htmlb:content>
OnInitialization code:
data parameter type string.
parameter = request->get_form_field( 'error' ).
if parameter eq '10'.
navigation->goto_page( 'test.htm?error=20' ).
endif.
if parameter eq '30'.
navigation->goto_page( 'test.htm?error=40' ).
endif.
urlparameter = parameter.
My example works perfectly so my guess is that somehow you must use a wrong url in the goto_page method.
Add a comment