on 02-08-2005 12:27 PM
Hi,
I have asked this before but I closed that thread and awarded all the points.
I'm still having trouble with it, so I post it again for clarification.
I have a BSP, a.bsp
in the Page Attributes I have a parameter error1 which is a string with the AUTO box checked
in the OnInitialisation Event I set error1 = 40
in the layout error1=40 is used as a trigger
in the layout there is a submit button which leads to the OnInputProcessing Event for the same page
in the OnInputProcessing Event I have an if statement with the criteria if error1 = 40
my problem is when I debug, error1 has not value assigned in the OnInputProcessing Event so my if statement gets ignored
why is that ? surely the value of the string parameter should be automatically carried from the OnInitialisation Event to the OnInputProcessing Event - because it is correctly defined in the page attributes with auto checked.
Anybody any ideas ?
Thanks,
Tomas.
Hi Tomas,
that's not necessary. Let me give you some pieces of source code:
<b>Layout:</b>
<%@page language="abap"%>
<%@extension name="htmlb" prefix="htmlb"%>
<htmlb:content design="design2003">
<htmlb:page title = " ">
<htmlb:form>
<htmlb:inputField id = "var1"
visible = " "
value = "<%= value %>" />
<htmlb:button id = "submit"
text = "Press Me <%= value %>"
onClick = "myClickHandler" />
</htmlb:form>
</htmlb:page>
</htmlb:content>
<b>onInitialisation:</b>
value = value + 1.
<b>onInputProcessing:</b>
DATA: event TYPE REF TO CL_HTMLB_EVENT.
event ?= CL_HTMLB_MANAGER=>GET_EVENT_EX( runtime->server->request ).
IF event->id = 'submit' AND event->event_type = 'click'.
DATA: data TYPE REF TO CL_HTMLB_INPUTFIELD.
data ?= CL_HTMLB_MANAGER=>GET_DATA( request = runtime->server->request
name = 'inputField'
id = 'var1'
).
IF data IS NOT INITIAL.
value = data->value.
ENDIF.
ENDIF.
Page attribute: value type string
Instead of a counter you can use your your number as value.
Hoping that helps.
Regards,
Rainer
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rainer,
are you therefore confirming that setting a page attribute to Auto does not necessarily mean it will be possible to pass that attribute from Event to Event ?
isn't the sequence:
onInitialisation
Layout
onInputProcessing
my scenario is:
onInitialisation
get some info from R/3
and if info meets certain criteria
error1 = 40
Layout
if error1 = 40
render certain htmlb within
the main htmlb for the general screen
onInputProcessing
if error1 = 40
do stuff
except error1 has lost its value
I will try what you say, but if I understand correctly,
for your example my error1 will have to become a hidden input field in the Layout - which is ok, but it is a shame that this seems to contradict the doco with regard to automatically passing attributes of the same name between events in the same page and between pages.
Thanks, I'll give it a try with a hidden input field.
Tomas.
Hi Tomas,
it depends if you run stateless or statefull. Here is the control flow of a BSP:
http://help.sap.com/saphelp_47x200/helpdata/en/a3/4b9afa7aa511d5992e00508b6b8b11/frameset.htm
Regards,
Rainer
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Rainer,
thank you very much for your patience, you are indeed correct, I was mistaken and I accept my mistake.
The problem is solved your way with the:
DATA: data TYPE REF TO CL_HTMLB_INPUTFIELD.
data ?= CL_HTMLB_MANAGER=>GET_DATA(
request = runtime->server->request
name = 'inputField'
id = 'rejectReason'
).
IF data IS NOT INITIAL.
rejectReason = data->value.
ENDIF.
and I continue my path the BSP enlightenment.
I think all points have been awarded to you, if not let me know I'll award them.
Thanks again and sorry for having my head in the sand,
Tomas.
Tomas,
the AUTO attribute wors correctly. Please read my last reply.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rainer,
can I just clarify for the record, you said:
"First comes the OnInitialisation, then the OnInputProcessing (if you click on the button) and finally the Layout.",
for me it works like this:
Page A - onCreate
Page A - onRequest
Page A - onInitialisation
Page A - Layout
Page A - onInputProcessing - potentially with a redirect calling again this same page
Page A - onCreate
Page A - onRequest
Page A - onInitialisation
Page A - Layout
Also, for me, as we have to go to all of this trouble with event handlers to retrieve the value of the Page Attribute, it means the Auto functionality is not working - as described in the documentation.
From the documentation one would interpret the description to mean if you set Auto on the Page Attribute then you can access the value of that attribute throughout the BSP events and / or other BSP's - no where is it described that you have to create event handlers to get to the value of the Page Attribute.
Mine though is still not working because of the problem described above, so for the time being I will discout this method as not being possible to pass newly assigned Page Attributes from the onInitialisation event to the onInputProcessing event via the Layout on the same page.
Thanks,
Tomas.
Tomas,
the value is also in OnInputProcessing available. Just add the line:
value = value + 1.
in OnInutprocessing and you will see that the counter increses by 2. First comes the OnInitialisation, then the OnInputProcessing (if you click on the button) and finally the Layout.
Regards,
Rainer
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I've got some stupid error,
DATA: event1 TYPE REF TO CL_HTMLB_EVENT.
event1 ?= CL_HTMLB_MANAGER=>GET_EVENT_EX( runtime->server->request ).
IF event1->id = 'submit' AND event1->event_type = 'click'.
DATA: data1 TYPE REF TO CL_HTMLB_INPUTFIELD.
data1 ?= CL_HTMLB_MANAGER=>GET_DATA( request =
runtime->server->request
name = 'inputField'
id = 'error1'
).
IF data1 IS NOT INITIAL.
error1 = data1->error1.
ENDIF.
ENDIF.
I get the error:
Field error1 is unknown. it is neither in one of the specified tables nor defined by a data statement.
Which is strange because I have it in the page attributes and, in the layout I have:
<htmlb:inputField id = "error1"
type = "string"
required = "false"
visible = "false"
value = "<%= error1 %>" />
Thank you for your input, if I can't get this to work I'll do it the long way.
But I think, a lesson for everybody we are concluding that it is not true that by setting an attribute to Auto you make it available to all events and other pages where the same attribute name is set.
Thanks,
Tomas.
Hi Tomas,
the Auto attribute should also work. Try my example above without OnInputProcessing and with the following layout:
<%@page language="abap"%>
<%@extension name="htmlb" prefix="htmlb"%>
<htmlb:content design="design2003">
<htmlb:page title = " ">
<htmlb:form>
<htmlb:inputField id = "value"
visible = " "
value = "<%= value %>" />
<htmlb:button id = "submit"
text = "Press Me <%= value %>"
onClick = "myClickHandler" />
</htmlb:form>
</htmlb:page>
</htmlb:content>
Important is now, that the id of the inputfield has the same name as the page attribute (in my case 'value').
Sorry for that mistake.
Regards,
Rainer
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rainer,
thanks, your example works, I have that working too already, just to clarify, I have no problem passing the value from the onInitialisation to the Layout, it is getting the value from the Layout with the Submit to the onInputProcessing event which cause me the problem, so the onInputProcessing is the most important part for me.
I try your suggestion for getting the value in the onInputProcessing event using the:
DATA: event TYPE REF TO CL_HTMLB_EVENT.
event ?= CL_HTMLB_MANAGER=>GET_EVENT_EX( runtime->server->request ).
IF event->id = 'submit' AND event->event_type = 'click'.
DATA: data TYPE REF TO CL_HTMLB_INPUTFIELD.
data ?= CL_HTMLB_MANAGER=>GET_DATA( request = runtime->server->request
name = 'inputField'
id = 'var1'
).
IF data IS NOT INITIAL.
value = data->value.
ENDIF.
ENDIF.
will report back the results.
Thanks,
Tomas.
Message was edited by: Tomas Altman
could it be that you use a stateless application and you navigate between to pages? Normaly it is not a problem to set one field in the OnInitialisation and the value is also available in the onInputProccessing(as long you dont navigate to another page)
What about an initialize statement for your error1 field?MAybe there is one you didnt realize?(only a hint)
Message was edited by: Thorsten Blechinger
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Raja,
thank you, I cannot move this to the OnCreate because I do some manipulation of the parameters which have been received from a different page in the OnInitialisation Event, the result of which sets this new parameter - the manipulation of the parameters from the other page doesn't work in the OnCreate Event.
Thorsten,
I have no problem passing parameters from the OnInputProcessing event of Page A to the OnInitialisation event of Page B.
My problem is passing a new parameter from the OnInitialisation Event of Page B to the OnInputProcessing Event of Page B.
to confirm, in Page B I have a parameter ERROR1 in the Page Attributes set to Auto.
I assign this parameter a value in the OnInitialisation event of Page B and then this value is used in the Layout of Page B
But, after the User presses Submit in the Layout of Page B and goes to the OnInputProcessing event in Page B the parameter ERROR1 has lost its value and is initial.
Thanks,
Tomas.
well it's just a,
<% if error1 = 40. %>
some htmlb
<% endif. %>
but the 40 value which was calculated and assigned in the onInitialisation event is also useful in the subsequent onInputProcessing - after the User hits the Submit button in the layout.
I have solved it by doing the same logic calculations in the onInputProcessing event, but it would have been easier to just continue using the value of the ERROR1 parameter in the onInputProcessing event - which is how I interpreted the doco that it should work.
Thanks,
Tomas.
For the OnInputProcessing you have to read the value of the error1 I would suggest you set the value of error1 in a hidden form field in your layout and then use the get_form_field to read that value in the OnInputProcessing.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Quote from the sap F1 help:
<i>Automatic Page Attribute
A page attribute marked as automatic is automatically supplied with a value from the calling URL or the navigation from another page. However there must exist a parameter of the same name with value in the URL or navigation interface.
Example of supplying a value using the navigation interface, when there is an automatic attribute with nameFLIGHT in the target page:
navigation->set_parameter( name = 'FLIGHT' value = "LH" ).
Note
Automatic page attributes cannot have reference types as their associated type.</i>
Tomas do you use the navigation interface as described?
Craig,
thanks for the quick reply, I just tried putting in a hidden input field in the layout to carry the value from the Initialisation event through the Submit button to the OnInputProcessing event - but it didn't work
<htmlb:inputField id = "error1"
type = "string"
required = "false"
visible = "false"
value = "40" />
also tried with, value = "<% error1 %>" />
but I didn't use your 'get_form_field' in the OnInputProcessing Event because I thought as Thomas points out that if a Page Attribute is set to Auto then it will be carried from Event to Event or Page to Page ?
Thomas, I don't think I need to use your,
navigation->set_parameter( name = 'FLIGHT' value = "LH" ).
because this is all in the same Page, just going between OnInitialisation Event and OnInputProcessing Event.
I do use the,
navigation->set_parameter( name = 'FLIGHT' value = "LH" ).
navigation->goto_page( event->event_server_name ).
but only for a back button to a different Page.
Interestingly this page is navigated to automatically from another page and all of the parameters which come over automatically from the other page arrive fine and are available in all events, it is only the parameters which I set in the OnInitialisation Event which are not availablem for other Enents in the same page - which aren't working - even though they are available to the layout after the OnInitialisation.
Oh well I keep trying.
Thanks for feedback, any more ideas ?
Tomas.
Message was edited by: Tomas Altman
User | Count |
---|---|
82 | |
10 | |
10 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.