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

Capturing return status from a call to STARTRFC from a shell script.

Former Member
0 Likes
1,153

Hi All

I am trying to use startrfc to integrate a Unix (Solaris) batch process with SAP. I want to determine whether an SAP user exists.

Here is the command as run in the Unix shell: -

startrfc -t -3 -h ourHost -s 01 -c 550 -l EN -u SAPuser -p secret -F BAPI_USER_EXISTENCE_CHECK -E USERNAME=testSAPuser

This command always exits with a status of zero, whether or not the user exists. (With the -t flag) It creates a file, dev_rfc and a second file of the form CPICTRCnnnnn. However there is no output to stdout, irrespective of whether testSAPuser exists.

Can I force this utility program to write its output to stdout instesd of writing it to a file? How?

Alternatively can I force the utility to write its output to a specific (named) file instead of writing to dev_rfc?

Thank you for your attention

Stephen Broadbridge

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
836

BAPI_USER_EXISTENCE_CHECK this is giving message if i enter some wrong user.

which version you are using..

vijay

Hi All

I am trying to use startrfc to integrate a Unix (Solaris) batch process with SAP. I want to determine whether an SAP user exists.

Here is the command as run in the Unix shell: -

startrfc -t -3 -h ourHost -s 01 -c 550 -l EN -u SAPuser -p secret -F BAPI_USER_EXISTENCE_CHECK -E USERNAME=testSAPuser

This command always exits with a status of zero, whether or not the user exists. (With the -t flag) It creates a file, dev_rfc and a second file of the form CPICTRCnnnnn. However there is no output to stdout, irrespective of whether testSAPuser exists.

Can I force this utility program to write its output to stdout instesd of writing it to a file? How?

Alternatively can I force the utility to write its output to a specific (named) file instead of writing to dev_rfc?

Thank you for your attention

Stephen Broadbridge

5 REPLIES 5
Read only

Former Member
0 Likes
836

Hi,

You could create an RFC in SAP and put your BAPI function, an the result into a table parameters:

- use -T parameter to get the table

- use w to set your file

<b>Example:</b>

startrfc -E PEBELP=00010 -t -d AR1 -h S01AZ03A01 -s 10 -g S01AZ03A01 -x sapgw10 -u LOLA -p flores -c 130 -l EN -F Y_RFC_EXAMPLE2 <b>-T RESULTADO,250,w=outputname.txt</b>

<b>Explanation of parameters:</b>

-T <table name>,<width>,[r=<file>][,w=<file>]

Where <file> is a path name to read from (r) or write to (w) the internal table. If <file> is -, stdin or stdout is used.

<b>Example of Y_RFC_EXAMPLE2</b>

FUNCTION Y_RFC_EXAMPLE2.

*"----


""Local interface:

*" IMPORTING

*" VALUE(PEBELP) TYPE EBELP

*" TABLES

*" RESULTADO STRUCTURE TAB512

*"----


DATA fecha(10).

DATA wa TYPE string.

WRITE sy-datum TO fecha.

CONCATENATE pebelp fecha INTO wa SEPARATED BY '/'.

ds_rec 'sample' wa.

append wa to resultado.

ENDFUNCTION.

Read only

0 Likes
836

Hi Johan

Thanks for your thoughtful answer. I am not a BAPI programmer and I would prefer, if possible, to avoid the direction you are suggesting.

It is clear from other posts in this and other fora that BAPI_USER_EXISTENCE_CHECK returns information to the calling process. My project really requires that this returned information is written to STDOUT so that I can capture it in a unix shell script.

The source code for startrf is available as part of the SDK. Another way of dealing with this problem may be to write a small mod to the startrfc.c program. I am more comfortable in C than in ABAP.

Anyway, thanks once more for your suggestions.

Cheers

Stephen

Read only

Former Member
0 Likes
837

BAPI_USER_EXISTENCE_CHECK this is giving message if i enter some wrong user.

which version you are using..

vijay

Read only

0 Likes
836

Hi Vjay

Thanks for your response. I assume you mean "which version" of SAP. R3 is the answer if I am right.

Cheers

Stephen

Read only

0 Likes
836

Yeah ...

vijay