Транзакция ZCHANGE_KODPROF изменение кода профессии

Транзакция ZCHANGE_KODPROF изменение кода профессии

В таблице ZPROF:

ZKPROF_OLD Код профессии старый
ZKPROF_NEW Код профессии новый

При первом запуске копирует в эти поля из ZKPROF.

https://hostiq.ua/clients/aff.php?aff=2305&lid=3

Изменяет поле  ZKPROF в PLPO и ZPROF

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
*&---------------------------------------------------------------------*
*& Report  ZCHANGE_KODPROF_LOPATKO
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

report  zchange_kodprof_lopatko.
tables: zprof.
data: it_zprof type table of zprof,
      it_plpo type table of plpo.
field-symbols: <fs_zprof> like line of it_zprof,
               <fs_plpo> like line of it_plpo.
select-options: zkprof for zprof-zkprof,
                so_old for zprof-zkprof_old,
                so_new for zprof-zkprof_new.
parameters: p_old as checkbox.
*            p_test as checkbox default 'X'.
update zprof set zkprof_old = zprof~zkprof where zkprof_old = ''.
update zprof set zkprof_new = zprof~zkprof where zkprof_new = ''.
select * from zprof into corresponding fields of table it_zprof where zkprof in zkprof and zkprof_old in so_old and zkprof_new in so_new.
loop at it_zprof assigning <fs_zprof>.
  if p_old = ''.
    delete from zprof where zkprof = <fs_zprof>-zkprof.
    commit work and wait.
    <fs_zprof>-zkprof = <fs_zprof>-zkprof_new.
    insert zprof from <fs_zprof>.
    commit work and wait.
    update plpo set zkprof = <fs_zprof>-zkprof_new where ( zkprof = <fs_zprof>-zkprof_new ) or ( zkprof = <fs_zprof>-zkprof_old ).
    if sy-subrc = 0.
      select * from plpo appending table it_plpo where ( zkprof = <fs_zprof>-zkprof_new ) or ( zkprof = <fs_zprof>-zkprof_old ).
    endif.
  else.
    delete from zprof where zkprof = <fs_zprof>-zkprof.
    commit work and wait.
    <fs_zprof>-zkprof = <fs_zprof>-zkprof_old.
    insert zprof from <fs_zprof>.
    commit work and wait.
    update plpo set zkprof = <fs_zprof>-zkprof_old where ( zkprof = <fs_zprof>-zkprof_new ) or ( zkprof = <fs_zprof>-zkprof_old ).
    if sy-subrc = 0.
      select * from plpo appending table it_plpo where ( zkprof = <fs_zprof>-zkprof_new ) or ( zkprof = <fs_zprof>-zkprof_old ).
    endif.
  endif.
  commit work and wait.
endloop.
include zchange_kodprof_uotput.

Добавить комментарий

Ваш адрес email не будет опубликован.