Home > Mobile >  Finding string operation to eliminate word ABAP
Finding string operation to eliminate word ABAP

Time:10-19

I am trying to create an algorithm in SAP ABAP to eliminate the word IBAN from certain fields. For example, in the below photo we have that for KNBK-Bankschlüssel=7415000, the KNBK-Bankkontonummer= <IBAN 000000000008. I am trying to eliminate IBAN from the field so that only 000000000008 will be shown in the table.

enter image description here

Is there any string operation that would let me check whether a field has the keyword IBAN and to eliminate it?

Thank you all in advance!

CodePudding user response:

You can do it with the REPLACE statement:

IF word CS 'IBAN'.                    "to check if the string contains IBAN (as substring)
  REPLACE 'IBAN' WITH '' INTO word.   "This will remove the substring IBAB, but it will be replaced with a space
  CONDENSE word NO-GAPS.              "This will remove the space (and other spaces as well, if there is any in the string)
ENDIF.

Looking at the screenshot, the field contains '< IBAN>' (instead of just 'IBAN'), so you have to modify the code accordingly.

  • Related