on 01-23-2006 4:08 PM
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
Peter,
Try to use a background job with one step for each process ( like reception, return). Start the next step on successfull completion of first step. Also use 'Wait' in BAPI transaction commit.
Apart from it, you may want to see qRFC with send queue to check if it maight help you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello!
Thanx for all the replies...
I think I´ll go with the Solution of Sharad Agrawal.
(I also thought about it doing that myself, but really wanted to figure out why this BAPI_TRANSACTION_COMMIT function doesn´t work the way it should. That said, I find it disappointing that the 'commit work an wait'-Statement (BAPI_TRANSACTION_COMMIT with wait parameter) doesn´t do what it is supposed to do... Try and create several BAPI_GOODSMVT_CREATE (MASS-TEST) and you will see what I mean...)
Happy Programming!
Greetz!
Pieter
Hi Rob!
Word! (Write letters ´n´ Stuff)
I checked my code, and actually the Sy-datum thing was OK because I´m booking goods receptions... They should be booked on the day this Proggie runs -> therefore sy-datum
Just wanted to let you know...
Thanks for all the help!
I´m a Belgian living in Germany... being helped by Canadian!
I´ve also spotted a lot of other nationalities here
SDN surely is a multicultural environment!
PS:Big up to Canada!
Greetz!
Pieter
When yo do the select, try adding 'BYPASSING BUFFER'.
Rob
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Pieter,
try to use
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'
* IMPORTING
* RETURN =
It forces to wait until commit work is completely executed.
Regards, Manuel
Please remember to reward points and to close the thread when your problem is solved.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Manuel,
That wouldn´t work.
f.e.:
Material A has no Stock
I create a BAPI for a goods reception for Material A of 10 Pieces.
Then, I create a BAPI for a return delivery for Material A of 10 Pieces.
-> Since Material A has no Stock, this BAPI will return an error (first BAPI isn´t BOOKED yet)
Would be kind of funny when it did, though...
Thanx for looking into it!
User | Count |
---|---|
103 | |
12 | |
11 | |
6 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.