cancel
Showing results for 
Search instead for 
Did you mean: 

usertable error after adding a udf

Former Member
0 Kudos

I have a UI add-on that assigns values ​​to a UDT by usertable object of the DI API, the problem is generated after adding a UDF from SAP menu and try to assign a value from the DI. The error is Invalida Field Name

My question is, is necessary to wait a while until SAP records the new field to be accessible by usertable?

Any suggestions?


oUserTable.UserFields.Fields.Item("U_" + colName).Value = respuesta;

Accepted Solutions (0)

Answers (2)

Answers (2)

edy_simon
Active Contributor
0 Kudos

Hi Ricardo,

Not sure also why it sometimes does not refresh metadata After you have add a UDF In UDT and UDO.

when the first time you create the udt together with the udfs, this never happen.

but when you update the udt to add new column, it will sometime give you this error.

when this happen, the only solution is to restart the sbo.

I Dont think the problem is with our code.

regards,

edy

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Ricardo,

As far as I know, you can use this field as soon as it is added to the usertable. But please make sure that this has been added successfully in your table and also make sure that ("U_" + colName ) is the same as it appears in SQL Server. Make sure that you are providing the right field name.

Hope it helps.

Thanks & Regards

Ankit Chauhan

Former Member
0 Kudos

OK, thanks i continue to debuggin because is a extrange behavior, if I close de form and re-open and try again all is OK.

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

If I add a field using Meta data objects, then I get a message that the Database structure has been modified something like this. So this could be the issue.

Anyways.. What you are trying to do ? Has your problem been resolved. ? If yes, please close the thread.

Thanks & Regards

Ankit Chauhan

Former Member
0 Kudos

What my add-on is doins is in a UDO Automanaged Form open by a button another form and capture some data, this form is not Automanaged by SAP, so when the data is capture  I filter OK button event and iterate in the items of the form one by one saving in the UDT with the UserTable object of the DI, this process works fine.

But...

If I add a new column to the UDT and then reopen my UDO, click button, open the form, capture the data, save then fail. Every time I save the data the code take care of referecing usertable to the UDT id again.

I need to restart SAP when this happen, then I repeat the process and "voila" nothing happen and every thing works fine. So my only clue is what say Edy.

I'm goin to continue with debuggin next mark the correct answer. Thanks

edy_simon
Active Contributor
0 Kudos

Hi Ricardo,

Just a thought.

In Application object, there is a property named MetadataAutoRefresh.

Can you try something like

SBO_Application.MetadataAutoRefresh = false;

//Insert code to add your new UDF here.

SBO_Application.MetadataAutoRefresh = true;

Does it help ?

Regards

Edy

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Ricardo,

Edy is right. You can use the lines that are given by him. I have tested it and I am able to use it instantly.

Thanks & Regards

Ankit Chauhan