Hello fellow homoSAPiens (see what I did there).
I'm trying to read in an Excel file (both .xls and .xlsx extension) but I haven't gotten any succes with it so far. The idea is that only need to read the first column, the amount of rows is dynamic so I'll have to figure something out but thats not the point right now.
I don't know if the way I'm developing (using classes) is a good practice here (advise is always welcome). So the idea is that I get the file path from the user and then assign it to my variable so my next method can access that variable with the correct content in it.
So the method get_file_path works as intended, I assume. But the method extract_data is not really doing anything. When I debug and check the it_file it's empty (hence I haven't gotten to write something to offload the records in it since currently I can't get any records).
In another class I initiate both methods by creating the object, run the 'get_file_path' method and then the 'extract_data' method.
What am I doing wrong here? Thanks in advance!
CLASS zp***_extract_data DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
METHODS get_file_path.
METHODS extract_excel.
PROTECTED SECTION.
PRIVATE SECTION.
DATA: actual_file_path TYPE rlgrap-filename.
ENDCLASS.
CLASS ZP***_EXTRACT_DATA IMPLEMENTATION.
METHOD extract_excel.
DATA: it_file TYPE TABLE OF alsmex_tabline INITIAL SIZE 0.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = actual_file_path
i_begin_col = '1'
i_begin_row = '1'
i_end_col = '1'
i_end_row = '256'
TABLES
intern = it_file
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
ENDMETHOD.
METHOD get_file_path.
DATA: file_path TYPE rlgrap-filename.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
field_name = 'FILE_LOC'
IMPORTING
file_name = file_path.
actual_file_path = file_path.
* test purposes
* WRITE actual_file_path.
ENDMETHOD.
ENDCLASS.