Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

deleting entry from internal table

Former Member
0 Likes
29,679

Hi Experts,

i have the following internal table:

data : it_result1 TYPE crmt_object_guid_tab

and work area

data : wa_result1 type crmt_object_guid.

i have to delete a guid from internal table based on some condition.

loop at it_resul1 into wa_result1

if lv_priority eq priority.

  • delete this entry from internal table.

endif.

endloop..

i tried using delete table it_result with table key CRMT_OBJECT_GUID = wa_result. but this is giving syntax error.

what should be done to delete the entry?

Thanks and regards

Shilpi

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
13,873

Try this,

Delete table it_result with table key CRMT_OBJECT_GUID = WA_RESULT1.

Regards,

Joan

8 REPLIES 8
Read only

_IvanFemia_
Active Contributor
0 Likes
13,873

Hi,

you're in a loop

use

DELETE it_result INDEX sy-tabix.

The sintax error that you have could be fixed by

delete table it_result with table key CRMT_OBJECT_GUID = wa_result1-CRMT_OBJECT_GUID. "specify the field and do not use all the work area

Regards,

Ivan

Read only

Former Member
13,873

Hi

Check Syntax for DELETE operator on pressing F1

1. DELETE itab.

2. DELETE TABLE itab WITH TABLE KEY k1 = v1 ... kn = vn.

3. DELETE TABLE itab [FROM wa].

4. DELETE itab INDEX idx.

5. DELETE itab FROM idx1 TO idx2.

6. DELETE itab WHERE logexp.

7. DELETE ADJACENT DUPLICATES FROM itab.

delete table it_result with table key CRMT_OBJECT_GUID = wa_result

this is wrong

delete it_result where CRMT_OBJECT_GUID = wa_result

Edited by: Lavanya K on Apr 22, 2009 10:20 AM

Read only

Former Member
0 Likes
13,873

Hi,

use the following:


delete table it_result with table key CRMT_OBJECT_GUID = wa_result1.

Read only

Former Member
0 Likes
13,873

Use

delete table it_result where CRMT_OBJECT_GUID = wa_result-<fieldname>.(compare with fieldname of workarea not ebntire workarea.)

Thanks

Vijeta Galani

Read only

Former Member
0 Likes
13,873

Hi Shilpi,

Delete the entry using the beow syntax.

DELETE TABLE table name FROM work area.

or get the index of the entry from the internal table and delete it

DELETE internal table name INDEX sy-tabix.

Hope this will help ou.

Regards,

Phani.

Read only

Former Member
0 Likes
13,874

Try this,

Delete table it_result with table key CRMT_OBJECT_GUID = WA_RESULT1.

Regards,

Joan

Read only

Former Member
0 Likes
13,873

Hi,

usually You can use delete statement to delete data from your internal table. For ex.

DELETE ITAB1 WHERE MATNR <> 105024 AND MATNR <> 105023 AND MATNR <> 100010 .

Regards,

Himanshu

Read only

Former Member
0 Likes
13,873

Hi Shilpi,

You can try this.


data : it_result1 TYPE STANDARD TABLE OF crmt_object_guid_tab.

data : wa_result1 type crmt_object_guid.

loop at it_resul1 into wa_result1.

if lv_priority eq priority.

delete table it_result1 from wa_result1.

endif.

endloop.

Note: when you use the below syntax, you might face problem in capturing the correct index of the record, since records are being deleted.


DELETE it_result INDEX sy-tabix.