2005 Oct 19 9:30 AM
Hi all
I have to do a CONCATENATE with some string.
The problem is that if one of this is space, this one doesn't appear in concatenated string, but I want it.
Any solution?
thanks
enzo
2005 Oct 19 9:38 AM
Hello Enzo,
there is no real good solution, but, if possible, translate the space to e.g. '_', CONCATENATE, and translate it back.
BTW.: Kernel 7.0 will have a "PRESERVING SPACE" extension for CONCATENATE.
If you find my answer useful, please don't forget the reward.
Regards,
Juergen
Hello Enzo,
there is no real good solution, but, if possible, translate the space to e.g. '_', CONCATENATE, and translate it back.
BTW.: Kernel 7.0 will have a "PRESERVING SPACE" extension for CONCATENATE.
If you find my answer useful, please don't forget the reward.
Regards,
Juergen
2005 Oct 19 9:36 AM
2005 Oct 19 9:38 AM
Hello Enzo,
there is no real good solution, but, if possible, translate the space to e.g. '_', CONCATENATE, and translate it back.
BTW.: Kernel 7.0 will have a "PRESERVING SPACE" extension for CONCATENATE.
If you find my answer useful, please don't forget the reward.
Regards,
Juergen
2005 Oct 19 10:03 AM
Hi,
The CONCATENATE statement combines two or more separate strings into one.
CONCATENATE <c1> ... <cn> INTO <c> [SEPARATED BY <s>].
This statement concatenates the character fields <c1> to <cn> and assigns the result to <c>. The system ignores spaces at the end of the individual source strings.
The addition SEPARATED BY <s> allows you to specify a character field <s> which is placed in its defined length between the individual fields.
If the result fits into <c>, SY-SUBRC is set to 0. However, if the result has to be truncated, SY-SUBRC is set to 4.
DATA: C1(10) VALUE 'Sum',
C2(3) VALUE 'mer',
C3(5) VALUE 'holi ',
C4(10) VALUE 'day',
C5(30),
SEP(3) VALUE ' - '.
CONCATENATE C1 C2 C3 C4 INTO C5.
WRITE C5.
CONCATENATE C1 C2 C3 C4 INTO C5 SEPARATED BY SEP.
WRITE / C5.
Output:
Summerholiday
Sum - mer - holi - day
In C1 to C5, the trailing blanks are ignored. The separator SEP retains them.
Hope it helps u.
Thanks&Regards,
Ruthra
2005 Oct 19 10:34 AM
EX:
DATA : S1 TYPE STRING VALUE 'ABC 123',
S2 TYPE STRING VALUE 'DEF 888',
S3 TYPE STRING VALUE ' '.
CONCATENATE S1 S2 INTO S3 SEPARATED BY ' '.
WRITE:/ S3.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |