Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Getting client IP-address

Former Member
0 Likes
2,070

Dear Experts,

We have built a RFC function module with web service enabled, we are transferring data from RFC to portal through EAI.

Is it possible to capture IP address of the user through when he/she logs on to the portal.

We wanted to give access to the users based on specific ip addresses.

Is this can be achieved pro-grammatically through ABAP ?

Thanks and Regards,

Kartheek.

7 REPLIES 7
Read only

Former Member
0 Likes
1,629

CL_GUI_FRONTEND_SERVICES=>get_ip_address( )

Read only

0 Likes
1,629

Thanks for the reply, but through this we get system IP address not the portal IP address or site IP address.

Thanks,

Kartheek.

Read only

0 Likes
1,629

you asked for:

"Is it possible to capture IP address of the user through when he/she logs on to the portal"

So via the method you get the frontend IP address of the user which is logged-in.

You want to give access to users based on the IP address of the server? I do not understand your requirement

Read only

0 Likes
1,629

Hi,

   Try

call method cl_http_client=>create_by_url

    exporting

      url    = 'Enter Desired URL'

    importing

      client = client

    exceptions

      others = 1.

Make the call

  client->send( ).

Receivingthe 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' ).

Regards,

Madhumahesh.

Read only

0 Likes
1,629

Hi Madhumahesh,

Thanks for the reply, i have used the above given code and when tried i am getting errror

http_communication_failure ,  can you please let me know wat to do.


Thanks,

Kartheek.

Read only

0 Likes
1,629

Hi,

   Check the url which you entered, or please post your code??

or you can try using the below FM's

TERMINAL_ID_GET

TERMINAL_IP_GET

if you know the host name then try the below FM's

RFC_HOST_TO_IP (or)

RFC_HOST_TO_IP0

Regards,

Madhumahesh.

Read only

0 Likes
1,629

Dear Madhu,


Please find the code below.



data: client     type ref to if_http_client,

       ip_address type string.

call method cl_http_client=>create_by_url

     exporting

       url    = 'https://login.yahoo.com/config/login_verify2?&.src=ym&.intl=us'

      ssl_id = ' '

     importing

       client = client

     exceptions

       others = 1.

  client->send( ).

    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' ).

Regards,

kartheek