Skip to Content
avatar image
-2
Former Member

Question on looping records and using special characters

Hello Team,

I am fetching records from VBAK table and I want to filter those out based on order type.

If the order type is Z*AB than only I want to do some operation like if the order type is Z1AB or Z2AB or Z3AB ..or ZHAB or ZDAB than the loop should be processed.

I am writing code as

LOOP AT IT_VBAK INTO W_VBAK where AUART CP 'Z*AB'.

ENDLOOP.

I had checked in debugging and its working but my doubt is CP basically considers any open spaces and matches the pattern and makes loop pass.

Please suggest how to achieve this in record processing for Z*AB order types.

Thanks,

rg

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Mar 13, 2017 at 10:49 PM

    First of all, check the documentation for CP:

    https://help.sap.com/http.svc/rc/abapdocu_751_index_htm/7.51/en-US/index.htm?file=abenlogexp_strings.htm

    Then, I propose to write (module) tests for your expected values.

    Add comment
    10|10000 characters needed characters exceeded