Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Problem while creating Invoice Create Invoices

Former Member
0 Likes
1,144

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

1 ACCEPTED SOLUTION
Read only

Jelena_Perfiljeva
Active Contributor
0 Likes
1,004

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

6 REPLIES 6
Read only

Former Member
0 Likes
1,004

Hi,

Use standard bapi " BAPI_BILLINGDOC_CREATEMULTIPLE" or "BAPI_BILLINGDOC_CREATE" for creating invoices.

Regards

Vinod

Read only

Former Member
0 Likes
1,004

--

Reddy

Read only

0 Likes
1,004

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

Read only

Former Member
0 Likes
1,004

HI Asish

at the end you must call fm BAPI_TRANSACTION_COMMIT

regards

Marco

Read only

Jelena_Perfiljeva
Active Contributor
0 Likes
1,005

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

Read only

0 Likes
1,004

Hi ,,

Thanks all for the response.

I didi it myself and wed are able to create Invoices now..

Regards,

Asish Dash