Skip to Content
0
Former Member
Jul 25, 2005 at 04:18 PM

Do I Need to Commit

14 Views

I am new to ABAP, and have written the following to update a BW ODS table.

Do I need to add a commit statement? It works without it, but I am wondering what the best practice is.

Any other comments or suggestions about the code would be welcomed, too.

report zz_update_ods.

data: itab type standard table of /bic/az_ods00,
      wa like line of itab.

parameters: p_ordr  like /bic/az_ods00-/bic/z_order_n obligatory,
            p_new_s like /bic/az_ods00-/bic/zsalesorg obligatory.

select /bic/z_order_n /bic/zsalesorg
into   corresponding fields of table itab
from   /bic/az_ods00
where /bic/z_order_n = p_ordr.

if sy-subrc eq 0.
  loop at itab into wa.

    update /bic/az_ods00
       set /bic/zsalesorg = p_new_s
       where /bic/z_order_n = p_ordr.

    write: / wa-/bic/z_order_n,
           ' salesorg changed to ',
           p_new_s,
           ' from ',
           wa-/bic/zsalesorg.
  endloop.
endif.