Code: Alles auswählen.
** Resevierungen zum Auftrag lesen
CALL FUNCTION 'CO_BT_RESB_SET'
EXPORTING
aufnr_act = is_header_dialog-aufnr
index = 1
EXCEPTIONS
entry_not_found = 1
table_empty = 2
OTHERS = 3.
IF sy-subrc <> 0.
RETURN.
ENDIF.
DO.
CALL FUNCTION 'CO_BT_RESB_GET'
EXPORTING
aufnr_act = is_header_dialog-aufnr
IMPORTING
resbd_exp = ls_resbd
resb_bt_index = lv_index
vbkz_exp = lv_vbkz
EXCEPTIONS
eof = 1
table_empty = 2
OTHERS = 3.
IF sy-subrc <> 0.
RETURN.
ENDIF.
CHECK lv_vbkz NE 'D'.
IF ls_resbd-postp EQ 'L'.
ls_resbd-bwart = '111'.
CALL FUNCTION 'CO_BT_RESB_PUT'
EXPORTING
resbd_new = ls_resbd
EXCEPTIONS
OTHERS = 0.
ENDIF.
ENDDO.
ENDIF.
Hi.
Code: Alles auswählen.
method IF_EX_WORKORDER_UPDATE~AT_SAVE.
DATA: ls_resbd TYPE RESBD,
lv_index TYPE SY-TABIX,
lv_vbkz TYPE RESBB-VBKZ,
lv_af_tab TYPE TABLE OF AFVGD,
ls_af LIKE LINE OF lv_af_tab,
lv_aufnr type CAUFV-AUFNR,
lv_found TYPE c LENGTH 1,
lv_lines type i,
lv_arbpl TYPE c LENGTH 8.
CALL FUNCTION 'CO_BT_RESB_SET'
EXPORTING
aufnr_act = is_header_dialog-aufnr
index = 1
EXCEPTIONS
entry_not_found = 1
table_empty = 2
OTHERS = 3.
IF sy-subrc <> 0.
RETURN.
ENDIF.
CALL FUNCTION 'CO_BT_AFVG_GET_ALL'
EXPORTING
AUFNR_IMP = is_header_dialog-aufnr
TABLES
AFVGD_TAB = lv_af_tab
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2
.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
" Prüfen ob ein Steuerschlüssel QM01 enthalten ist.
loop at lv_af_tab INTO ls_af.
if ls_af-steus = 'QM01'.
lv_found = 'X'.
endif.
ENDLOOP.
DESCRIBE TABLE lv_af_tab LINES lv_lines.
DATA: lv_rcr01 TYPE RCR01,
lv_afvgd TYPE AFVGD,
lv_tab TYPE i VALUE 5.
if lv_found = 'X'.
loop at lv_af_tab INTO ls_af.
lv_lines = lv_lines - 1.
CALL FUNCTION 'CO_BT_AFVG_GET'
EXPORTING
aufnr_act = is_header_dialog-aufnr
IMPORTING
AFVGD_EXP = lv_afvgd
RCR01_EXP = lv_rcr01
* EXCEPTIONS
* EOF = 1
* OTHERS = 2
.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
if lv_lines = 2.
lv_arbpl = lv_rcr01-arbpl.
endif.
AT LAST.
lv_afvgd-arbpl = lv_arbpl.
CALL FUNCTION 'CO_BT_AFVG_UPDATE'
EXPORTING
afvgd_new = lv_afvgd
* FLG_NO_SCHED = ' '
* FLG_NO_UVO_UPD = ' '
tabix_old = 5
* FLG_SCHED_LIGHT = ' '
* INS_MODE = ' '
* FLG_NO_DEALLOC = ' '
* FLG_NO_CALC = ' '
* FLG_NO_REC_PROCESS = ' '
* I_PROT_IMP =
* FLG_OCM = ' '
* I_FORCE_UPDATE = ' '
IMPORTING
TABIX_NEW = lv_tab
.
ENDAT.
ENDLOOP.
ENDIF.
endmethod.