04-21-2009 11:28 AM
Dear All,
I have this coding
data : w_data(100),w_data1 TYPE string, w_data2 TYPE xstring.
data w_replace(1).
************************************************************************
*START-OF-SELECTION.
START-OF-SELECTION.
w_data1 = 'A A A*R'.
w_replace = ' '.
REPLACE SECTION OFFSET 5 LENGTH 1 OF w_data1 WITH w_replace .
WRITE w_data1.
The idea is to replace the '*' in w_ data1 by a space. In w_replace I put 'ALT+32' and if I look the HEX code w_replace = 20. And it's exactly what I want.
But when I use REPLACE, the '*' is replace by nothing !
w_data1 before REPLACE = 41204120412A52
w_data1 after REPLACE = 412041204152
I want 41204120412052
I have already tried with w_replace = Space , = ' ', = 'ALT+32' For all, same problem
I also tried with 'ALT+255' , the HEX code is A0, and it's correctly replaced in w_data1, but for the rest of the program, I really need a blank corresponding at '20'.
- w_data1 is used to send by mail a PDF .
Idea ???
Thanks
Nathalie
04-21-2009 11:35 AM
data: lv_fdpos type syst-fdpos,
lv_part1 type c length 5,
lv_part2 type c length 20,
lv_final type char30.
search w_data1 for '.*.'.
lv_fdpos = sy-fdpos - 1.
lv_part1 = w_data1(lv_fdpos).
lv_fdpos = sy-fdpos + 1.
lv_part2 = w_data1+lv_fdpos.
concatenate lv_part1 lv_part2 into lv_final. separated by space.
04-21-2009 11:31 AM
Hi
Use Overlay operator as per below example
DATA: ONE(16), TWO(16).
ONE = '----****++++....'.
TWO = '-+.-.-*.-*+.'.
OVERLAY ONE WITH TWO ONLY '.'.
OVERLAY TWO WITH ONE ONLY '.+'.
OVERLAY ONE WITH TWO ONLY '+*'.
Field ONE now contains '---**-+-*.' and field TWO contains '-*-**-+-*.'.
04-21-2009 11:35 AM
data: lv_fdpos type syst-fdpos,
lv_part1 type c length 5,
lv_part2 type c length 20,
lv_final type char30.
search w_data1 for '.*.'.
lv_fdpos = sy-fdpos - 1.
lv_part1 = w_data1(lv_fdpos).
lv_fdpos = sy-fdpos + 1.
lv_part2 = w_data1+lv_fdpos.
concatenate lv_part1 lv_part2 into lv_final. separated by space.
04-21-2009 12:57 PM
Hi Florian,
Your suggestion was very helpfull and solved my problem .
Thanks a lot
04-21-2009 11:45 AM
Hi Nathalie,
try:
TRANSLATE w_data1 USING '* '. (*space)
Regards,
MayM
04-21-2009 12:11 PM
Check this:
data: wdata1 type string value 'A A A*R'.
TRANSLATE wdata1 USING '* '. " give space using Alt+255
write:/ wdata1.