‎2006 Oct 19 10:56 AM
Hi All,
I am using a custm table to fectch the 'H' datas and at the same time i want to fetch the 's' in that i want to take the latest data which they updated last.here i use sort using descending to get the latest one.here i cant take the latest one.how to solve pls help .i have the multiple matl no so i want to take the latest one for all material no.
Thanks,
Raj.
‎2006 Oct 19 11:03 AM
Rajendra,
Your Q is not clear, probably you can elaborate using an example.. What I feel is you need to pull all data in an internal table itab1.
have one more table .
itab2[] = itab1[].
delete utab2 where field = 'S'.
delete itab1 where fiels = 'H'.
then sort your itab1 by the latest record field.
loop thru and append/modify the details to itab2.
If you explain ur problem further, i can help.
Thanks
sh
‎2006 Oct 19 11:03 AM
Rajendra,
Your Q is not clear, probably you can elaborate using an example.. What I feel is you need to pull all data in an internal table itab1.
have one more table .
itab2[] = itab1[].
delete utab2 where field = 'S'.
delete itab1 where fiels = 'H'.
then sort your itab1 by the latest record field.
loop thru and append/modify the details to itab2.
If you explain ur problem further, i can help.
Thanks
sh
‎2006 Oct 19 11:31 AM
Hi,
I am using a customised table having matl no,date,docu no and status field.here the status field having 'H' OR 'S'.Now i want to display all the data having the condition 'h' and at the same time i want to display latest data in 'S'.to find the latest date only the date is available but in the same date they entered three times also so even i use date i want to get the latest one .i am using two internal tables for 'H' and 'S'.Help me how to do this.
Thanks,
Raj.
‎2006 Oct 19 11:53 AM
U can follow the below logic.
ih ===> internal table with H data.
is ===> internal table with S data.
sort is by matlno docno descending date descending.
loop at ih.
clear is.
loop at is where matlno = ih-matlno.
exit.
endloop.
if sy-subrc <> 0.
no data in is
else.
is data with latest date.
endif.
endloop.
‎2006 Oct 19 11:05 AM
I think it would be easier to provide the solution if you describe in detail your requirement with table structure and example if possible.
As far as what I can understand you can do the below.
1. To fectch the 'H' datas and at the same time i want to fetch the 's'.
--> U can simply use the filter in where clause to fetch both example
SELECT * from ztable
WHERE SHKZG in ('H','S').
2. Latest data
The latest data can be resolved by sorting the data in descending for the update date.
3. U can group by material number find the last one
‎2006 Oct 19 11:06 AM
Hi
You can loop on the internal table after sort, and keep updating the variable which points to the record which has the latest date/time. If you find a record having a date/time earlier to the one pointed by the variable, update the variable.
Finally after coming out of the loop, record pointed by the variable will be the latest.
Regards,
Raj
‎2006 Oct 19 11:29 AM
Hi,
after fetching H,S data in itab.
sort matnr date(last changed if any present) descending.
read table itab index 1.
<b>or use cdhdr,cdpos table to get latest updated
date
</b>
RegarDs
amole