07-23-2010 7:23 AM
Hi,
I have an internal table with 1000 material and i want to delete the material from internal table which length is more than 15.
I do not want to use
loop .
delete
endloop.
Is there any other better way?
Thanks
07-23-2010 8:05 AM
Hi,
Just a sample.
DATA lt_vbap TYPE TABLE OF vbap.
SELECT *
FROM vbap
INTO TABLE lt_vbap
WHERE matnr NE space.
DELETE lt_vbap WHERE matnr+15(x) NE ' '. "fill x with the remaining length of data variable
best regards,
John
07-23-2010 7:39 AM
Please clarify.
Are you saying that you only need the first 15 entries of the table or are you saying you want to remove any entries in the table which have a matnr field of greater length than 15? Or something else??
07-23-2010 7:52 AM
Hi,
I want to delete the material length if greater than 15
for ex
material
123444 - do not delete
1234567890abcdefr - delete
1234567890abcdefty - delete
asdhgk - do not delete
07-23-2010 7:58 AM
loop at itab.
find stlen for each material.
if stlen >15 .
delete itab using index.
endif.
endloop.
07-23-2010 8:06 AM
Hi,
I dont want to use use loop .. endloop.
If i have 2 lacs material if i use loop .. endloop it will read 2 lacs times . i want to avoid this
I need someother way to do it.
07-23-2010 8:10 AM
07-23-2010 8:13 AM
07-23-2010 8:21 AM
Hi,
You can code like this:
DELETE <itab> WHERE matnr+15(3) NE space.
This statement will delete the record from <itab> where the MATNR is greater than 15 character.
Regards
DKS
07-23-2010 7:41 AM
Hi
What you can do is create a field symbol and then let this field symbol point to the header line of the internal table then check you query against the field-symol entry and if the entry is found then the remove the adress where the field symbol is pointing for that entry.
Thanks
07-23-2010 8:05 AM
Hi,
Just a sample.
DATA lt_vbap TYPE TABLE OF vbap.
SELECT *
FROM vbap
INTO TABLE lt_vbap
WHERE matnr NE space.
DELETE lt_vbap WHERE matnr+15(x) NE ' '. "fill x with the remaining length of data variable
best regards,
John
07-23-2010 8:05 AM
Hi , check the following code..
data:begin of it_data occurs 0,
matnr(18),
end of it_data.
data: int type i.
it_data-matnr = '123444'.
append it_data.
it_data-matnr = '1234567890abcdefr'.
append it_data.
it_data-matnr = '1234567890abcdefty'.
append it_data.
it_data-matnr = 'asdhgk'.
append it_data.
loop at it_data.
clear int.
int = strlen( it_data-matnr ).
if int > 15.
delete it_data.
endif.
endloop.
Ram.
07-23-2010 8:23 AM
Hi
use this code.
DELETE <your Internal Table> WHERE strlen(material) GT 15.
Hope this will work.
With Regards.
07-23-2010 8:19 AM
Hi, check this one........becarefull remove leading zeros for material
data:begin of it_data occurs 0,
matnr(18),
end of it_data.
data: int type i.
it_data-matnr = '123444'.
append it_data.
it_data-matnr = '1234567890abcdefr'.
append it_data.
it_data-matnr = '1234567890abcdefty'.
append it_data.
it_data-matnr = 'asdhgk'.
append it_data.
DELETE it_data WHERE matnr+15(3) NE ' '.