04-25-2006 7:55 AM
Hi,
I use BAPI_SALESORDER_CREATEFROMDAT2 to create salesorder. Is there another BAPI or function to convert this salesorder to invoice?
04-25-2006 8:16 AM
Hi,
check the FM <b>GN_INVOICE_CREATE</b>, it will create the Invoice.
Regards
vijay
04-25-2006 10:11 AM
How do I tell to BAPI_BILLINGDOC_CREATEMULTIPLE (or GN_INVOICE_CREATE) that it should create invoice from existing sales order?
04-25-2006 10:24 AM
Hi Erki,
you need to fill the communication structures KOMFK,KOMFKGN,KOMFKKO,KOMFKTX etc..and pass it to FM.
CALL FUNCTION 'GN_INVOICE_CREATE'
EXPORTING
DELIVERY_DATE = DELIVERY_DATE
INVOICE_DATE = INVOICE_DATE
INVOICE_TYPE = 'ZFX'
PRICING_DATE = PRICING_DATE
VBSK_I = X_VBSK
WITH_POSTING = 'D'
ID_NO_ENQUEUE = 'X'
TABLES
XKOMFK = IT_KOMFK
XKOMFKGN = IT_KOMFKGN
XKOMFKKO = IT_KOMFKKO
XKOMFKTX = IT_KOMFKTX
XKOMV = IT_KOMV
XTHEAD = IT_HEAD
XVBFS = IT_VBFS
XVBPA = IT_VBPA
XVBRK = IT_VBRK
XVBRP = IT_VBRP
XVBSS = IT_VBSS
SUCCESS_DOC_OUT = IT_SUCCESS.
Regards
vijay
04-28-2006 12:20 PM
Hi,
I debugged vf01 and found that it uses RV_INVOICE_CREATE. It only needs xkomfk-vbeln field as order number and creates invoice correctly.
My invoices are automatically printed to spool.
My goal is to get the OTF spool, convert it to PDF and stream it to PHP web application.
<b>PDF part works OK, only missing link is how to get spool number after rv_invoice_create?</b>
br,
erki
04-28-2006 12:43 PM
Hi Erki,
Are you sure that will generate the Spool, if that is the case you can read the spool table TSP01 with the Username,date. in your program have a code like this...
before generating the spool(i mean calling the FM) take the latest spool with the help of username,date.
then call your FM, then later again select the Spool using user,date. compare both the spool numbers , if they are not same, then consider the second one as the spool number generated . if they are same then no spool generated.
Regards
vijay
05-23-2007 3:29 PM
Hello,
as I just found out, you have to call the fm RV_INVOICE_DOCUMENT_ADD, too. My coding (working) looks like this:
it_komfk-vbeln = '0000000111'.
it_komfk-vbtyp = 'J'.
append it_komfk.
CALL FUNCTION 'RV_INVOICE_CREATE'
EXPORTING
vbsk_i = wa_VBSK
IMPORTING
VBSK_E = wa_vbsk_e
tables
xkomfk = it_KOMFK
xkomv = it_KOMV
xthead = it_THEADVB
xvbfs = it_VBFS
xvbpa = it_VBPAVB
xvbrk = it_VBRKVB
xvbrp = it_VBRPVB
xvbss = it_VBSS.
CALL FUNCTION 'RV_INVOICE_DOCUMENT_ADD'
EXPORTING
vbsk_i = wa_vbsk_e
WITH_POSTING = 'A'
tables
xkomfk = it_KOMFK
xkomv = it_KOMV
xthead = it_THEADVB
xvbfs = it_VBFS
xvbpa = it_VBPAVB
xvbrk = it_VBRKVB
xvbrp = it_VBRPVB
xvbss = it_VBSS.
regards,
Johannes.
02-25-2009 1:40 PM
hi.. rv_invoice_create is returning values but when the same structures are passed to
rv_invoice_document_add it is not returning anything...
04-25-2006 10:23 AM
Pass the sales order number and its item to field DOC_NUMBER and ITM_NUMBER of structure BILLINGDATAIN.
04-25-2006 11:08 AM
Does not work, it requires also other fields and then creates invoice based on that data not on sales order data.
Is there an easier way to reference only sales order number to create matching invoice?