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

SM30 Event Before saving the data...

Former Member
0 Likes
7,244

Hello,

I tried to capture this event and put the validation as give message type e if one of the field is blank, while it is giving the error it goes ahead and saves the record. How I can prevent it from saving and be on the same screen till the time user makes the change. It is not even executing the line if I am asking it to set the screen to 1.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
4,472

Hi,

You would have ceated table maintenance generator to do this activity right. So there you would have given one function group.

Go to that function group and change screen attribute of the field to 'Required'. Now system will it self show an error message by allowing user to enter values.

No need to do any validation in the EVENT BEFORE SAVE.

Revert if you have any more questions on these.

Regards,

Kusuma K.

Hello,

I tried to capture this event and put the validation as give message type e if one of the field is blank, while it is giving the error it goes ahead and saves the record. How I can prevent it from saving and be on the same screen till the time user makes the change. It is not even executing the line if I am asking it to set the screen to 1.

9 REPLIES 9
Read only

Abhijit74
Active Contributor
0 Likes
4,472

Hi,

Error message will not work. Try with Information message or 'S' and set the parameterVIM_ABORT_SAVE = 'X' , then save will not take place.

Thanks,

Abhijit

Read only

Former Member
0 Likes
4,472

Abhijit thanks for the reply however it is not happeneing. Further more I have put foreign key check on that field but it still saves in the db.

Read only

Abhijit74
Active Contributor
0 Likes
4,472

Hi,

Try this way. After the validation

Perform validate changing W_flag,

if not w_eflag is initial.

message i398(00) with 'Space not allowed in description field'(001) .

move X to vim_abort_saving .

endif.

It works for me.

Thanks,

Abhijit

Read only

0 Likes
4,472

Hi,

Did u try deleting and recreating the maintenance after creating the foreignkey? If it doesn't work, try in the event 05 with below code. Ideally it should work.


DATA:  l_msg(35)      TYPE c.
CONSTANTS:l_e        TYPE c VALUE 'E'.

DEFINE macro_validate.
  if not &1 is initial.
" Your Validations
      if sy-subrc ne 0.
        clear : l_msg.
        concatenate text-001 &1 into l_msg.
        message l_msg type l_e .
      endif.
    endif.
END-OF-DEFINITION.

FORM create_new.
  macro_validate ztab-spcode.

ENDFORM.                    "create_new

Thanks,

Vinod.

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
4,472

Hello Vinod,

I think Event 01 can handle Event 05 as well. If you check the <ACTION> = NEUER_EINTRAG, the event will trigger when a new entry is being saved.

Also if you change some data in the table & try to save it will event 05 trigger ? So in this case the check cannot be made.

@Sanjane: Can you please share the code you written to achieve this ?

BR,

Suhas

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
4,472

Try the same in event 21 once.

Read only

0 Likes
4,472

The event 21 also does not work , I am surprised that how it can go to saving first and then enter custom code even if I use event 01 etc.

Read only

Former Member
0 Likes
4,473

Hi,

You would have ceated table maintenance generator to do this activity right. So there you would have given one function group.

Go to that function group and change screen attribute of the field to 'Required'. Now system will it self show an error message by allowing user to enter values.

No need to do any validation in the EVENT BEFORE SAVE.

Revert if you have any more questions on these.

Regards,

Kusuma K.

Read only

0 Likes
4,472

Hi Kusuma,

Its done, thanks for the information.

Others,

Thanks for your inputs.