Skip to Content

Better Delete Logic??

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.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Best Answer
    author's profile photo
    Former Member
    Posted on Aug 22, 2007 at 05: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.

    Add comment
    10|10000 characters needed characters exceeded