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: 

Event for preventing a new entry in DBTable

Former Member
0 Kudos

hi all,

please suggest me a event in table maintenance to have a check for preventing the entry into the table. i tried event 18 but wen the error msg is displayed it comes out of record entry window which is to be avoided.

regards

Madhu

1 ACCEPTED SOLUTION

Former Member
0 Kudos

My friend it is not

18

. it is

05

-> Creating New Entry.

so that you can validate with the User and do the validation and update the table .

"Below is the code for  it

Select 05 for an event for “Creating a new entry”.

This event will be triggered while creating a new entry in SM30 or using the TCODE.

Form Name: AT_NEWENTRY (Enter key)

Double Click on the editor.

form at_newentry.
Ztab-ZCOUNTRY = ‘India’.
Ztab-ZCREATEDATE = sy-datum.
Ztab-ZCREATETIME = sy-uzeit.
endform.

Create another event: 02 for “After Save”

FORM after_save.
Ztab-mandt = extract+0(3).
Ztab-ZCOUNTRY = extract+3(3)..
Ztab-ZCREATEDATE = sy-datum.
Ztab-ZCREATETIME = sy-uzeit.
MODIFY ztab.
ENDFORM. "after_save

Step 4: Create Transaction Code.

Go to SE93.

Transcation code: ZTAB
Transaction text Test Table Maintenance Events
Transaction: SM30, Skip first Screen
Default Values:
VIEWNAME ZTAB
UPDATE X

Reward points if it is usefull....

Girish

11 REPLIES 11

Former Member
0 Kudos

Hi Madhu,

What is your need? You want to restrict the new entries to table on what basis?

Can you explain in more detail.

Regards,

Atish

Former Member
0 Kudos

My friend it is not

18

. it is

05

-> Creating New Entry.

so that you can validate with the User and do the validation and update the table .

"Below is the code for  it

Select 05 for an event for “Creating a new entry”.

This event will be triggered while creating a new entry in SM30 or using the TCODE.

Form Name: AT_NEWENTRY (Enter key)

Double Click on the editor.

form at_newentry.
Ztab-ZCOUNTRY = ‘India’.
Ztab-ZCREATEDATE = sy-datum.
Ztab-ZCREATETIME = sy-uzeit.
endform.

Create another event: 02 for “After Save”

FORM after_save.
Ztab-mandt = extract+0(3).
Ztab-ZCOUNTRY = extract+3(3)..
Ztab-ZCREATEDATE = sy-datum.
Ztab-ZCREATETIME = sy-uzeit.
MODIFY ztab.
ENDFORM. "after_save

Step 4: Create Transaction Code.

Go to SE93.

Transcation code: ZTAB
Transaction text Test Table Maintenance Events
Transaction: SM30, Skip first Screen
Default Values:
VIEWNAME ZTAB
UPDATE X

Reward points if it is usefull....

Girish

0 Kudos

Hi all,

Events 01 & 05 r not getting triggered when i try to make a new entry in sm30. can pls tell me the exact scenario at when it gets triggered. my case is that i just want to show a error message to user and prevent the entry being posted.

regards

Madhu

0 Kudos

yes, i just saw that Madhu.

But once the user clicks on "SAVE" or comes out without saving the entires or tries to enter a data and delete and clicks on "BACK" the event will get triggerd.

If u dont want a user to edit/enter new data u can do it without the "EVENTS" part itself.

u can do it by specifying the Authorization group for the table itself.

y do u want to go for events?

0 Kudos

Thanks for all ur inputs,

i hav used event 05 for error msg display - thats seems ok, but how can i identify which is the newly entered entry in this event ? i c no flag in total...r can u pls giv me some other event whr i can see the newly entered values - i have error msg probs in event before save and after data change...kindly suggest other event

regards

Madhu

0 Kudos

Hi,

use the stmnt - break-point in the events and test. u will understand when the events are triggered.

event for 'before save'- 01

event for after data change- chk 08.

<i>but how can i identify which is the newly entered entry in this event ?</i>

- need to check.

- waiting for other SAP Gurus inputs...

0 Kudos

In after data change '08' am able to get modified values - but i have problems with error msg display.

0 Kudos

pls explain the problem with the error message

0 Kudos

Hi all,

Problem solved !! event used '05'

i was able to capture the modified value in screen field name as it loops for all new entry entered. (anjali this is wat u were lookin for...

Note: in this event table total will not be populated with new entries.

points awarded to all valuable answers. am closing the thread

Thanks for ur ideas.

0 Kudos

Thanks.

Good research.

will be helpful in future.

Regards,

Anjali

Former Member
0 Kudos

Hi,

Use the event '05'. Creating a new entry.

Give your message in the coding section, with Authorization chks or as per ur requirement.

(Also try 01, incase the above dosn't work).

Thanks & Regards,

Anjali