Dear Experts,
Please help me regarding this.....
In my requirement my user wants to create an invoice automatically and sends it to local printer for printing when PGI button is clicked on Vl01n/Vl02n
screen with respect to delivery.
I tried using Badi LE_SHP_DELIVERY_PROC. In this badi i tried methods save_document_prepare,SAVE_AND_PUBLISH_DOCUMENT,SAVE_AND_PUBLISH_BEFORE_OUTPUT,SAVE_AND_PUBLISH_DOCUMENT.
I tried userexits in SAPMV50A~MV50AFZ1----USEREXIT_SAVE_DOCUMENT,USEREXIT_SAVE_DOCUMENT_PREPARE.
my sample code as follows...
BREAK-POINT.
data : t_vbrk type TABLE OF bapivbrk," WITH HEADER LINE,
w_vbrk type bapivbrk ,"WITH HEADER LINE,
return type TABLE OF bapiret1," WITH HEADER LINE,
w_return type bapiret1," WITH HEADER LINE,
success type TABLE OF BAPIVBRKSUCCESS," WITH HEADER LINE.
w_success type BAPIVBRKSUCCESS ,"WITH HEADER LINE.
xlikp type likp.
loop at ct_xlikp into xlikp.
if xlikp-vkorg eq 'RME1' and sy-ucomm eq 'WABU_T'.
w_vbrk-ordbilltyp = xlikp-fkarv. " likp MANDATORY
w_vbrk-ref_doc = xlikp-vbeln. " likp MANDATORY
w_vbrk-ref_doc_ca = 'J'. " hard code MAINTAINED IN LIKP TABLE MADATORY
append w_vbrk to t_vbrk.
CLEAR w_vbrk.
CALL FUNCTION 'BAPI_BILLINGDOC_CREATEMULTIPLE'
EXPORTING
* CREATORDATAIN =
TESTRUN = 'X'
* POSTING =
TABLES
BILLINGDATAIN = t_vbrk
* CONDITIONDATAIN =
* CCARDDATAIN =
* TEXTDATAIN =
* ERRORS =
RETURN = return
SUCCESS = success.
endif.
endloop.
But I am getting error in Return table as "VF 066 Goods issue has not been posted for the delivery"...
Kindly please help me on this to find a right userexit/badi after the PGI Posted .....
I need to close this immediately.....
anybody please help me on this....
Thanks and Regards
Mahesh.P