cancel
Showing results for 
Search instead for 
Did you mean: 

How to set new table to exporting parameter?

Former Member
0 Kudos

I'm using the RFC RSDRI_INFOPROV_READ_RFC to read some data from DATACUBES.

Question is, I need to pass a custom table to the E_T_RFCDATA parameter, but I'm getting some error messages.

My code is:

IRfcFunction funcaoRT = repo.CreateFunction("RSDRI_INFOPROV_READ_RFC");

funcaoRT.SetValue("I_INFOPROV", "/CPMB/Z0IMVWV");

RfcStructureMetadata strucmetadata = new RfcStructureMetadata("RSDRI_S_RFCDATA");

strucmetadata.AddField(new RfcFieldMetadata("P_CONTA", RfcDataType.CHAR, 32, 32, 32, 32));

strucmetadata.AddField(new RfcFieldMetadata("CENTROCUSTO", RfcDataType.CHAR, 32, 32, 32, 32));

strucmetadata.AddField(new RfcFieldMetadata("VALOR", RfcDataType.CHAR, 32, 32, 32, 32));

RfcTableMetadata metadata = new RfcTableMetadata("RSDRI_T_RFCDATA", strucmetadata);

var export = metadata.CreateTable(500);

funcaoRT.SetValue("E_T_RFCDATA", export); ERROR HERE

var t = funcaoRT.GetTable("I_T_SFC");

t.Append();

t.SetValue("CHANM", "/CPMB/Z0DRB3Y");

t.SetValue("CHAALIAS", "P_CONTA");

var t3 = funcaoRT.GetTable("I_T_SFC");

t3.Append();

t3.SetValue("CHANM", "/CPMB/Z0DRB3Y__/CPMB/Z0PDBCY");

t3.SetValue("CHAALIAS", "CENTROCUSTO");

var t4 = funcaoRT.GetTable("I_T_SFK");

t4.Append();

t4.SetValue("KYFNM", "/CPMB/SDATA");

t4.SetValue("KYFALIAS", "VALOR");

funcaoRT.Invoke(meurfc);

The exception is:

{"Cannot convert TABLE RSDRI_T_RFCDATA [STRUCTURE RSDRI_S_RFCDATA] (from custom repository) into TABLE RSDRI_T_RFCDATA [STRUCTURE RSDRI_S_RFCDATA] (from BWD repository)"}

Accepted Solutions (0)

Answers (1)

Answers (1)

MarkusTolksdorf
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Rogger,

obviously, the metadata definitions do not fit together and therefore you cannot set it. But why do you want to do it at all? Obviously, you simply set the table but do not add any rows. In such a case it does not make sense at all. Even if you want append rows you should use the same approach like for t3 and fetch the table from the function instance directly.

Best regards,

Markus