Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9041

Re: Trimming internal table based on criteria

$
0
0

Hi,

 

As others said you can do this in many ways.

 

May be you can try the below logic.

 

Logic:

 

itab2[] = itab1[].

sort itab1 by name.

delete adjacent duplicates of itab1 comparing name.

unassign <fs_itab2>

loop at itab2 assigning <fs_itab2>.

unassign <fs_itab1>.

read table itab1 assinging <fs_itab1> with key name = <fs_itab2>-name

                                                                          terminal = <fs_itab2>-terminal.

if sy-subrc EQ 0.

delete itab2 from <fs_itab2>.

endif.

 

endloop.

 

At the end whatever records left in ITAB2 are the records with person logged in more than one terminal.

 

Or may be introducing 3rd internal table, you can replace:

 

if sy-subrc EQ 0.

delete itab2 from <fs_itab2>.

endif.

 

with:

 

if sy-subrc NE 0.

append <fs_itab2> to itab3.

endif.

 

In this case ITAB3 will have the required records.

 

Thanks,

Naresh

 

Message was edited by: naresh c


Viewing all articles
Browse latest Browse all 9041

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>