‎2006 Jun 01 5:41 AM
Hi..
I want to develop a logic which should be as follows:--
I have an internal table in which I have all the NAST Records.
But I dont want to display all of them in my final list.
What I want is that, I should go through each of the object numbers(NAST-OBJEK)of my internal table and whenever there is this green light(Processing complete) in the output type(NAST-VSTAT = 1), I should not display that object number in my list.
I will give you one example to extrapolate it:--
Say there is a document number '00001' with an output type as ZPRQ which is processd say 3 times..and all the three times its either red or orange light then we should display it in the final list and say there is this another document number '000002', which is also processed 3 times but with different lights say, red , orange and green lights respectively, then I should not show this document in the list as it has been succesfuly processed once.
CONCLUSION:--I want to display all the documents that are either not processed(NAST-VSTAT = 0 )or incorrectly processed (NAST-VSTAT = 2).I should not display the document if it is succesfully processed at any point of time.
I hope I am clear.
Please tell me a simple logic to follow.
Thanks
‎2006 Jun 01 5:44 AM
hi subash,
simply use..
loop at itab where vstat ne 1.
*write the values.
endloop.regards
satesh
Message was edited by: Satesh R
‎2006 Jun 01 6:05 AM
Thanks for the answer
And how do I remove the duplicate entries in teh internal table??
Thanks
‎2006 Jun 01 6:06 AM
‎2006 Jun 01 6:07 AM
Hi
You can use DELETE ADJACENT DUPLICATES statament.
SORT ITAB BY FIELD1 FIELD2.
DELETE ADJACENT DUPLICATES FROM itab COMPARING FIELD1 FIELD2.
Max
‎2006 Jun 01 6:09 AM
Hi subhash,
1. for deleting duplicate entries,
2. SORT ITAB by field1 field2.
DELETE ADJACENT DUPLICATES.
3. Note that, Duplicate means that,
The LEFT MOST FIELDS
which are same will be considered as duplicate.
4. Sorting is a must before deleting adjacent duplicates.
regards,
amit m.
‎2006 Jun 01 5:46 AM
Hi,
If you want to process only statuses 1 and 3
LOOP AT ITAB WHERE VSTAT = 1 OR VSTAT = 3.
WRITE THE RECORDS.
ENDLOOP.
Regards
Ravi
‎2006 Jun 01 5:50 AM
HI,
sort itab[] by document_number.
Loop at itab into workarea1.
at new document_number.
loop at itab into workarea
where document_number = workarea1-document_number.
check nast-vstat = 1.
v_append = 'X'.
endloop.
endat.
if v_append is initial.
append workarea to i_final.
endif.
endloop.
Regards,
Bujji
‎2006 Jun 01 5:53 AM
Hi,
Then it should be,
Loop at <itab> where vstat eq '0' or vstat eq '2'.
write: 'Document number:', itab-<fieldnameofojbect>.
endloop.
‎2006 Jun 01 6:45 AM
Hi Subhash
loop at t_nast into wa_nast
read table t_nast transporting no fields
with key OBJKY = wa_nast-objky
KSCHL = wa_nast-KSCHL
VSTAT = 1.
if sy-subrc eq 0.
delete t_nsat where OBJKY = wa_nast-objky.
endif.
endloop.
sort t_nast by objky kschl.
loop at t_nast into wa_nast.
write:....
endloop.
This way if there is even one objeckey that has a output type as processed(Green), all the records with the same object key and the output Message type get eleiminated from the list.
REgards,
Vinay
‎2006 Jun 01 6:54 AM
Correction:
delete t_nsat where OBJKY = wa_nast-objky
and kschl = wa_nast-kschl.