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: 

Table to be updated in the order which they are entered in Editable ALV

Sijin_Chandran
Active Contributor
0 Kudos
1,044

Hello All ,

I have an ALV program which updates a ZTABLE.

The issue which I am facing is that the order of records and in that table is getting just reversed.

I am using record by record update using MODIFY statement.

Eg.

After Save ,

Display when report re run ,

In SE11

also records are in above order.

Valuable suggestions required ABAP Gurus.

1 ACCEPTED SOLUTION

anilkumar_kalkivai
Active Participant
900

Hi Sij,

In Database table the records stored in sorted manner based on primary key.

regards,

Anil.

20 REPLIES 20

Former Member
0 Kudos
900

Hi Sijin,

It doesnot matter on what sequence you will enter the data the data will be displayed in assending order.

Regards,

Niladri

former_member217544
Active Contributor
0 Kudos
900

Hi,

Is Material Code primary key? If so remove the primary key and check if it following the order you saved?

Regards,

Swarna

0 Kudos
900

Hello Swarna ,

Thanks for your prompt reply ,

Yeah Material code is a part of Primary key and I can't change it . I want unique record material wise only.

Primary key used is a composite key ( with combination of 3 other fields along with MATNR )

anilkumar_kalkivai
Active Participant
901

Hi Sij,

In Database table the records stored in sorted manner based on primary key.

regards,

Anil.

0 Kudos
900

Okay fine Anil ,

Then can you provide any hint how to get things done as required

0 Kudos
900

Hello Anil ,

So the  records might be sorted in Ascending order in Database table.

So am going to add one extra field counter in my DB table which will increment with each update operation , let me check with this solution.

0 Kudos
900

Solved it !

Your hint helped me

0 Kudos
900

But did you create an unique index MANDT/MATNR for your other requirement

Yeah Material code is a part of Primary key and I can't change it . I want unique record material wise only.

Regards,

Raymon

0 Kudos
900

Hello ,

I have added Counter field between the already existing Keys , as shown below.

So it will work perfectly fine.

Very thanks for showing your concern

venkateswaran_k
Active Contributor
0 Kudos
900

It is in the impact of the Table defenition Primary Keys.

In your case, probably you may need to add the time of entry also in your Key field of table.

Then it will show you in the same sequence as exactly as the way you update...

Regards,

Venkat

0 Kudos
900

Okay ,

I have got a Time of Entry field.


And will try your solution.

And revert

0 Kudos
900

No its not working ,

cause more than one records are updated in  a same session.

0 Kudos
900

Dear Sij,

Sort the Internal Table by MATNR  Before Display.

Thanks & Regards.

Kranthi

Former Member
0 Kudos
900

Hi Sijin,

In your table add time and date fields and make them as key fields, and when you are retrieving the records, get the last updated entry this will work for your requirement.

0 Kudos
900

Hello All ,

I have got it solved .

By adding Counter field.

My concern was not with the ALV output but with the order maintained in  DB table underneath.

0 Kudos
900

Hi,

Can you please Publish the code .I have also same requirement.Please Publish the code pls...

0 Kudos
900

I have already pasted all the relevant details in this thread.

i.e Structure of table .

You just need to add counter with + 1 with each iteration.

Rest

In Database table the records stored in sorted manner based on primary key.

will take care of.

0 Kudos
900


Please paste the Thread link where i can get the coding details.Pls...

0 Kudos
900

Cool ,

I wrote the code myself and I haven't published it anywhere.

Just mention at what place you are facing the problem.

0 Kudos
900

This message was moderated.