Concatenate Problem

Question: Hi Abapers,

Iam new into ABAPing.I have a small troble which iam sure u people can answer.

For Ex:

ITAB-MATNR = QHTYBB11
ITAB-WERKS = 1030
ITAB-CHARG = NB0571102

CONCATENATE ITAB-MATNR ITAB-WERKS ITAB-CHARG INTO BAT_TEXT.

Now iam getting in BAT_TEXT as QHTYBB111030NB0571102

But for fetching data from FM "Read_text", I need the Name ie BAT_TEXT to be like "QHTYBB11 1030NB0571102".

While Concatenating how should i retain the original field length,though it doesnt have so many characters.

Please help...thanks in advance.

Answer:
i Guess its not clear what i am expecting in my previous post

"QHTYBB11 1030NB0571102".

Answer:
Do it in two steps.

Concatenate the final pair, then concatenate your first string and the existing information in your concatenated field separated by space.

Then you'll get the output you want.

e.g.:

How about using move instead of concatenate?

Hi R,

you are right, your coding is very elegant. But you should mention that your example only works if all data elements have a character type. As soon as integers come into play, they are converted to '####' when the whole structure is moved to a field.

And then the "magic numbers" could be handy

Ummm.... Actually they are not converted to '####', (see topic 0005 - Ascii Codes in the Abappers Forum.

When you move a structure to an unstructured string, Abap displays the string as a 'string'. It doesn't know the string is composed of a variety of different data types. The '#'s are displayed because they generally contain non-displayable characters below $20.

If you are moving stuff around like that, it doesn't matter how they are represented, until you come to use them again and then by moving them back to a string of the same structure that you used to compose the 'string' in the first place your numbers come back.

What you are seeing is a natural result of moving binary data into a field that is not meant to hold binary data so in truth, to get the values back you should use a string of the same structure. And no, magic numbers would not become useful.
_________________
Regards

R


Abap KC
SFMDR

Answer:


... it doesn't matter how they are represented, until you come to use them again and then by moving them back to a string of the same structure ...



Well, newbie156 does not want to move the data back to a string of the same structure, he wants to combine a key for the READ_TEXT function module. If he combines this key the way you described, an integer would be converted to something like '####'.

I just mentioned it to point out potential side effects.
Copyright ?2007 - 2008 www.jt77.com