hi guru's
My question is going about how to be sure the work of a bapi is has ended without the use of
several wait up to 'x' seconds.
In spite of these waits it is still going wrong sometimes.
then i get a message like : storage bin 0017nnnnnnnn is currently being processed by.
At the moment i use below coding.Does someone know what to change to be absolutely sure
the work of the bapi is completely finished and i do not get that kind of messages again.
I saw several other calls but no really clear answer.
So this time with coding. so it is more visual what happens.
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
goodsmvt_header = lv_good_header
goodsmvt_code = lv_good_code
* TESTRUN = ' '
* GOODSMVT_REF_EWM =
IMPORTING
goodsmvt_headret = lv_goodsmvt_headret
materialdocument = lv_materialdocument
matdocumentyear = lv_materialyear
TABLES
goodsmvt_item = lv_good_item
* GOODSMVT_SERIALNUMBER =
return = lv_return
* GOODSMVT_SERV_PART_DATA =
* EXTENSIONIN =
.
WAIT UP TO 1 SECONDS.
LOOP AT lv_return INTO lv_return_line WHERE type = 'E' OR type = 'A'.
MESSAGE ID lv_return_line-id TYPE 'W' NUMBER lv_return_line-number
WITH lv_return_line-message_v1
lv_return_line-message_v2
lv_return_line-message_v3
lv_return_line-message_v4.
ENDLOOP.
IF sy-subrc = 0.
CALL FUNCTION 'DEQUEUE_ALL'.
EXIT.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'
IMPORTING
return = lv_return_line.
* ENDIF.
* With help of transcation LT09 try to create follow-up TO
* With movement-type '999'.
CLEAR: lv_nlenr, lv_lgnum.
SELECT SINGLE lgnum INTO lv_lgnum FROM t320
WHERE werks = gt_data2-werks
AND lgort = gt_data2-lgort.
DO 7 TIMES.
WAIT UP TO 1 SECONDS.
SELECT SINGLE nlenr INTO lv_nlenr FROM ltap
WHERE lgnum = lv_lgnum
AND pquit = 'X'
AND vltyp = '902'
AND vlpla = gt_data2-ebeln
AND wenum = lv_materialdocument.
IF sy-subrc EQ 0.
EXIT.
ENDIF.
WAIT UP TO 2 SECONDS.
ENDDO.
IF lv_nlenr IS NOT INITIAL.
etc. etc.