on 03-14-2014 9:59 AM
Again I displayed a wrong details in my output screen.... I want the column names to be displayed in listbox but what the code below dows is, it prints the defaullt fields like [FIELD NAME,OFFSET,LENGTH,TYPE,FIELD TEXT] from the RFC_READ_TABLE function module... I want the column names like BNAME,CITY...etc!! Table name is USR02
RfcRepository repo = rfcDest.Repository;
IRfcFunction customerList = repo.CreateFunction("RFC_READ_TABLE");
customerList.SetValue("QUERY_TABLE", "USR02");
customerList.SetValue("DELIMITER", ";");
IRfcTable addressData = customerList.GetTable("FIELDS");
int j = addressData.Metadata.LineType.FieldCount;
for (int i = 0; i < j; i++)
{
RfcElementMetadata metadata = addressData.GetElementMetadata(i);
listallcolumn.Items.Add(metadata.Name);
}
I found out
This is the code:
int j = addressData.RowCount;
for (int i = 0; i < j; i++)
{
listallcolumn.Items.Add(addressData[i].GetString("FIELDNAME"));
}
This added the column names...
Thanks a lot Case Ahr
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Some one help me with this plz
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Your sample code is what you would use to get the field names of the return table "FIELDS." In this particular instance, the field names of the table are actual values in the table. So you would do this to get the list.
IRfcTable addressData = customerList.GetTable("FIELDS");
int j = addressData.RowCount;
for (int i = 0; i < j; i++)
{
IRfcStructure row = addressData.GetStructure(i);
listallcolumn.Items.Add(row.GetString("FIELDNAME"));
}
Great Now it counts the column as 43, its correct
but I get this error while coming to this line
int j = addressData.RowCount;
for (int i = 0; i < j; i++)
{
IRfcStructure row = addressData.GetStructure(i);---> Error at this line
ERROR msg: FIELD FIELDNAME of TABLE [STRUCTURE RFC_DB_FLD] (GETTER): cannot convert CHAR30 into IRfcStructure
so I changed the code to
IRfcStructure row = addressData.GetStructure(i.ToString());
It shows error as: Element 0 of container metadata unknown [RfcInvalidParameter Exception]
User | Count |
---|---|
91 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.