‎2008 Apr 16 12:07 PM
Hi Gurus,
I had a select option s_vbeln and an internal table.I should delete records based on this select-option.
i have done in following way...
READ TABLE T_CDHDR INTO W_CDHDR WITH KEY OBJECTID = S_VBELN.
IF SY-SUBRC NE 0.
DELETE T_CDHDR INDEX SY-TABIX.
ENDIF.
but it is not working....
in the read stmt objectid and s_vbeln are compatible..
Can anyone suggest me??
‎2008 Apr 16 12:09 PM
Hi,
You can do as below:
delete itab where vbeln not in S_VBELN.
Thanks,
Sriram Ponna.
‎2008 Apr 16 12:09 PM
Hi,
You can do as below:
delete itab where vbeln not in S_VBELN.
Thanks,
Sriram Ponna.
‎2008 Apr 16 12:09 PM
select options are always of type ranges. Go to the debuger and inspect your select option.
To use the select option use operator "in" instead of "=".
‎2008 Apr 16 12:09 PM
do this way.
delete itab where OBJECTID in S_VBELN. "To delete whichever matched the s_vbeln
delete itab where OBJECTID not in s_vbeln."To delete whichever did not match the s_vbeln
Regards,
Ravi Kanth Talagana
‎2008 Apr 16 12:15 PM
‎2008 Apr 16 12:11 PM
Hi,
Have you checked in table via SE11, if it is expecting leading zeros for Invoice no i.e. s)vbeln.
I hope this helps
Regards
Raju Chitale
‎2008 Apr 16 12:13 PM
you can use this directly...
DELETE T_CDHDR where OBJECTID not in S_VBELN.
‎2008 Apr 16 12:21 PM
hi madan
i think u have to delete records from internaltable which r not in s_vbeln
u can not delete directly. do one thing first fetch the data using select option from main table into one internal table
select vbeln
from table
into i_vbeln
where vbeln in s_vbeln.
u can get the data into i_vbeln.
then process the table t_cdhdr and delete records which r not in i_vbeln.
loop at t_cdhdr into wa_cdhdr.
read table i_vbeln with vbeln= wa_cdhdr-vbeln.
if sy-subrc ne 0
delete wa_cdhdr from t_cdhdr.
endif.
endloop.
check this one
‎2008 Apr 16 1:43 PM
Hello Madan-
Select-option is an internal table but in your read statement you are comparing directly with select-option this was it will not work.Ways to achieve your requirement.
1) Instead of select-option use parameter or
2) Loop the internal table with BT condition.
Cheers,
~Srini....
‎2008 Apr 16 1:50 PM
Hi,
Follow this Code.
loop at itab where vbeln Between Low anh High
Delete
Endloop.
Reward if it is Helpfull,
Naresh.
‎2008 Apr 16 1:56 PM
hi do like this
Data it_T_CDHDR tmp .type standart table of TCDHDR .
wa_CDHDR tmp type TCDHDR
READ TABLE T_CDHDR INTO W_CDHDR WITH KEY OBJECTID = S_VBELN.
if sy-subrc = 0
w_tabix = sy-tabix.
move T_CDHDR to wa_CDHDR tmp index wtabix
Append T_CDHDR tmp to itT_CDHDR _tmp .
endif.
refresh T_CDHDR .
T_CDHDR [] = it_T_CDHDR _tmp []
this wil giv u the desired values,
Reward points if helpful.
Ronak