Application Development 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: 

First time using a BAPI SUSR_USER_ADDRESS_READ

Former Member
0 Kudos
251

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.

1 REPLY 1

Former Member
0 Kudos
57

> 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.

> 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 = ' '

> MPORTING

> USER_ADDRESS = zAddress

> USER_USR03 = zUsr03

> * EXCEPTIONS

> * USER_ADDRESS_NOT_FOUND = 1

> * OTHERS = 2

> .

> C <> 0.

> * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

> * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

> ENDIF.

>

> endform.

Hi Frank,

i have difficulties to understand your question. The problem you mentioned, changing the variables of your perform,

> I started with the

> following code but i don't know how to use the

> changing parameters for my variables. Could someone

has nothing to do with using a bapi in your external form.

The interface sapscript <-> external perform is clearly defined an described in sap online help. The "perform" fills the field out_tab-key with the name of the changing parameter.

So you have to add the following lines in your form sachbeabeiter:

.....

read table out_tab with key 'LV_VORNAME'.

out_tab-value = zadress-name_first.

modify out_tab.

read table out_tab with key 'LV_NACHNAME'.

out_tab-value = zadress-name_last.

modify out_tab.

read table out_tab with key 'LV_DURCHWAHL'.

out_tab-value = zadress-TEL_EXTENS.

modify out_tab.

Regards