Problems with enabling of columns in a grid

arewer

Hi all,


 


I want to initialize the columns with a script when a form loads. I have Problems with UDFs.


 


An error occurs:


Error in optimizer rule ....


Item - The item is not a user-defined item [66000-8]


 


Code:


Matrix m = Matrix.GetFromUID(pVal.Form, "39");


m.Columns["U_Long"].Visible = true;


m.Columns["U_Long"].Editable = true;


 


 


 


If the column is already visible (set by form Settings) the code works. What is wrong there or is it a bug?


 


Regards


Andre


 


 


ChristianB

Hi,


 


this is the Standard behaviour of the B1 UI API. If you want to manipulate Standard Fields resp. Columns then you have to leave it visible and editable in the form Settings.


But you are able to disable them by form load. That way, you are able to manipulate them later on by your code when you want to set a value to.


If you want to set a value to those fields please do the following steps:


1. enable the field


2. set your value


3. bring the Focus to an other field (otherwise step 4. results in an error)


4. disable the field


 


hope that will help.


 


Regards


 


Christian


arewer

Hi Christian,


 


thanks for your help. I have read in the SDK help files, that there are restrictions for columns collections on system forms.


 


The problem is however, that SAP loses sometimes the form settings for a user. Then it happened that a column for my UDF is not visible and when I try to import data into the grid an error message appears. So I need to initialize the columns in the grid before importing data into it. Does anybody knows a workaround for this?


 


Regards


Andre

0

Comments

0 comments

Please sign in to leave a comment.

Didn't find what you were looking for?

New post