Skip to Content

Get local server name at runtime

Hi all,

I am looking for a function module or a system parameter that can give me the current server name that my ABAP program runs on.

I need to export the returned server name to parameter

TARGETSERVER of function module 'JOB_CLOSE'.

Thanks for your time,

Eyal.

Message was edited by: Eyal Alsheikh

Message was edited by: Eyal Alsheikh

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Dec 12, 2004 at 10:41 PM

    Hi Eyal,

    the current host name is in the SYST (or SY) structure: SY-HOST.

    Best wishes, harald

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 12, 2004 at 05:57 PM

    Hi Eyal

    You can make use of following FMs

    1. <b>"FIND_DB_APPLICATION_SERVER"</b> gives the server name via the export parameter <b>"SERVERNAME"</b> .

    2. <b>"TH_GET_ACTIVE_SERVER"</b> gives the server name via the export parameter <b>"SERVER"</b> .

    3. <b>"RFC_GET_LOCAL_SERVERS"</b> will give a list containing some info about servers, then you can use the FM <b>"TH_USER_INFO"</b> to get user's host address from the exporting parameter <b>"HOSTADDR"</b>. Then you can look-up the list you retrieved by the first FM where the first four characters at the field <b>"HOSTADR"</b> is the same with the user's. The server name is contained at the field <b>"NAME"</b> of the same row.

    <i>As another thing, let me introduce you SDN forums pointing system: If you find a post helpful about solving your question, you can assign points to the post. You can do this by clicking the yellow star icon at the header of each post. You can assign;

    - one 10 points (solved)

    - two 6 points (very helpful answer)

    - many 2 points (helpful answer)</i>

    Kind regards...

    *--Serdar

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 13, 2004 at 08:58 AM

    Thank you both,

    Eyal.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 14, 2004 at 06:54 AM

    Hi,

    Actually I found, after debugging menu System -> Status

    field "Server name" ( I am working on SAP version 4.7 ),

    a call that gives the server name directly:

    CALL 'C_SAPGPARAM'

    ID 'NAME' FIELD 'rdisp/myname'

    ID 'VALUE' FIELD ev_server_name.

    IF sy-subrc <> 0.

    CLEAR ev_server_name.

    where ev_server_name is function module export parameter of type BTCTGTSRVR-SRVNAME.

    thanks,

    Eyal.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.