Application Development 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: 

password code

Former Member
0 Kudos

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

former_member188685
Active Contributor
0 Kudos

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

0 Kudos

Hi,

Cant I do it bu using any FM.

With regards,

Abir.

0 Kudos

Try it with G_CHECK_PASSWORD ...

mirko

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi,

Try with these FM's :

SNC_LOGIN_EXTERNAL_ID

SUSR_USER_EXTID_LOOKUP

If its useful, award points pls..

Regards,

Bharadwaj

Former Member
0 Kudos

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

rahulkavuri
Active Contributor
0 Kudos

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