Use
Gets a list of servers that are defined for a specific R/3 system.
This is the list you would get when using the SAP logon dialog, choosing the Server button, selecting a system from the list, and then choosing List.
Syntax
HANDLE DLEX It_ServerLookup (const char *id, const char *ms, const char *router, Char **servers, int *serverCnt);
Parameters
id |
SAP System ID that identifies the SAP System. The list of SAP Systems is retrieved from the file SAPMSG.INI. |
ms |
Hostname of the message server. This message server will provide a list of the currently available application servers that are running on the selected system. Each SAP System provides one message server. This information is stored in the file SAPMSG.INI. |
router |
Destination router used to connect to the Message Server as well as to the listed application servers. The list of available SAP routers is retrieved from the file SAPROUTE.INI. |
servers |
Returns list of the servers available for given server ID. |
serverCnt |
Number of servers found. |
Return Value
Returns TRUE if successful, otherwise returns FALSE.
Comments
To read each group/server, use the macro NEXT_STR (list, index). You must free this list by using the free () call of the C runtime library after complete processing of this list.
Example
The following code prints the list of servers:
// id = SAP SystemID ,
// ms = Hostname of the message server,
// router = Destination router used to connect to the Message Server
// servers = Returns list of the servers available for given server ID
// Number of servers found
if (It_ServerLookup(id, ms, router, &servers, &servCnt))
{
int i;
for(i = 0; i < servCnt; i++)
{
char *str = NEXT_STR(servers, i);
printf("\t%s\n", str);
}
}
else
{
printf("serverLoopup: It_serverlookup failed. \n");
}
The following code returns the third server in the list of servers:
// hndl = Connection handle
hndl = It_NewServerConnection(id, ms, router, NEXT_STR(servers, 2), 0);