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: 

latest date

Former Member
0 Kudos

Hi ,

In table FPLT-AFDAT corresponds to Billing date.If there are more than one billing date for the corresponding VBELN(say line item) ,take the latest date and sum of the percentages of the fields FPROZ.

Kindly provide even the coding which would be very helpful.

Thanks in advance.

Points will be given for coding

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Jayasree,

Below query will help u to catch latest date.

select max( AFDAT )

from FPLT

into MAXDATE

where <condition 1>....<condition n>.

Regards,

Digesh Panchal

Note : Please reward points if it solve ur problem.

6 REPLIES 6

Former Member
0 Kudos

Hi,

I didn't understand the problem. Could you explain more details regarding the problem.

Cheers,

Nama Ganesh

0 Kudos

FOR A CORRESPONDING SALES ORDER NUMBER, I NEED TO FIND THE LATEST BILLING DATE TAKEN FROM TABLE FPLT - AFDAT.

The link for this ,take the FPLNR from FPLA based on the corresponding VBELN.then with this FPLNR, i take the AFDAT from table FPLT.Now i need to find the latest date

KINDLY HELP ME TO DO SO

0 Kudos

you can use ORDER BY to get the latest date.

SELECT *

FROM <db table>

INTO TABLE <itab>

ORDER BY AFDAT descending .

the first record of th itab now will be the latest date

alternate approach.

select the records into an itab and sort it descnding by date and read the first record which will be the latest.

Regards

Raja

Former Member
0 Kudos

Hi Jayasree,

Below query will help u to catch latest date.

select max( AFDAT )

from FPLT

into MAXDATE

where <condition 1>....<condition n>.

Regards,

Digesh Panchal

Note : Please reward points if it solve ur problem.

Former Member
0 Kudos

Try the followings.

SELECT FPLNR MAX( AFDAT ) SUM( FPROZ )

INTO (itab-fplnr, itab-afdat, itab-fproz)

FROM FPLT

WHERE <cond> = <value>

GROUP BY FPLNR.

Good Luck..

0 Kudos

Performance may be affected if you use aggregate functions on the database directly. Instead get all the records satisfying the VBELN condition into one internal table, sort it by date descending and then read the first record. That will give you the latest date. At the same time you can sum up the field that you wanted to add and use the result.

Srinivas