‎2007 Jun 22 8:06 AM
Hi,
please tell me if this works:
DELETE data_package where <condition>
or should i have to like this:
loop at data_package
if <condition?
delete data_package.
endif.
Thanks,
Vijaya
endloop.
‎2007 Jun 22 8:10 AM
Hi Vijaya,
I think it should work... if not, please provide a more detailed example code. In the ABAP documentation it says:
DELETE itab WHERE logexp.
Deletes all of the entries from the internal table itab that satisfy the condition logexp. The condition logexp can be almost any logical expression. The only restriction is that the first field in each comparison must be a component of the line structure of the internal table itab.
I hope it helps. Best regards,
Alvaro
‎2007 Jun 22 8:10 AM
Hello Vijaya,
Both of them would work the same way - including performance. To improve performance you can use SORTED Table.
Reward if helpful
Regards,
Ram
‎2007 Jun 22 8:14 AM
Hi Viyaya
Yes you can use DELETE data_package where <logical_expression>
From ABAP Help:
Addition 3
... WHERE log_exp
Effect
You can specify any logical expression log_exp after WHERE, for which the first operand of each individual comparison is a component of the internal table. This enables all logical expression with the exception of IS ASSIGNED, ISREQUESTED, and IS SUPPLIED. The dynamic specification of components using character-type data objects in parentheses is not supported here. All rows for which the logical expression is true are deleted.
Note
Whereas in standard tables, every row of the internal table is checked for the logical expression of the WHERE addition, in sorted tables and hashed tables (as of release 7.0), it is possible to use AND queries to optimize access by checking at least the starting component of the table key for equality with the logical expression. Access is also optimized if the logical expression contains additional queries linked with AND using any operators.
Example
Deletes all rows of an internal table from row 4. The result is the same as in the example for APPEND ... SORTED BY.
PARAMETERS: p_carrid TYPE sflight-carrid,
p_connid TYPE sflight-connid.
DATA: BEGIN OF seats,
fldate TYPE sflight-fldate,
seatsocc TYPE sflight-seatsocc,
seatsmax TYPE sflight-seatsmax,
seatsfree TYPE sflight-seatsocc,
END OF seats.
DATA seats_tab LIKE STANDARD TABLE OF seats.
SELECT fldate seatsocc seatsmax
FROM sflight
INTO TABLE seats_tab
WHERE carrid = p_carrid AND
connid = p_connid.
LOOP AT seats_tab INTO seats.
seats-seatsfree = seats-seatsmax - seats-seatsocc.
MODIFY seats_tab INDEX sy-tabix FROM seats.
ENDLOOP.
ENDLOOP.
SORT seats_tab BY seatsfree DESCENDING.
DELETE seats_tab FROM 4.
Regards
‎2007 Jun 22 8:19 AM
Hi
dont use to delete the work to delete the ITAB
use
Check the syntax for correctness.
DELETE TABLE ITAB where condi.
This will work faster than work area
Regards
Shiva
‎2007 Jun 22 8:26 AM
i am concentrating mainly on this point.
which one would be more good with respect to performace.
loop at data_package
it loops at all elements and deltes wherever satisfies the if condition.
delete data_package where <condition>--- also works in the same way but i want to ask if both the possiblities take same time to delete the entries or which one will be the best to use to achieve better performance.
Thanks a lot,
Vijaya
‎2007 Jun 22 8:34 AM
for more infor please go thru this link
http://help.sap.com/saphelp_nw04/helpdata/en/06/aafd54fc4011d195280000e8353423/content.htm
Regards
Shivakumar
‎2007 Jun 22 8:39 AM
Hi vijaya,
The first statement : DELETE data_package where <condition> is preferred instead of second one keeping PERFORMANCE in mind.
Reward points for helpful answers.
Regards,
Hari krishna
‎2007 Jun 22 8:46 AM
ya thanks but tell me the difference...both the possibilities loop through the data package or itab then how does that make difference when i use only delete statement instead of loop at data_package.
how the performance is better please throw some light on this.
Thanks,
Viajya.
‎2007 Jun 22 8:52 AM
HI.
This code is best "DELETE data_package where <condition>"
because it will create performance problem while using LOOP>.
Rewards all helpfull answers.
regrads.
Jay