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

problems with strings

Former Member
0 Likes
405

Hello there guys, I need to get strings of the same lentgh, for example if I declare name(30) type C, surname(40) type C and I do the following : concatenate name surname into fullname .where name = 'Julia' and Surname = 'Smith' I want Julia plus 25 caracters in blank remaining Smith Plus 35 Caract. remaining. 70 caracters as a result , is that possible?

1 ACCEPTED SOLUTION
Read only

naimesh_patel
Active Contributor
0 Likes
384

Instead of concatenate, use structure to move your data.

Like:


TYPES: BEGIN OF TY_ADD,
       FIRST TYPE CHAR30,
       LAST  TYPE CHAR40,
       END   OF TY_ADD.

DATA: L_ADD TYPE TY_ADD,
      L_RESULT TYPE CHAR70.

L_ADD-FIRST = 'Naimesh'.
L_ADD-LAST = 'Patel'.

MOVE L_ADD TO L_RESULT.

WRITE: L_RESULT.

Regards,

Naimesh Patel

2 REPLIES 2
Read only

naimesh_patel
Active Contributor
0 Likes
385

Instead of concatenate, use structure to move your data.

Like:


TYPES: BEGIN OF TY_ADD,
       FIRST TYPE CHAR30,
       LAST  TYPE CHAR40,
       END   OF TY_ADD.

DATA: L_ADD TYPE TY_ADD,
      L_RESULT TYPE CHAR70.

L_ADD-FIRST = 'Naimesh'.
L_ADD-LAST = 'Patel'.

MOVE L_ADD TO L_RESULT.

WRITE: L_RESULT.

Regards,

Naimesh Patel

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
384

You can do it like this as well.

data:   L_RESULT TYPE CHAR70.
 
L_RESULT(30) = 'Naimesh'.
L_RESULT+30(40) = 'Patel'.
  
WRITE: L_RESULT.

Regards,

Rich Heilman