Showing posts with label SD. Show all posts
Showing posts with label SD. Show all posts

Wednesday, April 22, 2009

Check delivery status

To check the delivery status of an order the following code can be used:

*Get all the schedule details by doing
SELECT * INTO TABLE xvbap FROM vbap
  WHERE vbeln = '7500000028'
  AND posnr = '000010'.
SELECT * INTO TABLE xvbup FROM vbup
  WHERE vbeln = '7500000028'
  AND posnr = '000010'.
SELECT * INTO TABLE xvbfa FROM vbfa
  WHERE vbelv = '7500000028'
  AND posnv = '000010'
  AND vbtyp_n = 'J'.
SELECT * INTO TABLE da_vbep FROM vbep
  WHERE vbeln = '7500000028'
  AND posnr = '000010'.
CALL FUNCTION 'RV_SCHEDULE_CHECK_DELIVERIES'
  EXPORTING
    fbeleg = '7500000028'
    fposnr = '000010'
* FVERRECHNUNG = ' '
* FS073_ALT = ' '
* IF_NO_SORT = ' '
  TABLES
    fvbfa = xvbfa
    fvbup = xvbup
    fxvbep = da_vbep
* FVBLB =
    fvbap = xvbap
  EXCEPTIONS
    fehler_bei_lesen_fvbup = 1
    fehler_bei_lesen_fxvbep = 2
  OTHERS = 3.

Friday, May 13, 2005

SD Invoice Verification: Post Invoice

Do Invoice verification and create and post incoming invoices with this BAPI: BAPI_INCOMINGINVOICE_CREATE. Here is an example:

ls_miro_head-invoice_ind = 'X'.
ls_miro_head-doc_date = sy-datum.
ls_miro_head-pstng_date = sy-datum.
ls_miro_head-currency = ls_ekko-waers.
ls_miro_head-comp_code = ls_ekko-bukrs.
ls_miro_items-invoice_doc_item = '000001'.
ls_miro_items-po_number = wa_ekpo-ebeln.
ls_miro_items-po_item = wa_ekpo-ebelp.
ls_miro_head-gross_amount = ls_miro_items-item_amount = wa_ekpo-netwr.
ls_miro_items-quantity = 1.
ls_miro_items-po_unit = gv_isocode.
ls_miro_items-ref_doc = it_migo_beleg-mat_doc.
ls_miro_items-ref_doc_year = it_migo_beleg-doc_year.
ls_miro_items-ref_doc_it = '0001'.
ls_miro_items-tax_code = wa_ekpo-mwskz.
APPEND ls_miro_items TO lt_miro_items.
ls_miro_split-split_key = '000001'.
ls_miro_split-split_amount = wa_ekpo-netwr.
APPEND ls_miro_split TO lt_miro_split.
* --- Call the bapi to create the invoice
CALL FUNCTION 'BAPI_INCOMINGINVOICE_CREATE'
  EXPORTING
    headerdata = ls_miro_head
* ADDRESSDATA =
  IMPORTING
    invoicedocnumber = lw_invoice
* FISCALYEAR =
  TABLES
    itemdata = lt_miro_items
* NFMETALLITMS =
* ACCOUNTINGDATA =
* GLACCOUNTDATA =
* MATERIALDATA =
* TAXDATA =
* WITHTAXDATA =
    vendoritemsplitdata = lt_miro_split
    return = lt_miro_return
.