cancel
Showing results for 
Search instead for 
Did you mean: 

SWNC_COLLECTOR_GET_AGGREGATES

obaid_ullah2
Explorer
0 Kudos
811

Trying to access ST03 related data through RFC 'SWNC_COLLECTOR_GET_AGGREGATES' when connecting with .Net Connector 3.1. 

 IRfcFunction rfcFunction = rfcRepository.CreateFunction("SWNC_COLLECTOR_GET_AGGREGATES");
            rfcFunction.SetValue("COMPONENT", "TOTAL");
            rfcFunction.SetValue("PERIODTYPE", 'D');
            rfcFunction.SetValue("PERIODSTRT", new DateTime(2024, 07, 07));
            rfcFunction.Invoke(_destination);
      

 At execution, getting following exception:

SAP.Middleware.Connector.RfcTypeConversionException
  HResult=0x80131600
  Message=FIELD READDIRTI of STRUCTURE SWNCAGGEXTSYSTEM (SETTER): cannot convert Byte[] into BCD[13:0]
  Source=<Cannot evaluate the exception source>
  StackTrace:
<Cannot evaluate the exception stack trace>

Inner Exception 1:
RfcTypeConversionException: Cannot convert byte[] of length 455 into a BCD of length 13

 

The data structure 'SWNCAGGEXTSYSTEM' in error message is actually associated with the table ' EXTSYSTEM' consumed by this RFC. Not sure what data is being transferred to this table and how to prevent  this run time error. 

I can execute this RFC successfully in SAP GUI from transaction 'se37' with same set of input parameter and can retrieve data from output table 'Times'.

The only data i'm interested to retrieve from this RFC is tcode and total #of dialog steps executed, with each step that is available from output table  'Times'. This RFC returns a lot of other data which is not of interest to me. Is there any other RFC to extract required data without overhead of extracting other statistical data? 
I found another RFC named 'SWNC_GET_WORKLOAD_STATISTIC' which also return similar set of data as 'SWNC_COLLECTOR_GET_AGGREGATES'. Interestingly, i'm not seeing any error when using this RFC form client machine and was able to get required data from table 'Times'. 

 

 

 

Accepted Solutions (0)

Answers (2)

Answers (2)

Ulrich_Schmidt
Product and Topic Expert
Product and Topic Expert

A test against my backend system works ok. But the difference seems to be: in my case, the FM only returns 13000 lines for table "WBC", but zero lines for table "EXTSYSTEM". Most probably in your case, the FM also returns some lines in table "EXTSYSTEM", and NCo does not know how to interpret this data correctly.

If this is the case, then there are two possibilities:

  1. The metadata used in your .NET program and the metadata in the backend do not match.
    For this it is important, that the "repository" object you use for the CreateFunction(), is really obtained from the same backend, against which you then make the Invoke() call!! Otherwise, the definitions of the structure SWNCAGGEXTSYSTEM​ in .NET and on ABAP side could potentially be different, leading to all kinds of strange problems.
  2. Bug in NCo.
    If you can verify, that point 1 above is done correctly, open a support ticket under component BC-MID-CON-NCO.
obaid_ullah2
Explorer
0 Kudos
We are using most recent release of .Net Connector version 3.1.0.42.
obaid_ullah2
Explorer
0 Kudos
We are using most recent release of .Net connector 3.1.0.42. To answer your first point, we are using only one backend system and same system is being used to get 'repository' object and to make the Invoke() call. It looks like a bug in .NetConnector but i'm surprised that no one else had reported this issue yet!
Ulrich_Schmidt
Product and Topic Expert
Product and Topic Expert

"3.1.0.42" is not really the version... This is only the "Assembly Version", which we keep constant over all 3.1.x versions, so that the Microsoft .NET Runtime accepts all patch levels as "compatible".
The real version can be seen in the "File Version" field. Please make sure that this shows "3.1.4.3", which is currently the latest version. (Can be downloaded as "3.1.4 Hotfix 3" from the NCo download page.)

but i'm surprised that no one else had reported this issue yet!
You need to know, that the ABAP DDIC (like the rest of the ABAP language) has grown historically and allows some pretty "pathologic" corner cases. If you look at the definition of SWNCAGGEXTSYSTEM, you will see that it is indeed a really strange structure. Basically it is a vector with one "un-named" field, and the contents of this field is a structure with 46 fields...

We do have some pretty pathologic test cases in our test-suite, but we cannot test all the possible thousands of exotic corner cases that ABAP developers around the globe can cook up in the ABAP DDIC... So even though NCo3 has first been released in 2012 and is used in thousands of applications, I am not surprised that there may still be some strange corner cases that NCo cannot decode correctly...

obaid_ullah2
Explorer
0 Kudos

This is standard RFC. Shouldn't be all internal table and/or structure are initialized by RFC itself?  How a table can be initialized before calling RFC through .Net connector?  To initialize, should i need something like

 rfcFunction.SetValue("EXTSYSTEM", XYZ )

where XYZ is an instance of 'SWNCAGGEXTSYSTEM' data structure contained by RFC. It means i've to create a proxy object for 'SWNCAGGEXTSYSTEM' and then proxy for each object used by this structure. There are more than 25 tables associated with this RFC and should i create proxy for each table? This does not make sense. 

 

 

Sandra_Rossi
Active Contributor
Please don't post an answer, which is reserved to propose a solution. Instead click on "Show replies" and then "Comment".