hanasapb1

How to prompt query selection criteria with just Year


I'm trying to get just the year in the following table with timestamps. Which is usually possible using Year(), but somehow I can't get it to work on query selection criteria thing:

table with two columns. 1: 'Posting date', 2: 'Number of Records'

I tried to cast Year() on the trigger but it still shows the entire thing. Here's the query:

SELECT 
    Year(A."DocDate") as "Years"
FROM 
    OPCH A
WHERE
    Year(A."DocDate") = Year([%0])
GROUP BY
    Year(A."DocDate") 

I wish I could try to make a new table for it but my license didn't allow me to. I just want it to have like dropdowns or just show years of available. I've tried Year(\[%0\]), Extract_year and just plain \[%0\], but none of them work. Is the issue with the query or something else?

Edit : While it is possible to use UDT (User-Defined Table) its not a good practice especially in the long run. I might just add 100 years and no one knows how long this app last. but i still would like to know if there's another method


Solution

  • As far as I know this isn't possible due to the Limitations of Sap B1

    The simplest solution would be to keep the Years column and instruct users to use the Filter to select the year they wish to see. Sap Filter

    an alternative would be to create a simple custom User Form with a SAPbouiCOM.ComboBox and a SAPbouiCOM.Grid.