Setting a unique constraint for a table field in SAP

How to add a restriction for a field in a table that should contain only unique values ​​in SAP?

+4
source share
3 answers

So in your table; you want no NON-KEY attributes, right?

  • SE11> Goto> Indexes
  • Create an INDEX in this field and make it unique.
  • SY-SUBRC will be made non-zero + use MANDT
+4
source

Setting a field as a table?

as far as I know, the flag "Unique" for the table field is missing. If you really need such a check, you can encode the control in an event (for example, sm30 / Environnement / Modify / Events) before the data is sent to the database.

considers

0
source

If you want to do this with code ...

ALTER TABLE dbo.MyTable ADD CONSTRAINT MyTable_Code_Name_UniqueKey UNIQUE (Code, Name) 
0
source

All Articles