Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Post invoice from individual sales order

Hello All:

I aming using a bapi to create a sales order and want a serial process to create a individual bill document for the created sales order!

I have tried many things trying to replicate the VF01 process.

BAPI_Billingdoc_createmultiple --> I can't put any net value into it. There is a conditiondatain structure, but I don't understand use of data_index. Appearantly whatever value I put in cond_type and Cond_value doesn't reflect on the bill documents. Also this bapi seems to be creating from value I set not the sales order it create from!

BAPI_Billingdoc_createfromdata --> Same data structure pass in as the createmultiple. However no return log returns document #. When I check in system status. The sales order is in status of processing. Appearantly not finished processing yet. But the Bapi has finished his work.

RV_INVOICE_CREATE --> I have tried to use this FM as well. By just put in information of XKOMFX-Mandt and XKOMFX-VBELN and POSNR. But when I ran all it does it give me a message VF063 "check the log". What log to check? where to check it?

Since in VF01 it's a simple 1 click process. Isn't there a bapi that I can just put in sales order reference and it pop back the Billing document # (or error messages if there are any)..

I appreciate any help on this! Thank You

Sincerely Yours

Bo Peng

Tags:
Former Member
Former Member replied

Hello Bo,

I have used RV_INVOICE_CREATE FM to create invoice with reference Sales order .

Check the below code :

DATA: VBSK_I LIKE VBSK.

data : v_vbeln like vbak-vbeln.

DATA: XKOMFK LIKE KOMFK OCCURS 0 WITH HEADER LINE,

XKOMV LIKE KOMV OCCURS 0 WITH HEADER LINE,

XTHEAD LIKE THEADVB OCCURS 0 WITH HEADER LINE,

XVBFS LIKE VBFS OCCURS 0 WITH HEADER LINE,

XVBPA LIKE VBPAVB OCCURS 0 WITH HEADER LINE,

XVBRK LIKE VBRKVB OCCURS 0 WITH HEADER LINE,

XVBRP LIKE VBRPVB OCCURS 0 WITH HEADER LINE,

XVBSS LIKE VBSS OCCURS 0 WITH HEADER LINE,

XKOMFKGN LIKE KOMFKGN OCCURS 0 WITH HEADER LINE.

refresh: XKOMFK, XKOMV,

XTHEAD, XVBFS,

XVBPA, XVBRK,

XVBRP, XVBSS.

clear : XKOMFK, XKOMV,

XTHEAD, XVBFS,

XVBPA, XVBRK,

XVBRP, XVBSS,

VBSK_I.

VBSK_I-SMART = 'F'.

XKOMFK-VBELN = P_VBELN.

<b>XKOMFK-VBTYP = 'C'</b>. " -> Sales order to Invoice

APPEND XKOMFK.

  • Invoice Creation Function Module

CALL FUNCTION 'RV_INVOICE_CREATE'

EXPORTING

VBSK_I = VBSK_I

WITH_POSTING = 'C'

TABLES

XKOMFK = XKOMFK

XKOMV = XKOMV

XTHEAD = XTHEAD

XVBFS = XVBFS

XVBPA = XVBPA

XVBRK = XVBRK

XVBRP = XVBRP

XVBSS = XVBSS.

if sy-subrc eq 0.

COMMIT WORK AND WAIT.

endif.

Thanks

Seshu

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question