cancel
Showing results for 
Search instead for 
Did you mean: 

Migration to SAP NCo 3.0

Former Member
0 Kudos

I have windows application which is built on top of old SAP connector framework. Not sure about the version but it is using SAP.Connector.DLL (v1.2.3.0).

I need to migrate it to .Net Framework 4.0 so I understand I would need to use SAP Connector 3.0.

I learnt that there are some major changes from the previous version of SAP connector framework for instance SAPServerHost , SAP.Connector.SAPServer are completely missing.

I have just started working with this API and I am not really how I should start with this migration.

Any pointers do this migration smoothly would really be helpful. I am currently stuck and not sure how to proceed further.

Regards,

Darshan

Accepted Solutions (0)

Answers (1)

Answers (1)

hynek_petrak
Active Participant
0 Kudos

I started with the documentation provided. Both NCo_30_Overview.pdf and NCo_30_Tutorial.zip gave me a quick and sufficient insight into the NCO 3 concept.

Former Member
0 Kudos

Thanks Hynek. But I do not have access to PDF and ZIP you have provided.

If you have any sample in SAP NCo 3.0 which depicts simple job of fetching SAP Host and starting and stopping it, that would be helpful.

Thanks.

hynek_petrak
Active Participant
0 Kudos

The pdf and Zip are part of the documentation of the NCO 3. If you do not have access to them mean you do not have access to NCO3 either?

Former Member
0 Kudos

HI Hynek,

I got the installable for NCo 3.0 separately so I could install it without issues. But accessing these documents require SAP market place login which I don't have.

I am particularly stuck at below point currently.

I am able to query the SAP Host status using below code and config below (and also able to execute BAPI functions but I do not need to do that)

But I am not able to Start or Stop the SAP Host. That means, if I write "SapHost.Start();"

SAPHost status is updated as Started but if I fetch the status next time (execute the application again), it is always stopped.

Code

Type[] RfcHandlers = new Type[1] { typeof(DxsRfcServer) };

RfcServer SapHost = null;

SapHost = RfcServerManager.GetServer("CONFIGENTRY", RfcHandlers);

app.config

<SAP.Middleware.Connector>

    <ClientSettings>

      <DestinationConfiguration>

        <destinations>

               <add NAME="ENTRY1" USER="*****" PASSWD="******" CLIENT="***" LANG="DE" ASHOST="**************************" SYSNR="**"/>

        </destinations>

      </DestinationConfiguration>

    </ClientSettings>

    <ServerSettings>

      <ServerConfiguration>

        <servers>

                  <add NAME="CONFIGENTRY" GWHOST="****" GWSERV="******" PROGRAM_ID="*****" REPOSITORY_DESTINATION="ENTRY1" />

        </servers>

      </ServerConfiguration>

    </ServerSettings>

  </SAP.Middleware.Connector>

Please suggest if you know how to fix this issue.

Thanks,

Darshan Bhatt

hynek_petrak
Active Participant
0 Kudos

You shall not exit your application as long the server is running. And do a proper shutdown at the end.

If I understand your "execute the application again"  - are you exiting right after the call to SapHost.Start() ?

Did you implement the error handlers?

            SapHost.RfcServerError += OnRfcServerError;

            SapHost.RfcServerApplicationError += OnRfcServerApplicationError

Former Member
0 Kudos

Thanks Hynek for your continuous help.

But here is what I need to do, Not sure if doing it right.

I need to query the "Status" of SAP Host (whether it is running ot not). If it is not running, I would like to start the SAP Host

So in my applicaiton, I an starting the SAP Host and stopping the application and next time I expect tahat I get SAP Host in "Started" status.

I am not sure if this is the correct way with NCo 3.0. But in my old application built on top of NCo 2.0 we were able to do change the sap host status by calling Start() method from SAP.Connector.SAPServerHost


hynek_petrak
Active Participant
0 Kudos

Let's call the objects by names of their classes. So I assume your "SAP Host" means RfcServer.

RfcServer is hosted within your .NET Application. As soon as the application terminates, the RfcServer terminates too.

Could you split your effort into creation of

a) Windows service that will provide your RfcServer functionality and will run all the time you need the "SAP Host" to be up.

b) query/control tool, that will monitor the status. You can query the a) component via any standard .NET IPC mechanism, e.g. anon/named pipes.

Component b) would query the status of SAPServer (contained in component a)).

Then you may have two possible scenarios

1) You make start/stop of windows service independent of RfcServer start/shutdown. So the component b) would send commands to a) to start or stop the RFCServer. I.e. to issue SAPHost.Start() SAPHost.Shutdown(true/false), not to restart the Windows service.

2) You would implement RfcServer.Shutdown in Windows service shutdown and RfcServer Start in service startup. Then Windows service status = RfcServer status.

You read your RfcServer status e.g. via RfcServerMonitor.State.

Former Member
0 Kudos

Hi Hynek,

I am able to develop application as per your guidelines. Windows service and windows application which communicates through Net Pipe.

But here is my scenario I am trying to execute.

For eg. I have one console application, which is fetching RfcServer and starting it within the console application by invoking .Start() method. Assuming it is already stoppped.

I have other console application which is initializing same RfcServer and when I am trying to fetch the status, it is shown as "Stopped".

I would like to know if RfcServer being started by one application is reflected in other calls to that same RfcServer.

I know I am missing something here but I am not sure. If you can share your personal email Id, I am happy to share the solution as well.

Thanks for your extended support.

hynek_petrak
Active Participant
0 Kudos

Hi Darshan,

I haven't seen such situation documented anywhere. I would assume each instance runs on it's own, even having a same name.

So perhaps if comes along, he can make it clear.

Hynek

Former Member
0 Kudos

Thanks for your inputs, Hynek.

Even I do not personally think that it would be possible.

But with SAP NCo 2.0 do you reckon that this scenario would be possible.

In fact, I can see it happening but not sure so I wanted check with you and replicate the same when I am migrating it to 3.0

MarkusTolksdorf
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Hynek, Darshan,

trying first to verify that I understood your question correctly: when starting the same RfcServer instance, i.e. twice with the same configuration, is this possible. If this is the question, then I can tell you that it is possible: The two executables don't know of each other and are independent. When starting those servers, both will register the same program ID on the same gateway, if each of them registers 2 connections for program ID Foo, there will be in the end 4 connections available for FOO on this gateway. Depending on the gateway settings, the connections will be used following a certain policy, default is a round robin policy.

One additional remark. You can also check from an ABAP system, whether a certain server is existing by sending a request to RFC_PING to the corresponding destination.

Best regards,

Markus

Former Member
0 Kudos

Hi Markus,

I think I got the idea. Now I have opened RfcServer and trying to capture STFC_DESTINATION request from Server.

I have a question though. I am not directly working with the SAP system so that I can not trigger this function directly to test my functionality.

I got some information regarding RfcServer can also be registered with saprfc.ini as well.

Now this might sound weird but is it possible to specify my RfcServer that I am hosting in saprfc.ini so when non-SAP application is making a call (dummy call to STFC_DESTINATION in this case) , I can handle it.

Thanks.

MarkusTolksdorf
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Darshan,

testing without an ABAP system is not really possible. Why don't you have access to one? saprfc.ini is not used by NCo 3.0, this file had only been used by the classic RFC library.

Best regards,

Markus