Application Development 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: 

Delete statement

Former Member
0 Kudos


Hi

I have a delete statement in a standard program.

 

DELETE (i_table) FROM TABLE i_del_tab.

Here, i_table is having table name: /IRM/AVIR, i_del_tab is having the record to be deleted.

In the program the above delete statement is getting failed.

So can you please tell me, how this delete statement will work.

Thanks.

7 REPLIES 7

iotatau
Participant
0 Kudos

Your syntax looks correct. What is the sy-subrc result? What is the exact content of i_del_tab? You say a single record. Do you pass it as a line of a table? If you want to use the record directly the syntax is

DELETE (i_table) FROM i_del_tab.

Former Member
0 Kudos

Actually in the transaction level we are deleting the header assignment details i.e., we are deleting a record. then when we click on SAVE we are facing the error : ERROR in DELETE.

the deleted record details are passed into the internal table i_del_tab. Sy-subrc is coming as 4.

0 Kudos

Hi Spandana,

The syntax  DELETE I_TABLE FROM TABLE I_DEL_TAB is correct.

Please check the below points before you execute this statement.

1. Is the structure of I_TABLE and I_DEL_TAB is same - if not then please make them similar.

2. See if I_TABLE is using any currency fields - if yes then you need to specify the reference table 

    and    reference field in 'Currency/Quantity fields' tab.


Regards,

Mohammed

0 Kudos

sy-subrc = 4 means that the record to be deleted which is passed in i_del_tab does not match any record in (i_table). It is not a program error but a valid outcome of the deletion attempt. "The record to be deleted could not be found." The next step would be to check why there is no match. Are there any special characters in the record to be deleted? What about capitalization?

Former Member
0 Kudos

i_table is of type dd02d-tabname, which is having the table name as /IRM/AVIR.

i_del_tab is of type /IRM/AVIR.

here, for the delete statement to be successful, is the record present in i_del_tab should be present in table, i_table (/IRM/AVIR) ?

0 Kudos

Hi,

The statement will be successful only when the the Delete is successful, so there must be a matching record in the table.

Thanks & Regards

Bala Krishna

jcutinho
Explorer
0 Kudos

If, for a row of the internal table, there is no row in the database with the same content as the primary key, the corresponding row is ignored and sy-subrc is set to 4.

Looks like the data in the I_DEL_TAB is mismatch.