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: 

custom table with only one entry and without any primary keys

santosh51
Advisor
Advisor
0 Kudos

Hello Guys

I have a requirement where I need to create a custom table without any primary keys and it can have only one entry in database at max.

It mean the user should not be able to insert new row but can modify only the existing row. The fields should be character type with a size of 1000 characters.

I created table with 4-5 fields of char predefined type with length 1000 characters but when I try to maintain in SM30 I do not get any fields for input.

Even I do not see the table fields in the table maintainence generator (modification screen).

Could you please help.. Is this requirement not possible? I also need help in creating event for table to have only one entry.

Thanks in advance.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

All database tables must have a primary key. In this case, it can be the client (MANDT). Then add your four fields as non-primary.

But 1,000 characters is awfully long for a field.

Rob

Message was edited by: Rob Burbank

6 REPLIES 6

Former Member
0 Kudos

All database tables must have a primary key. In this case, it can be the client (MANDT). Then add your four fields as non-primary.

But 1,000 characters is awfully long for a field.

Rob

Message was edited by: Rob Burbank

0 Kudos

Hi Rob

Yes, since the table must have primary key, I have used MANDT field to complete it.

The problem now with the character fields, I am able to activate table & create table maintainence but when I try to add entry in SM30, I do not get any fields for input. Even in SE11, screen modification also I do not see the table fields in the attributes/layout.

Is this because all the fields are character fields or non key fields? Is my requirement not possible to implement?

0 Kudos

Hi Santosh,

Its possible to have non-key fields with mandt as key.

delete and re-generate the table maintenance view again with maintenance type = Two step.

Also make sure that, in the Delivery  and Maintenance " Display/Maintenance allowed" is chosen.

Regards,

Rama

0 Kudos

Hi Rama

Thank you. Its working after maintainence type changed to two step. I am able to add entries through SM30 now.

Can you help in how/where to add logic to restrict the number of entries in table to only 1?

Regards,

Santosh

0 Kudos

Hi Santosh,

Here in your table as only client field MANDT is key, system allows only one entry per client.

So, you no need to do anything.

Always, only one record is maintained per client. You can only overwrite but cannot add more than 1 record.

Regards,

Rama

0 Kudos

Hi Rama

yes, you are correct..I just realised it..

Thanks a lot for your help..

Regards,

Santosh