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

Internal table query??

Former Member
0 Likes
1,135

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

10 REPLIES 10
Read only

Former Member
0 Likes
1,083

hi subash,

simply use..

loop at itab where vstat ne 1.
*write the values.  
 endloop.

regards

satesh

Message was edited by: Satesh R

Read only

0 Likes
1,083

Thanks for the answer

And how do I remove the duplicate entries in teh internal table??

Thanks

Read only

0 Likes
1,083

delete adjacent duplicates from itab comparing all fields

Read only

0 Likes
1,083

Hi

You can use DELETE ADJACENT DUPLICATES statament.

SORT ITAB BY FIELD1 FIELD2.

DELETE ADJACENT DUPLICATES FROM itab COMPARING FIELD1 FIELD2.

Max

Read only

0 Likes
1,083

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.

Read only

Former Member
0 Likes
1,083

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

Read only

Former Member
0 Likes
1,083

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

Read only

Former Member
0 Likes
1,083

Hi,

Then it should be,

Loop at <itab> where vstat eq '0' or vstat eq '2'.

write: 'Document number:', itab-<fieldnameofojbect>.

endloop.

Read only

Former Member
0 Likes
1,083

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

Read only

0 Likes
1,083

Correction:

delete t_nsat where OBJKY = wa_nast-objky

and kschl = wa_nast-kschl.