cancel
Showing results for 
Search instead for 
Did you mean: 

changing the property of one column in webdynprotable

Former Member
0 Kudos

Hi All,

I am accessing an RFC from webdynpro which returns me a table with 5 columns and n rows and i can chnage some column values and send to SAP to save also, i can display this table in webdynpro view using the node as datasource. My question if i want to restrict one of the columns "name" in table to 3 characters length , whats the best way.At the moment i can fill this column with out length restriction and hit save it saves in back end. but i want this column to be restricted to length of 3.As the data source is table node from back end it will not allow to change the property of a particular column.whats the best solution to solve this.

Thanks,

pkv.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

You can create a simple type "name" of string with maximum legth defined as 3, go to the type of the context attribute of the node which you have binded to the column in the table and assign this simple type..

By assigning the simple type, the user from frontend will not be allowed to enter more than 3 input characters..

If you dont want to this approach..

You can check this manually by checking the length of the string entered in the name column, if the user enters more than 3 characters, put a validation message when he submits it to the backend..

Hope this helps you..

Regards,

Saleem

Former Member
0 Kudos

Hi,

You can create a simple type modifiable object and then use the setMaxLength metho to set the maximum character. The following piece of code will do:

ISimpleTypeModifiable modObj = wdContext.<name of the node>.getNodeInfo().getAttribute(<attribute name to which the column is binded>).getModifiableSimpleType();

modObj.setMaxLength(3);

I feel this will be the better option rather than calling a validation to check for a maximum of three characters.

Regards,

Ponraj M

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi ,

When importing model structures and datatypes of the bapi are created in the dictionary. At the time of creating node for your table try to use the structure created by the model.

Thus whatever the validations put in backend datatypes will be applicable to front end also.

Best Wishes

Idhaya R

gill367
Active Contributor
0 Kudos

Hello pkv,

To restrict the length of the string that can be entered in the column. You need to change the property of the datatype of the attribute to which the column is bound.

For this you need to get the simple type of the attribute

--> You need to use Isimple type modifiable to modify the maximum external length of the attribute ' s data type

In this way you are modifying the properties of the simple type of the attribute bound to the column.

For this write the following code in the wddoinit method of your component controller

ISimpleTypeModifiable Column_ST =
	 wdContext
	.nodeOutput_list()  //Output_list is the name of the model node which is working as data source 
	.getNodeInfo()
	.getAttribute("COL2")  //COL2 is the attribute of the model node which is bound to the desired column
	.getModifiableSimpleType();

Column_ST.setMaxExternalLength(3);

Thanks,

Hope it is clear.

Sarbjeet Singh