on 09-11-2008 2:01 PM
Hi,
I have a scenario with login screen with a submit button and two views(success and error).
Now I want to show
a)a successful view if user enters a correct login name and password(which will be validated with static values in action method of submit button)
b)a Error view if user enters wrong username and password.
I am struck at action code to write a condition to show respective views.
Some thing like (In Java)
If (login.id=='abc' && login.password='xyz')
show.view1
else
show.view2
I am not familar to ABAP coding as I just started to know.
If anyone know action code, Please help on this.
Thanks in advance
Praveen
Create Outbound plugs to the view1 and view2 from Main view(where submit button is placed) and also create inbound plug in view1( from main) and view2(from main).
If (login.id=='abc' && login.password='xyz')
fire_view1_plug
else
fire_view2-plug.
check this Blog how to navigate to the other view.
Thanks
Suman
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Thanks for the docs.As I said I'm struck at ABAP action code for the submit button, I would appreciate if I get ABAP code that processes login and password with static values and shows appropriate view(success or failure).
OR any application example that demonstrates view navigation based on user input values.
Points will not be a constraint for the expected action code.
Thanks
Praveen
Hi Praveen,
Check this code.
First you have to create Plugs for view1 and view2 from Main view as show in the blogs.
Method onsubmit.
data:
node_input_data type ref to if_wd_context_node,
elem_input_data type ref to if_wd_context_element,
stru_input_data type if_first=>element_input_data.
* navigate from <CONTEXT> to <INPUT_DATA> via lead selection
node_input_data = wd_context->get_child_node( name = 'INPUT_DATA' ).
* get element via lead selection
elem_input_data = node_input_data->get_element( ).
* get all declared attributes
elem_input_data->get_static_attributes(
importing
static_attributes = stru_input_data ).
if stru_input_data-user_name = 'XXXX ' and
stru_input_data-password = 'YYYY'.
* Navigate to view1
wd_this->fire_<plugname>_plg(
).
else.
* Navigate to View2
wd_this->fire_<plugname>_plg(
).
endif.
endmethod.
Thanks
Suman
Hi Suman,
Thanks for the code. my issue is still not solved
I have to change the code with respect to context node info.
My context looks like
Root
->Person
-->Name
-->Address (which is designted as password)
Now how to do modify your code with respect to the context. I'm sorry I m new to ABAP coding.I tried with below changed code.it gave me an error as shown in below.(type if_first=>element_name is unknown)
method ONACTIONACTION_GO .
data:
node_input_data type ref to if_wd_context_node,
elem_input_data type ref to if_wd_context_element,
stru_input_data type iffirst=>element_name._
navigate from <CONTEXT> to <INPUT_DATA> via lead selection
node_input_data = wd_context->get_child_node( name = 'PERSON' ).
get element via lead selection
elem_input_data = node_input_data->get_element( ).
get all declared attributes
elem_input_data->get_static_attributes(
importing
static_attributes = stru_input_data ).
if stru_input_data-name = 'praveen ' and
stru_input_data-address = 'ilkal'.
Navigate to view1
wd_This->Fire_Outtov2_Plg(
).
else.
Navigate to View2
wd_this->fire_<plugname>_plg(
).
wd_This->Fire_Outtov2_Plg(
).
endif.
endmethod.
Error:
type if_first=>element_name is unknown (why this error..?)
Thanks
Praveen
Edited by: Praveen kumar Kadi on Sep 12, 2008 9:38 AM
Hi Praveen,
You have declared correct context node and attributes.
In the previous answer i pasted my code.you have to make some little changes..
You no need to write the code by yourself.you have a code wizard button in the application tool bar,click on that and then select Read from context.Select your context node from value help.thats all it will give you ready made code.
then implement your logic.
Thanks
Suman
User | Count |
---|---|
84 | |
10 | |
10 | |
9 | |
7 | |
6 | |
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.