Select with numc field condition returns no data

I want to extract some data from table view SACY_BOOK (which is one of those training tables always implemented in SAP) into my intern table wa_booking, filtered by a numc-field pa_anum. Here's what I got so far:

PARAMETERS pa_anum TYPE sacy_book-agencynum.

DATA wa_booking TYPE sacy_book.

  SELECT carrid connid fldate bookid name
    FROM sacy_book
      WHERE agencynum = pa_anum.  **<-- this here be the problem **

    WRITE: / ... (I'll skip this part)

Code should work for everyone who has ABAP editor, since it only uses example tables supplied by SAP.

So, debugger shows me that if I choose some company with e.g. agencynum "00000108", this exact number is sent to pa_anum, with zeros in front and everything. Still, my sy-subrc variable gives back a 4, meaning that nothing which fits the condition was found. Hard to believe, since pa_anum gets its values from the same source...


  • The demo tables are delivered empty - on purpose, because why would you want demo data in your production environment that you won't ever need? Use the program SAPBC_DATA_GENERATOR to fill the tables SBOOK and STRAVELAG that make up the view SACY_BOOK.