Skip to Content
0
Former Member
Jun 06, 2008 at 10:10 AM

BAPI to create vendors

271 Views

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