2009 Feb 13 7:00 AM
Hi experts,
I hve data in one internal table but i want to delete some data from that based on condition like when the condition satisfies i hve to make flag field as 1 and after checking for all records i hve to delete records mark as 1.
Plz tell me the procedure how to do that.
Thanks in advance.
2009 Feb 13 7:10 AM
hi,
check this code.
if <cond>
wa-flag = 1.
modify table itab from wa transaporting flag.
endif.
delete itab where flag = 1. "deletes multiple records in the table satisfying the conditionThanks
Sharath
Hi experts,
I hve data in one internal table but i want to delete some data from that based on condition like when the condition satisfies i hve to make flag field as 1 and after checking for all records i hve to delete records mark as 1.
Plz tell me the procedure how to do that.
Thanks in advance.
2009 Feb 13 7:04 AM
suppose you have the table itab[] .
use the below.
delete itab where field1 = '1' .
this will delete all the rows in which field1 has the value1 .
This is one of the basic concepts. U can click on DELETE and press F1.
That you have to try before posting a question
2009 Feb 13 7:05 AM
Hi,
U can use like this,
DELETE ITAB where (Ur conditions).
It'll delete the records based on the conditions. No nedd to set flag and then delete.Just use only one statement.
Press F1 on DELETE, U'll get Lot of inputs.
2009 Feb 13 7:08 AM
Hi,
If <condition>
fs-flag = 1.
endif.
delete itab where flag = 1.
2009 Feb 13 7:12 AM
Thanks a lot for your answer,but while setting flag i am loop on internal table like
loop at wt_itab into wa_itab.
if(condition)
ws_itab-flag = 'x'.
endif.
endloop.
now i hve to make flag = x in table like here i am making field of workarea as x.
can u plz tell me how to do that.
Thanks
2009 Feb 13 7:17 AM
Hi,
Then u can use modify
modify table itab from fs transporting flag.
2009 Feb 13 7:18 AM
hi,
Once the flag value is set, use modify statement for that to be reflected in your table.
This code will solve your purpose.
loop at wt_itab into wa_itab.
if(condition)
wa_itab-flag = 'x'.
MODIFY TABLE wt_itab FROM wa_itab TRANSPORTING FLAG.
endif.
endloop.This statement changes the value of flag for that particular record in the loop.
Thanks
Sharath
2009 Feb 13 7:08 AM
PARAMETERS p_carrid TYPE scarr-carrid.
DATA scarr_tab TYPE SORTED TABLE OF scarr
WITH UNIQUE KEY carrid.
SELECT *
FROM scarr
INTO TABLE scarr_tab.
DELETE TABLE scarr_tab WITH TABLE KEY carrid = p_carrid.
2009 Feb 13 7:09 AM
Hello,
refer the given below code
DELETE FROM it_t352r WHERE revnr = v_t352r-revnr.
Thanks
Arun
2009 Feb 13 7:10 AM
hi,
check this code.
if <cond>
wa-flag = 1.
modify table itab from wa transaporting flag.
endif.
delete itab where flag = 1. "deletes multiple records in the table satisfying the conditionThanks
Sharath
2009 Feb 13 7:36 AM
2009 Feb 13 7:47 AM
Let say your internal table is defined as follows:
data : begin of it_tab occurs 0,
field1 type c,
field1 type c,
flag type c, " field for flag
end of it_tab.
loop at it_tab.
****when condition meets
it_tab-flag = 'X' .
modify it_tab transporting flag.
endloop.
delete it_tab where flag eq 'X'.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |