cancel
Showing results for 
Search instead for 
Did you mean: 

ABAP Routine for TEXT characteristic in trnasformation: How to replace char

Former Member
0 Kudos

Good afternoon

I am not an ABAP'er, but require assistance to do the following please?

I load TEXT from a database via DB connect. The db field is 120 u2018varchar2u2019 in length, but I split it into two fields in the transformations. Both fields = 60 characters.

The 120 text field contains several ' ! ' anywhere in the text. It so happens that when I split it into 2, that the u2018 ! u2018 can be the first character of the second text field. This is rejected when the data is activated in DSO. They do not want to exclude this from the data on the db itself. I want to write a routine on the TEXT characteristic in the transformations to replace the u2018 ! u2018 with a space/or other character.

This is the routine that I have on the second text field currently.

result = source_fields-claim_text1+60(60).

Now I want to add a routine that will replace the u2018 ! u2018 when itu2019s the first character of the second text field.

Can any of the ABAP programmers be of assistance please?

Many thanks in advanceu2026

CJ

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

shift result right deleting leading '!'.

should do the trick.

regards

Siggi

Former Member
0 Kudos

Hi, Thanks for your quick response.

What do you mean by "Shift result right"?

It might be that the second or third character in the text field is also ' ! ', as the users love to use this sign in the free text field. I know the solution would be to stop the use of this at the user itself, but it's going to take a l o n g time! Thus, I need to replace the first ' ! ' with another valid character,

Thanks again.

Cj

vadimklimov
Active Contributor
0 Kudos

Dear CJ,

If I understood you correctly, your requirement is to replace the first '!' symbol only and leaving all others without changes - am I correct? If so, then what about implementing a small IF-statement? For example, something like this:

IF result(1) EQ '!'.

result(1) = ' '.

ENDIF.

This will check the first symbol of RESULT - if it is '!', it will be replaced with space, if not, nothing will happen to RESULT.

Please, advise me in case you need to implement some replacement logic for other '!' symbols which may appear in RESULT - and I will try to adjust the provided solution accordingly.

My regards,

Vadim

Former Member
0 Kudos

Exactly what I neede, thanks a lot.

Have a nice day.

Answers (0)