cancel
Showing results for 
Search instead for 
Did you mean: 

Delete user table - Filed

former_member458725
Active Participant
0 Kudos

Can anyone tell me how to delete the TABLE and FIELD i created .... using code.

PLEASE TELL ME TO WRITE THE CODE

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello

Use the Remove method .

Dim oUserTablesMD As SAPbobsCOM.UserTablesMD
        oUserTablesMD = oCompany.GetBusinessObject(BoObjectTypes.oUserTables)

        If oUserTablesMD.GetByKey("TABLE") Then
            oUserTablesMD.Remove()
        End If

Regards

János

Former Member
0 Kudos

For UDF-s

Dim oUserFieldsMD As SAPbobsCOM.UserFieldsMD
        oUserFieldsMD = oCompany.GetBusinessObject(BoObjectTypes.oUserFields)
        If oUserFieldsMD.GetByKey("TABLE", "FIELD") Then
            oUserFieldsMD.Remove()
        End If

Regards

János

former_member458725
Active Participant
0 Kudos

thanks for the reply..it was help full...but i cant able to delete the field...

oUserFieldsMD.GetByKey("TABLE", "FIELD")

the if condition is not successfull...becoz

oUserFieldsMD.GetByKey(String TableName, Int FieldId)

I am not getting the field id.

i have a table VBN

with one field - ItDesc

1. code

2. Name

3. ItDesc

I want to delete this Itdesc..

PlzHelp

Former Member
0 Kudos

Hello

TableName : Specifies the name of the user defined table.

(use the symbol @ as a prefix to the name, see the TableName property of the UserTablesMD object).

FieldID

Specifies the field identification key.

You can delete fields starts with U_ sign in the table. (Code, Name are standard fields, you cannot delete them).

in your example:

So for table name use @VBN

you can delete the field: ItDesc, and to indetify the field id run the following query:

select * from cufd where tableid = '@VBN' and AliasID = 'ItDesc'

Regards,

János

Edited by: János Nagy on Sep 2, 2010 3:31 PM

former_member458725
Active Participant
0 Kudos

no use.

My concept is this..

i have an excel file...with the table name and field name.

i wrote the code to read the data from the excel file and also find the FIELD ID from the table.

now i have both th table name and id in a string and int.

Now i used your methos to delete the field but it doesnt work...

Edited by: vibinvarghese on Sep 11, 2010 8:06 AM