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

Custom table

RahulSoneji31
Explorer
0 Likes
670

Hi all,

I am using a custom table to view particular records.

I have a custom program that selects records from this custom table, puts it into an internal table and displays the last record from this internal table on the spool.

The issue is that when i view the records from the table in SE16 or SE11, the record i get as the last record in the list is different from what i get in the internal table in the program, even though the search criteria is same. The no. of records selected are same in both the cases. The last record that appears in SE16 comes midway in the internal table and vice versa.

There is no sort used in the program for the list selected from the custom table.

I am confused as to how it does not show the last record in internal table as is expected from SE16.

Can anybody please give some pointers regarding this? could it be related to indexes?. I believe that since there is no sort in the program, this causes a different record to be picked up as the last one in the internal table( it could be due to some indexing but i am not sure).

6 REPLIES 6
Read only

Former Member
0 Likes
646

Hi Rahul

Try refreshing your internal table before populating data into it and after the data is retrived, sort the internal table.

Hope this solves the issue.

Regards

Gaurav

Read only

0 Likes
646

Thanks for the reply. Yes i can do that ..but my point is to find out why it is behaving the way it is doing..

I want to know how indexes are playing a role in populating the list in the internal table.

why do they seemingly put random record at the bottom of the internal table?

Read only

Former Member
0 Likes
646

Hi Rahul,

Could you post us the select query you are using to fill the internal table?

Regards

Karthik D

Read only

Former Member
0 Likes
646

Hi Rahul

After the program execution is over, the compiler takes the memory back from the program.

Again when we reexecute the program sometimes it happesns that last execution's data remain there and in some other cases some other cases comipler asigns garbage values prior to execution. This is why we get such results.

Regards

Gaurav.

Read only

Former Member
0 Likes
646

sort internal table same field as in sort of se16 table field and then refresh the internaltable

Read only

Former Member
0 Likes
646

Hi,

Refresh and clear the internal table before fetching the data into it. If you are using a sorted internal table then the records will be only in the sorted manner, so may be the last record has moved to somwhere in the middle. You can even check the record in the internal table to confirm using read statement.

refresh itab.

clear itab.

regards,

John