Select Option values compatibility issue
I'm new to object oriented program in ABAP and having some compatibility issues. I’m getting some values from user via selection screen as Select-Option. But when I try to pass these select-option variables to my class constructor then I get the following error.
“S_INV” is not type-compatible with formal parameter “IM_INV”.
My understand is that Select-Option is a range table, therefore I declared a range table in my class but still keep getting the same error. Can somebody please point out what mistake I’m making and how to rectify it?
Here is my code.
TABLES: vbrk, vbrl, vbak, vbap, konv.
INCLUDE ZAD_INV_TEST_CL.
DATA: gcl_main TYPE REF TO main.
SELECTION-SCREEN: BEGIN OF BLOCK BK2 WITH FRAME TITLE TEXT-002.
SELECT-OPTIONS: s_inv FOR vbrk-vbeln,
s_cust FOR vbrk-kunrg,
s_date FOR vbrk-erdat.
SELECTION-SCREEN: END OF BLOCK BK2.
START-OF-SELECTION.
CREATE OBJECT gcl_main
EXPORTING
im_inv = s_inv
im_cust = s_cust
im_date = s_date.
*---------------- Class Starts
CLASS main DEFINITION.
PUBLIC SECTION.
TYPES: BEGIN OF t_range_inv,
sign TYPE char1,
option TYPE char2,
dt_low TYPE vbrk-vbeln,
dt_high TYPE vbrk-vbeln,
END OF t_range_inv,
BEGIN OF t_range_cust,
sign TYPE char1,
option TYPE char2,
dt_low TYPE kunrg,
dt_high TYPE kunrg,
END OF t_range_cust,
BEGIN OF t_range_date,
sign TYPE char1,
option TYPE char2,
dt_low TYPE erdat,
dt_high TYPE erdat,
END OF t_range_date,
tt_inv TYPE TABLE OF t_range_inv INITIAL SIZE 0,
tt_cust TYPE TABLE OF t_range_cust INITIAL SIZE 0,
tt_date TYPE TABLE OF t_range_date INITIAL SIZE 0.
DATA: "variables to hold constructor values
gv_inv TYPE TABLE OF t_range_inv,
gv_cust TYPE TABLE OF t_range_cust,
gv_date TYPE TABLE OF t_range_date.
METHODS: constructor IMPORTING im_inv TYPE tt_inv
im_cust TYPE tt_cust
im_date TYPE tt_date.
ENDCLASS.
CLASS main IMPLEMENTATION.
METHOD constructor.
gv_inv = im_inv.
gv_cust = im_cust.
gv_date = im_date.
IF gv_inv IS NOT INITIAL
AND gv_cust IS NOT INITIAL
AND gv_date IS NOT INITIAL.
MESSAGE 'It works.' TYPE 'S'.
ELSE.
MESSAGE 'Please provide Invoice Information to process.' TYPE 'I'.
ENDIF.
ENDMETHOD.
ENDCLASS.
*---------------- Class Ends
Many thanks in advance.