01-16-2006 4:29 AM
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
01-16-2006 6:17 AM
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.
01-16-2006 4:48 AM
Hi,
I didn't understand the problem. Could you explain more details regarding the problem.
Cheers,
Nama Ganesh
01-16-2006 4:59 AM
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
01-16-2006 5:08 AM
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
01-16-2006 6:17 AM
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.
01-16-2006 6:26 AM
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..
01-16-2006 6:30 AM
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