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: 

Is it possible to ignore some characters of field inside of select?

shiz0frenik
Participant
0 Kudos
322

Hi, experts.
Is it possible to ignore some characters of field inside of select?
The field xblnr has 'letters and numbers', is it possible to ignore letter part and to compare only the number part?

  LOOP at lt_eschf_docli into ls_eschf_docli.
    select * from bkpf APPENDING CORRESPONDING FIELDS OF TABLE BKPF_INT
      WHERE
        bkpf~xblnr  = ls_eschf_docli-sernr
        and bukrs = 1000
        and  bldat = LS_ESCHF_DOCLI-ZDATE.

 

4 REPLIES 4

Tomas_Buryanek
Active Contributor
272

Yes. Check LIKE operator ABAP documentation.

-- Tomas --

0 Kudos
240

I don't think 'LIKE' will help.
Let's say.
Xblnr = AA 123456
ls_eschf_docli-sernr = 123456.

ls_eschf_docli-sernr - is always a number, xblnr not always a number.
And i want to put into mine BKPF_INT table, if values are equal ( with ignoring 'letters' of xblnr )

0 Kudos
239

LIKE is the way to go - read the manual provided by @Tomas_Buryanek 

raymond_giuseppi
Active Contributor
226

As written by @Tomas_Buryanek you can use a LIKE in where clause (Abap latest version) just build the operand2 from sernr (trailing and leading %, keep or remove leading zeroes?)

  • If your business rule isn't fully expressed (e.g. can SERNR also contains character and numbers) you could even use a (less maintainable) LIKE_REGEXPR function