大龄ABAP自由顾问
全部博文(55)
分类: 项目管理
2011-08-12 15:52:10
Hi,
is there a bapi allowing to create an incoming invoice an saving it as completed?.
i don´t need to park it.
i´d like to save the document as completed.
(i did try with BAPI_INCOMINGINVOICE_PARK but what i got was a parked document and what i need is a document saved as completed).
it is as if you cliked "Saved as completed" button of transaction MIR7.
Best regards.
-----------------------------------------------------------------------------------
To all people interested this is how i solved the question:
CALL FUNCTION 'BAPI_INCOMINGINVOICE_PARK'
EXPORTING
headerdata = x_in_header
IMPORTING
invoicedocnumber = lc_belnr
fiscalyear = lc_gjahr
TABLES
itemdata = i_in_item
return = i_return.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
CALL FUNCTION 'MRM_INVOICE_READ'
EXPORTING
i_belnr = lc_belnr
i_gjahr = lc_gjahr
IMPORTING
e_rbkpv = s_rbkpv
TABLES
t_drseg = tab_drseg
t_rbselbest = l_t_selbest
t_rbsellifs = l_t_sellifs
t_rbselfrbr = l_t_selfrbr
t_rbselwerk = l_t_selwerk
t_rbselerfb = l_t_selerfb.
PERFORM drseg_complete(SAPLMR1M) USING s_rbkpv
'V'
space
CHANGING tab_drseg[].
* As the next routine checks ok-code not initial i have to
* pass a value to the ok-code
DATA: c_okqu(17) TYPE c VALUE '(SAPLMR1M)OK-CODE'.
FIELD-SYMBOLS:
ASSIGN (c_okqu) TO
DATA: ok-code(20).
DATA: l_trtyp LIKE t169-trtyp value 'V'.
CONSTANTS: l_okcode LIKE ok-code VALUE 'COMP'.
PERFORM document_park(SAPLMR1M) USING s_rbkpv
tab_drseg[]
l_t_selbest[]
l_t_selfrbr[]
l_t_sellifs[]
l_t_selwerk[]
l_t_selerfb[]
l_trtyp "akt_typ
l_okcode. "fcocomp.
Note that the key here was the two routines drseg_complete and document_park