FORM replace_last USING value(i_old) TYPE csequence
value(i_new) TYPE csequence
CHANGING c_text TYPE csequence.
DATA:
lv_oldlen TYPE i,
lv_searchstart TYPE i,
lv_lastfound TYPE i.
lv_oldlen = STRLEN( i_old ).
IF lv_oldlen > 0.
lv_lastfound = - lv_oldlen.
lv_searchstart = 1.
SEARCH c_text FOR i_old STARTING AT lv_searchstart.
WHILE sy-subrc = 0.
lv_lastfound = lv_lastfound + sy-fdpos + lv_oldlen.
lv_searchstart = lv_searchstart + sy-fdpos + lv_oldlen.
SEARCH c_text FOR i_old STARTING AT lv_searchstart.
ENDWHILE.
IF lv_lastfound >= 0.
REPLACE SECTION OFFSET lv_lastfound LENGTH lv_oldlen
OF c_text WITH i_new.
ENDIF.
ENDIF.
ENDFORM. "replace_last
MfG
Thomas R.
Ein weiteres ABAP-Forum findet sich unter http:\\yaAbb.de