Search code examples
abapdynpro

SELECT-OPTIONS by arbitrary ABAP variable


I've created a report that contains a selection screen that has select options for fields like : kunnr,sortl etc from standard SAP tables.

In addition, I've created a variable that sums a few fields from a table. Now I need to add a select option for this field so I can run the report searching By the amount I will enter in it(range or specific amount). I've searched the web and haven't found a solution.

Would really appreciate any help. Thank you!


Solution

  • Following is suggestion for your case.

    Tables: KNA1,EKKO.
    SELECT-OPTIONS:  so_kunnr FOR kna1-kunnr.
                     so_amt FOR ekko-dpamt.
    
    **********
    SELECT * FROM KNA1 WHERE kunnr IN so_kunnr
    
    ********** Variable Amount
       IF  lv_var IN so_amt.
    ******** Your Logic
       ENDIF.
    

    regards,

    Umar Abdullah