cancel
Showing results for 
Search instead for 
Did you mean: 

Length of text in the input field

Former Member
0 Kudos

Hi,

i have a input field (passport number), The input field should display only 30 chars & the maximum length of input files should be 30 Chars.

i.e. , even though user enters more than 30 chars it shouldn't take.the size of the text in the input field should be less or equal to 30 chars, but shouldn't exceed 30 chars.

i tried giving the value for the property - length to 30 in the layout. but it is not restricting me to 30 chars.

Thanks

Maha

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Hussain,

Please follow the following procedure:

In your WD Project, Web Dynpro Explorer, Expand the context "Dictionaries" , You would see Data Types Context, On expanding that, there will be a node: "Simple Types".

Right Click on Simple Types and create simple types.

Give your simple types a name and give it a package, say "com.ls.test".

In the simple type definition, select the built in type, in your case, it would be string. In length constraints, choose the maximum length (In your case, it would be 30). You can even choose a fixed length and minimum length here.

Go back to the view, where you need input field. Create a value attribute of name say "attr_input" In the properties of the value attribute "attr_input", choose the type and click on the browse(...) button. In the dictionary you would see the package that we made "com.ls.test". Expand it and choose the simple types.

Bind this context to your input field. Now, the input field will not take values more than that of 30 char.

I hope this will help you.

In case of any problem, please get back, I'll be happy to help you.

Cheers !!!

Umang

[SAPHCM|www.saphcm.org]

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

or else you try by validating that input field at runtime by writing code. In for loop iterator you break letter by letter and keep a counter(i) in for loop and check condition if counter(i)<=30, Use message manager to validate the input field. If you have any doubt regarding Error Messages go through saptechnical.com, where you find a step-bystep procedure blog along with screen shots.

Regards

Raghu

former_member192434
Active Contributor
0 Kudos

Hi Maha,

Just go thru this URL. i hope it will help you

http://help.sap.com/erp2005_ehp_03/helpdata/EN/d7/ef8841e3af1609e10000000a155106/frameset.htm

Thanks

Anup

Former Member
0 Kudos

Hi,

try with simple type,

define a simple type and set the minimum and maximum length for that simple type.

Regards,

ramesh