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

Can We Sort A Database Table...

Former Member
0 Likes
937

Hi there...

I have to display a sap script....where the data will come directly from the data base tables and structures that are there in SAP...now the requirement is that particular field of a databse table has to be sorted before getting printed on to the SAP script...can anyone provide any leads...on this...

Pablo

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
745

ur getting data from database and printing on sap script...but before printing, ur getting data from database to internal table or fields....U can just sort this one and print according to ur requirements.

6 REPLIES 6
Read only

Former Member
0 Likes
745

read data in internal table and then do sorting in ur program on internal table and then pass the data to ur SAP script it wil be more effieicent..

amit

Read only

Former Member
0 Likes
745

We can sort the data of a DB table at Internal table level. like....

select * from mara into table itab.

sort itab by natnr.

loop at itab.

write: itab.

endloop.

Cheers.

Read only

Former Member
0 Likes
745

If the program is a customized one, we can get the data into an internal table, SORT and then issue for printing.

Kind Regards

Eswar

Read only

0 Likes
745

1)If you want to sort the data, you would most probably be needing to do it for the purpose of a report or some other application. In that case, you would have to fetch the data from the database table into an internal table in your program and then sort the data using the SORT statement on internal table

2)If you are seeing the contents using SE16, its a ALV grid, so you can sort by whatever field you want.

Read only

Former Member
0 Likes
746

ur getting data from database and printing on sap script...but before printing, ur getting data from database to internal table or fields....U can just sort this one and print according to ur requirements.

Read only

Former Member
0 Likes
745

hi

we can sort only I.T. it is not possible to sort dbt

If the program is a customized one, we can get the data into an internal table, SORT and then issue for printing.

deepak