Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

BAPI to create vendors

Former Member
0 Likes
1,082

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

3 REPLIES 3
Read only

piyush_mathur
Active Participant
0 Likes
802

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

Read only

0 Likes
802

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.

Read only

Former Member
0 Likes
802

Hi,

Both are same, but we can call BAPI from SAP or NON-SAP system and we can creat the Vendor.

Bye