Application Development 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: 

SPACE Problem

Former Member
0 Kudos

Hi All,

I am having the following statement in the program .

I am inserting this data in the z table but when it is getting inserted a space is getting inserted at the beginning of the character.

For example if the value of lt_ct1-hierno is 1 , then ' 2' is getting inserted in the database ,

Please suggest how to remove it.

The statement i am using is

it_chng-hierno = lt_ct1-hierno + 1.

Thanks

1 ACCEPTED SOLUTION

former_member181962
Active Contributor
0 Kudos

If it is a character field, then you can use the statement condense.

condense it_chng-hierno.

Regards,

Ravi

5 REPLIES 5

Former Member
0 Kudos

Please specify the data type u are using for both.

If it is a string u have to CONDENSE the string before updating the table.

former_member181962
Active Contributor
0 Kudos

If it is a character field, then you can use the statement condense.

condense it_chng-hierno.

Regards,

Ravi

Former Member
0 Kudos

Manik,

CONDENSE it_chng-hierno [NO-GAPS.

EX;

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.

Pls. MAek if useful

Former Member
0 Kudos

Hello Manik,

You can use the following statement:

SHIFT it_chng-hierno LEFT DELETING LEADING ` `.

or

CONDENSE it_chng-hierno.

Regards,

Beejal

**reward if this helps

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

it_chng-hierno = lt_ct1-hierno + 1.

pack it_chng-hierno to it_chng-hierno.

Pack will remove space if it is character.