cancel
Showing results for 
Search instead for 
Did you mean: 

Validation of login screen in WebDynpro ABAP

Former Member
0 Kudos

Dear All,

I have created a login screen using WebDynpro ABAP, but am not able to validate user name and password.

Please help in this with coding and if possible with samll example.

Thanks & Regards,

Tazeer KS.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Tazeer,

Assuming that, you are using two Input fields for the user name and password, Please try to follow below steps for the validation.

1. Select your input-field UI-element and set the 'State' property to 'required'.Now you will see a (*) symbol next to your input-field label.

2. Now place the following code in the WDDOBEFOREACTION Method.

data:  lt_msg TYPE cl_wd_dynamic_tool=>t_check_result_message_tab,
          lo_view_controller TYPE REF TO if_wd_view_controller,
 
  lo_view_controller ?= wd_this->wd_get_api( ).
 
  cl_wd_dynamic_tool=>check_mandatory_attr_on_view(
    EXPORTING
      view_controller = lo_view_controller
      display_messages = abap_true    "Set this true to display the message in message area
    IMPORTING
      messages = lt_msg ).

Please do let me know if you face any problems.

Thanks & Regards,

Prashant Jagdale

Former Member
0 Kudos

This message was moderated.

Answers (4)

Answers (4)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

If it is a logon screen that interacts with SAP user accounts, you really shouldn't use WDA for this. There is a logon screen framework that allows you to create a custom UI without having to replicate secure functionalites like password reset. You can read more about the process here:

http://help.sap.com/saphelp_nw70ehp1/helpdata/en/48/3a061a902131c3e10000000a42189d/frameset.htm

0 Kudos

hi,

in the event handler- which is the OnAction of the button, you need to validate the password

u read the passowrd enterd by reading the context attribute(inside the context node) to which the Value property of ur Input UI is bound... code wizard can be used by Control+F7 and the method get_attribute can be used to access the value entered by the user...

this value needs to be validated against the actual passowrd set for the user

if there is no password entered,then as posted in the first reply to the thread, u can do the validations...

regards,

Amit

Former Member
0 Kudos

Hi Tazeer, i have posted on scribd this document, step by step webdynpro login application,

pls go through the following link

http://www.scribd.com/doc/50261280/Login-Application-in-webdynpro

Step1:

Create 1 node in component controller and bind the attributes of dictionary structure USR02

Step 2: Select the required fields, bname and bcode,

Step3: Create Main View as shown, and bind the context view and component node and bind the input fields.

Step4:

Create second view for navigation.

Note:

First main view is outbound.

Second view is inbound.

method ONACTIONLOGIN .

TYPES : BEGIN OF ty_usr02,

bname TYPE USR02-bname,

bcode TYPE USR02-BCODE,

END OF ty_usr02.

DATA it_usr02 TYPE TABLE OF ty_usr02.

DATA lo_nd_login TYPE REF TO if_wd_context_node.

DATA lo_el_login TYPE REF TO if_wd_context_element.

DATA ls_login TYPE wd_this->Element_login.

DATA lv_bname TYPE wd_this->Element_login-bname.

DATA lv_bcode TYPE wd_this->Element_login-bcode.

  • navigate from <CONTEXT> to <LOGIN> via lead selection

lo_nd_login = wd_context->get_child_node( name = wd_this->wdctx_login ).

  • @TODO handle non existant child

  • IF lo_nd_login IS INITIAL.

  • ENDIF.

  • get element via lead selection

lo_el_login = lo_nd_login->get_element( ).

  • alternative access via index

  • lo_el_login = lo_nd_login->get_element( index = 1 ).

  • @TODO handle not set lead selection

IF lo_el_login IS INITIAL.

ENDIF.

  • get single attribute

lo_el_login->get_attribute(

EXPORTING

name = `BNAME`

IMPORTING

value = lv_bname ).

  • get single attribute

lo_el_login->get_attribute(

EXPORTING

name = `BCODE`

IMPORTING

value = lv_bcode ).

IF lv_bname is INITIAL and lv_bcode is INITIAL.

else.

SELECT bname bcode from usr02 INTO TABLE it_usr02 WHERE bname = lv_bname

and bcode = lv_bcode.

ENDIF.

wd_this->fire_out1_plg(

).

endmethod.

Hope it might help you,

Get back to me if your issue is not solved.

Thank you

Former Member
0 Kudos

Hi,

actually i go through the link but document is deleted from scribd

Former Member
0 Kudos

Hi ,

how did u create login screen?I mean what UI elements have you used .

Assuming that you have used an 2 input filelds and a login button, you can read the context attribute bound to the input fields

in the event handler of the login button and hence obtain the entered values and validate them.

Thanks,

aditya.