Skip to Content

Can I select the records from a table PROJ where the length of the PSPID is 13 characters only?

I am working on a requirement where I need to select the latest record from PROJ table where the PSPID starts with SE and the length of PSPID is 13 Characters only.

I have written the Select Query this way. But in this I cant restrict the selection of PSPID to 13 characters length. I do not want to select the entries with more than or less than 13 characters length and also which do not start with SE.

SELECT pspid from proj INTO TABLE @DATA(lt_proj)
UP TO 10 ROWS WHERE pspid LIKE 'SE%'
ORDER BY erdat DESCENDING.

In this select query the length restriction can not be possible. Can CDS views help us in achieving this requirement. Kindly let me know.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Mar 28 at 02:14 PM

    Use a WHERE pspid LIKE 'SE___________' " 'SE' + 11 x '_'

    Add comment
    10|10000 characters needed characters exceeded

  • Mar 28 at 04:39 PM

    Where psid like 'SE%' and length (psid)=13;

    Add comment
    10|10000 characters needed characters exceeded