Skip to Content
0
Former Member
Jun 08, 2011 at 09:19 AM

Passing more complex data between JAVA and SAP

219 Views

Hi,

now that my RFC connection works, i'm trying to pass some data between Java and SAP.

First time i've tried with simple objects like strings and integers and it worked fine. But i do have some problems with more complex structures like tables or one table row. Is it possible to send complete tables filled with data between the two systems? and if yes, how can i achieve it?

I did define a new parameter in the "Tables" tab within the function modul and then tried to access it in JAVA with

JCoTable zrksUsers = function.getTableParameterList().getTable("T_EXAMPLE_TABLE"); but i didnt get any data, only the column definitions.

Do i have to define an export parameter? (of which kind?)

I've tried that too:

FUNCTION ZFB_TEST01.
*"----------------------------------------------------------------------
*"*"Lokale Schnittstelle:
*"  IMPORTING
*"     VALUE(IM_USERID) TYPE  STRING
*"  EXPORTING
*"     VALUE(EX_ZRKS) TYPE  ZRKS
*"  TABLES
*"      T_RETURN STRUCTURE  ZRKS
*"----------------------------------------------------------------------

DATA temp TYPE ZRKS.

SELECT * FROM ZRKS INTO temp WHERE USRID = IM_USERID.
ENDSELECT.

EX_ZRKS = temp.

ENDFUNCTION.

but then i get a conversion error in Java:

"122) JCO_ERROR_CONVERSION: Cannot convert field EX_ZRKS of type STRUCTURE to TableRecord"

Thanks in advance!