2008 Apr 24 2:15 PM
I have a data
lv_var1(18) type c.
I have to assign value "LOAN" and "HP" to this variable.
but it should not compress the value means after LOAN it should add 14 spaces and after hp it should add 16 spaces and store the value.
how to do this ?
I have a data
lv_var1(18) type c.
I have to assign value "LOAN" and "HP" to this variable.
but it should not compress the value means after LOAN it should add 14 spaces and after hp it should add 16 spaces and store the value.
how to do this ?
2008 Apr 24 2:18 PM
By the nature of the field being type C, and moving character data to it, the field will be left justified as you need.
2008 Apr 24 2:19 PM
I dont think thats possible only using String Data type you can have variable length variables.
santhosh
2008 Apr 24 2:21 PM
Hi
lv_var1(4) = 'LOAN'.
or
lv_var1(2) = 'HP'.
here the remaing chararters of variable LV_VAR1 will be blank, now if you don't want to lose these space it depends on where you transfer it.
Max
2008 Apr 24 2:32 PM
Hi Santosh B,
when u assign it to the variable the left space will be blank only...
may be this code will clear ur doubt...
See below code...
data : lv_var1(18) type c,
lv_var2(18) type c.
lv_var1+0 = 'LOAN'.
lv_var2+0 = 'AFTER SPACES'.
WRITE : lv_var1 ,lv_var2 .
data : lv_var1(18) type c,
lv_var2(18) type c,
lv_var3(10) type c.
lv_var1 = 'LOAN'.
lv_var2 = 'AFTER SPACES'.
lv_var3 = lv_var1. " here from 18 to 10 so it will remove extra spaces...
WRITE : lv_var1 ,lv_var2 ,lv_var3,'a' .Hope it will solve your problem...
Reward points if useful...
Thanks & Regards
ilesh 24x7
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |