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

FM

Former Member
0 Likes
565

Hi,

I am using the FM susr_user_address_read in my print program to get the name of the user given in the field bkpf-usnam. The Export parameter of the FM is user_name which i am giving as bkpf-usnam.The import parameter is user_usr03. what should i equate it to? Please help me by looking at that FM. I want name1 and name2 fields from user_usr03 in the output of the form.

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
509

If you simply need the first and last name, then there is no need to import that structure as the first and last name are contained in the USR_AD structure, simply comment the USER_03 out. For example.



report zrich_0003.


data: xusr_ad type addr3_val.


call function 'SUSR_USER_ADDRESS_READ'
  exporting
    user_name                    = sy-uname
*   READ_DB_DIRECTLY             = ' '
  importing
    user_address                 = xusr_ad
*   USER_USR03                   =
  exceptions
   user_address_not_found       = 1
   others                       = 2.

write:/ xusr_ad-NAME_FIRST, xusr_ad-NAME_last.

If you still want to get form USER_03 structure, you can like this.

report zrich_0003.


data: xusr_ad type addr3_val.
<b>data: xusr_03 type usr03.</b>


call function 'SUSR_USER_ADDRESS_READ'
  exporting
    user_name                    = sy-uname
*   READ_DB_DIRECTLY             = ' '
  importing
    user_address                 = xusr_ad
<b>    USER_USR03                   = xusr_03</b>
  exceptions
   user_address_not_found       = 1
   others                       = 2.

write:/ xusr_ad-NAME_FIRST, xusr_ad-NAME_last.
<b>write:/ xusr_03-name1, xusr_03-name2.</b>

Regards,

Rich Heilman

3 REPLIES 3
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
510

If you simply need the first and last name, then there is no need to import that structure as the first and last name are contained in the USR_AD structure, simply comment the USER_03 out. For example.



report zrich_0003.


data: xusr_ad type addr3_val.


call function 'SUSR_USER_ADDRESS_READ'
  exporting
    user_name                    = sy-uname
*   READ_DB_DIRECTLY             = ' '
  importing
    user_address                 = xusr_ad
*   USER_USR03                   =
  exceptions
   user_address_not_found       = 1
   others                       = 2.

write:/ xusr_ad-NAME_FIRST, xusr_ad-NAME_last.

If you still want to get form USER_03 structure, you can like this.

report zrich_0003.


data: xusr_ad type addr3_val.
<b>data: xusr_03 type usr03.</b>


call function 'SUSR_USER_ADDRESS_READ'
  exporting
    user_name                    = sy-uname
*   READ_DB_DIRECTLY             = ' '
  importing
    user_address                 = xusr_ad
<b>    USER_USR03                   = xusr_03</b>
  exceptions
   user_address_not_found       = 1
   others                       = 2.

write:/ xusr_ad-NAME_FIRST, xusr_ad-NAME_last.
<b>write:/ xusr_03-name1, xusr_03-name2.</b>

Regards,

Rich Heilman

Read only

0 Likes
509

THANKS A TON RICH!

RICH, IS THERE A FM TO RETRIEVE EMAIL ADDRESS?

Message was edited by: vishwanath vedula

Read only

0 Likes
509

Hi, not sure. You can simply get the email address by getting the address number from USR21 and hitting against table ADR6.

Regards,

Rich Heilman