Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Question on looping records and using special characters

Former Member
0 Kudos

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

1 REPLY 1

horst_keller
Product and Topic Expert
Product and Topic Expert

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...

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