‎2010 May 18 12:33 PM
Hi ,
My requirement is to create an Invoice from a file sent by Informatica (Middleware).
I am using RV_INVOICE_CREATE tio create the invoice.I am using the below details to create the Invoice .
I am filling these strucutres from VBAP .
*Fill the KOMFK Structure
gw_komfk-vbeln = gw_vbap-vbeln.
gw_komfk-posnr = gw_vbap-posnr.
gw_komfk-vbtyp = gc_c.
gw_komfk-fkart = gc_z2.
gw_komfk-fkimg = 1.
gw_komfk-vrkme = gw_vbap-vrkme.
APPEND gw_komfk TO gt_komfk.
*Fill the KOMV structure
gw_komv-kschl = gc_loc.
gw_komv-kbetr = gw_final_tab-invoice_amnt.
gw_komv-waers = gc_usd.
APPEND gw_komv TO gt_komv.
*Fill the VBRK Structure
gw_vbrk-vbeln = gw_vbap-vbeln.
gw_vbrk-bukrs = gw_vbap-bukrs_vf.
gw_vbrk-zuonr = gw_final_tab-invoice_num.
APPEND gw_vbrk TO gt_vbrk.
Then , I am calling the FM to create the Invoice as below:
CALL FUNCTION 'RV_INVOICE_CREATE'
EXPORTING
invoice_type = gc_z2
vbsk_i = gt_vbsk
with_posting = 'B'
IMPORTING
vbsk_e = vbsk_e
od_bad_data = bad_data
TABLES
xkomfk = gt_komfk
xkomv = gt_komv
xthead = xthead
xvbfs = xvbfs
xvbpa = xvbpa
xvbrk = gt_vbrk
xvbrp = xvbrp
xvbss = xvbss.
IF sy-subrc EQ 0.
COMMIT WORK.
ENDIF.
My problem is that I am not able to successfully create an Invoice.
Kindly suggest me if I am missing out something.
Thanks in advance.
Regards,
Asish Dash
‎2010 May 18 6:23 PM
If you have VBAP entries, I'm assuming you have a preceding sales document. I was able to use another function module, to which I simply passed the document number and reference type (you may need to use a different type instead of C):
CALL FUNCTION 'RV_INVOICE_CREATE_RFC'
EXPORTING
i_refdoc = f_vbeln
i_reftype = 'C'.P.S. Do COMMIT WORK after calling FM.
Edited by: Jelena Perfiljeva on May 18, 2010 1:24 PM
‎2010 May 18 12:40 PM
Hi,
Use standard bapi " BAPI_BILLINGDOC_CREATEMULTIPLE" or "BAPI_BILLINGDOC_CREATE" for creating invoices.
Regards
Vinod
‎2010 May 18 1:02 PM
‎2010 May 18 2:43 PM
Hi ,
Thanks for the reply.
I have developing a custom program , could you guide me how to fetch the below details :
DELIVERY_DATE = RV60A-FBUDA
PRICING_DATE = RV60A-PRSDT
INVOICE_DATE = RV60A-FKDAT
INVOICE_TYPE = RV60A-FKART
SELECT_DATE = POSTAB-FKDAT.
How do i get the RV60A and POSTAB values?
Regards,
Asish Dash
‎2010 May 18 1:06 PM
HI Asish
at the end you must call fm BAPI_TRANSACTION_COMMIT
regards
Marco
‎2010 May 18 6:23 PM
If you have VBAP entries, I'm assuming you have a preceding sales document. I was able to use another function module, to which I simply passed the document number and reference type (you may need to use a different type instead of C):
CALL FUNCTION 'RV_INVOICE_CREATE_RFC'
EXPORTING
i_refdoc = f_vbeln
i_reftype = 'C'.P.S. Do COMMIT WORK after calling FM.
Edited by: Jelena Perfiljeva on May 18, 2010 1:24 PM
‎2010 Jun 15 10:11 AM
Hi ,,
Thanks all for the response.
I didi it myself and wed are able to create Invoices now..
Regards,
Asish Dash