‎2008 Mar 04 8:13 AM
Hello,
I have three fields (for example matnr,werks , lgort) to be concatenated.
While concatenating i have to take care of any spaces in werks.
If there were any spaces after concatenatig i am not able to find the spaces.
for exameple : matnr = 1234
werks = ab
lgort = lg
then by concatenating i should get '1234ab lg' but i am getting '1234ablg'.
Can any body suggest me some solution
Thanks and Regards,
Soumya.
‎2008 Mar 04 8:37 AM
Hi,
Concatenate the fields until WERKS using RESPECTING BLANKS in one variable and the remaining fields in another variable.. and then concatenate the two fields.
Reward if helpful.
Regards.
‎2008 Mar 04 8:16 AM
Hi,
Check the below code...
CONCATENATE <fld1> <fld2> ..... INTO <target field>
SEPARATED BY SPACE.
Cheers,
Bujji
‎2008 Mar 04 8:26 AM
I want the field length for werks as it is.
If werks value is 2 fields length then the remaining two spaces should be there.
I dont want the fields seperated by space
‎2008 Mar 04 8:22 AM
first concatenate matnr werks into some variable with out space.
then concatenate variable and lgort into target field with space.
regards.
santhosh reddy
‎2008 Mar 04 8:27 AM
Hi,
Use the Respecting blanks addition with concatenate statement............
data : l_matnr type matnr_d VALUE '000000000000123456',
l_werks TYPE werks_d VALUE ' 20 ',
l_lgort type lgort_d VALUE 'fg',
l_word TYPE string.
CONCATENATE l_matnr l_werks l_lgort into l_word RESPECTING BLANKS .
write l_word.
Cheers,
jose
‎2008 Mar 04 8:28 AM
Hi,
Try this
DATA: l_value(50) TYPE c.
CONCATENATE itab-matnr itab-werks itab-lgort INTO l_value SEPERATED BY SPACE.This will solve ur problem.
‎2008 Mar 04 8:32 AM
Respecting blanks will give spaces to all three fields, but i want only for werks.
‎2008 Mar 04 8:31 AM
hi use the fm STRING_CONCATENATE for this,
reward points if useful,
venkat.
‎2008 Mar 04 8:37 AM
Hi,
Concatenate the fields until WERKS using RESPECTING BLANKS in one variable and the remaining fields in another variable.. and then concatenate the two fields.
Reward if helpful.
Regards.
‎2008 Mar 04 8:38 AM
Hi
concatenate matnr werks into result .
concatenate result lgort into finalresult separated by space.
write:/ finalresult.
‎2008 Mar 04 8:40 AM
HI,
TYPES: BEGIN OF ITAB,
MATNR LIKE MARA-MATNR,
MEINS LIKE MARA-MEINS,
MTART LIKE MARA-MTART,
END OF ITAB.
DATA: C1(40),
C2(40),
IT TYPE ITAB.
SELECT MATNR MEINS MTART FROM MARA INTO IT UP TO 1 ROWS.
WRITE: IT-MATNR, IT-MEINS, IT-MTART.
CONCATENATE IT-MATNR IT-MEINS INTO C1 RESPECTING BLANKS.
CONCATENATE C1 IT-MTART INTO C2.
WRITE:/ C1.
WRITE:/ C2.
ENDSELECT.
REWARD POINTS IF USEFUL.
THANKS.
ARUNPRASAD.P
Edited by: arunprasad palaniswamy on Mar 4, 2008 9:44 AM
‎2008 Mar 04 8:45 AM
Hi,
CONCATENATE
Concatenates (chains) several strings to a string.
Syntax
CONCATENATE <c1>... <cn> INTO <c> [ SEPARATED BY <s> ]
[IN BYTE MODE|IN CHARACTER MODE].
This statement concatenates the strings <c1> to <cn> and assigns the result to <c>. The addition SEPARATED BY <s> allows you to specify a character field <s> which is placed in its defined length between the individual fields. In Unicode programs, you must specify whether the statement is a character or byte operation, using the IN BYTE MODE or IN CHARACTER MODE (default) additions
Regards,
Priya.