cancel
Showing results for 
Search instead for 
Did you mean: 

how i can delete from it_table

Former Member
0 Kudos

how i can delete from it_table

Accepted Solutions (0)

Answers (9)

Answers (9)

Former Member
0 Kudos

I WANT TO DELETE STAT FRO TABLE JEST

I HAVE 2 PARAMETRS STAT_I AND STAT_E

IF THE USER WRITE ECUS IN STAT_I AND ESTO IN STAT_E

I WILL GET ONLY THE RECORDS WHIT ECUS

ANY IDEA?

THANKS.

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Why are you do direct database update to JEST.

Regards,

Rich Heilman

Former Member
0 Kudos

I'M NOT DO DIRECT I TAKE ALL THE VALUES INTO IT TABLE

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Ahhh....I read your post wrong. Sorry.

Regards,

Rich Helman

former_member181962
Active Contributor
0 Kudos

HI Yehiel,

From what I have understood, YOu need to select using only the first parameter STAT_I

Select *

from JEST into table it_jest

where stat = stat_I.

Is that what you wanted??

Regards,

Ravi

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

This what you mean?



report zrich_0001 .

data: begin of itab occurs 0,
      field1 type c,
      field2 type c,
      end of itab.



ranges: stat_i for itab-field1,
        stat_e for itab-field1.

delete itab where not field1 in stat_i
              and field1 in stat_e.


Regards,

Rich Heilman

Former Member
0 Kudos

I SELECT ECUS

AND IF GET

"ECUS ESTO"

SO I NEED TO MANTION THAT I DO NOT WANT ESTO

IT WRITING IN "IE05" I'M TRYING TO MAKE IT EASY

Former Member
0 Kudos

I think I am understanding what you are trying to do, based on what I see on the selection screen of IE05 tcode. There are two select-options on the selection screen one that says include these status and the other says exclude these. You want to know how to write the select statement.

SELECT ..... FROM JEST

WHERE STAT IN INCLSTAT

AND NOT STAT IN EXCLSTAT.

Here INCLSTAT is your select-option for include status and EXCLSTAT is for the opposite.

Hope this is what you are looking for.

Srinivas

Former Member
0 Kudos

Hi,

report ztest no standard page heading.

data: begin of itab occurs 0,

field1(6) type c,

end of itab.

start-of-selection.

itab-field1 = 'apple'. append itab. clear itab.

itab-field1 = 'ectram'. append itab. clear itab.

itab-field1 = 'fxectr'. append itab. clear itab.

delete itab where field1 cs 'ectr'.

Regards,

Sailaja.

Former Member
0 Kudos

Hi braha,

while looping the internal table, check for the condition where you find 'ectr' then after that stmt say delete itab.

thats it.

Loop at itab.

check for the condition.

delete itab.

endloop.

Regards,

Vinod.

Former Member
0 Kudos

Hi,

check this it may help you...

1. DELETE FROM dbtab WHERE cond.

DELETE FROM (dbtabname) WHERE cond.

2. DELETE dbtab.

DELETE *dbtab.

DELETE (dbtabname) ...

3. DELETE dbtab FROM TABLE itab.

DELETE (dbtabname) FROM TABLE itab.

4. DELETE dbtab VERSION vers.

DELETE *dbtab VERSION vers.

http://help.sap.com/saphelp_46c/helpdata/EN/06/aafd54fc4011d195280000e8353423/frameset.htm

hope this may help you

regards,

venu.

Former Member
0 Kudos

Yehiel,

To Delete whole Internal Table:

<b> Delete iTab.</b>

or

<b>refresh iTab[].</b>

To Delete a single enrty:

<b> delete table iTab from waTab.</b>

Thank

Kam

Former Member
0 Kudos

Numerous ways...

Example: delete my_itab where field1 = 'SOME_VALUE'.

OR

delete my_itab where field1 = 'ectr'.

Suggestion - In ABAP Editor, click on the word DELETE in your source code and press F1. This will expose SAP's on-line help for the DELETE command.

Reward points accordingly.

Message was edited by: John Jakabcsin

former_member181962
Active Contributor
0 Kudos

Check the documentation below.

DELETE itab

Syntax

DELETE {itab_line|itab_lines|duplicates}.

Effect

This statement either deletes one or more rows itab_line or itab_lines, specified with the table key or table index, or it deletes neighbouring duplicate rows duplicates.

System Fields

sy-subrc Meaning

0 At least one row was deleted.

4 No row was deleted, since no suitable row was found using the table key or logical condition; or the specified index was larger than the current number of rows; or no duplicate neighbouring rows were found.

eg:

PARAMETERS p_carrid TYPE scarr-carrid.

DATA: scarr_tab TYPE SORTED TABLE OF scarr

WITH UNIQUE KEY carrid,

scarr_wa LIKE LINE OF scarr_tab.

SELECT *

FROM scarr

INTO TABLE scarr_tab.

IF sy-subrc = 0.

scarr_wa-carrid = p_carrid.

DELETE TABLE scarr_tab FROM scarr_wa.

ENDIF.

2)

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.

3)

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,

Ravi

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

You can do this a couple of different ways.

Loop at it_table.

If condition.....

Delete it_table.

endif.

endloop.

If you want to clear the whole thing, you can...

clear it_table.  refresh it_table.

or 

Free it_table.

You can also do stuff like this...

http://help.sap.com/saphelp_46c/helpdata/EN/06/aafd54fc4011d195280000e8353423/frameset.htm

Regards,

RIch Heilman

Message was edited by: Rich Heilman

Former Member
0 Kudos

Just say

"DELETE IT_TABLE.

THE CURRENT RECORD IN THE INTERNAL TABLE GETS DELETED.

Former Member
0 Kudos

i want to delete a record that contain the word 'ectr''

HOW I MADE IT

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

I would suggest something like this for your requirement.

delete from it_table where <the_field> = 'ectr'.

Regards,

Rich Heilman

former_member181962
Active Contributor
0 Kudos

Hi,

try

delete itab where field cs 'ectr'.

Former Member
0 Kudos

I think this is what you are looking for.

DELETE i_data WHERE field CP 'ectr'.

Please close the post if answered.

Srinivas