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: 

PO Last Purchase Price ??

Former Member
0 Kudos

Hi ! currently I'm working on a P.O. Report. My query is :- I want to display the last purchase price of the P.O..

For this requirement, I've joined the tables EKKO & EKPO, sorted on material & plant. And now I want to fetch the last purchase price from EIPA table using the info rec no. For that how can I write a select query.

Right now I'm using :-

 SELECT SINGLE PREIS    INTO DISP-LASTPR      FROM EIPA  WHERE INFNR    = DISP-INFNR.

which is not solving the problem.

Please help.

3 REPLIES 3

Former Member
0 Kudos

Hi,

Get the last info record number from table EINA by passing the material number. Pass this info record number into EIPA and get the Price details.

Regards

Vinod

0 Kudos

Thanks for your prompt reply. Could you please give me the code to select the last info rec. Which statements to achieve this ?

How can we add or minus from sy-tabix to read the value of the last entry ?

0 Kudos

Hi,

Try below logic.

Select <required fields> from EINA
into table <itab>
where matnr = <matnr>.

sort <itab> by erdat descending

read table <itab> into <wa> index 1.

Last info record = <wa>-infnr.

Regards

Vinod