Skip to Content
0
Former Member
Feb 04, 2005 at 11:09 AM

RFC in C++ to SAP doesn t transfer data

42 Views

Hello,

I make in C++ a RFC call of a function module.

The RFC works but not the data transfer.

The import parameters of the function module in SAP are:

I_MANDT TYPE NUMC3

I_WERKS TYPE CHAR4

I_PROCESS TYPE CHAR10

I_STRING TYPE STRING

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The export definition in the C++ programm is:

exporting[0].name = malloc(7);

memcpy(exporting[0].name,"I_MANDT", 7);

exporting[0].nlen = 7;

exporting[0].type = RFCTYPE_NUM;

exporting[0].leng = 3;

exporting[0].addr = malloc(4);

memset(exporting[0].addr,0,4);

sprintf((char *) exporting[0].addr, "%04d", cst_mandt);

exporting[1].name = malloc(7);

memcpy(exporting[1].name,"I_WERKS", 7);

exporting[1].nlen = 7;

exporting[1].type = RFCTYPE_CHAR;

exporting[1].leng = 4;

exporting[1].addr = malloc(5);

memset(exporting[1].addr,0,5);

sprintf((char *) exporting[1].addr, "%05d", cst_werks);

exporting[2].name = malloc(9);

memcpy(exporting[2].name,"I_PROCESS", 9);

exporting[2].nlen = 9;

exporting[2].type = RFCTYPE_CHAR;

exporting[2].leng = 10;

exporting[2].addr = malloc(11);

memset(exporting[2].addr,0,11);

sprintf((char *) exporting[2].addr, "%11c", cst_process);

exporting[3].name = malloc(8);

memcpy(exporting[3].name,"I_STRING", 8);

exporting[3].nlen = 8;

exporting[3].type = RFCTYPE_CHAR;

exporting[3].leng = 5000;

exporting[3].addr = malloc(5001);

memset(exporting[3].addr,0,5001);

sprintf((char *) exporting[3].addr, "%5001c", chr_line);

rfc_rc = RfcCall( handle, cha_prog,

exporting,

tables);

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Does anybody know, where the mistake is, that i don t get the data from the C++ to SAP transferred?

In the debugger in C++ I can see, that the fields are filled.

I would appreciate a quick answer, because the project has to be active in 2 weeks.

Thank you""

best regards

Jasmin Söllner