Skip to Content
author's profile photo Former Member
Former Member

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Nov 09, 2007 at 04:11 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 12, 2007 at 09:07 PM

    Hi,

    In the BAPI BAPI_BILLINGDOC_CREATEFROMDATA you have to pass the PRICE_DATE in the parameter BILLING_DATA_IN

    BILLING_DATA_IN-PRICE_DATE = SY-DATUM

    to get the pricing.

    Thanks

    Naren

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hello Narendran:

      I understand. I don't want to use system price list, I have specific values for each item. This is a special sales order, Unless it can pass data from the original sales order which have those price, then I need a place to identify the special prices.

      I have tried to use the CONDITIONDATAIN. But can't figure out how to use the DATA_INDEX. and unable to pass any value into it!

      Sincerely

  • author's profile photo Former Member
    Former Member
    Posted on Feb 01, 2008 at 03:30 AM

    It was very interesting to see the whole process. Sheshu Can you please help me with this. My problem is what kind of changes do they do in RV_INVOICE_CREATE for before invoice cancellation. The user_exit used is

    CALL CUSTOMER-FUNCTION '002'

    TABLES

    xkomfk = xkomfk.

    What all scenario's might come under such situations. Can you pls reply to this.

    I would appreciate your help.

    krishna

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.