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

avoid same entry in ztable

Former Member
0 Likes
1,699

i created ztable ..for inserting data into that table i used module pool programming....my requirement is to avoid the same data inserted... i got error message whevever i insert same data in table...what i do for this problem

9 REPLIES 9
Read only

Former Member
0 Likes
1,124

Hi,

You need to put a validation on the Save event and check whether a record already exists with the same Primary Key. You can throw your own error message to the user in such case.

Hope this helps.

Regards,

Himanshu

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,124

set Primary key in you table.

check whether that entry already exists in the table before insertion.

Its Better you can go for table maintenance.

Read only

Former Member
0 Likes
1,124

Hi Dhanu,

What i understand from the issue, you need to mark one field as a Mandatory field and that should be your primary key.

When user enters the same entry, it will sort with the Primary key and if it already exist it will display an error message saying that 'Entry already exist'

Ex : If table-mandatory = S_mand (Where user enters the value)

message 'Entry already exist

endif.

Please refer to the link below :

Hope the information is helpful.

Regards,

Kittu'

Read only

matt
Active Contributor
0 Likes
1,124

Duplicate deleted. Please avoid posting the same entry in the forums.

Read only

Former Member
0 Likes
1,124

Hi Dhanu,

Use DELETE ADJACENT DUPLICATES FROM TABLEbefore going to the ZTABLE (That is you delete the internal table itself.)

Please Try this.

Regards,

K.Karthikeyan.

Read only

Former Member
0 Likes
1,124

Hi,

When you use 'Modify' stmt instead of 'Insert' stmt, an entry with existing key will update the existing entry and an entry with new key will be inserted i.e. you will not get the error for the same entry.

Read only

Former Member
0 Likes
1,124

Hi,

check the following points

1) check whether your table has primary key or not

2) put validation before inserting new record and use insert command do not use modify command

Thanks & Regards,

Sateesh.

Read only

RahulKeshav
Active Contributor
0 Likes
1,124

Hi Dhanu,

Just get the data from ur ztable into internal table itab and compare it with ur internla table jtab..

delete the records from jtab which exist in the itab.

then insert ztable from table itab .

thnx

RK

Read only

Former Member
0 Likes
1,124

Use addition ACCEPTING DUPLICATE KEYS with an INSERT statement.

Hope this will be helpful.