cancel
Showing results for 
Search instead for 
Did you mean: 

SNC connect using CPIC (C-Programm)

Former Member
0 Kudos

Hi there,

I have to add SNC to an old C-Programm which uses CPIC to communicate with SAP.

( I know that CPIC is an obsolet interface - but this old app is too complex to migrate it on shorthand).

A C-Programm using RFC connection which uses SNC works perfect!

I am using the command SAP_CMINIT3 and have filled the SNC struct as described.

This call does not get a error. But when I want to test if SNC is activated by calling SAP_CMSNCMODE,

I always get - SNC ist not active.

So I have read the complete SNC documentation and checked all snc profile parameters (RZ11).

All seems to be correct and hey RFC SNC works...

When I try to use the SNC communication the other way - external app registers to SAP Gateway (SAP_CMREGTP2)

and let my app wait for accepting the converstation (SAP_CMACCPTP)

I get this error:

SNC disabled for conversation <nr>, tp = <name>

Well, can anyone at SAP provide me a sample app which establishes a CPIC connection with SNC on?

The documentation is very poor concerning the CPIC SNC commands.

Thanks on advance,

Andi

Accepted Solutions (1)

Accepted Solutions (1)

mvoros
Active Contributor
0 Kudos

Hi,

it looks like you set up SNC for your RFC connection but caller does not use it. Have you looked at this [SAP documentation|http://help.sap.com/saphelp_nw70/helpdata/en/8c/6584fd91d946eaa5d5600c44972ecb/frameset.htm]. You need to define SNC configuration in sideinfo file. The function SAP_CMINIT should automatically load this file. You can leave it in current working directory or use environment variable SIDE_INFO. Check also [this|http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVSKPR/BCSRVSKPR.pdf] and [this|http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVSKCF/BCSRVSKCF.pdf] document.

Cheers

Answers (2)

Answers (2)

Former Member
0 Kudos

I am not logged on but take a look at the gw/* params in rspfpar.

The gateway only knows the registered program ID and when SAP calls back then you need to instruct it to use SNC.

I remember reading about this somewhere - probably in an OSS note so also try there with the command names or term "reginfo" which is what I was looking into to limit the host which SAP then sends the conversation back to - which is probably a greater risk.

Cheers,

Julius

Edited by: Julius Bussche on Jul 15, 2010 9:40 PM

Former Member
0 Kudos

Hi ,

I could not clearly understand the question

If you trying to communicate between ABAP and JAVA , as far as I remember SNC SNC works only for ABAP stacks.

Can you please rephrase your question?

Edited by: Franklin Jayasim on Jul 15, 2010 6:29 PM

Former Member
0 Kudos

Again in short form:

- old C-programm connects to SAP using CPI-C API (yes - I know its obsolete)

- Now, SNC should be added but does NOT work. (commands in C programm SAP_CMINIT3)

- Tried RFC and this works...? so SAP system seems to be configured correct.

Detailed:

- all snc* profile parameters are correct

- all gw* profile parameters also seem to be correct (well, RFC with SNC works)

- in SM54 the TXCOM destination is set to use SNC and SNC is ON

- the external C-Programm has set all SNC params in its CPIC calls (no sideinfo file is needed!)

Here is some C code I am using:

CPIC_SNC_DATA cSncData;
ZeroMemory(&cSncData, sizeof(CPIC_SNC_DATA));
cSncData.version = CPIC_SNC_DATA_VERSION;
cSncData.mode = CPIC_SNC_ON;
cSncData.role = CPIC_SNC_INITIATOR;
cSncData.qop = CPIC_SNC_QOP_DEFAULT;
cSncData.myname = "p:MYDOMAIN\user";
cSncData.partnername = "p:DOMAIN\SAPServiceBW2";
cSncData.lib = "D:\bin\SAP\FrontEnd\SAPgui\gssntlm.dll";

SAP_CMINIT3(pConvID, "MYTXCOM", "MYHOST", "MY_DISPATCHER", "GW_HOST", "GW_SERVICE", 
					INT_SOCK_COMM, 3/*iTraceLevel*/, &cSncData, &iReturn_code);

CPIC_BYTE bSncEnabled = CPIC_SNC_ON;
SAP_CMSNCMODE(mpConvID, &bSncEnabled, &iReturn_code);
// bSncEnabled is 0, it should be 1 = ON
...
CMALLC(pConvID, &iReturn_code);
...
SAP_CMLOGON2(psOutput,
	&iSend_length,
	"CONN",
	"CPIC",
	'1',
	"800",
	"USER",
	"PWD",                                            // What is as Password needed??? We are using SNC !!!!
	"D",
	"ZMYREP1",
	"MY_FORM1",
	&iReturn_code);
...
CMSEND(mpConvID, psOutput, &iSend_length, &iRequest_to_send_received, &iReturn_code);
...
CMRCV(mpConvID, psInput, &iRequested_length, &iData_received, &iReceived_length, 
		&iStatus_received, &iRequest_to_send_received, &iReturn_code);
...

The Problems:

1) SAP_CMSNCMODE() call says SNC is not enabled - it must be enabled

2) SAP_CMLOGON2() must be used without a password (SNC!) - but this results in an error!

Hoping any body can help me,

Andi

mvoros
Active Contributor
0 Kudos

So what is in your sideinfo file?

Cheers

Former Member
0 Kudos

That's the one which I could not remember!

Thanks and enjoy the weekend,

Julius

Former Member
0 Kudos

Hi,

NO sideinfo-File is needed because the CPIC call in the C-programm gets all those parameters.

see

Note the following points:
·        No side info: SAP_CMINIT3 provides all the connection parameters

Any Ideas what's wrong?

Bye,

Andi

mvoros
Active Contributor
0 Kudos

Hi,

have you tried to call SAP_CMPERR to get error message after function call fails? I would also try to use sideinfo file jsut to compare results from different approaches.

Cheers

Former Member
0 Kudos

Hi Martin,

SAP_CMINIT3 and SAP_CMSNCMODE did not set any error - all fine !?!?!

When I try to get the SNC Name with SAP_CMSNCNAME I get this error message:

LOCATION    CPIC (TCP/IP) on local host
ERROR       SNC disabled for conversation 07925707, tp = SAPCPIC

TIME        Tue Jul 20 08:13:19 2010
RELEASE     640
COMPONENT   CPIC (TCP/IP)
VERSION     3
RC          765
MODULE      r3cpic.c
LINE        10220
COUNTER     1

Now, I will try if a sideinfo file - though I can NOT use a file because the connects are dynamic during my app.

Does anybody at SAP have a old C programm which connects with CPIC to a SAP system and uses SNC?

Andi