cancel
Showing results for 
Search instead for 
Did you mean: 

Question on JCo 3.0 Server Programming o

Former Member
0 Kudos

Hi all,

I am using JCo 3.0 and i am following the example StepByStepServer.

In ABAP i have something like,


data:    escalation_level type int1 value '2'.

call function 'ZCALL_FUNCTION' destination 'CONNECTION'
  exporting
    escalation_level  = escalation_level 
.....

In JAVA i have something like,


System.out.println(function.getExportParameterList().getValue("escalation_level"));

But i am always getting 0.

When i do a function.getExportParameterList().toString(), it is shown as


| PARAMETERS 'OUTPUT'
|----|
|ESCA|
|----|
|   0|
|----|
|0000|
|----|

The metadata for the RFM is retrieved dynamically from the SAP system at runtime.

Any ideas or advice?

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

For the issue you are facing, follow the steps:

a) Give sample input to function module/BAPI and execute it directly. Note down escalation_level value

b) set external break point for BAPI in ABAP GUI and from JAVA try to execute the program. Debug BAPI

c) Check the value at the end of BAPI value populated

regards,

ganga

Former Member
0 Kudos

a) Give sample input to function module/BAPI and execute it directly. Note down escalation_level value

b) set external break point for BAPI in ABAP GUI and from JAVA try to execute the program. Debug BAPI

c) Check the value at the end of BAPI value populated

And what do i do next?

Former Member
0 Kudos

Try doing like this

String test = (String)function.getExportParameterList().getValue("escalation_level");

System.out.println(test);

Former Member
0 Kudos

Try doing like this

String test = (String)function.getExportParameterList().getValue("escalation_level");

System.out.println(test);

Former Member
0 Kudos

Hi all,

i am facing the same problem. The values of ABAP Importing parameters are not always passsed to Java. This problem only occurs with some ABAP types. I tried INT1, INT2 and INT3 and no values arrived at the Javeserver side. When i tried CHAR, the values can be seen/read in Java.

What am I missing here? Some basic settings?

thanks for any help or hints

Former Member
0 Kudos

Hi

i realized what was wrong over here.

In ABAP, you have



call function 'ZCALL_FUNCTION' destination 'CONNECTION'
  exporting
    escalation_level  = escalation_level 

...

In Java you would do,


   function.getImportParameterList().toString();

So i got the export and import mixed up in Java.

Now it is working fine.

Former Member
0 Kudos

Hi,

I also realized what I did wrong. It wasn't the same error like the one sap_noop described, so I am posting my results here.

1) It is necessary to use capital letters to refer to the importingparameter names.

Example: Integer out1 = (Integer)importList.getValue("I_INTE1");

If I write i_inte1, I always get a shortdump in SAP saying that i_inte1 is not part of INPUT.

2) In order to make tests easy, I passed interger values directly when calling a function.

Example: CALL FUNCTION 'ANY_FUNCTION'

DESTINATION 'ANY_DESTINATION'

EXPORTING I_INTE1 = 12.

This only works if the type of I_INTE1 is c. If it is an Integer I always received 0 instead of 12 in Java. To make it work I had to define a variable which has the value 12 and then passed the variable to the function.