Friday, June 22, 2018

Create incoming vendor invoice (MIRO) using BAPI BAPI_INCOMINGINVOICE_CREATE IN SAP ABAP..

Create incoming vendor invoice (MIRO) using  BAPI BAPI_INCOMINGINVOICE_CREATE.

*&---------------------------------------------------------------------*
*& Report  ZSW_BAPI_INC_INV_CREATE
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  ZSW_BAPI_INC_INV_CREATE.

DATAwa_header LIKE bapi_incinv_create_header.

DATAit_item TYPE STANDARD TABLE OF bapi_incinv_create_item,
      wa_item TYPE bapi_incinv_create_item.

DATAit_ret LIKE bapiret2 OCCURS WITH HEADER LINE.

DATAg_invno LIKE bapi_incinv_fld-inv_doc_no,
      g_fyear LIKE bapi_incinv_fld-fisc_year.

********************************************
****<<<<<<<<<<<<DATA DECLARE>>>>>>>>>>>>****
********************************************

wa_header-invoice_ind 'X'.
wa_header-doc_date '20120131'.     "Document date
wa_header-pstng_date '20120201'.   "Posting date
wa_header-ref_doc_no 'Test'.       "Ref doc. No.
wa_header-comp_code '3101'.        "Company Code
wa_header-gross_amount '5908.11'.  "Gross amount(aft. tax) for the invoice
wa_header-calc_tax_ind 'X'.
wa_header-currency 'USD'.          "Currency Field

wa_item-invoice_doc_item '000011'.
wa_item-po_number '4590038151'.    "PO number
wa_item-po_item '00121'.           "PO item number
wa_item-ref_doc '5007548571'.      "GR number
wa_item-ref_doc_year '2018'.       "GR fiscal year
wa_item-ref_doc_it '0011'.         "GR item number
wa_item-tax_code 'V7'.             "Tax code applicable
wa_item-item_amount '5521.61'.     "Item amount
wa_item-quantity '3381'.           "Invoice quantity
wa_item-po_unit 'EA'.              "UoM
APPEND wa_item TO it_item.

*********************************************************
*<<<<<<<<<CALL BAPI fOR INCOMINGINVOICE_CREATE>>>>>>>>>>*
*********************************************************
CALL FUNCTION 'BAPI_INCOMINGINVOICE_CREATE'
  EXPORTING
    headerdata                wa_header
*   ADDRESSDATA               =
 IMPORTING
   invoicedocnumber          g_invno
   fiscalyear                g_fyear
  TABLES
    itemdata                  it_item
*   ACCOUNTINGDATA            =
*   GLACCOUNTDATA             =
*   MATERIALDATA              =
*   TAXDATA                   =
*   WITHTAXDATA               =
*   VENDORITEMSPLITDATA       =
    return                    it_ret
*   EXTENSIONIN               =
          .
*********************************************************
******<<<<<<<<<<<<Bapi Commit section start.>>>>>>>>>>***
*********************************************************
IF g_invno IS NOT INITIAL.
  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
*   EXPORTING
*     WAIT          =
*   IMPORTING
*     RETURN        =
            .
ENDIF.
*********************************************************
******<<<<<<<<<<<<Bapi Commit section End.>>>>>>>>>>***
*********************************************************
WRITE:/1 g_invnog_fyear.

LOOP AT it_ret.
  WRITE:/1 it_ret-message.
ENDLOOP.
*****************<<<<<<<<<<<<END>>>>>>>>>>>>*************

5 comments:

  1. How to calculate the gross amount in the header

    ReplyDelete
    Replies
    1. Sap Abap For Best Practice And Travel Related Guide: Create Incoming Vendor Invoice (Miro) Using Bapi Bapi_Incominginvoice_Create In Sap Abap.. >>>>> Download Now

      >>>>> Download Full

      Sap Abap For Best Practice And Travel Related Guide: Create Incoming Vendor Invoice (Miro) Using Bapi Bapi_Incominginvoice_Create In Sap Abap.. >>>>> Download LINK

      >>>>> Download Now

      Sap Abap For Best Practice And Travel Related Guide: Create Incoming Vendor Invoice (Miro) Using Bapi Bapi_Incominginvoice_Create In Sap Abap.. >>>>> Download Full

      >>>>> Download LINK CF

      Delete
  2. we need to create an automatic debit note for the returns with reference to the reverse PO and reverse migo.
    we are using invoice_ind as initial
    in tax code we are giving v0 but we need gst also to be calculated
    what needs to be passed for gst calculation ?

    ReplyDelete
  3. Oh my goodness! an excellent post dude. Thanks a ton Nevertheless We’re experiencing trouble with ur rss . Do not know why Unable to register for it. Will there be everyone getting identical rss difficulty? Anybody who knows kindly respond. Thnkx Ethiopian Airlines Bookings

    ReplyDelete
  4. Sap Abap For Best Practice And Travel Related Guide: Create Incoming Vendor Invoice (Miro) Using Bapi Bapi_Incominginvoice_Create In Sap Abap.. >>>>> Download Now

    >>>>> Download Full

    Sap Abap For Best Practice And Travel Related Guide: Create Incoming Vendor Invoice (Miro) Using Bapi Bapi_Incominginvoice_Create In Sap Abap.. >>>>> Download LINK

    >>>>> Download Now

    Sap Abap For Best Practice And Travel Related Guide: Create Incoming Vendor Invoice (Miro) Using Bapi Bapi_Incominginvoice_Create In Sap Abap.. >>>>> Download Full

    >>>>> Download LINK

    ReplyDelete