Serialization of RFC parameters in JCo

982 Views Asked by At

What would be the best way to serialize informations about SAP RFC Function Module parameters (i.e. parameter names and parameter values) with which the function was called in SAP (with parameter 'DESTINATION' provided as SAP JCO SERVER) and then captured in JCo?

The point is that the serialization should be done in Jco (using Java) and then this data would be send back to SAP and saved in a Z-Table in SAP, so that later using this entries in SAP Table it will be possible to "reserialize" this data in ABAP and call again the given funcion with exactly the same parameters and values.

To make it easier to understand, I will give an example:

Step 1. We call RFC FM in ABAP:

CALL FUNCTION 'remotefunction'
DESTINATION jco_server
EXPORTING e1 = exp1
* IMPORTING i1 =
TABLES t1 = tab1.

Step 2. We catch this function call in Jco and need to serialize the information about the parameters with which the function was called and save it in a SAP table, for example:

String ImportParList = function.getImportParameterList().toXML().toString(); //serialization of import parameters
String ExportParList = function.getExportParameterList().toXML().toString(); //serialization of export parameters
String TableParList = function.getTableParameterList().toXML().toString(); //serialization of table parameters
String ParList = ImportParList + ExportParList + TableParList;
//Call function to save content of variable "ParList" in a SAP table

Step 3. Using ABAP we need to select the data from SAP table and "reserialize" (e.g. using CALL TRANSFORMATION FM in ABAP) to be able to recall again the FM "remotefunction" with the same parameters and values as earlier.

To sum it up:

A. Is there maybe any standard Java method in Jco for such serialization (better than manually converting this to xml/JSON and saving as String)?

B. How to deal with deep ABAP structures, e.g. tables in which subsequent tables are nested? Also convert it to XML/JSON just like the rest?

C. Do you have any other ideas how to perform this process better than what I presented?

Thanks in advance!

1

There are 1 best solutions below

0
Suncatcher On

What I describe here may not be appropriate to you due to the complexity of installation and setup, but just for sake of use for other community members and for the acknowledgement that such functionality exists.

SAP has a special framework for enabling the case you want, called LOWGWIN (LOGCOM 200). Instructions for installation are in SAP Note 1870371.

Details of the feature set:

The logging of RFCs allows you to establish which users had access to which data at what point in time. You can log data on RFC Function Module (FM) level, for example:

  • Type of parameters

  • Name and corresponding values of parameters

In order to minimize the amount of logged data, you can do the following:

  • Restrict logging to certain users

  • Filter the parameters that need to be logged before they are included in the log records

  • Enable logging on client level only for the RFC Function Modules that you want to log

You can fine-tune wich RFC calls (modules) will be logged including successful or failed ones by BAdI /LOGWIN/BADI_RFC_LOG_FILTER.

Initially the log is stored temporarily in SAP and can be viewed via transaction /LOGWIN/SHOW_LOG, after that you can transfer necessary log records to external repository (which you should set up in advance) by transaction /LOGWIN/TSF_TO_EXT.

Architecture overview:

enter image description here

So you can setup external repository in Java storage or leave it as is and read parameter values from SAP, after that you can re-run failed modules from SAP or Java side.

Also, there is a bunch of other settings about data archiving, user permissions, exclusion, mappings etc. which are too big to describe in the answer.

More documentation is here:

also check notes 1870371 and 1878916