Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Deleting Space - Internal Table

Former Member
0 Likes
3,476

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,918

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.

9 REPLIES 9
Read only

Former Member
0 Likes
1,918

HI Tina,

before writing just use

CONDENSE BSID-WRBTR.

you can also use FORMAT INTENSIFIED ON to make it appear thicker..

regards

satesh

Read only

0 Likes
1,918

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

Read only

Former Member
0 Likes
1,918

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

Read only

Former Member
0 Likes
1,918

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

Read only

Former Member
0 Likes
1,918

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

Read only

Former Member
0 Likes
1,919

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.

Read only

0 Likes
1,918

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.

Read only

0 Likes
1,918

>><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..

Read only

0 Likes
1,918

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.