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

Event in Table Maintenance Generator

Former Member
0 Likes
1,410

Hi,

I have created a Custom Table.

Now I am validating an Field value while making entry  in a Custom Table through SM30 using the events in TMG.

I have written an validation in the Events

1. Before saving the data in Data base

2. Creating a new entry

Problem is when i enter the value and Press on ENTER key

the data gets validate and show the Error Message but when i press on save button these events are getting triggered but instead of

throwing the error Message   the data gets saved.

Please help me how to resolve this.

Regards,

Shashikanth               

1 ACCEPTED SOLUTION
Read only

nabheetscn
SAP Champion
SAP Champion
0 Likes
1,351

On save are you reading data from EXTRACT and TOTAL table to validate?

Check this code for stopping it

 

DATA: ls_record TYPE <Custom Table>.

LOOP AT total .
READ TABLE extract WITH KEY <vim_xtotal_key>.
IF sy-subrc = 0.
ls_record = total.
IF ls_record-abc IS INITIAL OR
ls_record-def
IS INITIAL OR
ls_record-erf
IS INITIAL.
MESSAGE i115.
vim_abort_saving =
'X'.
ENDIF.
ENDIF.
ENDLOOP

.

Hi,

I have created a Custom Table.

Now I am validating an Field value while making entry  in a Custom Table through SM30 using the events in TMG.

I have written an validation in the Events

1. Before saving the data in Data base

2. Creating a new entry

Problem is when i enter the value and Press on ENTER key

the data gets validate and show the Error Message but when i press on save button these events are getting triggered but instead of

throwing the error Message   the data gets saved.

Please help me how to resolve this.

Regards,

Shashikanth               

2 REPLIES 2
Read only

nabheetscn
SAP Champion
SAP Champion
0 Likes
1,352

On save are you reading data from EXTRACT and TOTAL table to validate?

Check this code for stopping it

 

DATA: ls_record TYPE <Custom Table>.

LOOP AT total .
READ TABLE extract WITH KEY <vim_xtotal_key>.
IF sy-subrc = 0.
ls_record = total.
IF ls_record-abc IS INITIAL OR
ls_record-def
IS INITIAL OR
ls_record-erf
IS INITIAL.
MESSAGE i115.
vim_abort_saving =
'X'.
ENDIF.
ENDIF.
ENDLOOP

.

Read only

Former Member
0 Likes
1,351

Check in debug mode while saving whether control goes in the validation code you have written.

Also provide more details on what code you have written for validation on saving the entry .