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: 

Table without primary key

Former Member
0 Kudos

Hi,

I have a requirement to create table without primary key.

It shows error when i create table without primary key.

Can anyone help me to create table without primary key.

Thanks in advance

Regards

Shanthi

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Shanthi,

You can't create a table without Primary key in SAP DDIC.

Better you consider 3 rows instead of 2 rows.

the first row will be a dummy row with Serial No..

2nd and 3rd rows will be ROLE and Employee ID as usual.

Make this 1st row as primary key field

Regards,

Anirban

14 REPLIES 14

former_member209217
Active Contributor
0 Kudos

No, u will surely get warnings and error messages if u wont put any primary key in ur table.

Why du want a table without primary key. Wats ur requirement?

Former Member
0 Kudos

Maintain only MANDT as primary key.

Goto SE14 and click on activate and adjust database.

Thanks and Regards,

Chandra

Former Member
0 Kudos

Hi,

I have two fields in the table Role and Employee id.

There will be persons who will not have employee id but a role.

so they are asking to create table without primary key.

Regards

Shanthi

0 Kudos

Hi,

As Chandra mentioned, use MANDT field in your table at the beginning and have that as your primary key.

0 Kudos

HI,

There will be no problem if you keep MANDT as primary key. And it will be allowed.

It only keep the client no. And it will be taken care automatically by SAP.

You could maintain role without employee code.

Regards,

Nitin.

0 Kudos

>

> Hi,

>

> As Chandra mentioned, use MANDT field in your table at the beginning and have that as your primary key.

If you do this then you will only be allowed to create a single record in the table per client - which I don't think is what you want to do. I would generate a unique reference for each record and use that as the key. Though of course you should always include MANDT as the first column in a table and have that as the first column in each index, unless you want your table to be non-client specific.

Former Member
0 Kudos

If you not use this table in foreign key relationship u can create a table without primary key,

so that the primary key is not must for all the situation.

Edited by: jamuna palanisamy on Aug 12, 2009 11:59 AM

0 Kudos

Hi,

I am not using any foreign key relationship.

Can u help me how to create table without primary key.

Regards

Shanthi

Former Member
0 Kudos

Hi,

Yes ,u can create a table without primary key

Create a MANDT column is an option but it allows only one row per client.

Other option is u can create a identity type of column as primary key which can auto increment by one on every new row.

Thamks,

Smita

0 Kudos

Hi smita,

How to create identity type of column as primary key which can auto increment by one on every new row.

Thank you for all your response.

Thanks,

shanthi

0 Kudos

Hi

YOu can use the FM NUMBER_GET_NEXT and pass the number generated here to the Ztable which will identify the row uniquely

and creatre this as the first Field of your table so that it will identify your row as unique, or you can make this as your

PRIMARY KEY

Cheers

Ramchander Rao.K

Edited by: Ramchander Krishnamraju on Aug 12, 2009 1:50 PM

0 Kudos

Hi,

You can make all your fields as composite primary key...

Regards,

Nibha

Former Member
0 Kudos

Hi Shanthi,

You can't create a table without Primary key in SAP DDIC.

Better you consider 3 rows instead of 2 rows.

the first row will be a dummy row with Serial No..

2nd and 3rd rows will be ROLE and Employee ID as usual.

Make this 1st row as primary key field

Regards,

Anirban

Former Member
0 Kudos

Hi,

Choose both the fields as primary keys. It means the same person cannot have the same role more than once. But he can have a different role. I think this would be the best solution. Let me know if you have any Queries.

- Sheeba.