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: 

Module Pool Login Query Need

0 Kudos

Am New to Abap.

I need Login Query for Module Pool.

Kindly Correct My Query.

TABLES: ZEMP.

TYPES: BEGIN OF ST_ZPSS,

EID TYPE ZEMP-EID,

PASS TYPE ZEMP-PASS,

END OF ST_ZPSS.

DATA: IT_ZPSS TYPE TABLE OF ST_ZPSS,

WA_ZPSS TYPE ST_ZPSS,

USER(6) TYPE c,

PASS1(6) TYPE C.

CASE SY-UCOMM.

WHEN 'P1'.

SELECT SINGLE EID PASS FROM ZEMP INTO (ZEMP-EID , ZEMP-PASS ) WHERE EID = USER AND PASS = PASS1.

IF SY-SUBRC = 0.

CALL SCREEN 1002.

ELSE. MESSAGE 'WRONG USER NAME AND PASSWORD' TYPE 'E'.

ENDIF.

WHEN 'BACK'.

LEAVE PROGRAM.

ENDCASE.

ENDMODULE.

1 ACCEPTED SOLUTION

DoanManhQuynh
Active Contributor
0 Kudos

in old way:

SELECT SINGLE EID PASS FROM ZEMP INTO ZEMP WHERE EID = USER AND PASS = PASS1.

in new way:

select single @abap_true from zemp into @data(lv_exists) where eid = user and pass = pass1.
if lv_exists = abap_true. call screen 1002. endif.

FYI: you should set password field as invisible to display as asterisk (you can find sample on internet).

2 REPLIES 2

former_member593648
Active Participant
0 Kudos

Hi,

What exactly is the issue that you are facing ?

Ideally you should define the OK_CODE variable first and then do a case-end case on that. That's the better & advisable way of doing this.

Use this blog as a reference - https://www.sapnuts.com/courses/core-abap/module-pool/module-pool-materials.html

Thanks,

Piyush

DoanManhQuynh
Active Contributor
0 Kudos

in old way:

SELECT SINGLE EID PASS FROM ZEMP INTO ZEMP WHERE EID = USER AND PASS = PASS1.

in new way:

select single @abap_true from zemp into @data(lv_exists) where eid = user and pass = pass1.
if lv_exists = abap_true. call screen 1002. endif.

FYI: you should set password field as invisible to display as asterisk (you can find sample on internet).