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: 

Insert into table irrespective of sorting order of a field

Former Member
0 Kudos

Hi All,

I am not able to insert data in the data base table(YY...) as it is in the internal table.

I do have data in following order in the internal table :

I am simply using statement insert (database table) from (wa) in the loop...endloop.

001 0002 2008 0000494219 001 0000494219 254.02 W4136 Keller & Kalmbach Widex

001 0002 2008 0000198630 001 0000494219 100.10 W4136 Keller & Kalmbach Widex

001 0002 2008 0000198418 001 0000494219 39.57 W4136 Keller & Kalmbach Widex

001 0002 2008 0000198419 001 0000494219 89.93 W4136 Keller & Kalmbach Widex

but when data is inserted in the table it appears as below:

Means system is sorting the data in ascending order based on 4th column which is document number.

001 0002 2008 0000198418 001 0000494219 39.57 W4136 Keller & Kalmbach Widex

001 0002 2008 0000198419 001 0000494219 89.93 W4136 Keller & Kalmbach Widex 001 0002 2008 0000198630 001 0000494219 100.10 W4136 Keller & Kalmbach Widex 001 0002 2008 0000494219 001 0000494219 254.02 W4136 Keller & Kalmbach Widex

How can I keep the sequence of data as it is in the internal table when I insert them into data base table.

Thanks,

Mark

5 REPLIES 5

Sandeep_Kumar
Advisor
Advisor
0 Kudos

Hi,

When you insert the data in DB tables , you can not control the sequence , it depends on the primary keys and table design.

Rgds,

Sandeep

Former Member
0 Kudos

Hi,

In Ur Database table which field hav primary Key.

Check if Docnum is primary key .

Former Member
0 Kudos

Assign one more field (let's say SEQ_NO). In your loop keep on incrementing this field and insert in database.

You have to add this field as first primary key in your database table also.

Hence you data will look like

1 001 0002 2008 0000494219 001 0000494219 254.02 W4136 Keller & Kalmbach Widex

2 001 0002 2008 0000198630 001 0000494219 100.10 W4136 Keller & Kalmbach Widex

3 001 0002 2008 0000198418 001 0000494219 39.57 W4136 Keller & Kalmbach Widex

4 001 0002 2008 0000198419 001 0000494219 89.93 W4136 Keller & Kalmbach Widex

Regards,

Mohaiyuddin

Former Member
0 Kudos

001 0002 2008 0000494219 001 0000494219 254.02 W4136 Keller & Kalmbach Widex

001 0002 2008 0000198630 001 0000494219 100.10 W4136 Keller & Kalmbach Widex

001 0002 2008 0000198418 001 0000494219 39.57 W4136 Keller & Kalmbach Widex

001 0002 2008 0000198419 001 0000494219 89.93 W4136 Keller & Kalmbach Widex

the order of ur internal table is in descending if i take the field 0000494219.

in my opinion the DB stores or displays the table entries in ascending in which the reverse sequence is appearing to you ..

Former Member
0 Kudos

soleved