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

Fetching data from ISEG table

Former Member
0 Likes
1,652

Hello Guyz!

urgently need you attention. let me brief about my proble. i am fetching physical inventory from ISEG table. so as per my requirement, I should pick the latest record, to be more precise, the last record / most recent record. so i designed accordingly that. what i did is, after writing select query, i just described the internal table with its total number of lines. then i was reading the inteernal table with the index(max) which was giving me most recent recoed. but rite now the problem, I am facing is, with select query, most recent record is not coming in the bottom. the order is getting changed. so any one can suggest me, how to pick the most recent record from database table / the last record which satisfies the where condition.

thanks

manas

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,461

How do you determine which is the most recent record?

Rob

11 REPLIES 11
Read only

suresh_datti
Active Contributor
0 Likes
1,461

sort itab descending.

read table itab index 1.

Now the itab header will have the most recent/last record.

~Suresh

Read only

Former Member
0 Likes
1,461

Hi Manas,

Welcome to SDN........

Sort the internal table in descending order on fiscal year and line number and read the first record.

SORT IT_ISEG BY GJAHR DESCENDING ZEILI DESCENDING.

READ TABLE IT_ISEG INDEX 1.

Thanks,

Vinay

Read only

Former Member
0 Likes
1,461

As you say the problem is that the last table in the internal table is not the last record ..it could be possible if you are using a sorted table and the key is different as compared to the ISEG.

Secondly you can sort the table on change date descending to get the last record

Regards

Anurag

Message was edited by: Anurag Bankley

Read only

Former Member
0 Likes
1,462

How do you determine which is the most recent record?

Rob

Read only

0 Likes
1,461

Rob

Hello!

I believe the most recent record for a where clause comes in the bottom. I mean to say, if there are 5 records for a where clause, then the most recent record should come in the 5th position, untill and unless, the database table is indexed. Just let me know what is your idea about the positioning of most recent record.

Manas

Message was edited by: manas swain

Read only

0 Likes
1,461

Manas,

As specified in my previous post the problem can be either of the below.

1. The definition of your internal table ..if it is sorted table than it might not give you the same order as it fetches from the databse.

2. U r using the wrong index...if you using the primary key than basically it should fetch the data in the same sequence as in the table.

As for the solution is concerned ...i think to get the last record..I would advice you to sort it on the post date(either in ISEG or getting the corresponding data from IKBF).

Regards

Anurag

Read only

0 Likes
1,461

Anurag

Hello!

Thanks for your fruitful response. You are absolutely correct. Your point number 2 was the solution to my query.

Thanks

Manas

Read only

0 Likes
1,461

U r welcome...please assign points for useful answers and close the thread !!

Thanks and Cheers

Anurag

Read only

0 Likes
1,461

Anurag

Hello!

I was about to ask you how to give point to helpful answers and how to close threads. As I am new to his community, I could not find any option to give score to somebody. Can you say me, so that I can give scores and close the thread.

Thanks

Manas

Read only

0 Likes
1,461

When you post it as a question ..in the thread where people have replied to your question..on the left hand there are three radiobuttions

Yellow - helpful answers

Green - Very Helpful answers

Blue - Problem Solved

Once you mark it as blue it is basically termed as close to the people that you have got the solution.

Read only

anversha_s
Active Contributor
0 Likes
1,461

first sort ur internal table by descending.

fetch the first record.

ur requiremnt will be obtained