DATA : it_errtab TYPE tpit_t_errdoc WITH HEADER LINE,
it_fldtab TYPE tpit_t_fname WITH HEADER LINE,
it_buztab TYPE tpit_t_buztab WITH HEADER LINE.
* 확정전표확인
CLEAR ls_bkpf.
SELECT SINGLE *
INTO ls_bkpf
FROM bkpf
WHERE bukrs = bukrs
AND belnr = belnr
CHECK ls_bkpf-bstat EQ space.
CALL FUNCTION 'DEQUEUE_EFBKPF'
EXPORTING
belnr = ls_bkpf-belnr
bukrs = ls_bkpf-bukrs
gjahr = ls_bkpf-gjahr.
* Field name to be changed
FREE : it_buztab, it_errtab, it_fldtab.
it_fldtab-fname = 'ZLSPR'.
APPEND it_fldtab. CLEAR it_fldtab.
* Field value
CLEAR w_bseg.
w_bseg-zlspr = space.
* ITEM
SELECT bukrs
belnr
gjahr
buzei
koart
umskz
bschl
mwart
mwskz
FROM bseg
INTO CORRESPONDING FIELDS OF TABLE it_buztab
WHERE bukrs EQ ls_bkpf-bukrs
AND belnr EQ ls_bkpf-belnr
AND gjahr EQ ls_bkpf-gjahr
AND koart EQ 'K'
AND zlspr EQ 'R'
AND augbl EQ space.
IF it_buztab[] IS NOT INITIAL.
CALL FUNCTION 'FI_ITEMS_MASS_CHANGE'
EXPORTING
s_bseg = w_bseg
IMPORTING
errtab = it_errtab[]
TABLES
it_buztab = it_buztab
it_fldtab = it_fldtab
EXCEPTIONS
bdc_errors = 1
OTHERS = 2.
ENDIF.
IF it_errtab[] IS INITIAL.
성공
ELSE.
CLEAR lv_flag.
LOOP AT it_errtab.
IF it_errtab-err-msgtyp EQ 'E'.
lv_flag = 'X'.
EXIT.
ENDIF.
ENDLOOP.
IF lv_flag EQ 'X'.
에러
ELSE.
성공
ENDIF.
ENDIF.
임시전표일 경우 해당BAPI 나 함수를 찾지 못함.
댓글 없음:
댓글 쓰기