cancel
Showing results for 
Search instead for 
Did you mean: 

JCo's StatefulServerExample problem (returning a value from RFC call?)

Former Member
0 Kudos

Hi,

I'm using JCo3 and want to run StatefulServerExample sample program. I've created the ABAP-side code according to JCo's docs (2 wrappers and report ZJCO_STATEFUL_COUNTER). I'm connecting to SAP CRM. I've successfully runned all other sample programs.

I've got a problem with receiving data from the JCo server to CRM report. The error is reported on the SAP's side:

error: CALL_FUNCTION_WRONG_VALUE_LENG

description: Incorrect field length for 'Remote Function Call'.

error analysis:

A data error occured when executing a Remote Function Call

The length of one of the fields is incorrect.

Length of source field... 1

Length of target field .. 4

Data type of field....... 8

(Data type 0=C, 1=D, 2=P, 3=T, 4=X, 6=N, 7=F, 8=I)

error is triggered by the call to 'Z_GET_COUNTER' (see code below).

There is no problem with preceding calls to JCo server which do not return anything.

I would appreciate any help with this problem!

Piotr

Problematic report code:


*&---------------------------------------------------------------------*
*& Report  ZJCO_STATEFUL_COUNTER
*&---------------------------------------------------------------------*

REPORT  ZJCO_STATEFUL_COUNTER.
PARAMETER dest TYPE RFCDEST.
DATA value TYPE I.
DATA loops TYPE i VALUE 5.
DO loops TIMES.
  CALL FUNCTION 'Z_INCREMENT_COUNTER' DESTINATION dest.
ENDDO.
CALL FUNCTION 'Z_GET_COUNTER' DESTINATION dest
  IMPORTING
    GET_VALUE = value.
IF value <> loops.
  write: / 'Error expecting ', loops, ', but get ', value,
  ' as counter value'.
ELSE.
  write: / 'success'.
ENDIF.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

It seems to me that the ABAP code in the example is wrong - it should be INT1 instead of i:


DATA value TYPE INT1.

Now it works.