on 11-18-2009 6:01 AM
Hi,
I am new to web dynpro. I am designing a web dynpro application where I have a log in view, in which the user will enter the username and the password. On submitting the user will be able to log in to the application. I have developed a ztable wherein I have maintained the user name and the passwords. Now I am not able to connect the view , component controller and the ztable. Please guide me as to how should I proceed.
Regards,
Ashutosh
hi ashutosh ,
Please guide me as to how should I proceed.
please follow the steps in my first reply to this thread and in the OnActionSubmit method write the piece of code
which I posted in my second reply
You neednot map the view controller and comp controller.
when u create the attributes under node in ur component controller and map it to the views , the attributes created in this way r
global and can be accessed across differnt views. evn if u wish to use it in ur sinle view , thn also its recommended to craete it in component controller
u wud get it
if u r beginner in WD ABAP , follow these links to learn WD ABAP :
http://help.sap.com/saphelp_nw2004s/helpdata/en/03/0048413e466e24e10000000a155106/content.htm
Main Topic Page:
http://sdn.sap.com/irj/sdn/nw-wdabap#section2
Tutorials for Beginners:
eLearning Videos:
/people/thomas.jung/blog/2006/06/20/web-dynpro-abap-demonstration-videos
cheers
regards,
amit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi ashutosh ,
Now I am not able to connect the view , component controller and the ztable.
proceed like this :
1 in the attribute's tab in ur component controller , create a context node
2 in the context node , create two attributes USERNAME , and PASSWORD of type string
3 map the context ( drag n drop the node) from ur component controller to the view , the attributes created shud be reflected in ur view now. attributees created in this way r global and cn be accessed by several views
4 in ur view , go to the layout tab
5 right click on ROOT ELEMENT CONTAINER , insert element
6 maintain the MATRIX DATA for ur ROOTelement container
7 insert the UI s , 2 input fields , and 1 button
8 maintain the layout data as MATRIX HEAD DATA for all the UIs , so that UIs appear in the beginning of ur line.
9 map the VALUE property of ur two input fields , with the context attributes created ie USERNAME and PASSWORD
9 in the Action property of ur Button , write the name of appropriate action , suppose u write SUBMIT
10 a method OnActionSubmit wud be created in the methods tab of ur view
11 in this method , get the values entered by user in the two fields
12 u can use code wizard for the same , press CNTL + F7 , choose the button read context node/attribute
13 thn using the GET_ATTRIBUTE method , u wud get values in ur local variables
14 u can use the value to update ur ztable
15 for ur this view , which u want to fire create a OUTBOUND PLUG
16 create INBOUND PLUG for ur next view , which u want to navigate
17 After this, create a navigation link mapping the outbound plug of your view and the inbound plug of the target window
I hope it wud surely help u
regards,
amit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
1.Create a view with has 2 fields User name(input field) and password(input field)
you can make the input field as password field by checking the property of the input field as passwordfield(flag the check box)
2.As user enters the username and password
Create a button login.
on action of it
lo_el_user_role->get_attribute(
EXPORTING
name = `USER_ID`
IMPORTING
value = lv_userid ).
lo_el_user_role->get_attribute(
EXPORTING
name = `password`
IMPORTING
value = lv_password. )
SELECT * FROM zrm_c_cv_overl INTO CORRESPONDING FIELDS OF TABLE lt_resume_info WHERE userid = lv_userid AND pasword = lv_password...
if sy-subrc = 0.
navigate to next view.
fire the plug which u r using to navigate to next view.
endif.
Plugs:
create an out bound plug for login view.
create an inbound plug for next view u want to navigate.
go to windows of the component and establish the navigation link.
Priya
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi,
Follow these steps:
1. Design your first view with User name and PAssword.
2. Use input fields so that user can enter username and password.
3. After user enters it, get the entered data using get_Attributes method.
4. On the click of button, check whether the values entered by user exist in database table or not.
5. If not, throw an error message.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi,
And also where to write the code
You got to have one button in your first view.
In the OnAction of button, write the code to get the data entered by user and validate it.
mean how should I connect view context and the controller context.
You neednot map the view controller and comp controller.
Just make the two context attributes in Context Tab of View Controller for UserName and Password.
And you can read them in button onAction using Code Wizard (control + F7 ).
Hi ,
1Create a node in component controller with name Logindata
Create the attributes userid and password .the attributes should be of the type where u have cretaed the fields in the table where u storing all the usernames and pass words.
2.Go to the view .
go to context tab.
drag and drop the node to the view's context.
3.desiging the lay out.
a..Create a view with has 2 fields User name(input field) and password(input field)
you can make the input field as password field by checking the property of the input field as passwordfield(flag the check box)
b.Create a button login.
.As user enters the username and password
in the events of the buttons
i.e n action of the button
write the below code.
lo_el_user_role->get_attribute(
EXPORTING
name = `USER_ID`
IMPORTING
value = lv_userid ).
lo_el_user_role->get_attribute(
EXPORTING
name = `password`
IMPORTING
value = lv_password. )
SELECT * FROM zrm_c_cv_overl INTO CORRESPONDING FIELDS OF TABLE lt_resume_info WHERE userid = lv_userid AND pasword = lv_password...
if sy-subrc = 0.
navigate to next view.
fire the plug which u r using to navigate to next view.
endif.
And you can refer the link which i mentioned to navigate between the views.
Priya
hi Ashutosh ,
here is the code for ur reference , which u wud write ( or be able to genrate some of it thru code wizrad)
by pressing CONTROL+F7
// *read the context attribute USERNAME and PASSWORD under context node cn_all*
DATA lo_nd_cn_all TYPE REF TO if_wd_context_node.
DATA lo_el_cn_all TYPE REF TO if_wd_context_element.
DATA ls_cn_all TYPE wd_this->element_cn_all.
DATA lv_username LIKE ls_cn_all-username.
DATA lv_password LIKE ls_cn_all-password.
* navigate from <CONTEXT> to <CN_ALL> via lead selection
lo_nd_cn_all = wd_context->get_child_node(
name = wd_this->wdctx_cn_all ).
* get element via lead selection
lo_el_cn_all = lo_nd_cn_all->get_element( ).
* get single attribute
lo_el_cn_all->get_attribute(
EXPORTING
name = `USERNAME`
value = lv_username) .
* get single attribute
lo_el_cn_all->get_attribute(
EXPORTING
name = `PASSWORD`
value = lv_password) .
next is ur ABAP code
DATA : itab type standard table of ztable.
SELECT * FROM ztable INTO CORRESPONDING FIELDS OF TABLE ltab WHERE
userid = lv_username AND pasword = lv_password.
refer this thread for navigating between views :
//fire to ur next view
wd_this->FIRE_PLUG( ) .
do let me know in case of further queries
regards,
amit
Hi ashutosh,
you can get the method get_attribute in yourr own code when you try to read the context node ar attribute using ctrl+f7. there you can see get_attribute method and for navigation relate thin you can get tutorial name as tutorial3 on navigation in wd abap.
hope it helps you
regards,
anand
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
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.