02-13-2007 7:57 AM
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
02-13-2007 7:59 AM
If it is a character field, then you can use the statement condense.
condense it_chng-hierno.
Regards,
Ravi
02-13-2007 7:59 AM
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.
02-13-2007 7:59 AM
If it is a character field, then you can use the statement condense.
condense it_chng-hierno.
Regards,
Ravi
02-13-2007 8:03 AM
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
02-13-2007 8:06 AM
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
02-13-2007 8:08 AM
Hi,
it_chng-hierno = lt_ct1-hierno + 1.
pack it_chng-hierno to it_chng-hierno.
Pack will remove space if it is character.