Skip to Content
0
Jan 10, 2023 at 08:56 AM

BAPI_GOODSMVT_CANCEL error message

148 Views Last edit Jan 10, 2023 at 09:01 AM 3 rev

I used the function " BAPI_GOODSMVT_CANCEL SPAN" to write off the material, but there was a problem.

LOOP AT gt_out_009_back_temp INTO DATA(gs_out_009_back_temp)   .<br>        CALL FUNCTION 'BAPI_GOODSMVT_CANCEL'<br>        EXPORTING<br>        materialdocument    = gs_out_009_back_temp-MBLNR         "<br>        matdocumentyear     = gs_out_009_back_temp-MJAHR         "year<br>        goodsmvt_pstng_date = sy-datum<br>        goodsmvt_pr_uname   = sy-uname<br>        IMPORTING<br>        goodsmvt_headret    = goodsmvt_headret<br>        TABLES<br>            return              = t_return.<br>        LOOP AT t_return INTO s_return WHERE  type = 'E'. "<br>        temp_msg = temp_msg && s_return-message .<br>        CLEAR : s_return .<br>        ENDLOOP.<br>     IF sy-subrc <> 0.<br>     COMMIT WORK AND WAIT .<br>     ELSE.<br>     ROLLBACK WORK .<br>endloop.

But there will be some material vouchers that cannot be written off.

No error message was returned, but a few minutes later prompted "Express cancel update"

ST22:

An exception has occurred which is explained in more detail below. The
exception is assigned to class 'CX_SY_OPEN_SQL_DB' and was not caught in
procedure
"FML_ACDOCA_M_EXTRACT_INSERT" "(FUNCTION)", nor was it propagated by a RAISING
clause.
Since the caller of the procedure could not have anticipated this
exception, the current program was terminated.
The reason for the exception is:
When an Open SQL array insert is performed, trying to insert a record
into the database table "ACDOCA_M_EXTRACT" causes the function to terminate if
a
record with the same key already exists.

(When an Open SQL individual record insert is performed, this situation
does not cause the function to terminate. SY-SUBRC is set to 4 instead.)

Error in the ABAP application program.

The current ABAP program "SAPLFML_ACDOCA_M_EXTRACT" had to be terminated
because it found a
statement that could not be executed.

I need some help. Thank you.