Skip to Content
0
Former Member
Sep 19, 2012 at 03:00 AM

Replace First Character with Space

4999 Views

In BW I have a record coming in and wtihin the address field the first character contains a ! or #. This is causing the DSO not to activate due to invalid characters of ! or # as the first character. I am trying to replace these characters with a space. Any ideas? Listed below I am trying to to determine if the source field contains a ! as the first character. If this is true then I am replacing ! with a space in the REPLACE statement. Still no luck so asking around for suggestions. Thanks.

DATA: VADDRESS LIKE SOURCE_FIELDS-ADDRESS.

IF SOURCE_FIELDS-ADDRESS CP '!'.

VADDRESS = SOURCE_FIELDS-ADDRESS.

REPLACE '!' WITH ' ' INTO VADDRESS.

RESULT = VADDRESS.

ELSE.

RESULT = SOURCE_FIELDS-ADDRESS.

ENDIF.