FI_ITEMS_MASS_CHANGE usage

source: http://forums.sdn.sap.com/thread.jspa?threadID=1961864&start=0&tstart=0

REPORT ZTEST_FB02 .
 
type-pools : TPIT.
 
DATA : W_BSEG TYPE BSEG,
W_message TYPE T100-TEXT.
 
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.
 
* Field name to be changed
it_fldtab-fname = 'ZUONR'.
append it_fldtab.
clear it_fldtab.
 
* Field value
W_BSEG-ZUONR = 'TEST19'.
 
* ITEM 7
select single bukrs belnr gjahr buzei koart umskz bschl mwart mwskz
     from bseg into corresponding fields of it_buztab
       where belnr = '0902001922' and bukrs = '3160' and 
             gjahr = '2006'       and BUZEI = '007'.
if sy-subrc = 0.
  APPEND it_buztab.
  clear it_buztab.
endif.
 
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.
IF SY-SUBRC 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  perform generate_message.
  write : w_message.
else.
write : 'Updated successfully'.
ENDIF.
&---------------------------------------------------------------------
* & Form generate_message
&---------------------------------------------------------------------
FORM generate_message .
CLEAR W_message.
 
read table it_errtab index 1.
if sy-subrc 0.
CALL FUNCTION 'FORMAT_MESSAGE'
  EXPORTING
    id = it_errtab-ERR-MSGID
    lang = sy-langu
    no = it_errtab-ERR-MSGNR
    v1 = it_errtab-ERR-MSGV1
    v2 = it_errtab-ERR-MSGV2
    v3 = it_errtab-ERR-MSGV3
    v4 = it_errtab-ERR-MSGV4
  IMPORTING
    msg = W_message
  EXCEPTIONS
    not_found = 1
    OTHERS = 2.
endif.
 
ENDFORM. " generate_message

你可能感兴趣的:(change)