Professional Documents
Culture Documents
REPORT ZEAM_ORDER_OPER_FIX.
* This report check for one order if any related information for
* operations exist. If so and the corresponding operation do not
* exist the report will list them.
* In case of parameter P_TEST = ' ' the report will also delete
* the associated orphaned records
* Following status tables will be checked :
* JSTO
* JEST
* JCDO
* JCDS
* ONR00
* ONROK
* AFVV
* AFVU
*
* Parameter P_TEST :
* - P_TEST = SPACE -> update mode
* - P_TEST <> SPACE -> test mode
* - only in update mode the report will make database changes
* - set text "Test Mode" for this text element*
*
* Parameter P_ORDER :
* - you can restrict by order number
* - set flag dictionary reference for this text element
gv_objnr_low = 'OV'.
gv_objnr_low+2 = afko-aufpl.
gv_objnr_low+12 = '00000000'.
gv_objnr_high = 'OV'.
gv_objnr_high+2 = afko-aufpl.
gv_objnr_high+12 = '99999999'.
select * from jsto into table gt_jsto where objnr between gv_objnr_low and
gv_objnr_high.
select * from jest into table gt_jest where objnr between gv_objnr_low and
gv_objnr_high.
select * from jcdo into table gt_jcdo where objnr between gv_objnr_low and
gv_objnr_high.
select * from jcds into table gt_jcds where objnr between gv_objnr_low and
gv_objnr_high.
select * from onr00 into table gt_onr00 where objnr between gv_objnr_low and
gv_objnr_high.
select * from onrov into table gt_onrov where objnr between gv_objnr_low and
gv_objnr_high.
loop at gt_afvc.
delete gt_jsto where objnr = gt_afvc-objnr.
delete gt_jest where objnr = gt_afvc-objnr.
delete gt_jcdo where objnr = gt_afvc-objnr.
delete gt_jcds where objnr = gt_afvc-objnr.
delete gt_onr00 where objnr = gt_afvc-objnr.
delete gt_onrov where objnr = gt_afvc-objnr.
delete gt_afvv where APLZL = GT_AFVC-APLZL.
delete gt_afvu where APLZL = GT_AFVC-APLZL.
endloop.
skip 2.
write : / 'Records to be DELETED:'.
skip 1.
loop at gt_jsto.
write : / 'JSTO :',gt_jsto-objnr.
if p_test = ' '.
delete from jsto where objnr = gt_jsto-objnr.
endif.
endloop.
loop at gt_jest.
write : / 'JEST :',gt_jest-objnr, gt_jest-stat.
if p_test = ' '.
delete from jest where objnr = gt_jest-objnr and stat = gt_jest-stat.
endif.
endloop.
loop at gt_jcdo.
write : / 'JCDO :',gt_jcdo-objnr, gt_jcdo-chgnr.
if p_test = ' '.
delete from jcdo where objnr = gt_jcdo-objnr and chgnr = gt_jcdo-chgnr.
endif.
endloop.
loop at gt_jcds.
write : / 'JCDS :',gt_jcds-objnr, gt_jcds-stat, gt_jcds-chgnr.
if p_test = ' '.
delete from jcds where objnr = gt_jcds-objnr and stat = gt_jcds-stat and
chgnr = gt_jcds-chgnr.
endif.
endloop.
loop at gt_onr00.
write : / 'ONR00 :',gt_onr00-objnr.
if p_test = ' '.
delete from onr00 where objnr = gt_onr00-objnr.
endif.
endloop.
loop at gt_onrov.
write : / 'ONROV :',gt_onrov-objnr.
if p_test = ' '.
delete from onrov where objnr = gt_onrov-objnr.
endif.
endloop.
loop at gt_afvv.
write : / 'AFVV :',GT_AFVV-AUFPL, ' ', GT_AFVV-APLZL.
if p_test = ' '.
delete from afvv where aufpl = gt_afvv-aufpl and aplzl = gt_afvv-aplzl.
endif.
endloop.
loop at gt_afvu.
write : / 'AFVU :', GT_AFVU-AUFPL, ' ', GT_AFVU-APLZL.
if p_test = ' '.
delete from afvu where aufpl = gt_afvu-aufpl and aplzl = gt_afvu-aplzl.
endif.
endloop.
endif.