cancel
Showing results for 
Search instead for 
Did you mean: 

BAPI SD_SALESDOCUMENT_CREATE Update Document Flow in Sales Document referencing Invoice

former_member461047
Participant
0 Kudos
1,111

Hello Experts,

I am using this BAPI to create a Sales Order and I have a requirement to update the Sales Order's Document Flow w.r.t., Invoice.

I have tried passing the following to the BAPI

ls_header-refobjtype = 'VBRK'.

ls_header-refobjkey = ls_vbrk-vbeln. (Invoice Number)

ls_header-refdoctype = 'M'.

The sales order is created but the Document Flow is not getting updated. Have I missed anything ? Can anyone please help me out ?

BR Naresh

Accepted Solutions (0)

Answers (1)

Answers (1)

Jeansy
Active Contributor
0 Kudos

Hi Naresh,

I had the same requirement. I solved it via function module SD_SALESDOCUMENT_CREATE.

Here I filled the reference document in the header data.

  ls_hd-ref_doc_l  = iv_invoice.<br>  ls_hd-ref_doc    = iv_invoice.<br>  ls_hd-refdoc_cat = ls_invoice-vbtyp.<br>

This works fine in my scenario 🙂

I hope this helps you!

Kind regards
Jens

former_member461047
Participant
0 Kudos

Hi Jens,

Thanks for responding. I tried with these three fields but the document flow is not getting updated.

Is there anything else that I should pass here ?

BR Naresh

Jeansy
Active Contributor
0 Kudos

Hi,

that is really strange because it is working in my case. See below

In my case it's a return order that is created related to the invoice. And I really only filled the mentioned fields in the function module.

So it looks that the type of Sales Order seems to be relevant?

Did you already test if the document flow is written when creating the sales order manually w/o BAPI?

Kind regards
Jens

former_member461047
Participant
0 Kudos

Yea., It looks that way doesn't it.

Yes. I have created one successfully using VA01.

BR Naresh

mhtan88
Discoverer
0 Kudos

I also facing the same problem. May I know any one found out the solution?