Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

password code

Former Member
0 Likes
875

Hi all,

I want to write a code for selection screen for username and password but the code should not be hard coded.

It will accept values from a Ztable and check whether that password exists there or not.

If the password dont exist it will throw error The password should match the corresponding user id.

Pls experts help me out which FM to be used and how to proceed with the code.

With regards,

Abir.

7 REPLIES 7
Read only

Former Member
0 Likes
810

Check this code,...

REPORT  z_pass_word  MESSAGE-ID zz                           .

data: wa like ztable.

PARAMETERS: p_user TYPE sy-uname,
            p_passwd(10).


AT SELECTION-SCREEN OUTPUT.

  LOOP AT SCREEN.
    IF screen-name = 'P_PASSWD'.
      screen-invisible = 1.
      MODIFY SCREEN.
    ENDIF.
  ENDLOOP.

  at selection-screen.

    SELECT SINGLE * FROM ztable INTO wa WHERE username = p_user
                                        AND   password = p_passwd.

    IF sy-subrc <> 0.
      MESSAGE e000 WITH 'Please enter valid user id and password'.

    ENDIF.

Regards

vijay

Read only

0 Likes
810

Hi,

Cant I do it bu using any FM.

With regards,

Abir.

Read only

0 Likes
810

Try it with G_CHECK_PASSWORD ...

mirko

Read only

Former Member
0 Likes
810

Hai

Password should be in some other format

I think it is in ascii format or Hexadescimal format

before comparing you will translate into the existing format

Thanks & regards

Sreenivasulu P

Read only

Former Member
0 Likes
810

Hi,

Try with these FM's :

SNC_LOGIN_EXTERNAL_ID

SUSR_USER_EXTID_LOOKUP

If its useful, award points pls..

Regards,

Bharadwaj

Read only

Former Member
0 Likes
810

HI

GOOD

AS PER YOUR REQUIREMENT

YOU WANT TO ACCEPT THE VALUE FROM A ZABLE AND YOU DONT WANT TO CREATE A SELECTION SCREEN FOR THIS.

IF THERE WONT BE ANY SELECTION SCREEN THAN HOW COULD YOU DIRECTLY SELECT THE VALUE FROM THE ZTABLE.

CAN YOU GIVE SOME MORE DETAIL ABOUT YOUR REQUIREMENT.

THANKS

MRUTYUN

Read only

rahulkavuri
Active Contributor
0 Likes
810

hi please copy and run the code below, it will display '*' for the password field.. award points if found helpful

*&---------------------------------------------------------------------*
*& Report  ZKSP_PASSWORD                                               *
*&                                                                     *
*&---------------------------------------------------------------------*
*&                                                                     *
*&                                                                     *
*&---------------------------------------------------------------------*

report  zksp_password .
parameters: p_pass type xuncode.

*---------------------------------------------------------------------*
at selection-screen output.

  loop at screen.
    if screen-name = 'P_PASS'.
      screen-invisible = '1'.
      modify screen.
    endif.
  endloop.

*---------------------------------------------------------------------*
start-of-selection.

  write: / p_pass.


                        .

For getting the password value from data base table the follow the event AT SELECTION given by vijay