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: 

Copy structure View to a Internal table with keys

Former Member
0 Kudos
152

HI I have a View without key fields.

I want to copy all the data in tab1. The tab1 has the same structure to view. But in tab1 I need some keys fields.

How can I do it? How can I copy the structure and assign fields as key fields?

thanks

Message was edited by:

Marc PM

1 ACCEPTED SOLUTION

Former Member
0 Kudos
93

Hi,

Why you need a Key field in internal Table?

Fetch the data from the VIEW using the select statement into that internal table and sort that internal table.

and do what ever you wants with that Int table data.

If at all you wants to put that data into a DB table create the DB table in SE 11 and copy all the fields from VIEW to table manully and tick the first few fields as Key fields, and write a small program and dump the data from view to DB table.

reward if useful

regards,

ANJI

6 REPLIES 6

Former Member
0 Kudos
93

Hey..am not very clear abt ur question.

Areu trying to copy a view into a table?? ie r u trying to create a table out of a view??

Also tell me are u talking about view or a structure??

Cheers,

Sam

0 Kudos
93

sorry...

I want to copy the structure of a View to a internal table. But the view doesnt have key fields. And I need the internal table with key fields.

Example:

View:

field1

field2

field3

internal table :

field1 as key

field2 as key

field

I explain best?

Former Member
0 Kudos
94

Hi,

Why you need a Key field in internal Table?

Fetch the data from the VIEW using the select statement into that internal table and sort that internal table.

and do what ever you wants with that Int table data.

If at all you wants to put that data into a DB table create the DB table in SE 11 and copy all the fields from VIEW to table manully and tick the first few fields as Key fields, and write a small program and dump the data from view to DB table.

reward if useful

regards,

ANJI

0 Kudos
93

Because I want to use the AT NEW on the internal table. And I new to define key field in the internal table to use it.

0 Kudos
93

Hi,

U needn't have key fields to perform AT-NEW. It will work just fine even without key fields. Only that make sure that the columns that are to the left of the field on which u r putting AT-NEW don't change. Or u keep that column first. It will work perfectly fine!

Cheers,

Sam

0 Kudos
93

Here is an example...

Fld1 Fld2 Fld3 Fld4

1 0 0 0 -A

1 1 0 0 -B

1 1 1 0 -C

1 1 1 1 -D

At-New Fld1 -> Will never be triggered since its always 1.

At-New Fld2 -> Will get triggered at B since it changes to 1.

At-New Fld3 -> Will get triggered at B since Fld1, Fld2 are changing from (1,0) to (1,1).

At-New Fld4 -> Will get triggered at B,C and D since the other 3 cols to the left are changing continuously.

Got it??

Reward points if useful...

Cheers,

Sam