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: 

how to set "Not Null" & "Default" value for a field of a db table in DDIC?

tongping
Explorer
0 Kudos

Hi,

Please refer to the picture first: I didn't see the maintenance places for the last 2 properties of a field of dabatase table, "NOT NULL" u201CDEFAULTu201D (). Is that possible with SAP DDIC; if true, how to do it?

http://bbs.sjtu.edu.cn/file/PIC/1214474726179743.JPG

Sorry, i didn't find possibility to upload and display a picture in SDN, can only to upload it here; if you are afraid there is virus, don't click it.

Regards,

Said

6 REPLIES 6

Former Member
0 Kudos

Hi,

If the field is specified as Key field in SE11 (DDIC) then the NotNull field is X

If the fields are specified as VARCHAR, they are defaulted to Zeros.

reward if useful,

regards,

teja.

Former Member
0 Kudos

Hi,

You can check the check box after the fieldname in SE11 i.e. the column name initial.

If you tick that then this field will not accept null value.

For default value set the values at the domain level .

I hope this will help you.

Help children of U.N World Food Program by rewarding points and encourage others to answer your queries.

0 Kudos

Hi Sandipan,

Regarding "Initial Values", it might affect Not Null property; while even it's not checked, Not Null for many fields is still true. You can check it, e.g. the table I attached, INDX, a SAP delivered db table.

Regarding using domain to set default value, I'll try it.

Thanks

Said

Former Member
0 Kudos

Hi,

Regarding INITIAL VALUE In SAP DDIC Table

You can achieve it Enabling(Check) the Checkbox of Initial After key Checkbox.

If You Do not enter vale for a particular field then field will be filled up with initail value of the Datatype, Field has used.

you can not set default value for a DDIC Table in SAP.

Thanks.

0 Kudos

Hi,

I don't care the function of Inital Value; if it don't help for setting Not Null as true or not.

Please confirm that, true or not? :

Not Null is not possible to set by developers in SAP DDIC, unless the data type don't support a initial value, it will be auto set as Not Null as false, e.g. data type LRAW

Thanks,

Said

0 Kudos

Hi,

pls go throgh following you will understand-

Selecting INITIAL VALUE FLAG-

Select this flag if a field to be inserted in the database is to be filled with initial values. The initial value used depends on the data type of the field.

Please note that fields in the database for which the this flag is not set can also be filled with initial values.

When you create a table, all fields of the table can be defined as NOT NULL and filled with an initial value. The same applies when converting the table. Only when new fields are added or inserted, are these filled with initial values. An exception is key fields. These are always filled automatically with initial values.

Restrictions and notes:

The initial value cannot be set for fields of data types LCHR, LRAW, and RAW. If the field length is greater than 32, the initial flag cannot be set for fields of data type NUMC.

If a new field is inserted in the table and the initial flag is set, the complete table is scanned on activation and an UPDATE is made to the new field. This can be very time-consuming.

If the initial flag is set for an included structure, this means that the attributes from the structure are transferred. That is, exactly those fields which are marked as initial in the definition have this attribute in the table as well.

Regards,

Sujit