‎2008 Mar 18 11:31 PM
Hi guys, i need to delete some entries from different tables like 20,
i want to do something like this:
IF dumy = x.
table = 'PA0001'.
ELSE.
table = 'pa2001'.
ENDIF.
DELETE FROM TABLE.
WHERE BEGDA = '99991231'
AND ENDDA = '99991231'.
any ideas?
Edited by: javier santana on Mar 19, 2008 12:33 AM
‎2008 Mar 19 5:42 AM
Hi,
Refer to the code snippet below.
Code Snippet
DATA: l_dummy TYPE char1,
l_table TYPE tabname.
l_dummy = 'X'.
IF l_dummy EQ 'X'.
l_table = 'PA0001'.
ELSE.
l_table = 'PA2001'.
ENDIF.
DELETE FROM (l_table)
WHERE begda = '99991231'
AND endda = '99991231'.
Regards,
Farheen
‎2008 Mar 18 11:44 PM
Hi Javier,
It is not recommended that you delete the data from standard table using ABAP code. Use the standard transactions, BAPI provided to do the same.
Regards,
Atish
‎2008 Mar 18 11:47 PM
Atish,
its only for Z tables, i wrote standards in order to made the example.
tks anyway.
‎2008 Mar 19 5:42 AM
Hi,
Refer to the code snippet below.
Code Snippet
DATA: l_dummy TYPE char1,
l_table TYPE tabname.
l_dummy = 'X'.
IF l_dummy EQ 'X'.
l_table = 'PA0001'.
ELSE.
l_table = 'PA2001'.
ENDIF.
DELETE FROM (l_table)
WHERE begda = '99991231'
AND endda = '99991231'.
Regards,
Farheen
‎2008 Mar 19 6:12 AM
data: tab(10) type c,
l_pernr type pa0001-pernr value '00000002'.
if l_pernr eq '00000002'.
tab = 'PA0001'.
else.
tab = 'PA2001'.
endif.
delete from (tab) where pernr = l_pernr.
if sy-subrc eq 0.
write:/ 'Done'.
endif.
Reward if useful............