on 01-24-2006 11:24 PM
Hello:
I have the next code:
// Calling remote function
proxy.Z_Hrpfpa00105("XX", "45", out sts, ref tIVAEmp);
foreach (ZHRRESNOM row in tIVAEmp)
{ Console.WriteLine("{0} ", row.Desc2, row.Betrg, ); } Assuming that tIVAEmp has 100 fields I need to build some loops during Console.WriteLine process, so I asked for your help for one part of the solution: // Getting the field names and lengths of an RFC Table Type structureType = tIVAEmp.GetElementType(); SAPField[] fields = SAPStructure.GetSAPFieldsSchema(structureType); // Verifying foreach (SAPField row in fields) Console.WriteLine(" - ", row.FieldName, row.FieldLength);
It worked, but now I can´t find the connection between SAPField and the content of every RFC Table field for every record, my mind is in blank and a I need help how can I do in C# something similar to:
foreach (ZHRRESNOM row in tIVAEmp)
+// The next is pseudo-code
for every field F in fields
{ stri += contents of row, column F }
Console.WriteLine(, stri);+</i></i>
Thanks again
E.g
proxy.Z_Hrpfpa00105("XX", "45", out sts, ref tIVAEmp);
Type structureType = tIVAEmp.GetElementType();
SAPField[] fields = SAPStructure.GetSAPFieldsSchema(structureType);
foreach (ZHRRESNOM row in tIVAEmp)
{
foreach (SAPField field in fields)
{
Console.WriteLine("{0}: {1}", field .FieldName, row[field.FieldName]);
}
}
Accessing fields by name may be a little bit slow. Alternatively you can access it by index, which is faster:
for (int i=0; i<fields.Length; i++)
{
Console.WriteLine("{0}: {1}", fields<i>.FieldName, row<i>);
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.