Application Development 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: 

Ping

Former Member
0 Kudos
2,699

Hi all,

anybody knows if there is a function or an example code to make a ping to specific IP (not necessary to a server).

Regards,

20 REPLIES 20

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos
790

Yes, there is.

Try RFC_PING

Regards,

Rich Heilman

andreas_mann3
Active Contributor
0 Kudos
790

hi,

try fm FTP_CONNECT

Andreas

Former Member
0 Kudos
790

I've tried but the function is empty and I try to execute but it do nothing, there is no place to specify the IP.

0 Kudos
790

I believe that you must set up an RFC connection via SM59. Then when calling the function module, you specify the DESTINIATION <RFC_CONNECTION>

Regards,

Rich HEilman

0 Kudos
790

You have to create RFC destination and then try FM SCWB_RFC_PING

Former Member
0 Kudos
790

Hi,

Try SCMS_RFC_PING.

Regards,

Former Member
0 Kudos
790

Is possible to make a ping without defining an rfc?my problem is that I only want to know if a printer (connected via LAN) is on.

0 Kudos
790

I don't think there is any other way.

Regards,

Rich HEilman

0 Kudos
790

It sounds like maybe you want to do this via an OS command on the Server. Look in transaction SM69. These are the allowed and configured OS commands. I checked on my systems (HP-UX and Windows) and I see PING and NIPING both configured and last changed by SAP (so it looks like these are delivered). They are also marked as ANY OS.

Have a look at the function moduel SXPG_COMMAND_EXECUTE to excute the command.

Former Member
0 Kudos
790

OK, thank you to everybody

Former Member
0 Kudos
790

Thanks Thomas, I'm trying the function module with the commands but it give me an exception, commmand_not_found.

0 Kudos
790

Be careful using the function test tool with this function module. It looks like it is autofilling the OPERATINGSYSTEM parameter with the value of your host. However change this to ANYOS and you should not get the command_not_found error.

0 Kudos
790

You can also use transaction SM49 to test External Operating System Commands.

0 Kudos
790

An interesting note here if you trying this on a Windows OS Server. On WebAS 640, the delivered Ping Command required parameter '-c 4'. This doesn't appear to be valid on the Windows OS version of Ping.

However I checked a 7.00 WebAS, and SAP has removed that parameter from the PING Command.

In order to get the PING command to work on 640, I had to copy it to ZPING and remove the parameter. Now it tests out fine.

Former Member
0 Kudos
790

I'm trying the test transaction, but it says: syntax error at line 1: ´(' unexpected, but I'm using the commands defined by SAP and I don't know what to do

Thank you

0 Kudos
790

What parameters are you inputting?

Former Member
0 Kudos
790

I had defined a command ZPING for the command ping without parameters and I try to execute it via SM49 with the IP in the additional parameters

0 Kudos
790

I did the exact same thing and it works fine for me. Perhaps some screen shots of my ZPING will help out:

<a href="https://weblogs.sdn.sap.com/weblogs/images/1918/SM69_1.JPG">SM69 Setup</a>

<a href="https://weblogs.sdn.sap.com/weblogs/images/1918/SM49_1.JPG">SM49 Test</a>

Former Member
0 Kudos
790

Thank you Thomas, the problem persists, I defined another time the command but when I test it, it give me this failure:

Comando efectuado: & ping : : 199.5.83.13

Máquina destino: SATI06

sapxpg: executing "ping".

Remote Call Failed in O4PRTLIBC::spawn_ile

Errno = 2

FILE=as4execp.cpp - LINE=150

SharedLibCache Information:

Search Path:

/sapmnt/DAS/exe

*LIBL

/usr/sap/DAS/DVEBMGS00/work

/QOpenSys/usr/bin

/usr/ccs/bin

/QOpenSys/usr/bin/X11

/usr/sbin

/usr/sap/DAS/SYS/exe/run

.

/usr/bin

/usr/sap/DAS/SYS/exe/run

Load Cache:

O4PRTLIBC Loaded as /sapmnt/DAS/exe/O4PRTLIBC

Program output follows

Program output ends

sh: syntax error at line 1 : `(' unexpected

External program terminated with exit code 255

0 Kudos
790

I just tried this on our HP-UX system as well. It didn't work at first (I got external command not found). It turns out our unix admins move the ping executable to different directory. I had to adjust the command in SAP to get it to work.

So first I would suggest that you try some of the other external commands and make sure your environment is setup right.

Second, I would get with your system admin and make sure that you can issue the ping command from the OS level of the server (and if there is anything special you need to do it - like on my system).