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

Validating data using events

Former Member
0 Likes
816

I have added the below code to event 01 (before save). But if I output an error message then I am taken out of the table maintenace. I just want to stop the data from being saved and allow the user to correct the data. I have tried an information message, but then the data is saved..

lit_notif[] = EXTRACT[].

* Loop around the Modifed entries only.
  LOOP AT lit_notif INTO ls_notif.
*                          WHERE ENTRY = 'M'. "M not always left Aligned
*   Ensure entry is left aligned
    CONDENSE ls_notif-ENTRY.
*   If the entry has been modified(delete) and is a 'C' reason code
    IF ( ls_notif-ENTRY = 'U' OR ls_notif-ENTRY = 'N' ) AND
         ls_notif-TAGEN > 0   AND
         ls_notif-LTRUR > 0.
*     Not allowed to populate both hours and days
      MESSAGE E007(Z1) with ls_notif-KUNUM.
    ELSEIF ( ls_notif-ENTRY = 'U' OR ls_notif-ENTRY = 'N' ) AND
             ls_notif-TAGEN = 0   AND
             ls_notif-LTRUR = 0.
*     Must populate hours or days
      MESSAGE E008(Z1) with ls_notif-KUNUM.
    ENDIF.

    MOVE-CORRESPONDING ls_notif TO ls_prior.
    APPEND ls_prior TO lit_prior.
  ENDLOOP.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
794

Hi ,

Change the message type to S and set this parameter .

vim_abort_saving = 'X'.

Regards,

Deepthi

7 REPLIES 7
Read only

Former Member
0 Likes
794

Hi,

Use message type 'S'

and write 'EXIT' immediately after the message

Regards

Krishna

Read only

Former Member
0 Likes
794

Hi,

change the message type E to S and after message write exit command.

put the flag when ever message is triggeres and capture the message in one text..

after the loop.

check the flag and if it is not intial.

again show the message with s and exit.

regards,

prabhduas

Read only

Former Member
0 Likes
794

I have treid the mnessage S and EXIT, but the message doesn't appear now, and the data saves...

Read only

0 Likes
794

yes it happens.

because you kept the exit inside the loop so it comes from the loop and it does not comes from the screen.

so catch the message in the loop and put in some text.

and outside the loop check the message if it is not initial then again write exit command.

then it will works.

regards,

Prabhudas

Read only

Former Member
0 Likes
794

I've treid at at the end of the subroutine too, and still no joy???

Read only

0 Likes
794

Use warning Message 'W' instead of Error or any other message.

Or :

Use Information message and After that Use Check statement the later half of the code will not be executed.

This will resolve the issue.

Regards,

Gurpreet

Read only

Former Member
0 Likes
795

Hi ,

Change the message type to S and set this parameter .

vim_abort_saving = 'X'.

Regards,

Deepthi