Skip to Content
0
Sep 28, 2020 at 03:12 AM

No Documentflow for Contract Creation

30 Views

Hi SAP Pundits,

I'm using BAPI_CONTRACT_CREATEFROMDATA to crate Contract from Billing doc. But after creation, there is no Document flow. I wrote below code, but it didnt fix the issue. Need help.

I used the this 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 = ''.