cancel
Showing results for 
Search instead for 
Did you mean: 

SWNC_COLLECTOR_GET_AGGREGATES from Java

Former Member
0 Kudos

I am not able to call "SWNC_COLLECTOR_GET_AGGREGATES" from java layer. It results in no_data_found error all the time. When I run the same from SAP, it shows result.

Anything wrong in the code? OR setting issues at SAP side? If yes, what setting could cause this issue?

final JCoDestination destination = getDestination(destinationName);

  final JCoFunction function = destination.getRepository().getFunction("SWNC_COLLECTOR_GET_AGGREGATES");

  if (function == null) {

  throw new RuntimeException("SWNC_COLLECTOR_GET_AGGREGATES not found in SAP.");

  }

  function.getImportParameterList().setValue("COMPONENT", "TOTAL");

  function.getImportParameterList().setValue("ASSIGNDSYS", "A11");

  //function.getImportParameterList().setValue("PERIODTYPE", "W");

  function.getImportParameterList().setValue("PERIODTYPE", "M");

  DateFormat formatter = new SimpleDateFormat("yyyyMMdd");

  Date date = formatter.parse("20150701");

  function.getImportParameterList().setValue("PERIODSTRT", date);

  //function.getImportParameterList().setValue("TABLE_NAME", "t_usertcode");

  function.execute(destination);

  int count = Integer.parseInt(function.getExportParameterList().getString("NUMBER_OF_ENTRIES"));

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

The problem turns out to be that I was trying to read the data from exportParameterList. It was available in tableParameterList.

int count = Integer.parseInt(function.getExportParameterList().getString("NUMBER_OF_ENTRIES")); changed to   function.getTableParameterList()

Answers (2)

Answers (2)

MarkusTolksdorf
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Shirish,

very probably you are facing the so-called alpha conversion in this case. There exist certain values for enumerable fields that are translated. When being executed e.g. in the SAP GUI, the language dependent value is translated automatically and for the execution the technical value is used. In case of RFC, which is used by JCo as well, the automatic transaltion simply does not take place und one has to specify the internal value directly. For that you go into se37 in ABAP execute the function module in the debugger and check whether some of your input values have been changed before execution.

Best regards,

Markus

former_member193379
Active Contributor
0 Kudos

Hi Shirish,

Pleasse put debugger on in you NWDS and get the values of Import Parameters and then with these values run this FM.

Thanks,

Hamendra