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: 

Calling ABAP program via UNIX script

Former Member
0 Kudos
1,338

All,

We have several BPs that require us to execute shells scripts from within the application; so we're pretty familiar with that process. Our current need is to go back the other way: UNIX Script calling ABAP program. I've looked into SAPEVT, which would work okay, except I don't want to go through a batch job. These are going to be frequent, short running tasks, and I don't want the overhead that comes with executing a batch job.

Thanks in advance.

Jose

1 ACCEPTED SOLUTION

Former Member
0 Kudos
453

Okay, so I've tried using RFCEXEC to try to accomplish what I specified above, which is to call an ABAP program/RFC from a UNIX script/program. I have completed the following:

1. Created the TCP/IP RFC on the ECC side

2. I created a process on the UNIX which registers the program on the gateway (rfcexec -aProgram -gHost -xsapgw00)

What I haven't been able to figure our is how to call the RFC or pass it paremeters. Any suggestions?

Thanks in advance,

Jose

3 REPLIES 3

Former Member
0 Kudos
454

Okay, so I've tried using RFCEXEC to try to accomplish what I specified above, which is to call an ABAP program/RFC from a UNIX script/program. I have completed the following:

1. Created the TCP/IP RFC on the ECC side

2. I created a process on the UNIX which registers the program on the gateway (rfcexec -aProgram -gHost -xsapgw00)

What I haven't been able to figure our is how to call the RFC or pass it paremeters. Any suggestions?

Thanks in advance,

Jose

0 Kudos
453

Jose,

Instead of RFCEXEC,

use startrfc

Bruce

This is the unix script that my BASIS guy gave me. It call a custom RFC enabled function module, "Z_JOB_COPY".

-


startrfc -3 -d <sapsid> -u <uname> -p <password> -c <client> -l <lang> -h <hostname> -s <sysnum> -g <gatewayhostname> -x <gateway> -t -F <functionmodule> -E <inputVar1>=MYVar1 -E <inputVar2>=MyVar2

startrfc -3 -d DEV -u JDOE -p PASSWD -c 100 -l EN -h mydevhost -s 00 -g mydevhost -x sapgw00 -t -F Z_JOB_COPY -E SOURCE_JOB=ZREQUESTS -E TARGET_JOB=JMB_COPY_RFC2 -E START_DATE=20100120 -E START_TIME=154500

remember they have to have a function module built that can handle the input/output variables mentioned above.

-


function z_job_copy.

*"----


""Local interface:

*" IMPORTING

*" VALUE(SOURCE_JOB) LIKE TBTCJOB-JOBNAME DEFAULT SPACE

*" VALUE(TARGET_JOB) TYPE TBTCJOB-JOBNAME DEFAULT SPACE

*" VALUE(JOBUSER) LIKE SY-UNAME DEFAULT SPACE

*" VALUE(PRINT_OVERRIDE) TYPE BTCH0000-CHAR1 DEFAULT SPACE

*" VALUE(PRINT_PARMS) TYPE PRI_PARAMS DEFAULT SPACE

*" VALUE(START_DATE) TYPE BTCSDATE DEFAULT 00000000

*" VALUE(START_TIME) TYPE BTCSTIME DEFAULT 000000

*" VALUE(STATUS_FILE) TYPE STRING

*" EXPORTING

*" VALUE(JOBCOUNT) LIKE TBTCJOB-JOBCOUNT

*" VALUE(ERROR_MSG) LIKE TBTC5-TEXT

*" EXCEPTIONS

*" NO_SCHEDULED_SAP_JOB

*" INVALID_USER

*" INVALID_START_DATE_TIME

0 Kudos
453

Outstanding Bruce! I really appreciate your reply on this, its working as expected. Please pass my thanks along to your Basis Team as well.

Jose