Update target and change status for released transports.
Use below program to updated status from released to modifiable and the target system.
*&---------------------------------------------------------------------*
*& Report ZTRANPORT_UPDATE
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT ZTRANPORT_UPDATE.
TABLES: e070, e070c,e07t.
DATA: ls_e070 LIKE e070,
ls_e070c LIKE e070c,
ls_e07t LIKE e07t.
DATA: lv_msgtext1 LIKE sy-msgv3,
lv_msgtext2 LIKE sy-msgv3,
lv_msgtext3 LIKE sy-msgv3.
CLEAR ls_e070.
CLEAR ls_e070c.
CLEAR ls_e07t.
SELECT-OPTIONS: P_trkorr for e070-trkorr.
PARAMETERS: p_trsys.
* MOVE-CORRESPONDING ko020 TO ls_e070.
loop at p_trkorr.
select SINGLE * INTO ls_e070
FROM e070
WHERE trkorr = p_trkorr-low.
ls_e070-TRSTATUS = 'D'.
ls_e070-TARSYSTEM = p_trsys.
SELECT SINGLE * INTO ls_e070c "read additional fields - note 2231381
FROM e070c
WHERE trkorr = P_trkorr-low.
* MOVE-CORRESPONDING ko020 TO ls_e070c.
* Note 2744888 - Only for transport collections: If the status (-> TRSTATUS) is
* changed, then the extended state (-> EXTENDED_STATE) needs to be adjusted as
* well ...
* If the status is 'D - Modifiable' and the extended state is 'F - Finalized',
* then switch/set the extended state to 'O - Open'
IF ls_e070-trstatus = 'D' AND ls_e070c-extended_state = 'F'.
ls_e070c-extended_state = 'O'.
* If the status is 'R - Released' and the extended state is not 'F - Finalized'
* and it's a transport collection (-> extended_state <> space), then switch/set
* the extended state to 'F - Finalized'
ELSEIF ls_e070-trstatus = 'R' AND ls_e070c-extended_state <> 'F' AND ls_e070c-extended_state <> space.
ls_e070c-extended_state = 'F'.
ENDIF.
* MOVE-CORRESPONDING ko020 TO ls_e07t.
SELECT SINGLE * INTO ls_e07t "read additional fields - note 2231381
FROM e07t
WHERE trkorr = P_trkorr-low.
ls_e07t-langu = sy-langu.
CALL FUNCTION 'TRINT_UPDATE_COMM_HEADER'
EXPORTING
wi_e070 = ls_e070
wi_e07t = ls_e07t
wi_save_user = ' '
wi_sel_e070 = 'X'
wi_sel_e07t = 'X'
wi_user = sy-uname
wi_e070c = ls_e070c
wi_sel_e070c = 'X'
IMPORTING
we_e070 = ls_e070
we_e070c = ls_e070c
EXCEPTIONS
e070_update_error = 01
e07t_update_error = 02
e070c_update_error = 03.
IF sy-subrc <> 0.
* CALL FUNCTION 'DEQUEUE_E_TRKORR'
* EXPORTING
* trkorr = ls_e070-trkorr.
* MESSAGE a040(tk) WITH ls_e070-trkorr
* RAISING update_failed.
ENDIF.
lv_msgtext1 = ls_e070-trkorr.
lv_msgtext2 = sy-uname.
lv_msgtext3 = ' '.
CALL FUNCTION 'TRINT_APPEND_COMM_SYSLOG_ENTRY'
EXPORTING
wi_msgid = 'TR'
wi_msgno = '018'
wi_msgv2 = lv_msgtext1
wi_msgv3 = lv_msgtext2
wi_msgv4 = lv_msgtext3
wi_new_order = ' '
wi_trfunction = ls_e070-trfunction
wi_trkorr = ls_e070-trkorr.
write: ls_e070-trkorr.
* MESSAGE s666(tk).
endloop.
* MOVE-CORRESPONDING ls_e070 TO ko020.
* MOVE-CORRESPONDING ls_e070c TO ko020.
* MOVE ls_e07t-as4text TO ko020-as4text.
*
* gs_ko020save = ko020.
*&---------------------------------------------------------------------*
*& Report ZTRANPORT_UPDATE
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT ZTRANPORT_UPDATE.
TABLES: e070, e070c,e07t.
DATA: ls_e070 LIKE e070,
ls_e070c LIKE e070c,
ls_e07t LIKE e07t.
DATA: lv_msgtext1 LIKE sy-msgv3,
lv_msgtext2 LIKE sy-msgv3,
lv_msgtext3 LIKE sy-msgv3.
CLEAR ls_e070.
CLEAR ls_e070c.
CLEAR ls_e07t.
SELECT-OPTIONS: P_trkorr for e070-trkorr.
PARAMETERS: p_trsys.
* MOVE-CORRESPONDING ko020 TO ls_e070.
loop at p_trkorr.
select SINGLE * INTO ls_e070
FROM e070
WHERE trkorr = p_trkorr-low.
ls_e070-TRSTATUS = 'D'.
ls_e070-TARSYSTEM = p_trsys.
SELECT SINGLE * INTO ls_e070c "read additional fields - note 2231381
FROM e070c
WHERE trkorr = P_trkorr-low.
* MOVE-CORRESPONDING ko020 TO ls_e070c.
* Note 2744888 - Only for transport collections: If the status (-> TRSTATUS) is
* changed, then the extended state (-> EXTENDED_STATE) needs to be adjusted as
* well ...
* If the status is 'D - Modifiable' and the extended state is 'F - Finalized',
* then switch/set the extended state to 'O - Open'
IF ls_e070-trstatus = 'D' AND ls_e070c-extended_state = 'F'.
ls_e070c-extended_state = 'O'.
* If the status is 'R - Released' and the extended state is not 'F - Finalized'
* and it's a transport collection (-> extended_state <> space), then switch/set
* the extended state to 'F - Finalized'
ELSEIF ls_e070-trstatus = 'R' AND ls_e070c-extended_state <> 'F' AND ls_e070c-extended_state <> space.
ls_e070c-extended_state = 'F'.
ENDIF.
* MOVE-CORRESPONDING ko020 TO ls_e07t.
SELECT SINGLE * INTO ls_e07t "read additional fields - note 2231381
FROM e07t
WHERE trkorr = P_trkorr-low.
ls_e07t-langu = sy-langu.
CALL FUNCTION 'TRINT_UPDATE_COMM_HEADER'
EXPORTING
wi_e070 = ls_e070
wi_e07t = ls_e07t
wi_save_user = ' '
wi_sel_e070 = 'X'
wi_sel_e07t = 'X'
wi_user = sy-uname
wi_e070c = ls_e070c
wi_sel_e070c = 'X'
IMPORTING
we_e070 = ls_e070
we_e070c = ls_e070c
EXCEPTIONS
e070_update_error = 01
e07t_update_error = 02
e070c_update_error = 03.
IF sy-subrc <> 0.
* CALL FUNCTION 'DEQUEUE_E_TRKORR'
* EXPORTING
* trkorr = ls_e070-trkorr.
* MESSAGE a040(tk) WITH ls_e070-trkorr
* RAISING update_failed.
ENDIF.
lv_msgtext1 = ls_e070-trkorr.
lv_msgtext2 = sy-uname.
lv_msgtext3 = ' '.
CALL FUNCTION 'TRINT_APPEND_COMM_SYSLOG_ENTRY'
EXPORTING
wi_msgid = 'TR'
wi_msgno = '018'
wi_msgv2 = lv_msgtext1
wi_msgv3 = lv_msgtext2
wi_msgv4 = lv_msgtext3
wi_new_order = ' '
wi_trfunction = ls_e070-trfunction
wi_trkorr = ls_e070-trkorr.
write: ls_e070-trkorr.
* MESSAGE s666(tk).
endloop.
* MOVE-CORRESPONDING ls_e070 TO ko020.
* MOVE-CORRESPONDING ls_e070c TO ko020.
* MOVE ls_e07t-as4text TO ko020-as4text.
*
* gs_ko020save = ko020.
Comments
Post a Comment