Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Query abourt 'REPLACE' statement in SAP 4.7

Former Member
0 Likes
584

hello,

I have developed one program in SAP 4.7 version.Now i have copied it to 4.6C in SAP.When i tried to run this program it gives me error in

REPLACE ALL OCCURRENCES OF ':' IN l_col_time WITH ' '.

this statement.this statement is working in 4.7 but not in 4.6C.What should i do to eliminate this replace statement?should i use any function module that replaces off occurrences of particular character with specified character.

4 REPLIES 4
Read only

Former Member
0 Likes
523

REPORT abc.

DATA : BEGIN OF itab OCCURS 0,

str(50),

END OF itab.

DATA : cha(50) VALUE 'cha:sek:jskjfsjf',

str(2000).

SPLIT cha AT ':' INTO TABLE itab.

loop at itab.

concatenate str itab-str into str separated by space.

endloop.

write : str.

Read only

0 Likes
523

you can try this

data: raja(100) .
raja = '123:44:67:' .
translate raja using ': ' .

Regards

Raja

Read only

Former Member
0 Likes
523

hI,

This Replace statement wont work in 4.6C.

You can Split the string at ':' and then concatinate back seperated by SPACE.

Regards,

Tanveer.

<b>Please mark helpful answers</b>

Read only

Former Member
0 Likes
523

hi,

try this

DO.

REPLACE ':' IN l_col_time WITH ' '.

IF SY-INDEX <> 0.

EXIT.

ENDIF.

ENDDO.

or

  • CLEAR lv_length.

  • lv_length = STRLEN( lv_format_sdata ).

*

  • DO lv_length TIMES.

*

  • REPLACE ',""' WITH ',' INTO lv_format_sdata.

*

  • IF sy-subrc <> 0.

  • EXIT.

  • ENDIF.

*

  • ENDDO.

This will solve ur problem.

<b>Mark Helpful answers</b>

Regards