2023 Jun 18 8:22 AM
I have to make a program that could read data of a specific table via table name from Excel file. Now I am confused about how to identify that table from an Excel file. I looked through the abap2xlsx project, but I didn't find any method for identifying a specific table through the table name.
If somebody could give me some advice, that would be great. Thanks in advance.
2023 Jun 18 12:26 PM
There are lots of methods in abap2xlsx to extract the texts from an Excel file.
After that, storing these texts in an internal table, and in a database table, is easy.
2023 Jun 18 12:39 PM
sandra.rossi, thanks for your reply. But, can you please give me more information about it.
- For example, in the below sheet I have 6 tables. But, I want to read or extract only the data of "PriceList" table, not the others. So, how can I do this?
2023 Jun 18 12:54 PM
I don't know what you have understood from abap2xlsx, but reading the cells below "PriceList" is basically simple:
sheet->get_table(
EXPORTING
iv_skipped_rows = 3
iv_skipped_cols = 8
iv_max_col = 10
iv_max_row = 10
IMPORTING
et_table = table_interne ).
2023 Jun 18 2:59 PM
Yeah, you are right. With "get_table" I can read it. But how should I set values for these 4 parameters "iv_skipped_rows", "iv_skipped_cols", "iv_max_col", and "iv_max_row".
As you can see in the above image. I should have these 2 parameters in my program. And based on the entry table name, the program should read data of that specific table. Now if I use "get_table", so how should I find values of these parameters dynamically "iv_skipped_rows", "iv_skipped_cols", "iv_max_col", and "iv_max_row".
2023 Jun 18 3:27 PM
Unless you want to use Artificial Intelligence, it's where human beings must be educated to place the information always at the same position in the Excel file otherwise the program can't work well.
2023 Jun 19 1:20 PM
Keep it simple.
Do a GET_TABLE of all cells to fill an internal table, and then apply the logic you want on this internal table.
2023 Jun 19 8:14 PM
2023 Nov 26 9:35 AM
If you have this worksheet, and you want to read the cells below "PriceList" (columns I to K = 9 to 11, rows 4 to 10)
Do this code with abap2xlsx:
sheet->get_table(
EXPORTING
iv_skipped_rows = 3
iv_skipped_cols = 8
iv_max_col = 11
iv_max_row = 10
IMPORTING
et_table = price_list ).