cancel
Showing results for 
Search instead for 
Did you mean: 

Error - Type not compatible

Former Member
0 Kudos

Hi ,

I have a problem .I am working in 6.0.

I have a structture with a couple of fields.How can I move all the field values , along with the spaces , into a string.

Ex:

data : string type char240.

wa-matnr = 'M12345'.

wa-werks = 'US20'.

if I say move it into a string..

string = wa.----->this is throwing an error 'not type compatible'

how can I move these values into the same variables , without changing their types.

the result should be like this ...

string = 'M12345 US20'.

Anyone please help me with the syntax.

Thanks in advance

Edited by: ramana peddu on Jan 28, 2009 1:53 AM

Edited by: ramana peddu on Jan 28, 2009 2:43 AM

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Use this FM HR_99S_COPY_STRUC1_STRUC2 which is used to copy the structure of different types.

Pass the WA to exporting parameters and receive the values in string as Import parameters.

This will solve the problem.

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

Check the FM HR_99S_COPY_STRUC1_STRUC2

Former Member
0 Kudos

use like this

Concatenate wa-matnr wa-werks into string seperated by ' '.

кu03B1ятu03B9к

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos
concatenate wa-matnr wa-werks into lv_string separated by space.

Regards,

Rich Heilman

Former Member
0 Kudos

Sorry Rich , I don't want a single space in between both the values infact I want the original length of every field occupied.

I mean like below

M12345 and US20 combined together with 13 spaces in between.

That's because length of Matnr is 18 .Please let me know , if I am able to explain the issue.

Former Member
0 Kudos

Hi, if u have not condensed matnr, i think it shud have spaces but leading spaces, so if u want trailing spaces, may be u can try like this.


condense wa-matnr.

i = strlen(wa-matnr).
i = 18 - i.

do i times.
concatenate wa-matnr '$' to wa-matnr.
enddo.
REPLACE ALL OCCURRENCES OF '$' IN wa-matnr WITH ` `.

"now u can concatenate like
concatenate wa-matnr wa-werks.

кu03B1ятu03B9к

Edited by: kartik tarla on Jan 28, 2009 9:20 AM