‎2009 Nov 14 4:58 PM
Hi to everybody
I have tihs values
31.800
0.300
2.100
I should to get this
31,800
00,300
02,100
I use REPLACE ALL OCCURRENCES OF '.' IN lt_itob-id1 WITH ',' it is ok
but I get an error if I use REPLACE ALL OCCURRENCES OF space IN lt_itob-id1 WITH '0' .
Could you help me?
Thanks a loto
‎2009 Nov 16 7:17 AM
Hi,
To Replace space with '0' use OVERLAY statement.
DATA: l_val TYPE char6 VALUE '0.300'.
REPLACE ALL OCCURRENCES OF '.' IN l_val WITH ',' .
SHIFT l_val RIGHT DELETING TRAILING space.
OVERLAY l_val WITH '000000'.
WRITE l_val.
Regards,
Farheen
‎2009 Nov 14 5:12 PM
Hi
For pdding zeros in the begning use the following:
SHIFT RIGHT <variable> RIGHT DELETING TRAILING SPACE.
And for replacing '.' with ',', i think you will ahve to make use of IF loop and do this operation withn it.
Regards
Gaurav
‎2009 Nov 14 5:19 PM
‎2009 Nov 14 5:26 PM
Hi,
I think you can use SHIFT statement as suggested. Press F1 on SHIFT.
‎2009 Nov 14 6:41 PM
Hi Georgio,
unable to answer incomplete questions: ID1 is no field of DB view ITOB. Thus you should give the field technical settings here.
Post a few code lines on how you populate the field (Don't worry, CIA knows anyway)..
Then someone can answer your question.
Regards,
Clemens
‎2009 Nov 16 6:37 AM
Hi ,
if the pattern of the variable in which u r taking value is constant,i.e if there are 3 values after decimal as shown in below code ,you can use below code.
DATA : l_local(6) TYPE c.
l_local = '0.300'.
concatenate '0' l_local into l_local.
REPLACE ALL OCCURRENCES OF '.' IN l_local WITH ',' .
Edited By
Tejaswini Khante
‎2009 Nov 16 7:17 AM
Hi,
To Replace space with '0' use OVERLAY statement.
DATA: l_val TYPE char6 VALUE '0.300'.
REPLACE ALL OCCURRENCES OF '.' IN l_val WITH ',' .
SHIFT l_val RIGHT DELETING TRAILING space.
OVERLAY l_val WITH '000000'.
WRITE l_val.
Regards,
Farheen