Skip to Content
0
Former Member
Nov 27, 2006 at 09:07 AM

First time using a BAPI SUSR_USER_ADDRESS_READ

187 Views

Hi,

i am using the first time a BAPI. I need in SAPScript in RVDELNOTE the first name, last name an phone extension from the VBDKL-ERNAM. I started with the following code but i don't know how to use the changing parameters for my variables. Could someone complete my code for a better understanding in using BAPIs in ABAP?!

Thank you in advance!

Best regards,

Frank

SAPScript:

/* read Sachberabeiter with BAPI SUSR_USER_ADDRESS_READ

DEFINE &LV_VORNAME& := ' '

DEFINE &LV_NACHNAME& := ' '

DEFINE &LV_DURCHWAHL& := ' '

PERFORM SACHBEARBEITER IN PROGRAM ZSD_PERFORM

USING &VBDKL-ERNAM&

CHANGING &LV_VORNAME&

CHANGING &LV_NACHNAME&

CHANGING &LV_DURCHWAHL&

ENDPERFORM

ABAP-Program:

form Sachbearbeiter tables in_tab structure itcsy

out_tab structure itcsy.

data: zBNAME type BNAME,

zAddress LIKE addr3_val,

zUsr03 LIKE usr03,

zVorname type AD_NAMEFIR,

zNachname type AD_NAMELAS,

zDurchwahl type AD_TLXTNS1.

read table in_tab index 1.

check sy-subrc = 0.

zBNAME = in_tab-value.

CALL FUNCTION 'SUSR_USER_ADDRESS_READ'

EXPORTING

USER_NAME = zBNAME

  • READ_DB_DIRECTLY = ' '

IMPORTING

USER_ADDRESS = zAddress

USER_USR03 = zUsr03

  • EXCEPTIONS

  • USER_ADDRESS_NOT_FOUND = 1

  • OTHERS = 2

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

endform.