Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

FI_DOCUMENT_CHANGE

Hello Experts,

I have to update the text field SGTXT of BSEG with few texts by code. Am using the FM

FI_DOCUMENT_CHNAGE to do that. The sy-subrc returns 0. But the texts doesn't update on the

line item of the document. I have made use of 'COMMIT WORK'. Yet no go.

gs_accchg-fdname = 'SGTXT'.

gs_accchg-newval = itab-sgtxt.

APPEND gs_accchg TO gt_accchg.

CLEAR gs_accchg.

CALL FUNCTION 'FI_DOCUMENT_CHANGE'

EXPORTING

i_awtyp = gs_bkpftab-awtyp

i_awref = gs_bkpftab-awkey+00(10)

i_aworg = gs_bkpftab-awkey+10(10)

i_buzei = gs_bsegtab-buzei

TABLES

t_accchg = gt_accchg

EXCEPTIONS

no_reference = 1

no_document = 2

many_documents = 3

wrong_input = 4

overwrite_creditcard = 5

OTHERS = 6.

COMMIT WORK.

Request to suggest if am missing something here.

Thanks and Regards in advance

Kumar

Former Member
replied

Hi,

if its not working try this function module FI_ITEMS_MASS_CHANGE but its not updating for all the line item. Please refer the code below.

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

Regards,

Dhina..

1 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question