2013 Jun 14 6:26 PM
Hello experts,
Let’s sat tableA with following records :
Field 1 | Field 2 | Field 3 | Field 4 |
XXX | XXX | XXX | |
XXX | XXX | XXX | XXX |
XXX | XXX | XXX | XXX |
XXX | XXX | XXX | |
XXX | XXX |
I am looking for the more performant logic to delete records where all the columns are complete.
In my example, only green lines have to be kept. The red lines must be delete.
I tought about:
Loop at table into structure
Where field1 is not initial
And Where field2 is not initial
And Where field3 is not initial
And Where field4 is not initial
Delete structure
Endloop.
Thanks for your suggestions.
Amine
2013 Jun 14 7:17 PM
Hi Amine
When a "performance" question is asked in this forum, it often receives many answers, from many different people, with many different opinions offered... but you should test them yourself to make sure you find the best for your specific situation.
Here's my opinion...
If I was you, I'd use the following:
DELETE tablea
WHERE field1 IS NOT INITIAL
AND field2 IS NOT INITIAL
AND field3 IS NOT INITIAL
AND field4 IS NOT INITIAL.
Regards
Glen
Hello experts,
Let’s sat tableA with following records :
Field 1 | Field 2 | Field 3 | Field 4 |
XXX | XXX | XXX | |
XXX | XXX | XXX | XXX |
XXX | XXX | XXX | XXX |
XXX | XXX | XXX | |
XXX | XXX |
I am looking for the more performant logic to delete records where all the columns are complete.
In my example, only green lines have to be kept. The red lines must be delete.
I tought about:
Loop at table into structure
Where field1 is not initial
And Where field2 is not initial
And Where field3 is not initial
And Where field4 is not initial
Delete structure
Endloop.
Thanks for your suggestions.
Amine
2013 Jun 14 7:17 PM
Hi Amine
When a "performance" question is asked in this forum, it often receives many answers, from many different people, with many different opinions offered... but you should test them yourself to make sure you find the best for your specific situation.
Here's my opinion...
If I was you, I'd use the following:
DELETE tablea
WHERE field1 IS NOT INITIAL
AND field2 IS NOT INITIAL
AND field3 IS NOT INITIAL
AND field4 IS NOT INITIAL.
Regards
Glen
2013 Jun 14 7:50 PM
Hi Amine,
DELETE itab WHERE field1 is not initial
AND field2 is not initial
AND field3 is not initial
AND field4 is not initial.
2013 Jun 14 9:55 PM
Hi Amine,
Another perspective,
Loop at table into structure.
if structure-field1 is not initial
and structure-field2 is not initial
and structure-field3 is not initial
and structure-field4 is not initial .
append structure to another table.
endif.
Endloop.
Here you need not delete anything. Just simple If condition and you get another internal table with your data.
BR,
Ankit.
2013 Jun 17 9:24 AM
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |