‎2008 May 06 7:59 AM
Hi,
Can anyone please tell me how to use BAPI.I had created a BAPI
and it is visible in BOR .But I dont knew how to use a created BAPI.
So please provide me the information how to use it.
‎2008 May 06 8:05 AM
Go to SE37 and release the API enabled Function module. In the Object created in the BOR, set the status of Object Type Component to Released.
You can then display the BAPI in the BAPI Explorer. Invoke the same using the T-code BAPI.
This BAPI can be called in the way you call FM in your report.
Have a look at below link which gives details with Example:
[Use of BAPI|http://www.erpgenie.com/sap/abap/bapi/example.htm]
I hope it helps.
Best Regards,
Vibha
Please mark all the helpful answers
‎2008 May 06 8:02 AM
hi,
You can call the BAPI from pattern button... the way you call a normal function module ... here is an example how a BAPI is used in a program ...
DATA: l_headerdata LIKE bapi_incinv_create_header,
l_invoicedocnumber LIKE bapi_incinv_fld-inv_doc_no,
l_fiscalyear LIKE bapi_incinv_fld-fisc_year,
i_itemdata LIKE bapi_incinv_create_item OCCURS 0 WITH HEADER LINE,
i_return LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
DATA: l_additionalheaderdata LIKE bapi_incinv_save_header_backgr,
l_refdoccategory LIKE bapi_incinv_fld-ref_doc_category.
LOOP AT i_list_cab WHERE check = 'X'.
CLEAR l_headerdata.
l_headerdata-doc_type = 'RS'.
l_headerdata-invoice_ind = ''.
l_headerdata-doc_date = i_list_cab-bldat.
l_headerdata-pstng_date = i_list_cab-budat.
l_headerdata-ref_doc_no = i_list_cab-xblnr.
l_headerdata-comp_code = 'YW01'.
l_headerdata-currency = i_list_cab-waers.
l_headerdata-exch_rate = i_list_cab-kursf.
l_headerdata-gross_amount = i_list_cab-rmwwr.
l_headerdata-bline_date = i_list_cab-zfbdt.
l_headerdata-del_costs_taxc = i_list_cab-mwskz.
l_headerdata-diff_inv = i_list_cab-lifnr.
l_headerdata-alloc_nmbr = i_list_cab-id_archivo.
l_headerdata-dsct_amount = 0.
l_headerdata-calc_tax_ind = 'X'.
l_headerdata-del_costs_taxc = i_list_cab-mwskz.
LOOP AT i_list_pos WHERE xblnr = i_list_cab-xblnr.
i_itemdata-invoice_doc_item = i_list_pos-buzei.
i_itemdata-po_number = i_list_pos-ebeln.
i_itemdata-po_item = i_list_pos-ebelp.
i_itemdata-tax_code = i_list_cab-mwskz.
i_itemdata-item_amount = i_list_pos-wrbtr.
i_itemdata-quantity = i_list_pos-menge.
i_itemdata-po_unit = i_list_pos-meins.
SELECT SINGLE bprme FROM ekpo
INTO i_itemdata-po_pr_uom
WHERE ebeln = i_list_pos-ebeln
AND ebelp = i_list_pos-ebelp.
APPEND i_itemdata.
ENDLOOP.
CALL FUNCTION 'BAPI_INCOMINGINVOICE_PARK'
EXPORTING
headerdata = l_headerdata
* ADDRESSDATA =
IMPORTING
invoicedocnumber = l_invoicedocnumber
fiscalyear = l_fiscalyear
TABLES
itemdata = i_itemdata
* ACCOUNTINGDATA =
* GLACCOUNTDATA =
* MATERIALDATA =
* TAXDATA =
* WITHTAXDATA =
* VENDORITEMSPLITDATA =
return = i_return.
**** PERFORM generar_doc_prelim_mm.
IF NOT l_invoicedocnumber IS INITIAL.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
WRITE: / l_invoicedocnumber.
ENDIF.
‎2008 May 06 8:05 AM
Go to SE37 and release the API enabled Function module. In the Object created in the BOR, set the status of Object Type Component to Released.
You can then display the BAPI in the BAPI Explorer. Invoke the same using the T-code BAPI.
This BAPI can be called in the way you call FM in your report.
Have a look at below link which gives details with Example:
[Use of BAPI|http://www.erpgenie.com/sap/abap/bapi/example.htm]
I hope it helps.
Best Regards,
Vibha
Please mark all the helpful answers
‎2008 May 06 8:08 AM
Hi,
This is a smaple bapi usage:
http://www.sap-img.com/abap/bapi-goodsmvt-create-to-post-goods-movement.htm
http://www.erpgenie.com/abap/bapi/example.htm
Regards
Kiran Sure