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

Concatenate statement

Former Member
0 Likes
1,183

Hi Experts

I am concatenating a line of more than 400 alphabets in a variable of length 1000 type char. But this variable does not store more than 255 characters.

The code is:

data: lv_url(1000) type c.

loop at i_tab into wa_tab.

concatenate lv_url i_tab-name '=' i_tab-values into lv_url.

endloop.

The table i_tab contains about 15 entries. After the 10th in i_tab entry when lv_url contains 255 characters the further entries are not concatenated.

Please let me know an alternative solution for the same.

Thanks in Advance.

12 REPLIES 12
Read only

Former Member
0 Likes
1,144

hi

use this

data: lv_url type string.

regards

Read only

Former Member
0 Likes
1,144

Try using STRING instear of defining lv_url as character of length 1000.

DATA: lv_url type string.

Read only

Former Member
0 Likes
1,144

Hi,

The CONCATENATE should work with variable of length 1000 type char.

Probably what you are concatenating contains several blank spaces and that the reason why you are not able to see it.

Check with offset if it contains the data in the end or try by using a variable of type string.

Regards,

Ankur Parab

Read only

Former Member
0 Likes
1,144

hi,

> I am concatenating a line of more than 400 alphabets in a variable of length 1000 type char. But this variable does not store more than 255 characters.

>

> The code is:

> data: lv_url(1000) type c.

>

> loop at i_tab into wa_tab.

> concatenate lv_url i_tab-name '=' i_tab-values into lv_url.

> endloop.

>

> The table i_tab contains about 15 entries. After the 10th in i_tab entry when lv_url contains 255 characters the further entries are not concatenated.

>

In SAP you can concatenate only upto 255 Character..

Hope this helps

Regards

Ritesh j

Read only

0 Likes
1,144

Thanks Ritesh

I used 2 string variables in place of one and then always used them together. Thanks.

Read only

Former Member
0 Likes
1,144

Hi,

There should not be any problem with the Concatenate statement. Check for:

1. loop at i_tab into wa_tab.

concatenate lv_url i_tab-name '=' i_tab-values into lv_url.

endloop.

Since you are filling wa_tab why do you use i_tab-values ?

2. How are you checking whether the values are getting concatenated in lv_url or not. If in debugging then check as lv_url+250(100) and see if you are able to view the values.

Revert.

Read only

Former Member
0 Likes
1,144

Hi,

Define ur variable as type of string as said by other experts.

ur problem vil be resolved.

Regards,

Anil.

Read only

Former Member
0 Likes
1,144

Hi,

In SAP a char type variable can only store upto 255 characters...so better to use the STRING as the data type.

Pooja

Read only

Former Member
0 Likes
1,144

hello,

try using the datatype string instead of char and CONDENSE the varibles before concatenating, this will remove the extra spaces ion between .

Regards

geeta gupta

Read only

0 Likes
1,144

Hello,

Just wanted to kno....if CONDENSE removed leading spaces also or only in between spaces.

Regards,

Anil.

Read only

0 Likes
1,144

I think it removes in between spaces......leading spaces are removed using SHIFT <var name> LEFT/RIGHT DELETING LEADING/TRAILING.

hope this help you.

Pooja

Read only

Former Member
0 Likes
1,144

This piece of code works just fine..

so no need to change your data type...

DATA lv_final(1000).

DATA lv_var(3).

Do 250 times.

lv_var = sy-index.

CONCATENATE lv_final lv_var INTO lv_final.

ENDDO.

WRITE:/ lv_final+0(10),

/ lv_final+250(10),

/ lv_final+500(10).

Revert if u need more.