cancel
Showing results for 
Search instead for 
Did you mean: 

cl_gui_frontend_services=>get_user_name throws CNTL_ERROR

Former Member
0 Kudos

Hi Guys,

              I am getting short dump from cl_gui_frontend_services=>get_user_name. it throws CNTL_ERROR.

Here is the extract from ST22

Error analysis                                                                    

    A RAISE statement in the program "CL_GUI_FRONTEND_SERVICES======CP" raised the

     exception                                                                    

    condition "CNTL_ERROR".                                                       

   

If you have access to SAP Notes, carry out a search with the following      

keywords:                                                                   

                                                                            

"RAISE_EXCEPTION" " "                                                       

"CL_GUI_FRONTEND_SERVICES======CP" or "CL_GUI_FRONTEND_SERVICES======CM00R" 

"GET_USER_NAME"                                                                                                                                      

or                                                                                                                                                 

"CL_GUI_FRONTEND_SERVICES======CP" "CNTL_ERROR"                                                                                               

or                                                                                                                                                  

"SAPMHTTP " "CNTL_ERROR"                                                    

Information on where terminated                                                                

     Termination occurred in the ABAP program "CL_GUI_FRONTEND_SERVICES======CP" -              

      in "GET_USER_NAME".                                                                       

     The main program was "SAPMHTTP ".                                                          

                                                                                                

     In the source code you have the termination point in line 11                               

     of the (Include) program "CL_GUI_FRONTEND_SERVICES======CM00R".                            

                                                                                  

Source Code Extract                                                            

                                                                               

Line  SourceCde                                                                

                                                                               

    1                                                                          

    2 METHOD GET_USER_NAME.                                                    

    3 * ...                                                                    

    4                                                                          

    5   CLASS CL_GUI_CONTROL DEFINITION LOAD .                                 

    6                                                                          

    7   DATA: supported TYPE ABAP_BOOL.                                        

    8                                                                          

    9 * check class constructor error code                                     

   10   IF IS_VALID_HANDLE( ) NE 0 AND CL_GUI_CONTROL=>WWW_ACTIVE IS INITIAL.  

>>>>>     RAISE CNTL_ERROR.                                                    

   12   ENDIF.                                                                 

   13                                                                          

   14 * special handling for SAPGUI for HTML                                   

   15   IF CL_GUI_CONTROL=>WWW_ACTIVE IS NOT INITIAL.                          

Cheers

Sam

Accepted Solutions (0)

Answers (3)

Answers (3)

Daniel-Alex
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Sam,

what is your intension of using this method? If you want to get the visible name from a person you can try the following code:

  data ls_address type bapiaddr3.
  data lt_return  type bapirettab.
  data ls_name    type t_user_name.

  if iv_user is initial.
    rv_name = 'Unknown'. "#EC NOTEXT
    return.
  endif.

  read table mt_user_name into ls_name
                          with table key user = iv_user.
  if sy-subrc = 0.
    rv_name = ls_name-name.
  else.
    call function 'BAPI_USER_GET_DETAIL'
      exporting
        username      = iv_user
*       CACHE_RESULTS = 'X'
      importing
        address       = ls_address
      tables
        return        = lt_return.

    rv_name = ls_address-fullname.
    ls_name-user = iv_user.
    ls_name-name = rv_name.
    insert ls_name into table mt_user_name.
  endif.

As I have to retrieve a lot of names from user data, I build up a buffer table for my own. Nevertheless, you might simply use BAPI_USER_GET_DETAIL in case you just have to get a single name.

Hope this helps,

Cheers, Daniel

faebulicious
Explorer
0 Kudos

You cannot use any SAP Gui frontend service in Web Dynpro, because there is no GUI available...

Regards,

Fabian

madhu_vadlamani
Active Contributor
0 Kudos

Hi Sam,

Check directly execute from se24 and see what is heppening.Still if there is any error then post.

Regards,

Madhu.

Former Member
0 Kudos

Hi,

      I am using this method inside a ABAP WebDynpro component. Looks like it don't work web based applications. Just wondering is there any infotype stores the Windows ID of the employee..?!

Thanks

Sam