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

Primary key from .include structure?

Former Member
5,908

Hi All,

can i assign primary key field to database table from included structure ?

1 ACCEPTED SOLUTION
Read only

Former Member
3,179

Hello Abdulkadir

I think this is not possible. You can select the included structure as primary key, but then all fields of that structure are marked as primary keys

Maybe create a seperate structure to include just with the field you want as primary key?

Hope this helps.

Kind regards

Thomas

9 REPLIES 9
Read only

vinodkumar_thangavel
Participant
0 Likes
3,179

Hi Abdulkadir,

I hope it is not possible to assign the field of include structure as Primary key field.

Regards,

Vinodkumar.

Read only

Former Member
0 Likes
3,179

NO

Read only

Former Member
0 Likes
3,179

YES.

Rob

Read only

0 Likes
3,179

How?

Read only

Former Member
3,180

Hello Abdulkadir

I think this is not possible. You can select the included structure as primary key, but then all fields of that structure are marked as primary keys

Maybe create a seperate structure to include just with the field you want as primary key?

Hope this helps.

Kind regards

Thomas

Read only

0 Likes
3,179

Hello Thomas,

Yes your advice is my best alternative solution.

Thanks.

Read only

0 Likes
3,179

Exactly what I meant - it is possible.

Rob

Read only

Former Member
0 Likes
3,177

I am new at SAP systems therefore i want to consult to experts. I 'll develope an application (Db + Web Service). I wanted to design my dictionary objects in best and short style, generate all objects from structure (all objects= Db Tables, web services inputs/outputs, codebehind declarations ...). But Db Primary key attribute block it.

Which way is better?

Then, there is no benefit to declare structure if I can't assign primary key field to  table from included structure.

i 'll create table  without create/.include structure and use type of the table at codebehind declarations, web service inputs/outputs. (please look at followings images)

I mean;

  >  ztUser(Table) > Data: gv_user type ztUser.

and there is no requirement create table from structure .

  > zsUser(Structure) > ztUser(Table .included zsUser) > Data: xx type ztUser

, , Former Member

Read only

0 Likes
3,177

The benefit of include structures is there re-usability. Your ZDEN_SDATASTATUS is a good example. SAP creates structures for key fields, inserts them at the beginning of tables and sets the structure as the key field. They can then add more keys in subsequent fields.

Generally, we don't use structures for keys, but use them for non-key fields in multiple tables.

Rob