2016 Aug 01 11:55 AM
Hi,
I'm using the fm BAPI_BILLINGDOC_CREATEMULTIPLE to create an invoice for a sales order. In the next step I want to link this new invoice to the document flow of the sales order.
I've found several fms to do this (BINARY_RELATION_CREATE_COMMIT, SD_DOCUMENT_FLOW_MAINTAIN, RV_DOCUMENT_FLOW_UPDATE, RV_XVBFA_MAINTAIN ...) but I have no idea which one is correct and how it has to be called.
Any ideas/examples would be greatly appreciated.
Greetings Stefan
2016 Aug 01 2:07 PM
Yes..You can do as Juwin said...
Initialize the flow
CALL FUNCTION 'SD_DOCUMENT_FLOW_INIT'
EXPORTING
i_vbtyp_n = 'V'.
And prepare the structures..
DATA: ls_vbfa TYPE vbfa.
ls_vbfa-mandt = sy-mandt.
ls_vbfa-vbelv = is_vbap-vbeln.
ls_vbfa-posnv = is_vbap-posnr.
ls_vbfa-vbeln = iv_ponum.
ls_vbfa-posnn = is_vbap-posnr.
ls_vbfa-vbtyp_n = 'V'.
ls_vbfa-rfmng = is_vbap-kwmeng.
ls_vbfa-meins = is_vbap-vrkme.
ls_vbfa-vbtyp_v = 'H' .
ls_vbfa-erdat = sy-datum.
ls_vbfa-erzet = sy-uzeit.
ls_vbfa-matnr = is_vbap-matnr.
* Maintain document flow
CALL FUNCTION 'SD_DOCUMENT_FLOW_MAINTAIN'
EXPORTING
i_delete = space
i_status = 'H'
i_vbfa = ls_vbfa.
And finally save the document flow
CALL FUNCTION 'SD_DOCUMENT_FLOW_SAVE_PO'.
Regards
Raj
Hi,
I'm using the fm BAPI_BILLINGDOC_CREATEMULTIPLE to create an invoice for a sales order. In the next step I want to link this new invoice to the document flow of the sales order.
I've found several fms to do this (BINARY_RELATION_CREATE_COMMIT, SD_DOCUMENT_FLOW_MAINTAIN, RV_DOCUMENT_FLOW_UPDATE, RV_XVBFA_MAINTAIN ...) but I have no idea which one is correct and how it has to be called.
Any ideas/examples would be greatly appreciated.
Greetings Stefan
2016 Aug 01 1:40 PM
Initialize the call using SD_DOCUMENT_FLOW_INIT
Call SD_DOCUMENT_FLOW_MAINTAIN passing i_status = 'H', and i_vbfa = new document flow record
Call SD_DOCUMENT_FLOW_SAVE_PO to save the record to database.
Thanks,
Juwin
2016 Aug 01 2:07 PM
Yes..You can do as Juwin said...
Initialize the flow
CALL FUNCTION 'SD_DOCUMENT_FLOW_INIT'
EXPORTING
i_vbtyp_n = 'V'.
And prepare the structures..
DATA: ls_vbfa TYPE vbfa.
ls_vbfa-mandt = sy-mandt.
ls_vbfa-vbelv = is_vbap-vbeln.
ls_vbfa-posnv = is_vbap-posnr.
ls_vbfa-vbeln = iv_ponum.
ls_vbfa-posnn = is_vbap-posnr.
ls_vbfa-vbtyp_n = 'V'.
ls_vbfa-rfmng = is_vbap-kwmeng.
ls_vbfa-meins = is_vbap-vrkme.
ls_vbfa-vbtyp_v = 'H' .
ls_vbfa-erdat = sy-datum.
ls_vbfa-erzet = sy-uzeit.
ls_vbfa-matnr = is_vbap-matnr.
* Maintain document flow
CALL FUNCTION 'SD_DOCUMENT_FLOW_MAINTAIN'
EXPORTING
i_delete = space
i_status = 'H'
i_vbfa = ls_vbfa.
And finally save the document flow
CALL FUNCTION 'SD_DOCUMENT_FLOW_SAVE_PO'.
Regards
Raj
2016 Aug 01 3:52 PM
Thanks for your answers, I did as you said and added a COMMIT WORK and it works!
2016 Aug 09 9:11 AM
Thank you Stefan for asking the question and thanks to Juwin and Raj for the helpful answers.
I had a similar Problem : i deleted a handling Unit in a packing proposal of a scheduling Agreement with FM "V51F_DELETE_HU" (commit for the deletion of HU is done with FM "HU_POST".
To maintain the document flow I used FM "RV_XVBFA_MAINTAIN".
I did not understand why table VBFA was not updated.
Thanks to this post I used FM "RV_DOCUMENT_FLOW_UPDATE_U" -> it is inside of FM "SD_DOCUMENT_FLOW_SAVE_PO".
It worked.
Regards
Stephan
2016 Aug 09 10:02 AM
2020 Sep 28 4:09 AM
Hi,
I used the same code for tried to make flow between Contract & Billing after Contract creation, but it didnt work out. I'm getting below challenge
1> What do I need to export in SD_DOCUMENT_FLOW_INIT, as V is for PO.
2> In, SD_DOCUMENT_FLOW_SAVE_PO, it asking me to export PO, but I'm creating Contract from Billing, there is no EBELN.
Code is below
CALL FUNCTION 'SD_DOCUMENT_FLOW_INIT'
EXPORTING
i_vbtyp_n = 'V'.
And prepare the structures..
DATA: ls_vbfa TYPE vbfa.
ls_vbfa-mandt = sy-mandt.
ls_vbfa-vbelv = is_vbap-vbeln.
ls_vbfa-posnv = is_vbap-posnr.
ls_vbfa-vbeln = iv_ponum.
ls_vbfa-posnn = is_vbap-posnr.
ls_vbfa-vbtyp_n = 'G'.
ls_vbfa-rfmng = is_vbap-kwmeng.
ls_vbfa-meins = is_vbap-vrkme.
ls_vbfa-vbtyp_v = 'M' .
ls_vbfa-erdat = sy-datum.
ls_vbfa-erzet = sy-uzeit.
ls_vbfa-matnr = is_vbap-matnr.
* Maintain document flow
CALL FUNCTION 'SD_DOCUMENT_FLOW_MAINTAIN'
EXPORTING
i_delete = space
i_status = 'H' OR 'V'
i_vbfa = ls_vbfa.
And finally save the document flow
CALL FUNCTION 'SD_DOCUMENT_FLOW_SAVE_PO'.
EXPORT
I_EBELN = ''.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |