‎2011 Aug 09 11:38 AM
Hello,
There is a way to build string with restriction of length ,I know that basically string don't have
any restriction but i need to create data somehow type string with restriction of length like 10 , 20 ,100 etc
when i try to do create data lv_data type ('string') length 8.
i get dump since you cannot limit the string length but there is some workaround ?
Thanks,
Joy
‎2011 Aug 09 11:49 AM
You can try this
DATA weird_string TYPE REF TO DATA.
FIELD-SYMBOLS <fs_string> TYPE STRING.
CREATE DATA weird_string TYPE c LENGTH 8.
ASSIGN weird_string->* TO <fs_string>.
*Now <fs_string> is a limited (8 char) string ... weird !!
Regards
Suresh
‎2011 Aug 09 11:44 AM
‎2011 Aug 09 11:48 AM
‎2011 Aug 09 11:49 AM
You can try this
DATA weird_string TYPE REF TO DATA.
FIELD-SYMBOLS <fs_string> TYPE STRING.
CREATE DATA weird_string TYPE c LENGTH 8.
ASSIGN weird_string->* TO <fs_string>.
*Now <fs_string> is a limited (8 char) string ... weird !!
Regards
Suresh
‎2011 Aug 09 11:56 AM
Create an object class to emulate a limited length string, in SE24.
‎2011 Aug 09 12:30 PM
Hello,
Why don't you try in this manner
PARAMETERS : p_name TYPE string.
DATA : len TYPE i.
len = strlen( p_name ).
IF len gt 8.
MESSAGE 'String length exceeds 8 characters' TYPE 'E'.
ELSE.
...
(Your business logic...)
....
ENDIF.Here in the above example, we are restricting the string length to 8 characters.