cancel
Showing results for 
Search instead for 
Did you mean: 

Limiting Field Input length

Former Member
0 Kudos
572

Dear Experts

I have a problem on basic set up of the system.

My question is: If the maximum length of a field is 20 charcters, can I limit users to enter a maximum of 10 characters in stead of 20? If so, how to do it ? I would like the solution that could be applied to all fields that require user input

Thanks for any response

Regards

Elton

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Dear All

Almost all of my requirements have been fulfilled.

But just got one last last question on this thread.

I am wondering whether the requirements above can be fulfilled by assigning FMS on the field.

Please advice.

Really appreciate for all of your help.

Regards

Elton

former_member206437
Active Contributor
0 Kudos

Hi

Sorry by FMS u can't make Restriction. u have to achive by SP transaction only.

Giri

Former Member
0 Kudos

Thanks

All problem resolved and this thread is closed

Regards

Answers (3)

Answers (3)

former_member204969
Active Contributor
0 Kudos

You can use this for partner name:

IF @object_type = '2' and @transaction_type in ('A','U') 
If (select len(OCRD.CardName) 
    from OCRD where OCRD.CardCode=@list_of_cols_val_tab_del)>10
Select @error =1,
    @error_message = 'Partner name length invalid !'

(The code Giri sent looks correct, but if you want apply for more case it may be useful a simpler code.)

former_member206437
Active Contributor
0 Kudos

Hi

If it is one ore two fields then u can try with SP TRansaction,but if u wana to do apply in all fields then it will effect ur system performance.U can Try with SDK but u want to cosnider the system Perf.

May i know why u wana to restrict the user.

Giri

Former Member
0 Kudos

Hi Giri

I understand what you mean.

I would like the set of SP code that enables me to apply the restriction on one field e.g. BP Name and after alteration of the code, I could apply this for another field e.g. Item Name

Please advise any code could do so

Thanks

Regards

Elton

former_member206437
Active Contributor
0 Kudos

Hi

Use this code : I have written for the Item Name same way u can use for Card Name by changing the code little bit:

Declare @ItemName nvarchar(100)
if @object_type = '4' And (@transaction_type ='A' Or @transaction_type = 'U')
 Begin
	 Select @ItemName = ItemName from OITM Where ItemCode = @list_of_cols_val_tab_del
	 if LEN(@ItemName) > 10
		 Begin
		 Set @error = -1
		 Set @error_message = 'Item Name can not be more than 10 characters'
		 End	 
 End

Giri

Former Member
0 Kudos

Dear Giri

I followed your code and it does work for limiting input length for the Item Name Field.

But can the SP also be able to limit the format of input?

e.g for Item Code, is it possible to limit user to input the Item Code as first 3 characters is Alpha, and a -, then 4 numbers, then a -, and 4 numbers (XXX-1111-1111)

Thanks for your response

Regards

Elton

former_member204969
Active Contributor
0 Kudos

Try this code:

IF @object_type = '4' and @transaction_type in ('A','U') 
If @list_of_cols_val_tab_del
   not like '[a-z][a-z][a-z]-[0-9][0-9][0-9][0-9]-[0-9][0-9][0-9][0-9]'
Select @error =1,
    @error_message = 'Item code invalid !'

Former Member
0 Kudos

hi elton,

FIELDS available in sap B1 cant be limited.only in USER DEFINED FIELDS we can limit the charecters string length.

regards

Ravindran