cancel
Showing results for 
Search instead for 
Did you mean: 

Query the table CUFD

Former Member
0 Kudos

Hi All,

I'm facing a difficulty while trying to get record from table CUFD with column 'TableID' in the where clause. I think the '@' sign cause the issue where I can filter this table with other column fields.


SELECT "TableID", "AliasID" FROM "CUFD" WHERE "TableID" ='@MyTable'

Is there anyway to avoid the 'at' sign or the problem occurs due to other cause? Your help will be highly appreciate.


Thank in advance and Best Regards,
J S L Geeganage

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Sorry to bother you all. Today morning when I try to do the same, it worked. No additional step has except running the bellow query. I don't believe this fixed the problem.


SELECT "TableID" FROM "CUFD" WHERE "TableID" = (SELECT "TableID" FROM "CUFD" WHERE "CUFD"."AliasID" = 'Variant')

May be there was a kind of a latency to update the changes that I have made Or may be I mixed up with upper and lower cases. Not sure though, but now it is working fine.


Best Regards,
J S L Geeganage

Answers (2)

Answers (2)

former_member830523
Discoverer
0 Kudos

This sample code is the solution:

Dim exists As Boolean = False

Dim oUserTable As SAPbobsCOM.UserTable

oUserTable = oCompany.UserTables.Item(TableName)

Dim FieldsCount As Integer = oUserTable.UserFields.Fields.Count

System.Runtime.InteropServices.Marshal.ReleaseComObject(oUserTable)

oUserTable = Nothing

GC.Collect()

Dim oUsrFldsMD As SAPbobsCOM.UserFieldsMD

oUsrFldsMD = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserFields)

For i = 0 To FieldsCount - 1

Try

If oUsrFldsMD.GetByKey("@" & TableName, i) Then

If oUsrFldsMD.Name = FieldName Then

exists = True

Exit For

End If

End If

Catch ex As Exception

Exit For

End Try

Next

System.Runtime.InteropServices.Marshal.ReleaseComObject(oUsrFldsMD)

oUsrFldsMD = Nothing

GC.Collect()

pfefferf
Active Contributor
0 Kudos

Hello Jeewan,

what error message do you get?

Best Regards,

Florian

Former Member
0 Kudos

Hi Florian,

No errors, Records have stored in the table with the same name that appear in the where clause. But no result found.

Thanks,

J S L Geeganage

pfefferf
Active Contributor
0 Kudos

Hello,

tested it on revision 85 and 97. On both revisions it works for me. What data type you are using for your column "TableID" (is used nvarchar).

Best Regards,

Florian

Former Member
0 Kudos

Hi Folorian,

Thank you very much. At this moment I couldn't have a way to see the column definitions of HANA database. But in SQL it is varchar(20) too.

If you have SAP B1 Database with you could you please query the table 'CUFD'? I did using 'Query Genarator' (Tools > Queries > Query Genarator)


Best Regards,
J S L Geeganage