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

Default value setting in creating table!

Former Member
0 Likes
4,583

Hi~~

Please let me know how I can set a default value in specific field, when I create a table.

when I create a table in 'SE11', there is an check box option for default value, but I couldn't find any option

where I set default value...

sorry for my poor english.

regards

kyung Woo

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,608

Hello Kyung Woo Nam,

I think you're referring to the <i>Entry help / Check</i> tab that you see in SE11. There is a column there called <i>Defaults</i>, but the purpose of that is not to set the defaults for a field in the table. I agree that the term <i>Defaults</i> might be somewhat misleading in this context.

The checkbox there cannot be edited - which means you cannot decide whether you want to check it or not.

Now when you have a field in a table which is referring to a domain (through a data-element) which has some Fixed-Values defined, the system automatically checks this check-box. If you observe carefully, this checkbox can be found on the <i>Entry help / Check</i> tab. What that means is "even if you don't define a check table for this field, the system by <i>default</i> takes into consideration the fixed-values defined at the domain level for that field. When this screen is placed on any Screen, the system will automatically check if the values entered for that field belong to the set of fixed-values defined for its domain.

I hope this is what you're looking for. If I have misunderstood the question, please get back to me.

And remember, you do not have to apologize saying that your English is bad. The Official language in this forum is ABAP :-). And you're usually unambiguous in your problem statement. Okay ?

Regards,

Anand Mandalika.

7 REPLIES 7
Read only

Former Member
0 Likes
2,609

Hello Kyung Woo Nam,

I think you're referring to the <i>Entry help / Check</i> tab that you see in SE11. There is a column there called <i>Defaults</i>, but the purpose of that is not to set the defaults for a field in the table. I agree that the term <i>Defaults</i> might be somewhat misleading in this context.

The checkbox there cannot be edited - which means you cannot decide whether you want to check it or not.

Now when you have a field in a table which is referring to a domain (through a data-element) which has some Fixed-Values defined, the system automatically checks this check-box. If you observe carefully, this checkbox can be found on the <i>Entry help / Check</i> tab. What that means is "even if you don't define a check table for this field, the system by <i>default</i> takes into consideration the fixed-values defined at the domain level for that field. When this screen is placed on any Screen, the system will automatically check if the values entered for that field belong to the set of fixed-values defined for its domain.

I hope this is what you're looking for. If I have misunderstood the question, please get back to me.

And remember, you do not have to apologize saying that your English is bad. The Official language in this forum is ABAP :-). And you're usually unambiguous in your problem statement. Okay ?

Regards,

Anand Mandalika.

Read only

0 Likes
2,608

Hi,

By the way, if you haven't yet placed your cursor on that field and hit F1, then you must do it immediately.:-)

Regards,

Anand Mandalika.

Read only

0 Likes
2,608

Thanks for your kind answer.

Let me ask you something... Even though I marked the check box for initial.., when the table created, ths SQL like this(object log.)

 CREATE TABLE "ZSDTS003"
("MANDT" VARCHAR2 (000003)
DEFAULT '000' NOT NULL,
"YMON" VARCHAR2 (000006)
DEFAULT '000000' NOT NULL,
"KUNNR" VARCHAR2 (000010)
DEFAULT ' ' NOT NULL,
"GROUP1" NUMBER (000013, 000002)
DEFAULT 0 NOT NULL,
"GROUP2" NUMBER (000013, 000002)
DEFAULT 0 NOT NULL,
"GROUP3" NUMBER (000013, 000002)
DEFAULT 0 NOT NULL,
"GROUP4" NUMBER (000013, 000002)
DEFAULT 0 NOT NULL,
"WAERS" VARCHAR2 (000005)
DEFAULT ' ' NOT NULL)
PCTFREE 10
PCTUSED 40
TABLESPACE PSAPBTABD
STORAGE (INITIAL 0000000016 K
NEXT 0000000160 K
MINEXTENTS 0000000001
MAXEXTENTS 0000000300
PCTINCREASE 0000
FREELISTS 001
FREELIST GROUPS 01)
DDL ½Ã°£___1: ........65 ¹Ð¸®ÃÊ

looks like all fields would be set ' ' by default,

I don't know why initial check box is needed...

please more explain to me~~

Read only

0 Likes
2,608

Hi,

very good proof! Maybe not each database (Oracle,...) defaults values 'NOT NULL' at creation without explicit flag in SE11.

It might also be a problem left by earlier releases.

But this question is more important during field extensions. Normally all fields get distinct values during INSERT (independent of table creation). But when you append (/modify) a table with existing entries, it's a real difference if you default initial values during table adjustment or if you leave 'not maintained' in database (initial and not maintained are two different status on database level).

Regards,

Christian

Read only

0 Likes
2,608

Hi,

I thought you were talking about the <i>Default</i> checkbox in your original post. So it is the <i>Initial Values</i> checkbox, is it? If that's the case, then Christian is right. Here's the actual documentation -

<i>If new fields are inserted in or added to transparent tables in the ABAP

Dictionary, the fields are added to the database by means of an ALTER

TABLE ADD FIELD <field name>..... .

The values for these new fields are undefined (NULL value in the

database), so long as nothing else was specified. This status does not

cause any problems, provided the new fields are not selected.

Example: The numeric field <newfield> was added to a table TAB. If you

access this table with

'SELECT ... FROM TAB WHERE <newfield> <> 5 ...'

records with NULL values in <newfield> are not found, although they

logically satisfy the WHERE condition of the SELECT (since the new

column contains only NULL values). The cause of this is the NULL value

behavior of the database systems.

If the newly added columns are to be selected in this way, the new field

must be created at ADD FIELD with an initial value (force NOT NULL). In

this case, the situation shown in the above example could not occur,

since fields filled with an initial value could be selected correctly.

The initial values depend on data class of the field.</i>

Does that help?

Regards,

Anand Mandalika.

Read only

jayanthi_jayaraman
Active Contributor
0 Likes
2,608

Hi,

If you are generating table maintenance for the table,then you have to use a function group.In the PBO of the function group, you need to set the default value.

Hope this helps.Get back to me if any doubt in this.

Regards,

J.Jayanthi

Read only

0 Likes
2,608

Hi Jayanthi,

I'm sorry, but I fail to see any mention of a table maintenance dialog in the question. It appears to me to be reasonably clear that Kyung Woo is trying to <i>create</i> a table. And that there is a <i>checkbox</i> out there which says <i>Default</i>.

However, I appreciate your enthusiasm in trying to answer the question...Hope to have some nice times here with you.

Regards,

Anand Mandalika.