‎2008 Oct 27 7:49 PM
I have the code as below. p_value = '#', and when i debug,the <dyn_field> contain the character '#'.
but after execute the <dyn_field> CS p_value, the sy-subrc <> 0;i think the sy-subrc should be 0.
I do not know why? Could you please help me
**********************code **********************************************
FORM check_value.
DATA l_value(225) TYPE c.
DATA s TYPE string.
WRITE: / 'Detail Updated Information: '.
CLEAR g_lines.
LOOP AT <dyn_table> INTO <dyn_wa>.
ASSIGN COMPONENT g_tabix
OF STRUCTURE <dyn_wa> TO <dyn_field>.
IF <dyn_field> CS p_value.
l_value = <dyn_field>.
REPLACE ALL OCCURRENCES OF REGEX p_value IN <dyn_field> WITH p_repla.
IF sy-subrc = 0.
WRITE: /2(25) c_old_v, 27 '->',30(25) c_new_v.
WRITE: / l_value UNDER c_old_v.
WRITE: <dyn_field> UNDER c_new_v.
MODIFY <dyn_table> FROM <dyn_wa>.
g_lines = g_lines + 1.
ENDIF.
ENDIF.
ENDLOOP.
‎2008 Oct 27 7:53 PM
hi if I can guess correct .. you would have read some file from app server or presentation server and loded data into internal table..
symbolizes the carriage return or page breaker.. search the forum for this key words.. you will find a solution.
‎2008 Oct 27 8:21 PM
Sometimes chars may look similar but in fact they're not. It is especially encountered when reading the file. Debug the code and ensure that '#' sign has the same hex code that your p_value, which I guess is a char.
If not do following:
- declare p_value_hex as xstring
- assing it a hex value for # sign (check in ASCII table)
- give on input of FM HR_KR_XSTRING_TO_STRING this hex value to convert it to string
- then check if your statement "F <dyn_field> CS p_value_string." works
‎2008 Oct 28 1:04 AM
it may be a horizontal tab or a new line character.
try one of these..
cl_abap_char_utilities=>horizontal_tab
cl_abap_char_utilities=>newline
REPLACE ALL OCCURRENCES OF cl_abap_char_utilities=>horizontal_tab IN <dyn_field> WITH p_repla.or
REPLACE ALL OCCURRENCES OF cl_abap_char_utilities=>newline IN <dyn_field> WITH p_repla.