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

Former Member
0 Likes
1,296

hi all,

plz suggest me.

<b>LOOP AT T_DATA.

IF T_DATA-FLD+1(1) = '3'.

concatenate T_DATA-FLD+359(80) into w_data-zmardesc

separated by space.</b>

when i use the above code i am getting error as use char like field after concatenate.

reagrds,

siri.

Message was edited by:

sireesha yalamanchili

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,268

Hello,

When u r using concatenate then the fields used in statement should be of CHAR variable.

But in ur case I tnink there is no need of concatennate.

make th chnage like this.



LOOP AT T_DATA.
IF T_DATA-FLD+1(1) = '3'.
w_data-zmardesc =  T_DATA-FLD+359(80).

Vasanth

hi all,

plz suggest me.

<b>LOOP AT T_DATA.

IF T_DATA-FLD+1(1) = '3'.

concatenate T_DATA-FLD+359(80) into w_data-zmardesc

separated by space.</b>

when i use the above code i am getting error as use char like field after concatenate.

reagrds,

siri.

Message was edited by:

sireesha yalamanchili

14 REPLIES 14
Read only

Former Member
0 Likes
1,268

You are not using two fields at all to concatenate? If you want just one field, do a move and not a concatenate.

Read only

Simha_
Product and Topic Expert
Product and Topic Expert
0 Likes
1,268

Hi,

When u use concatenate statemate the variable u are using has to be character type.

In ur case it is not so.

So, before concatenating move ur data to other variable of character type and then use it with the concatenate statement.

It solves the problem.

Cheers,

Simha.

Reward all the helpful answers..

Read only

Former Member
0 Likes
1,268

Hello sireesha,

Check the definition of T_DATA-FLD/ w_data-zmardesc. Are both Character fields ??

BY chris

Read only

Former Member
0 Likes
1,268

Hi,

You don't have to concatenate the fields...

Move the six to a structure where you have those 6 fields only..

Example..

DATA: BEGIN OF WA,

MATNR TYPE MATNR,

NUMC(10) TYPE N,

END OF WA.

lOOP AT ITAB.

WA-MATNR = ITAB-MATNR.

WA-NUMC = ITAB-NUMC.

  • NOW THE WORK AREA WA HAS THE CONCATENATE VALUE OF MATNR AND NUMC..

ENDLOOP.

Regards

Read only

kostas_tsioubris
Contributor
0 Likes
1,268

Hi,

concatenate 'join' two or more character type fields in one character field. In your command there is only one field which you should use on e of the below statements.

write T_DATA-FLD+359(80) to w_data-zmardesc.

or

w_data-zmardesc = T_DATA-FLD+359(80)

Unless you wanted to write something like this.

concatenate T_DATA-FLD+359(80) w_data-zmardesc into w_data-zmardesc

separated by space.

Kostas

Read only

Former Member
0 Likes
1,269

Hello,

When u r using concatenate then the fields used in statement should be of CHAR variable.

But in ur case I tnink there is no need of concatennate.

make th chnage like this.



LOOP AT T_DATA.
IF T_DATA-FLD+1(1) = '3'.
w_data-zmardesc =  T_DATA-FLD+359(80).

Vasanth

Read only

0 Likes
1,268

thanks to all.

but T_DATA-FLD+359(80) this particular text is there in multiple records which has to be concatenated into field zmardesc.

if i write W_DATA-ZMARDESC = T_DATA-FLD+359(80).

like this is it ok?

regards,

siri.

Read only

0 Likes
1,268

Hi,

you have to use concatenate

Concatenate W_DATA-ZMARDESC T_DATA-FLD+359(80) into W_DATA-ZMARDESC

separated by space.

Kostas

Read only

0 Likes
1,268

Hello,

Then do like this:


Concatenate W_DATA-ZMARDESC T_DATA-FLD+359(80) into W_DATA-ZMARDESC 
separated by space.

" Check if both W_DATA-ZMARDESC and T_DATA-FLD are character fields.

VAsanth

Read only

0 Likes
1,268

thanks kostas,

why should we write like this.

actually we r moving T_DATA-FLD+359(80) to W_DATA-ZMARDESC .

then why we have to use like this concatenating both W_DATA-ZMARDESC T_DATA-FLD+359(80) into W_DATA-ZMARDESC .

Concatenate W_DATA-ZMARDESC T_DATA-FLD+359(80) into W_DATA-ZMARDESC

separated by space.

regards,

siri.

Read only

0 Likes
1,268

Hi siri,

concatenate actually merges 2 or more character fields into one character field.

e.g

concatenate <source_text1> <source_text2> ... into <target_text3>.

or

concatenate <target_text1> <source_text2> .... into <target_text1>.

so as you see you must declare which texts you are "merging" into your target, that's why you have to use W_DATA-ZMARDESC twice in your statement (in your case W_DATA-ZMARDESC is both your target and source text).

Hope this made it more clear to you.

Kostas

Read only

0 Likes
1,268

thanks Kostas,

its working.

if any problem will let you know.

regards,

siri.

Read only

Former Member
0 Likes
1,268

Hi,

U r not concatenating two fields. If ur purpose is to simply assign the value, use move statement.

ie. move T_DATA-FLD+359(80) to w_data-zmardesc

Or

if u have multiple values for t_data-fld , use concatenate like

concatenate w_data-zmardesc T_DATA-FLD+359(80) into w_data-zmardesc separated by space.

Read only

Former Member
0 Likes
1,268
data  :   begin of T_DATA   occurs  0  ,
FLD(370) type  c,
end of  T_DATA .
data  :   begin of T_DATA1   occurs  0  ,
FLD  like  SY-DATUM ,
end of  T_DATA1 .
PARAMETERS: FROMDATE LIKE VTBBEWE-DBERVON.

T_DATA-FLD   =  FROMDATE .
append T_DATA .

LOOP AT T_DATA.
IF T_DATA-FLD+1(1) = '3'.
concatenate  T_DATA-FLD   T_DATA-FLD+359(10) into  T_DATA-FLD
separated by space.

endif.
endloop.

reward points if it is usefull ...

Girish