首页 > 代码库 > 根据工号获取姓名

根据工号获取姓名

逻辑很简单,就是去标准表中关联取值,源代码如下:

DATA: w_firstname TYPE adrp-name_first.
  DATA: w_lastname  TYPE adrp-name_last.
  CLEAR: e_name.
  IF I_ernam IS NOT INITIAL.
    CLEAR: w_firstname,w_lastname.
    SELECT SINGLE name_first name_last
      INTO (w_firstname, w_lastname)
      FROM usr21
      INNER JOIN adrp ON usr21~persnumber = adrp~persnumber
      WHERE usr21~bname = i_ernam.
    CONDENSE: w_firstname,w_lastname.
    CONCATENATE w_lastname w_firstname INTO e_name.
    CONDENSE e_name.
  ENDIF.

执行结果:技术分享

根据工号获取姓名