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

latest date

Former Member
0 Likes
975

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
Read only

Former Member
0 Likes
951

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.

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

6 REPLIES 6
Read only

Former Member
0 Likes
951

Hi,

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

Cheers,

Nama Ganesh

Read only

0 Likes
951

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

Read only

0 Likes
951

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

Read only

Former Member
0 Likes
952

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.

Read only

Former Member
0 Likes
951

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..

Read only

0 Likes
951

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