Skip to Content
2

FI_ITEMS_MASS_CHANGE - problem with update

Dec 24, 2017 at 03:10 PM

210

avatar image

Hello

I am using FM

FI_ITEMS_MASS_CHANGE

and unfortunately the data is not updating immediatlly

I tried to use commit work (and also bapi_transaction_commit)

both not solved this issue.

Lets say my field "zterm" have value "A"

I'm trying to update it to "B"

When i'm checking it the value is still "A"

I'm doing another itteration, update the value to "C"

and the when i'm checking the value i'm getting "B" (from the previous itteration)

here is part of the code:


SELECT SINGLE zterm, zfbdt
INTO @DATA(ls_bseg)
FROM bseg
WHERE bukrs = @t_bseg-bukrs
AND belnr = @t_bseg-belnr
AND gjahr = @t_bseg-gjahr
AND buzei = @t_bseg-buzei.

IF sy-subrc = 0 AND ( ls_bseg-zterm <> t_bseg-zterm OR t_bseg-zfbdt <> ls_bseg-zfbdt ) .

SELECT bukrs belnr gjahr buzei koart bschl
APPENDING CORRESPONDING FIELDS OF TABLE lt_buztab
FROM bseg
WHERE bukrs = t_bseg-bukrs "lv_bukrs
AND rebzg = t_bseg-belnr "lv_belnr
AND rebzj = t_bseg-gjahr "lv_gjahr.
" AND buzei = t_bseg-buzei
AND koart = 'K'
.

LOOP AT lt_buztab INTO DATA(ls_bseg_new).

ls_fldtab-aenkz = abap_true.
ls_fldtab-fname = 'ZTERM'.
APPEND ls_fldtab TO lt_fldtab.
* .

ls_fldtab-fname = 'ZFBDT'.
APPEND ls_fldtab TO lt_fldtab.


es_bseg-zfbdt = t_bseg-zfbdt.
es_bseg-zterm = t_bseg-zterm.
" es_bseg-rebzg = t_bseg-rebzg.

break yakovk.
CALL FUNCTION 'FI_ITEMS_MASS_CHANGE'
EXPORTING
s_bseg = es_bseg
IMPORTING
errtab = it_errtab
TABLES
it_buztab = lt_buztab
it_fldtab = lt_fldtab
EXCEPTIONS
bdc_errors = 1
OTHERS = 2.
IF sy-subrc <> 0.
* Implement suitable error handling here
ELSE.

DATA ls_return TYPE bapiret2.

* CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
* EXPORTING
* wait = 'X'
* IMPORTING
* return = ls_return.


COMMIT WORK.

ENDIF.

FREE lt_fldtab.

ENDLOOP.

Thank in advance :)

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
avatar image
Former Member Dec 28, 2017 at 10:18 AM
1

Hello

You can try use FM:

IN BACKGROUND TASK AS SEPARATE UNIT

And it can solve your issue

Avner

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Dec 25, 2017 at 03:43 PM
0

Before calling the FM 'FI_ITEMS_MASS_CHANGE'' try using SET UPDATE TASK LOCAL.

Share
10 |10000 characters needed characters left characters exceeded