Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

fix string length?

Former Member
0 Likes
812

Hi all,

How to fix length of character field.

eg. if a(10) type 10,

if a = hello b= hi

after concatenating these fields. i want to 'a' field length should be 10 & after that from 11 length Hi should be there.

Thanks in advance.

1 ACCEPTED SOLUTION
Read only

former_member156446
Active Contributor
0 Likes
669

Try this way:

data: string type string.

string+0(10) = a.

string+11(2) = b.

3 REPLIES 3
Read only

former_member156446
Active Contributor
0 Likes
670

Try this way:

data: string type string.

string+0(10) = a.

string+11(2) = b.

Read only

0 Likes
669

there are N (above 300) no of fields in table..........

for that i m wondering is there any command to fix the length of string as defined in table...

Read only

0 Likes
669
DATA: char TYPE char20.
DATA: a TYPE char10 VALUE 'Hello', b TYPE char2 VALUE 'Hi'.
DATA: lv_len TYPE i.

DESCRIBE FIELD a LENGTH lv_len IN CHARACTER MODE.
WRITE: lv_len.
DESCRIBE FIELD a LENGTH lv_len IN BYTE MODE.
WRITE: lv_len.

You must specify the addition MODE in Unicode programs.

The variant with the addition IN BYTE MODE determines

the length of the data object dobj in bytes. The variant

with the addition IN CHARACTER MODE determines the

length of the data object dobj in characters. When

using IN CHARACTER MODE, the data type of dobj must

be flat and character-type. You can only specify

IN BYTE MODE for deep data types and in this case,

the length of the reference (8 bytes) is determined.

Check the help on Write statement..

WRITE [AT] [/][pos][(len|*|**)] dobj 
      [int_format_options] 
      [ext_format_options] 
      [list_elements] 
      [QUICKINFO info].