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: 

screen-record already exists

Former Member
0 Kudos

hi sap,

i have screen with 6 fields and when i enter values and click save button... if the record already exists it should give me message that record already exists

am able to save the record in the table but how to get that info can you please provide me some logic which would be much helpful.

and when i enter worng values on the screen...it should say enter valid values and should give me an option to re-enter the values...

your help is much apreciated.

regards,

laya.

3 REPLIES 3

sridhar_meesala
Active Contributor
0 Kudos

Hi,

You need to validate those fields in order to give the requored message:

Suppose if you want to validate an employee number whether it exists in the database or not and then if it doesn't then you have to save it, you can do the following in the PAI

SELECT SINGLE empno

FROM <ztable>

INTO <local variable>

WHERE empno = <the field name in screen painter>.

IF sy-subrc = 0.

MESSAGE 'Emp no already exists' TYPE 'E'.

ELSE.

save the empno to ztable.

In order to avoid the disabling of the fields after entring the wrong data place the field in CHAIN. and ENDCHAIN.

Hope this solves your problem.

Thanks,

Sri.

Former Member
0 Kudos

Hi,

You gotto validate your values you enter. To do this, you need to write the code for validation in your PAI and enclose the module in a CHAIN...ENDCHAIN so that your fields dont get locked on wrong input.

I am giving you a snippet

PROCESS AFTER INPUT.

CHAIN.

FIELD Z_EKKO-EBELN. "Screen field

MODULE USER_COMMAND_0100.

ENDCHAIN.

MODULE USER_COMMAND_0100 INPUT.

SELECT SINGLE ebeln FROM Z_EKKO INTO lv_ebeln WHERE EBELN eq Z_EKKO-ebeln.

if sy-subrc eq 0.

MESSAGE E000.

endif.

ENDMODULE.

Former Member
0 Kudos

answered and thank you