2007 Aug 22 6:39 PM
Hi All,
I have requirement to write a function module to delete records from 125 Y(custom) tables
This is my scenario.
delete from y100 where docno eq v_docno.
if sy-subrc eq 0.
delete from y101 where docno eq v_docno.
if sy-subrc eq 0.
......... " Keep this loop all remaining 125 tables
else.
rollback.
else.
rollback.
endif.
I know i can do this using lot of IF statements, I want know any other better way to do this?
Please don't suggest to use lot of IF statements.
a®
2007 Aug 22 6:48 PM
Hi ARS,
May we can do this way.
v_table = 'Y100'.
do 25 times.
delete from v_table where docno eq v_docno.
if sy-subrc ne 0.
flag = 'X'.
exit.
endif.
v_table = v_table + 1.
enddo.
if flag = 'X'.
rollback.
endif.
Ali.
Hi ARS,
May we can do this way.
v_table = 'Y100'.
do 25 times.
delete from v_table where docno eq v_docno.
if sy-subrc ne 0.
flag = 'X'.
exit.
endif.
v_table = v_table + 1.
enddo.
if flag = 'X'.
rollback.
endif.
Ali.
2007 Aug 22 6:48 PM
Hi ARS,
May we can do this way.
v_table = 'Y100'.
do 25 times.
delete from v_table where docno eq v_docno.
if sy-subrc ne 0.
flag = 'X'.
exit.
endif.
v_table = v_table + 1.
enddo.
if flag = 'X'.
rollback.
endif.
Ali.
2007 Aug 22 6:59 PM
Quadri
Thanks for your reply.
Here table names are not unique. Some times delete for table name go like
Y100, Y101, Y106, Y123 ....... like that
I am getting the table name to delete in a import parameter table.
a®
2007 Aug 22 7:06 PM
ARS,
You can append all the table in one internal table and loop it.
This is one of the way.
Again it depends on your requirement.
Ali
2007 Aug 22 7:11 PM
Hi,
From your reply i understood, that i need to write dynamic delete, dynamically assign the table name something like this way
delete from = v_docno.
I think i need to field-symbol for this.
Anyway thanks for your help.
a®
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |