Hello ABAP-Collegues!
I´m experiencing some Problems regarding Bapi´s.
CASE:
I´m Using BAPI_GOODSMVT_CREATE to create several goods movements (GOODS RECEPTION). Sometimes I have to make 3 different bookings for the same reception (Reception, return delivery, scrapping).
The Problem is that before I can make a 'return delivery' the reception has to be booked. Ín my Programm, the reception-BAPI is created before (when required) the return delivery-BAPI. Unfortunately this doesn´t mean that the reception is BOOKED before the return delivery...
My code:
loop at i_tobook.
clear tables, structures, fill them up again
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
goodsmvt_header = h_goodsmvt_header
goodsmvt_code = h_goodsmvt_code
IMPORTING
materialdocument = h_materialdocument
TABLES
goodsmvt_item = i_goodsmvt_item
return = i_return.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT =
IMPORTING
RETURN =
.
begin-> I tried adding this, problem is not solved!!!
if h_materialdocument NE ''.
clear: h_MBLNR, h_MJAHR, h_MBLNR2.
h_MBLNR = h_materialdocument.
h_MJAHR = Sy-datum(4).
DO 150 TIMES.
select single mblnr from mkpf into h_MBLNR2
where MBLNR = h_MBLNR and
MJAHR = h_MJAHR.
if sy-subrc = 0.
exit.
else.
WAIT UP TO 1 seconds.
endif.
enddo.
endif.
end-> I tried adding this, problem is not solved!!!
endloop.
*************
I really need the bookings with BAPI_GOODSMVT_CREATE to be COMPLETELY FINISHED before I can create the next BAPI_GOODSMVT_CREATE.
Any Help would be very appreciated!
Greetz!
Pieter