on 10-25-2007 7:46 PM
We upgraded to SP 5 build 5.5.42.48 from SP 3 build 5.5.28.88. After getting through a couple issues with how fields were referenced, I am now having a problem referencing certain field characteristics. Here is my sample code:
Dim ata As XCATCOMLib.Field = oRlset.Fields.Item(ProdFldName_aweight)
If Not IsDBNull(oRlset.Fields.Item(ProdFldName_aweight).Value) Then
Dim jval As XCATCOMLib.CharacteristicValue =
oRlset.Fields.Item(ProdFldName_aweight).Value
Dim aweight As String = ""
aweight = jval.GetString(ata.DimensionID, ata.DecimalPlaces)
End If
The field I am dealing with is of type = xcMeasurementFieldType
The issue is that some characteristics on the field, like "Attributes", "CurrencySymbol","DecimalPlaces","FalseString","ShowFractions" and "TrueString" give an error saying "<error: an exception of type: {System.Runtime.InteropServices.COMException} occurred>". While other characteristics like "Description", "FixedTextWidth", "IsCached", etc. return just fine.
This code worked in the previous version. Any help would be appreciated.
Also, is there a guide to what differences can be expected between the versions. I am having trouble finding any documentation for COM API but have no problem finding docs for Java API.
Thank you for posting what was confirmed by SAP. Did they happen to say if this was going to be fixed in a future release? I am not sure how they could release a version with such a bug. How about posting known issues with versions? Could have saved me a couple wasted days.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The workaround is to retrieve the field definition from ICatalog.Tables.Item.Fields.Item. For example:
Dim ata As XCATCOMLib.Field = oRlset.Fields.Item(ProdFldName_aweight)
XCATCOMLib.Table table = catalog.Tables.Item(rsd.Table);
XCATCOMLib.Field altField = table.Fields.FindByID(ata.ID);
If Not IsDBNull(oRlset.Fields.Item(ProdFldName_aweight).Value) Then
Dim jval As XCATCOMLib.CharacteristicValue =
oRlset.Fields.Item(ProdFldName_aweight).Value
Dim aweight As String = ""
aweight = jval.GetString(altField.DimensionID, altField.DecimalPlaces)
End If
You seem to be the only person on here doing COM API stuff.... So I thought I would share...
I just confirmed with SAP that there is a bug when trying to retrieve measurement fields in a Qualified Lookup table. It will error out if you try field.DecimalPlaces.
foreach (XCATCOMLib.QualifiedLink link in links)
{
foreach (XCATCOMLib.Field field in link.Qualifiers)
{
if (field.Value == System.DBNull.Value)
continue;
if (field.Type == XCATCOMLib.FieldTypeEnum.
xcMeasurementFieldType)
{
XCATCOMLib.CharacteristicValue cv = (XCATCOMLib.
CharacteristicValue) field.Value;
String str = cv.GetString(field.DimensionID,
field.DecimalPlaces, field.ShowFractions,
field.DefaultUnitID);
PrintUtil.Print(str);
}
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I've been using the COM API for 2 yrs now. That SP3 COM API manual is the latest one. You're not going to find a lot of info on the COM API.
I only write code in C#, but, don't you have to cast the field value to a CharacteristicValue?
XCATCOMLib.CharacteristicValue cv = (XCATCOMLib.CharacteristicValue) field.Value;
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Michael,
>>> I am having trouble finding any documentation for COM API but have no problem finding docs for Java API.
this seems to be the only COM reference available:
https://websmp203.sap-ag.de/~sapidb/011000358700007403212005E
but it's from 11/18/2005
Regards,
michal
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.