‎2008 Jun 06 11:10 AM
Hi,
This is the standard function module (Bapi_Vendor_Create) to create the vendors.
DATA: verbuchter_lieferant LIKE lfa1-lifnr,
msgv1 LIKE sy-msgv1.
SET PARAMETER ID 'LIF' FIELD vendorno.*
CALL TRANSACTION 'XK01'.
Wurde der Verbucher aufgerufen? Parameter 'VENDOR_VERBUCHT wird in*
Form schluss_bearbeitung gesetzt.*
GET PARAMETER ID 'VENDOR_VERBUCHT' FIELD verbuchter_lieferant.
IF verbuchter_lieferant is initial.
Returnparameter füllen*
MESSAGE i248(f2). "Es wurde kein Lieferant angelegt.*
CALL FUNCTION 'BALW_BAPIRETURN_GET1'
EXPORTING
type = 'I'
cl = 'F2'
number = 248
IMPORTING
bapireturn = return.
ELSE.
**----
Rückgabeparameter setzen. -
*
Schlüsselparameter*
GET PARAMETER ID 'LIF' FIELD vendor.
Rückgabeparameter für Lieferantennummer*
vendorno = vendor.
Returnparameter füllen*
MOVE verbuchter_lieferant TO msgv1.
MESSAGE i249(f2). " Der Lieferant &1 wurde angelegt*
CALL FUNCTION 'BALW_BAPIRETURN_GET1'
EXPORTING
type = 'I'
cl = 'F2'
number = 249
par1 = msgv1
IMPORTING
bapireturn = return.
ENDIF.
ENDFUNCTION.
Here it is calling the transaction XK01 and the user will input the values like the way he enters usually in XK01. What is the difference between creating the vendor in XK01 and using this BAPI which calls the standard transaction XK01. ?
Thanks.
Edited by: keyur p on Jun 6, 2008 12:24 PM
‎2008 Jun 06 11:29 AM
Hi,
Functionality there is no difference. BAPI is provide to use this functionality from outside SAP. If you want to create vendor from outside SAP, the u can use this BAPI.
Thanks
PIyush
‎2008 Jun 06 11:35 AM
Hi Piyush,
Bapi provides the functionality to use from outside sap. But here we are calling the standard transaction XK01 and we are entering the values. can we call XK01 outside the SAP and enter the values?
Thanks.
‎2008 Jun 06 11:33 AM
Hi,
Both are same, but we can call BAPI from SAP or NON-SAP system and we can creat the Vendor.
Bye