![]() ![]() If no header is specified with the field names, make sure the ordering of fields in the excel are the same as the ordering of the fields in the table/structure definition.If just part of the fields of a given structure are available in the excel, make sure to label the columns with the correct field names.e.g., if the date format is dd.mm.yyyy in SU01 for the user, the excel should have date values in the same format. The format of data in the excel should match the format settings of the SAP user executing the FM.Clearer error messages with message variables.The functionality can be extended to actually update the excel content to DB tables (with just a few lines of code.With just the path of the file and the target structure, this FM can be re-used in any place where the data from excel needs to be dumped into an internal table.Having a general/common FM to retrieve data from an excel file into any internal table following the specified structure.So, we utilize this to develop a general purpose FM, which can read any excel file and put it in an internal table of the specified structure. We can use various RTTS (Run Time Type Services), Data references, Field-Symbols to achieve this. SAP has provided us the means to create data at run-time. And parses the excel content into an internal table with the same structure given as input. I have developed an FM ‘Y_EXCEL_TO_ITAB ‘, which takes an excel file name and a structure/table name as inputs. ![]()
0 Comments
Leave a Reply. |