11-27-2018 8:56 AM
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.
11-28-2018 2:15 AM
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).
11-27-2018 4:15 PM
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
11-28-2018 2:15 AM
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).