Application Development 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: 

Concatenation of two strings

Former Member
0 Kudos

Hi,

I am facing one proble while concatenating two strings.

I declared var1 type char100,

var2 type char140,

var3 type char255.

I want to concatenate var1 var2 into var3.

But var3 is taking only 128 characters only.

so i am not getting full data into var3.

How i can acheive this.

Even in parameters i declard one parameter as

P_var1(255) type c,

In the selection screen, it is taking only 128 characters for the field.How i can declare more than 128 characters.

Thanks in Advance,

Best regards,

Pavan.

1 ACCEPTED SOLUTION

andreas_mann3
Active Contributor
0 Kudos

Hi ,

it works correct:

REPORT zforum09 LINE-SIZE 255.

DATA:

var1 TYPE char100,

var2 TYPE char140,

var3 TYPE char255.

*

var1 = text-001. "100

var2 = text-002. "132

CONCATENATE var1 var2 INTO var3.

WRITE:/ '001', 50 '050', 100 100, 150 150, 200 200, 250 250.

ULINE.

WRITE: / var1 COLOR 1.

WRITE: / var2 COLOR 2.

ULINE.

WRITE: / var3 COLOR 3.

BREAK-POINT.

regards Andreas

3 REPLIES 3

Former Member
0 Kudos

Hello Pavan,

How can you be sure that the variable var3 is taking only 128 characters? Look at this code:

REPORT  ZTEST no standard page heading line-size 260.

data : w_string_length type i,
       w_string(260) type c.


do 10 times.
  concatenate sy-abcde
              w_string
        into w_string.
enddo.

w_string_length = strlen( w_string ).

write 😕  w_string_length.

write : / w_string.

Morale of the story : look at the line-size addition of your report statement.

Regards,

Anand Mandalika.

andreas_mann3
Active Contributor
0 Kudos

Hi ,

it works correct:

REPORT zforum09 LINE-SIZE 255.

DATA:

var1 TYPE char100,

var2 TYPE char140,

var3 TYPE char255.

*

var1 = text-001. "100

var2 = text-002. "132

CONCATENATE var1 var2 INTO var3.

WRITE:/ '001', 50 '050', 100 100, 150 150, 200 200, 250 250.

ULINE.

WRITE: / var1 COLOR 1.

WRITE: / var2 COLOR 2.

ULINE.

WRITE: / var3 COLOR 3.

BREAK-POINT.

regards Andreas

Former Member
0 Kudos

Hi Pavan,

Regarding your question on parameters, it is not possible to have a <i><b>field</b></i> of length greater than 132 characters on any (selection)screen in SAP. In fact the F1 help for the parameters keyword clearly states this point. Please refer to that.

If you need to have something of length more than 132, then you can think of a text-edit control.

Hope that helps.

Regards,

Anand Mandalika.