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

BAPI for VF01

Former Member
0 Likes
1,487

Hi experts,

I have a requirement to create billing request based on Sales order, I tried BAPI (BAPI_BILLINGDOC_CREATEMULTIPLE).

This bapi create document no for each sales order, But i want one billing request irespective of number of sales order, say some example i have 2 sales order with n number of item, which it has to be create single billing request number, So kindly guide me the same which BAPI i have to use.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,151

Hi,

Check this,

CALL FUNCTION 'RV_INVOICE_CREATE'
            EXPORTING
              invoice_date  = sy-datum
              vbsk_i        = vbsk_i
              with_posting  = 'B'
              id_no_enqueue = 'X'
            IMPORTING
              vbsk_e        = vbsk_i
            TABLES
              xkomfk        = xkomfk
              xkomv         = xkomv
              xthead        = xthead
              xvbfs         = xvbfs
              xvbpa         = xvbpa
              xvbrk         = xvbrk
              xvbrp         = xvbrp
              xvbss         = xvbss.

Here internal table xkomfk will contain ur orders and their line items.

Foe Ex :

vbsk_i-smart = 'F'.
        vbsk_i-ernam = sy-uname.
        vbsk_i-erdat = sy-datum.
        vbsk_i-uzeit = sy-uzeit.

        LOOP AT it_final INTO wa_final WHERE cb = 'X'.

          wa_xkomfk-vbeln = wa_final-vbeln.
          wa_xkomfk-posnr = wa_final-posnr.
          wa_xkomfk-fkimg = wa_final-lfimg.
          wa_xkomfk-vrkme = wa_final-meins.
          wa_xkomfk-vbtyp = 'J'.

          APPEND wa_xkomfk TO xkomfk.
          CLEAR wa_xkomfk.

        ENDLOOP.

3 REPLIES 3
Read only

Former Member
0 Likes
1,152

Hi,

Check this,

CALL FUNCTION 'RV_INVOICE_CREATE'
            EXPORTING
              invoice_date  = sy-datum
              vbsk_i        = vbsk_i
              with_posting  = 'B'
              id_no_enqueue = 'X'
            IMPORTING
              vbsk_e        = vbsk_i
            TABLES
              xkomfk        = xkomfk
              xkomv         = xkomv
              xthead        = xthead
              xvbfs         = xvbfs
              xvbpa         = xvbpa
              xvbrk         = xvbrk
              xvbrp         = xvbrp
              xvbss         = xvbss.

Here internal table xkomfk will contain ur orders and their line items.

Foe Ex :

vbsk_i-smart = 'F'.
        vbsk_i-ernam = sy-uname.
        vbsk_i-erdat = sy-datum.
        vbsk_i-uzeit = sy-uzeit.

        LOOP AT it_final INTO wa_final WHERE cb = 'X'.

          wa_xkomfk-vbeln = wa_final-vbeln.
          wa_xkomfk-posnr = wa_final-posnr.
          wa_xkomfk-fkimg = wa_final-lfimg.
          wa_xkomfk-vrkme = wa_final-meins.
          wa_xkomfk-vbtyp = 'J'.

          APPEND wa_xkomfk TO xkomfk.
          CLEAR wa_xkomfk.

        ENDLOOP.

Read only

brad_bohn
Active Contributor
0 Likes
1,151

Don't use RV_INVOICE_CREATE as the other poster suggested. It won't work either.

You don't need a different BAPI. If you have multiple documents billing to separate documents, then you have criteria that are causing the documents to split. Check your billing copy control routines and the specification of the ZUKRI values. Also check any other fields which would cause the comparision to split: sold-to/payer, region, assignment, address number, etc.

Read only

Former Member
0 Likes
1,151

Hi brad,

We are tried to create billing with 2 sales order with same document type , the billing created for both sales document as one billing document, the same thing we are doing in BAPI it create seperate billing document for each sales order. I dont want each billing document, i want one billing document irrespective of number of sales order..