I'm using SAP .NET Connector 3.0 to read data from SAP(R/3). I need to get some header texts from sales orders:
A lot of information I found regarding READ_TEXT function which can be used for this purpose. Here you can find some sample how to do it by using ERPConnect. I'm trying to do the same and I have following function which returns IRfcTable:
static IRfcTable ReadFunction(string destName, int rowCount)
{
// get the destination
RfcDestination dest = RfcDestinationManager.GetDestination(destName);
IRfcFunction func = dest.Repository.CreateFunction("RFC_READ_TEXT");
IRfcTable table = func.GetTable("TEXT_LINES");
table.Insert();
table.Insert();
table.Insert();
table.Insert();
table[0].SetValue("TDOBJECT", "VBBK");
table[1].SetValue("TDNAME", "3147856016");
table[2].SetValue("TDID", "Z019");
table[3].SetValue("TDSPRAS", "PL");
func.Invoke(dest);
return table;
}
VBBK
- means header objects, 3147856016
- sales order number, Z019
- ID for EDI Supplier text field, PL
- language.
As a result I'm retrieving some data, but field TDLINE is blank:
According to example this field should contain text.
Probably some parameters are incorrect. Here is a good post where I found how to obtain TDID parameter for each text field.
What I'm doing wrong?
UPDATE: According to vwegert
answer below, code has been changed like:
IRfcTable table = func.GetTable("TEXT_LINES");
table.Insert();
table[0].SetValue("TDOBJECT", "VBBK");
table[0].SetValue("TDNAME", "3147856016");
table[0].SetValue("TDID", "Z019");
table[0].SetValue("TDSPRAS", "PL");
func.Invoke(dest);
return table;
Now parameters are correct. But TDLINE
is still empty. Result: