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

SPACE Problem

Former Member
0 Likes
765

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
Read only

Former Member
0 Likes
743

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

condense it_chng-hierno.

Regards,

Ravi

5 REPLIES 5
Read only

Former Member
0 Likes
743

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.

Read only

Former Member
0 Likes
744

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

condense it_chng-hierno.

Regards,

Ravi

Read only

Former Member
0 Likes
743

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

Read only

Former Member
0 Likes
743

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

Read only

jayanthi_jayaraman
Active Contributor
0 Likes
743

Hi,

it_chng-hierno = lt_ct1-hierno + 1.

pack it_chng-hierno to it_chng-hierno.

Pack will remove space if it is character.