‎2006 Oct 05 2:07 PM
Hi,
I need to delete selected records from database table(dynamic names). Table names are being passed from main program with some of their field names. The record to be deleted from the database table is being decided based on the fields passed for the table and their contains passed from the main program.
It is not possible to write dynamic where clause for DELETE statement directly.
So, I created a dynamic internal table and selected the records to be deleted in that internal table.
Now I want to use the syntax :
DELETE (dbtabname) FROM TABLE itab.
But for "(dbtabname)", the system is recognising it as internal table.
When i use "DELETE FROM (table_name), it recognises "table_name" as database table.
As i know
To specify the database table dynamically, we have to enter the following for <target>:
DELETE [FROM] (<name>) [CLIENT SPECIFIED] <lines>.
Please help How should I delete entries from database table when i have the records to be deleted in an internal table.
Thanks & Regards,
Surya
‎2006 Oct 05 2:16 PM
DELETE (dbtabname) FROM TABLE itab.
will work. What error is it giving?
Regards,
Ravi
‎2006 Oct 05 2:16 PM
DELETE (dbtabname) FROM TABLE itab.
will work. What error is it giving?
Regards,
Ravi
‎2006 Oct 05 2:21 PM
According to my program logic, Insteed of "table_name" I am useing T_FLDS_AGTAB-TABNAME where T_FLDS_AGTAB containing table names and their field names (table passed from the main program).
Error message:
"T_FLDS_AGTAB" is a table without a header line and therefor no component called "TABNAME"
‎2006 Oct 05 2:24 PM
DELETE (dbtabname) FROM TABLE itab.
Define (dbtabname) LIKE DD02L-tabname.
Ex:
DATA: dbtabname LIKE dd02l-tabname.
‎2006 Oct 05 2:27 PM
Hi,
Did u check if T_FLDS_AGTAB has some data in it. May be you need to declare an internal table of type T_FLDS_AGTAB and populate it with required values and later use that delete statement. Because "DELETE dbtab FROM TABLE itab" is statement used to delete database tables only.
Regards
Saikiran
‎2006 Oct 05 2:28 PM
Thanks buddy, now the code is working.
There was a mistake.
I was using t_flds_agtab, insteed of s_flds_agtab.
Thanks,
Still i need to test the code for its successful deletion from database table.
I will be back with issues soon.
Thanks again,
Surya
‎2006 Oct 05 2:32 PM
‎2006 Oct 05 2:48 PM
Please let me know some more things.
I am using a subroutine to create a dynamic inter table and the reference variable is being passed to the calling program.
the calling program will get an address(as a CHANGING parameter passed while calling)
I want to know - after it comes out of the subroutine, will the address be meaningful. The memory area in which the dynamic internal table was created will we flushed after returning from the sub-routine ??
"Remember the GEETA's Quote - Do your DUTY !! without thinking of the RESULTS or PRIZES ...
Please dont mind buddy....just kidding...I will soon reward you with points.
Enjoy ABAP !!!
‎2006 Oct 05 2:54 PM
That shuldn't happen ideally ( Think the value should remain intact even after coming out of the subroutine ) ..anyways if u post the exact code it will be much easier to sort out
‎2006 Oct 05 2:30 PM