Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 8894

Get Terminal or Client ID from the Webdynpro ABAP application

$
0
0

Hello Friends,

     I am having a requirement where I need to "get the TERMINAL NAME or THE CLIENT ID of the system I logged"  inside a webdynpro application. For example, I do a remote login to a different system from my laptop and execute a webdynpro application, I need to get the information of my laptop. I was able to get this information  inside normal ABAP dynpro using SE37,  if I use the following method:

 

Call method Cl_gui_frontend_services=>is_terminal_server

    CALL METHOD cl_gui_frontend_services=>environment_get_variable

      EXPORTING

        variable             = 'CLIENTNAME'

      CHANGING

        value                = l_env_var_value

      EXCEPTIONS

        cntl_error           = 1

        error_no_gui         = 2

        not_supported_by_gui = 3

        OTHERS               = 4.

 

This piece works perfectly in normal programs, but not with the ABAP Webdynpro. Yes, I understand the reason behind it and even SAP Help also says the same that "cl_gui_frontend_Services" is not supported for Webdynpro.

 

So, I would like to know the alternative for this. I tried using the following:

Method I

Function module  TH_USER_INFO

 

Method II

Function module  TH_USER_LIST

 

Method III

 

  DATA: lo_component TYPE REF TO if_wd_component,

lo_application TYPE REF TO if_wd_application,

ip TYPE string,

clenv TYPE i.

 

  lo_component = wd_comp_controller->wd_get_api( ).

  lo_application = lo_component->get_application( ).

  ip = lo_application->get_remote_address( ).

  clenv = lo_application->get_client_environment( ).

 

Method IV

data: client type ref to if_http_client,

ip_address type string.

 

****Create the Call

call method cl_http_client=>create_by_url

exporting

url = 'http://www.yahoo.com'

  • ssl_id = ' '

importing

client = client

exceptions

others = 1.

 

****Make the call

client->send( ).

 

****Receive the Response Object

call method client->receive

exceptions

http_communication_failure = 1

http_invalid_state = 2

http_processing_failed = 3

others = 4.

 

ip_address = client->response->get_header_field( name = '~remote_addr' ).

 

All of them returns the IP address of the remote system I logged in, but not my laptop terminal information.

 

Appreciate if you guys can help.

 

Thanks,

Adithya K


Viewing all articles
Browse latest Browse all 8894

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>