cancel
Showing results for 
Search instead for 
Did you mean: 

How to Use RFC in RPG (AS400)

former_member220028
Active Contributor
0 Kudos

Hi all,

we are setting up a SAP System and want to establish a RFC connection to a non SAP-System "AS400 (RPG)".

Therefor we installed the "NW RFCSDK 720" on the AS400.

So far so good but now we dont know how to use the NW RFCSDK.

I didnt find any example thats up to date due to the new "NW RFCSDK 720" dont have a LIBRFC.

after we installed the NW RFCSDK we got  a R3710NRRFC Library including following Objects

LIBINFO_MT*PGMCPPLE04/25/14 21:00:48, ILE version 0/613
RFCEXEC*PGMCPPLE04/28/14 19:53:09, ILE version 0/613
STARTRFC*PGMCPPLE04/28/14 19:52:43, ILE version 0/613
CPICTLIB*SRVPGMILE version 0/613
LIBICUDECN*SRVPGMCLEILE version 0/613
LIBSAPNRFC*SRVPGM04/28/14 19:46:21, ILE version 0/613
C*FILEPF-SRCILE version 0/613
H*FILEPF-SRCILE version 0/613
NWRFC_X*DTAARASAP Context NWRFC_X

but i was more expecting Funktions like these:

Procedure

Description

RfcEnvironment

Points to an error control program

RfcAccept

Establishes a conversation

RfcInstall

Points to an RFC-definition, server program

RfcDispatch

Invokes a server program

RfcGetData

Receives data from ABAP program

RfcSendData

Sends data from ABAP program

RfcClose

Closes conversation

Though i wonder how to use the RFC-Statments within an RPG Programm...

I have to tell im an ABAP-developer but our RPG-developer is also clueless...

I got following questions:

-where can i find the RFC-Funktions? In the R3710NRRFC-Library?

-how to use the RFC-Funktions within an RPG-Code (there are some expamles out there... but non of them seems to fit to NW RFCSDK Version 7.20 because no LIBRFC) (we got the EBCDIC-ILE-Version installed)

kind regards

Stefan Seeburger

Accepted Solutions (0)

Answers (1)

Answers (1)

volker_gldenpfennig
Active Participant
0 Kudos

Hi Stefan,

we did this kind of consulting - especially based on RPG - for a lot of customers. But, yes, we never did it with NWSDK, just with the older LIBRFC.

LIBRFC is still possible and in maintenance and will work for an unforseeable future. As the functions all got renamed and even worth - all parameters got totally changed, we didn't see the business case to convert the interfaces to NWSDK by now.

So, we could easy help you with LIBRFC, if you were interested in that.

Regards,

Volker Gueldenpfennig, consolut international ag

former_member220028
Active Contributor
0 Kudos

Hello Volker,

i already heard ur an expert in this field.

As mentioned in OSS-Note 27517 - Installation RFCSDK  the support for the old RFCSDK will end 2016


"....Mit dem Wartungsende von SAP Release 7.10 (31.03.2016) endet auch der

Support für das klassische RFCSDK bzw. die klassische RFC Bibliothek.

Dieses Wartungsende gilt auch für die SAP Releases 7.11 und 7.20."

because of that i think its better for us to start with the new NW RFCSDK...

At the moment im looking for some free hints for a proper understanding

-Do u also know something about the NW RFCSDK?

-Did it just got renamed?

-Are the functions basically the same?

-How can i call a RfcAccept-Routine within my RPG-Programm? because i cant even find the Routine in the "RPG-Programming-GUI". After installation there are just some Objekts listed in R3710NRRFC      -> but i dont know whats inside these...

          -->Can i use Funkctions like "RfcAccept" without beeing able to dive into their RPG-Code?

Can u help me out with this or do we have to order consulting?

kind regards

Stefan Seeburger

volker_gldenpfennig
Active Participant
0 Kudos

Hi Stefan,

yes, that is correct with the dates ...

The functions got all renamed, often you need more functions, then everywhere the parameters are totally changed.

So, it is not easy, to work with NWSDK - but possible.

As LIBRFC is used insite SAP "everywhere", it will work at least until 2022 where ERP 6 is in maintenance ...

I'm sorry, but, yes, we are talking on consulting here ...

Regards,

Volker Gueldenpfennig, consolut international ag

Ulrich_Schmidt
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Volker,

> So, it is not easy, to work with NWSDK - but possible

I'm sorry, but I have to vehemently contradict on this point...

In my opinion, the NWRFC SDK is a huge improvement over the old LIBRFC in terms of usability, supported functionality and robustness. So it's not only "renaming and shuffling things around" -- it's a major re-design!

To give you just a few examples out of many many others:

  • If your function module has nested structures, it was very hard (up to almost impossible for less experienced programmers) to call that function module using LIBRFC. You had to have a very deep understanding of some "internals" of the RFC protocoll. With NWRFC the lib does all the work for you, and you (as the application programmer) don't even notice a difference between "flat" structures and nested structures.
  • If the backend runs on a non-standard codepage, like Chinese, Arabian, Kyrillic, etc. you had to be very careful. A small mistake and you could end up receiving data garbage. Now you write a program once and it runs against every type of backend, be it Japanese, ISO-Latin-1, Unicode or EBCDIC.
  • In case something went wrong inside the backend, you got only very limited error information on LIBRFC side. The NWRFC on the other hand provides as much dump information, E messages, etc. as is available on R/3 kernel side. You can even get ABAP-OO exception information, if the ABAP code of the function module runs into one of those new ABAP-OO exceptions.
  • bgRFC ("background RFC") is not supported by the old LIBRFC.
  • LIBRFC had some security problems, which were caused by the "inner design" and therefore could not be fixed via a patch. It took a re-design of the RFC architecture to fix these problems.

Of course, if you are used to the old RFC library, it takes a bit of "re-thinking" to get used to the NW RFC lib, because the new library uses a completely different programming model. (At least in it's handling of data and data types -- the connection handling pretty much remained the same.)

In order to learn the new programming model, I recommend my SCN articles:

Part I -- RFC Client Programming: https://scn.sap.com/docs/DOC-52886

Part II -- RFC Server Programming: https://scn.sap.com/docs/DOC-52887

Part III -- Advanced Topics: https://scn.sap.com/docs/DOC-52888

Best Regards, Ulrich