2006 Apr 27 6:41 AM
Hi All,
I wish to know how to delete the leading / trailing spaces in <b>Internal Table's</b> field & bolding the field name in Report Output.
Ex: In report output - when i output BSID-WRBTR via an Internal table how to delete the blank spaces.
I appreciate ur time.
Regards
Tina
2006 Apr 27 7:15 AM
Hi tina,
1. since BSID-WRBTR is a NUMERIC Field,
it will be written
RIGHT-JUSTIFIED by default.
(with leading spaces)
2. we can copy this value to a char variable,
CONDENSE it, and then print this new variable.
3. Just copy paste this in new program.
(it will show you both right and left justified output_
4.
report abc.
*----
data : num like BSID-WRBTR .
data : str(15) type c.
*----
num = 55.
str = num.
*----
condense str.
write 😕 num .
write 😕 str.
regards,
amit m.
Hi All,
I wish to know how to delete the leading / trailing spaces in <b>Internal Table's</b> field & bolding the field name in Report Output.
Ex: In report output - when i output BSID-WRBTR via an Internal table how to delete the blank spaces.
I appreciate ur time.
Regards
Tina
2006 Apr 27 6:44 AM
HI Tina,
before writing just use
CONDENSE BSID-WRBTR.
you can also use FORMAT INTENSIFIED ON to make it appear thicker..
regards
satesh
2006 Apr 27 6:46 AM
hi Tina,
Use <b>Condense</b> Statement
i.e,
<b>The CONDENSE statement deletes redundant spaces from a string:</b>
CONDENSE <c> [NO-GAPS].
This statement removes any leading blanks in the field <c> and replaces other sequences of blanks by exactly one blank. The result is a left-justified sequence of words, each separated by one blank. If the addition NO-GAPS is specified, all blanks are removed.
DATA: STRING(25) VALUE ' one two three four',
LEN TYPE I.
LEN = STRLEN( STRING ).
WRITE: STRING, '!'.
WRITE: / 'Length: ', LEN.
CONDENSE STRING.
LEN = STRLEN( STRING ).
WRITE: STRING, '!'.
WRITE: / 'Length: ', LEN.
CONDENSE STRING NO-GAPS.
LEN = STRLEN( STRING ).
WRITE: STRING, '!'.
WRITE: / 'Length: ', LEN.
Output:
one two three four !
Length: 25
one two three four !
Length: 18
onetwothreefour !
Length: 15
Note that the total length of the field STRING remains unchanged, but that the deleted blanks appear again on the right.
Regards,
Santosh
2006 Apr 27 6:46 AM
Hi,
You can try the following:-
Loop at ITAB.
CONDENSE ITAB-FIELD1. " will delete the blank spaces.
CONDENSE ITAB-FIELD2.
MODIFY ITAB.
Endloop.
Regards,
Sameena
2006 Apr 27 6:47 AM
Tina,
If you don't want gaps at all
use CONDENSE var NO-GAPS
WRITE var INTENSIFIED ON.
Regards,
Ravi
Note :Please mark the helpful answers
2006 Apr 27 6:55 AM
Hai Tina
Basic form
CONDENSE c.
Addition
... NO-GAPS
Effect
Shifts the contents of the field c to the left, so that each word is separated by exactly one blank.
Example
DATA: BEGIN OF NAME,
TITLE(8), VALUE 'Dr.',
FIRST_NAME(10), VALUE 'Michael',
SURNAME(10), VALUE 'Hofmann',
END OF NAME.
CONDENSE NAME.
WRITE NAME.
produces the output:
Dr. Michael Hofmann
Addition
... NO-GAPS
Effect
Suppresses all blanks from the field c
Example
DATA: BEGIN OF NAME,
TITLE(8), VALUE 'Dr.',
FIRST_NAME(10), VALUE 'Michael',
SURNAME(10), VALUE 'Hofmann',
END OF NAME.
CONDENSE NAME NO-GAPS.
The contents of NAME is now " Dr.MichaelHofmann ".
Thanks & Regards
Sreenivasulu P
2006 Apr 27 7:15 AM
Hi tina,
1. since BSID-WRBTR is a NUMERIC Field,
it will be written
RIGHT-JUSTIFIED by default.
(with leading spaces)
2. we can copy this value to a char variable,
CONDENSE it, and then print this new variable.
3. Just copy paste this in new program.
(it will show you both right and left justified output_
4.
report abc.
*----
data : num like BSID-WRBTR .
data : str(15) type c.
*----
num = 55.
str = num.
*----
condense str.
write 😕 num .
write 😕 str.
regards,
amit m.
2006 Apr 27 7:27 AM
Hi All,
CONDENSE statement is used for Strings - not in Internal Table . Thatswhy i bolded "internal Table".
I've used "IT_FINAL-WRBTR UNDER TEXT-009 <b>LEFT-JUSTIFIED</b>"
which solves my purpose.
Thanks for all.
2006 Apr 27 7:32 AM
>><i>CONDENSE statement is used for Strings - not in Internal Table . Thats why i bolded "internal Table".</i>
what do you mean by this..
convert the field to a string if it is not..
2006 Apr 27 7:35 AM
Tina,
Each field of internal table is dealt as a string. That is why every one give CONDENSE as the answer. So, you will have to deal with individual fields and that is what you also have done. You cannot CONDENSE the entire table anyway.
Regards,
Ravi
Note : Please close the post if the question is answered and mark all the helpful answer.