on 01-16-2006 4:09 PM - last edited on 02-04-2024 2:03 AM by postmig_api_4
Hi All,
I am developing a BSP application that contains a region/subregion relationship. For example, when a user selects a region 'NORTH AMERICA', it should refresh the page and display another dropdown that has sub-region options for 'NORTH AMERICA' only. For example, 'NORTH EAST', 'SOUTH EAST', 'SOUTH WEST', 'MID WEST', etc...
The problem that I have with it is that when I select a region, it triggers an "onSelect" event of the dropdown control thus refreshing the BSP page and losing all other values that the user has already entered such as name, DOB, etc...
So my question is whether there is a way to trigger a dropdown event to refresh the BSP without losing any of the data already in the form. I could do it by setting "auto" parameters, but that would be a mess as some of the data resides in very complex structures and internal tables.
Ideally, I would just pass the 'region' selection as the "auto" parameter to perform a filter on sub-regions in onInitialize routine. Unfortunately, if I do it now, I lose all the other stuff.
Please let me know if you had a similar challenge, and if you were able to solve it.
Thanks very much!
Roman D.
Hi Roman,
You can try something like this. In OnInputProcessing add the code to get the form values and again store it.
for example:
***********************************************
call method request->get_form_field
EXPORTING
name = 'inputfield1'
RECEIVING
value = inputfield_value.
where 'inputfield1' is the ID of the inputfield in ur layout and the value is the value u entered before selecting the dropdown.
*******************************************
in the similar way u can use the structure to retain the entered values. Hope this helps.
Regards,
Shailaja
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Shaijala,
Your answer is very interesting, but my problem is that i dont know how to work with methods in the events...do you have any guide, example or documents...¿? ( u or anybody)
For example I use your example in my code and it doesnt work, the error talks about: Field "ENDMETHOD" is unknow.
Tx guys!
Best regards,
Mon
Hi Shailaja,
Thanks for your response. However, I'm not sure I completely understand it. If I use REQUEST->GET_FORM_FIELD method to retrieve all data entered in my form prior to dropdown event, the page will then refresh, thus losing all my data. Or, are you suggesting that I do the actual database commit twice - once on dropdown selection, and the second time when I hit the save button?
Please let me know. My application has to be stateless, so may be I will not be able to use such solution.
Thanks for your quick response!
Roman D.
Hi Mon & Roman,
Probably i was not clear in explaining you my concept. I had the similar issue what Roman has and i solved in this way. Iam would explain you with an example on my page with 2 input fields and 2 dropdowns one country and other the state: say input fields to enter First name and Last name and the state drop down gets the list depending on the country selected. I would take 4 variables as the page attributes:
fname type string,
lname type string,
gt_country type table of t005,
gt_state type table of t005u,
country type string,
state type string.
**NOTE the type definitions for tables can be defined under the tab TYPE DEFINITIONS of the page***
****LAYOUT********************
First Name:
<htmlb:inputField id = "firstname"
value = "<%=fname%>"
width = "150"
design = "STANDARD" />
Last Name:
<htmlb:inputField id = "lastname"
value = "<%=lname%>"
width = "150"
design = "STANDARD" />
Country:
<htmlb:dropdownListBox id = "country"
width = "200"
tooltip = "Select a COuntry"
selection = "<%=country%>"
table = "<%= gt_country %>"
onSelect = "myHandler"
nameOfKeyColumn = "LAND1"
nameOfValueColumn = "LAND1" />
State:
<htmlb:dropdownListBox id = "state"
selection = "<%=state%>"
table = "<%= gt_state %>"
nameOfKeyColumn = "BLAND"
nameOfValueColumn = "BLAND" />
*****onInitialization/OnCreate****** you can write the code in any event handler
select land1 into corresponding fields of table gt_country from t005.
*****onInputProcessing******
call method request->get_form_field
EXPORTING
name = 'firstname' "the id of the inputfield
RECEIVING
value = fname. "variable
call method request->get_form_field
EXPORTING
name = 'lastname'
RECEIVING
value = lname.
call method request->get_form_field
EXPORTING
name = 'country'
RECEIVING
value = country.
call method request->get_form_field
EXPORTING
name = 'state'
RECEIVING
value = state.
if country is not initial.
select bland into corresponding fields of
table gt_state from t005u
where spras eq sy-langu and
land1 eq country.
endif.
****************
i have taken a very simple example to show the dropdowns as well as the inputfields. IF a page has many fields displayed probably instead of single call for single field we can have single call for all the fields in this way:
***************
DATA: i_ffs TYPE tihttpnvp,
form1 TYPE ihttpnvp,
form2 TYPE ihttpnvp.
request->get_form_fields( changing fields = i_ffs ).
read table i_ffs into form1 with key name = 'firstname'.
. ...
.
.
********************
Roman for ur Q:---
<b>However, I'm not sure I completely understand it. If I use REQUEST->GET_FORM_FIELD method to retrieve all data entered in my form prior to dropdown event</b>
I restore the form values am using page attributes to save the values u entered in the form.
Hope i was clear. Please let me know if this something u r looking for.
regards,
Shailaja
HI MON
You can retain your values by this way
Assign an attribute to your form field as a value tag. For example if it is an input field you can define the tag in layout like this
<htmlb:inputField id="ASD"
value="<%= <b>AAA</b> %>"/>
Also define this <b>AAA</b> as an attribute.
now on input processing just write this code....
DATA: DATA TYPE REF TO CL_HTMLB_INPUTFIELD.
DATA ?= CL_HTMLB_MANAGER=>GET_DATA(
REQUEST = RUNTIME->SERVER->REQUEST
NAME = 'INPUTFIELD'
ID = 'ASD'
).
IF DATA IS NOT INITIAL.
AAA = DATA->VALUE.
ENDIF.
what it does is , it gets the value that you fill in the input box and assign it to <b>AAA</b> Whenever any server event is fired....
But in this case you have to do this for all the fields that are there on your form....
It will definitely work....Try out....
Regards
Mithlesh Kumar Jha
User | Count |
---|---|
98 | |
11 | |
11 | |
10 | |
10 | |
8 | |
6 | |
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.