[絕對原創] SAP Get User data by User ID

dicksonjyl560101發表於2015-04-01

[絕對原創] SAP Get User data by User ID

 

1, Table

Go to table USR21 and get the person number, then use that person number number go to ADRP

2, View

view V_USR_NAME is a view over the USR21 and ADRP tables

 

3, Function module

  • You can alternatively use SUSR_USER_ADDRESS_READ.

The exporting parameter user_address would have the full name of the user in the field name_text.

    DATA: user_address LIKE addr3_val.

    CALL FUNCTION 'SUSR_USER_ADDRESS_READ'

      IMPORTING

        user_name                    = sy-uname

*       READ_DB_DIRECTLY             = ' '

      EXPORTING

        user_address                 = user_address

*       USER_USR03                   =

      EXCEPTIONS

        user_address_not_found       = 1

        OTHERS                       = 2.

 

    IF sy-subrc = 0.

       write:/ user_address-name_text.

    ENDIF.

 

 

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29829936/viewspace-1482198/,如需轉載,請註明出處,否則將追究法律責任。

相關文章