Get the full name of a user
Sometimes we need to present a welcome message to the users.
Sometimes we need to present a welcome message to the users. Instead of saying "welcome" followed by sy-uname, it would be nicer if we use the full name of user as set by him/her in his profile. e.g. <Dr. Mr. FirstName Surname>. Here is the code to get the full name.
The code was written in version 4.7 and should work in 4.6B and above,
DATA: l_user_data TYPE soudatai1, l_user TYPE soudnamei1, l_fullname type SO_ADRNAM. * give the logged on user id l_user-sapname = sy-uname. * get the user data CALL FUNCTION 'SO_USER_READ_API1' EXPORTING user = l_user IMPORTING user_data = l_user_data. * get the user full name l_fullname = l_user_data-fullname.