‎2007 May 18 5:38 PM
Hi,
I've a screen that receives a dbtab name and some conditions for deleting records, I've filled an itab with the conditions in order to use dynamic SQL. It runs perfectly if I do
SELECT * INTO <tab> FROM (dbtab) WHERE (conditions).but it won't accept with the Delete statement.
DELETE FROM (dbtab) WHERE (conditions)..
Is there any solution for this problem or do I really have to create a report dynamically?
‎2007 May 20 3:47 PM
Hi Andr,
you can use
SELECT * INTO <tab> FROM (dbtab) WHERE (conditions).
DELETE (dbtab) FROM TABLE <tab>.
Regards,
Clemens
‎2007 May 18 5:44 PM
Hi,
Try deleting with in a loop..
LOOP AT <tab> ASSIGNING <FS>.
DELETE (dbtab) FROM <fs>.
ENDLOOP.
Thanks,
Naren
‎2007 May 20 12:40 PM
Hi...
Where do you want me to put the WHERE clause?
And the main problem is that I can't create an internal table from a reference of a dbtab (a variable with the name of the dbtab).
If I could create an itab with the structure of the dbtab my problem should be solved with:
SELECT * INTO CORRESPONDING FIELDS OF TABLE <itab> FROM (dbtab_name) WHERE (conditions).and
DELETE FROM (dbtab_name) VALUES <itab>.
‎2007 May 18 5:46 PM
Can you check your delete statement,it might be problem with your delete statement
delete db table from table int_table where condition..
‎2007 May 20 12:41 PM
‎2007 May 18 5:59 PM
Try this....
DELETE (QUERY_TABLE) FROM TABLE <DYN_TABLE>.
Greetings,
Blag.
‎2007 May 20 12:48 PM
Hi,
I don't have the dbtab name into a field-symbol but in a variable... Like
dbtab_name = 'ZHR_AL'.And when using your code I've to change to
DELETE (conditions) FROM TABLE (dbtab_name).And the result is an error: Unable to interpret the expression "(DBTAB_NAME)".
#-/
‎2007 May 20 1:28 PM
DELETE (conditions) FROM TABLE (dbtab_name).
when you use above condition then it will delete the data from your internal table...
if you want to delete from database table then use :
DELETE (conditions) FROM TABLE (dbtab_name).
if you want to delete from internal table :
DELETE TABLE (dbtab_name). where conditions..
Thanks
Seshu
‎2007 May 21 8:52 AM
???
DELETE (conditions) FROM TABLE (dbtab_name).
when you use above condition then it will delete the
data from your internal table...
if you want to delete from database table then use :
DELETE (conditions) FROM TABLE (dbtab_name).
I've already solved my problem but I'd love to do it your way because it seems it would have a better performance...
But like I said before, with your solution it will give me a syntax error:
Unable to interpret the expression "(dbtab_name)". -
Regards,
André Costa
‎2007 May 20 3:47 PM
Hi Andr,
you can use
SELECT * INTO <tab> FROM (dbtab) WHERE (conditions).
DELETE (dbtab) FROM TABLE <tab>.
Regards,
Clemens
‎2007 May 21 8:47 AM
Hi Clemens Li,
thank you very much!! The solution is almost like you said:
SELECT * INTO <tab> FROM (dbtab) WHERE (conditions).
DELETE (dbtab) FROM <tab>.
ENDSELECT.
Now it works perfect! Thanks again.
Regards,
André Costa