03-18-2014 4:39 PM
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.
03-18-2014 4:47 PM
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.
03-18-2014 4:59 PM
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.
03-18-2014 5:16 PM
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
03-18-2014 5:18 PM
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?
03-18-2014 5:34 PM
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) ?
03-18-2014 5:41 PM
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
03-18-2014 5:43 PM
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.