on 01-06-2005 9:37 AM
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Eddy,
all parameters are checked for auto.
Motivation/Goal:
Within the same page and layout I want to deliver different layouts depending on the value of a parameter.
How it works:
This page is in the private area therefore logon is required.
In the on-initialization event I check to see whether the person loggin in is in a table of people who should see this information.
If yes no problem proceed
If no, reload this page with the error paramter set
When the layout sees the new value of the error parameter it renders the markup within the criteria based on that parameter value.
This works fine if I set the redirect to a different page but I don't want millions of pages based on different conditions, I want to keep everything in one page with different conditions in the layout area giving different information to the Users.
See what I mean ?
Milan.
Oh, we do that all the time. With and without redirecting to another page.
Just test the authorisation and set a variable according to the result. Use this error variable in your layout in order to show the message in the things you display. It's just a matter of testing on that variable then (as you presumably are already doing).
If you do a redirect, it's not only the trafiic that it makes less performant, but you are doing auth tests again (unless you test if you get the error variable or not).
So my conclusion would be not to redirect and handle it with this variable in the page itself.
Hi Tomas
you basically want to show the error message and you want to show it on the same page.
as Eddy said you need not to redirect to same page to show error on the same page.
whenever you are getting error or whatever info you wnat to display that you can set in a variable and that you can display in the layout.
If you are not redirecting to any page it will come to same page.
Regards
Naresh
shall we start a new thread on how to award the points - you can have the ones off there too
Eddy,
when I made my post before last there was a radio button beneath it which said something like click here if this post solved your problem - which I did.
Is that all I have to do or something else ?
Incidentally, I've noticed that although I have 73 posts, the majority of them on here, my positions in the rankings on this topic show me as making a total of only 22 posts which is 100% incorrect - I wonder if the ranking system is broken.
Milan.
You need explitly assign points. See
Have look at https://www.sdn.sap.com/sdn/index.sdn?page=crp_help.htm#posted on how to do this. The whole FAQ is at https://www.sdn.sap.com/sdn/index.sdn?page=crp_help.htm
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>
<htmlb:link id="link1" reference="test.htm?error=10">link1</htmlb:link>
<br>
<htmlb:link id="link2" reference="test.htm?error=30">link2+parameter</htmlb:link>
</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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.