<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Bapi for invoice creation in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-for-invoice-creation/m-p/2867347#M672678</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;try this  BAPI &lt;/P&gt;&lt;P&gt; BAPI_BILLINGDOC_CREATE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 03 Oct 2007 20:46:01 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-10-03T20:46:01Z</dc:date>
    <item>
      <title>Bapi for invoice creation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-for-invoice-creation/m-p/2867345#M672676</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can any one tell me the Bapi to create invoice for Delivery.The Delivery is against a sales order not purchase order.i tried bapi_incominginvoice_create..but here the DOC_TYPE RE is Sales order ..most of the time this bapi talking for PO Only..can any one help me with another BAPI..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Challa.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Oct 2007 14:53:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-for-invoice-creation/m-p/2867345#M672676</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-03T14:53:26Z</dc:date>
    </item>
    <item>
      <title>Re: Bapi for invoice creation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-for-invoice-creation/m-p/2867346#M672677</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;there is no bapi avilable for this&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Oct 2007 14:59:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-for-invoice-creation/m-p/2867346#M672677</guid>
      <dc:creator>suredarreddy_pulimamidi</dc:creator>
      <dc:date>2007-10-03T14:59:33Z</dc:date>
    </item>
    <item>
      <title>Re: Bapi for invoice creation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-for-invoice-creation/m-p/2867347#M672678</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;try this  BAPI &lt;/P&gt;&lt;P&gt; BAPI_BILLINGDOC_CREATE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Oct 2007 20:46:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-for-invoice-creation/m-p/2867347#M672678</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-03T20:46:01Z</dc:date>
    </item>
    <item>
      <title>Re: Bapi for invoice creation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-for-invoice-creation/m-p/2867348#M672679</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this sample proram&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

DATA: v_vbeln TYPE likp-vbeln.

* Parameters
PARAMETERS: p_vbeln LIKE v_vbeln.
PARAMETERS: p_fkart LIKE vbrk-fkart.
PARAMETERS: p_test  TYPE allgtest.

* Data declarations.
DATA: s_vbsk LIKE vbsk.
DATA: t_komfk TYPE STANDARD TABLE OF komfk,
      t_komv  TYPE STANDARD TABLE OF komv,
      t_thead TYPE STANDARD TABLE OF theadvb,
      t_vbfs  TYPE STANDARD TABLE OF vbfs,
      t_vbpa  TYPE STANDARD TABLE OF vbpavb,
      t_vbrk  TYPE STANDARD TABLE OF vbrkvb,
      t_vbrp  TYPE STANDARD TABLE OF vbrpvb,
      t_vbss  TYPE STANDARD TABLE OF vbss.

DATA: BEGIN OF s_likp,
vbeln TYPE vbeln,
vbtyp TYPE vbak-vbtyp,
END OF s_likp.

DATA: BEGIN OF s_lips,
vbeln TYPE vbeln,
posnr TYPE posnr,
END OF s_lips.

* Internal tables.
DATA: t_likp  LIKE TABLE OF s_likp.
DATA: t_lips  LIKE TABLE OF s_lips.
DATA: s_komfk        TYPE komfk.
DATA: s_vbfs         TYPE vbfs.
DATA: v_with_posting TYPE xfeld.
DATA: v_no_enqueue   TYPE xfeld.
DATA: v_message      TYPE string.

START-OF-SELECTION.

* Check the testrun.
  IF p_test IS INITIAL.
    v_with_posting = 'B'.
  ELSE.
    v_with_posting = 'H'.
    v_no_enqueue = 'X'.
  ENDIF.



* Get the data from VBAK.
  SELECT vbeln vbtyp FROM likp
  INTO TABLE t_likp
  WHERE vbeln = p_vbeln.

  IF sy-subrc &amp;lt;&amp;gt; 0.
    MESSAGE s208(00) WITH 'Invalid vbeln'.
    LEAVE LIST-PROCESSING.
  ENDIF.

* Get the data from VBAP.
  IF NOT t_likp IS INITIAL.
    SELECT vbeln posnr INTO TABLE t_lips
    FROM lips
    FOR ALL ENTRIES IN t_likp
    WHERE vbeln = t_likp-vbeln.
  ENDIF.

* Refresh.
  CALL FUNCTION 'RV_INVOICE_REFRESH'
       EXPORTING
            with_posting = 'B'
       TABLES
            xkomfk       = t_komfk
            xkomv        = t_komv
            xthead       = t_thead
            xvbfs        = t_vbfs
            xvbpa        = t_vbpa
            xvbrk        = t_vbrk
            xvbrp        = t_vbrp
            xvbss        = t_vbss.

* Build the internal table t_komfk.
  LOOP AT t_likp INTO s_likp.

    LOOP AT t_lips INTO s_lips WHERE vbeln = s_likp-vbeln.
* Fill the values.
      s_komfk-mandt  = sy-mandt.
      s_komfk-vbeln  = s_likp-vbeln.
      s_komfk-posnr  = s_lips-posnr.
      s_komfk-vbtyp  = s_likp-vbtyp.
      s_komfk-seldat = sy-datum.
      s_komfk-fkart  = p_fkart.
      APPEND s_komfk TO t_komfk.
      CLEAR: s_komfk.
    ENDLOOP.

  ENDLOOP.

* invoice create
  CALL FUNCTION 'RV_INVOICE_CREATE'
       EXPORTING
            vbsk_i        = s_vbsk
            with_posting  = v_with_posting
            id_no_enqueue = v_no_enqueue
       IMPORTING
            vbsk_e        = s_vbsk
       TABLES
            xkomfk        = t_komfk
            xkomv         = t_komv
            xthead        = t_thead
            xvbfs         = t_vbfs
            xvbpa         = t_vbpa
            xvbrk         = t_vbrk
            xvbrp         = t_vbrp
            xvbss         = t_vbss.

* Display the invoice created.
  LOOP AT t_vbfs INTO s_vbfs.
    CALL FUNCTION 'FORMAT_MESSAGE'
         EXPORTING
              id        = s_vbfs-msgid
              no        = s_vbfs-msgno
              v1        = s_vbfs-msgv1
              v2        = s_vbfs-msgv2
              v3        = s_vbfs-msgv3
              v4        = s_vbfs-msgv4
         IMPORTING
              msg       = v_message
         EXCEPTIONS
              not_found = 1
              OTHERS    = 2.
    IF sy-subrc &amp;lt;&amp;gt; 0.
      MESSAGE e208(00) WITH 'Error in calling function module'.
    ENDIF.

    WRITE: / s_vbfs-msgty, s_vbfs-msgv1, v_message.
  ENDLOOP.

* Refresh and clear.
  REFRESH: t_vbfs,
           t_komfk,
           t_komv,
           t_thead,
           t_vbfs,
           t_vbpa,
           t_vbrk,
           t_vbrp,
           t_vbss.

  CLEAR: t_vbfs,
         t_komfk,
         t_komv,
         t_thead,
         t_vbfs,
         t_vbpa,
         t_vbrk,
         t_vbrp,
         t_vbss.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Naren&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Oct 2007 21:04:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-for-invoice-creation/m-p/2867348#M672679</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-03T21:04:20Z</dc:date>
    </item>
  </channel>
</rss>

