09-30-2008 4:14 PM
Hi Experts,
I am concatenating few field to a character field..by separating with "|" symbol..it is something like this..
*|||***||** (* refers char value)
few field does not have value for which subsequent '|' symbol is there..
I want number of spaces (as per data-element) should be there instead of blank. Some thing like this..
*| | |***| |**
How to achieve this?
Thanks,
Rajesh
09-30-2008 4:28 PM
09-30-2008 4:32 PM
09-30-2008 4:46 PM
You can try something like this:
REPORT ZMP_TEST.
DATA: v_string1(3) TYPE C VALUE 'abc',
v_string2(3) TYPE C VALUE '',
v_string3(3) TYPE C VALUE 'def',
v_string4(3) TYPE C VALUE 'ghi',
v_output(50) TYPE C ,
sep(1) VALUE '|'.
CONCATENATE v_string1 v_string2 v_string3 v_string4 INTO v_output SEPARATED BY sep RESPECTING BLANKS.
CONDENSE v_output.
BREAK-POINT.
It also depends on the fields you concatenating. The above logic will not work as desired if the other fields also have spaces in them.
10-01-2008 6:55 AM
Hi,
Thanks for reply...
I am working in 4.7EE, where this code is not working...
any other way..??
Thanks,
Rajesh.
09-30-2008 4:50 PM
Another aproach, this one's dirty and doesn't use concatenate at all.
DATA:
one(3) TYPE c VALUE 'abc',
two(4) TYPE c,
three(3) TYPE c VALUE 'fgh',
BEGIN OF record,
first(3) TYPE c,
h1 TYPE c VALUE '|',
second(4) TYPE c,
h2 TYPE c VALUE '|',
third(3) TYPE c,
END OF record.
START-OF-SELECTION.
record-first = one.
record-second = two.
record-third = three.
WRITE record.