cancel
Showing results for 
Search instead for 
Did you mean: 

Table Parameter & JCO

Former Member
0 Kudos

Hi Experts,

I'm using JCO to access BAPIs from our SAP-System. Now I'm trying to use a wrapper BAPI for CHANGE_POINTERS_CREATE_DIRECT to create an entry for the table BDCPV. The wrapper has exactly the same parameters as CHANGE_POINTERS_CREATE_DIRECT. Here is a part of my coding:

f=jco.getFunction("Z_CP_CREATION");//my own method to retrieve a function

f.getImportParameterList().setValue("message", "MESSAGE_TYPE");

table=f.getTableParameterList().getTable("T_CP_DATA");

table.appendRow();

table.setValue("someValue","TABNAME");

table.setValue("someValue","TABKEY");

table.setValue("someValue","FLDNAME");

table.setValue("someValue","CDOBJCL");

table.setValue("someValue","CDOBJID");

table.setValue("someValue","CDCHGID");

jco.execute_function("Z_CP_CREATION");

My problem now is, that the parameters, which are set in the table, are not getting to the BAPI. When I debug the BAPI while running this code, I see, that the import parameter (message) is received but the table T_CP_DATA is empty.... So what the heck am I doing wrong?

Regards

Torsten

Edited by: Torsten Nordmann on Jan 22, 2008 5:00 PM

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello

AFAIK you need to append a row to the table before inserting values

try table.appendRow()

regards franz

reward points if useful

Former Member
0 Kudos

I'm sorry, I did it, just forgot the line in the code here. Without the append command there would be an Exception, while trying to fill in data.

Former Member
0 Kudos

maybe there is a problem in your Z function module

do you use a table with a work area, if so change the calling of the bapi like this

CALL FUNCTION .....

IMPORTING

....

EXPORTING

....

TABLES

T_CP_DATA = MY_CP_DATA[]

because without the [] i think you only hand over the work area of the table (which in case of RFC is initial)

also try to debug your Z function module to see if the table data arrives there

regards franz

Former Member
0 Kudos

Directly in the SAP-System the BAPI works just fine. I tested it. It's just that if I call the BAPI via JCO the table parameter for the BAPI (right at the beginning) is empty.

So, as I stated, the Import Parameter is supplied, but the Table Parameter isn't. And I have no clue why....

Former Member
0 Kudos

did you try to set the table parameter with [] in your Z function module

code should look like this

CALL FUNCTION 'CHANGE_POINTERS_CREATE_DIRECT'

EXPORTING

message_type = my_message_type

tables

t_cp_data = my_cp_data[]

otherwise only the workarea (or in German 'Kopfzeile') of your internal table is submitted, an this workarea in case of RFC is empty

regards franz

Former Member
0 Kudos

Franz,

as I stated, the call for CHANGE_POINTERS_CREATE_DIRECT works just fine. This is no ABAP problem, it's a JCO problem as far as I can say.

I call Z_CP_CREATION via JCO (Java Connector for SAP). Z_CP_CREATION is just a wrapper for CHANGE_POINTERS_CREATE_DIRECT, because CHANGE_POINTERS_CREATE_DIRECT can't be called via RFC.

Former Member
0 Kudos

Hello

could you please post the source of Z_CP_CREATION, then i'll give it a try on my dev system

regards franz

Former Member
0 Kudos

No, because I've already rewritten the code, so the Z_CP_CREATION gets all it needs via Import Parameters, now, to call CHANGE_POINTERS_CREATE_DIRECT. Actually this way works, but that's not satisfying. There has to be a way to use tables to get data into BAPIs.