‎2010 Dec 29 5:38 AM
Dear Experts,
I have a small requirements, i have a function module with 4 input parameters ( I_LIFNR,I_MATNR,I_EKORG,I_WERKS). The requirement is User will upload his excel sheet with this 4 values, the function module should fetch the records from the excel sheet and do the remaining functionality.
So how to get the excel sheet records or how to upload the excel sheet records to this function module or to this input parameters?
Anyone can guide me?
Mohana
‎2010 Dec 29 8:02 AM
Best is to Use the FM TEXT_CONVERT_XLS_TO_SAP
It stores the excel data into an internal table.
Now loop through that internal table and feed the data accordingly to the FM which you needed to pass the data.
‎2010 Dec 29 5:44 AM
Hi,
Use TEXT_CONVERT_XLS_TO_SAP to download the data from excel to some internal table.
loop at this internal table into workarea and call your FM with 4 input parameters ( I_LIFNR,I_MATNR,I_EKORG,I_WERKS) .
Pass the work area values accordingly and carry on with your code for other fuctionality.
BR,
Lokeswari.
‎2010 Dec 29 5:46 AM
You cannot.
Either write a wrapper program on your FM to upload Excel and pass value to it or change your FM for the requirement.
‎2010 Dec 29 6:59 AM
A function module cannot directly fetch data from an excel file. You will have to code it.
There are two ways you can code this.
Option 1 :
Add another input parameter in the function say 'filename'.
call FM GUI_UPLOAD to upload the excel file into an internal table.
Option 2:
Create a wrapper program for this function module which provides an input for the file name.
Again use GUI_UPLOAD to upload the file in the program.
Regards,
Jovito.
‎2010 Dec 29 8:02 AM
HI
Use this FM : ALSM_EXCEL_TO_INTERNAL_TABLE to upload the data from excel.
‎2010 Dec 29 8:02 AM
Best is to Use the FM TEXT_CONVERT_XLS_TO_SAP
It stores the excel data into an internal table.
Now loop through that internal table and feed the data accordingly to the FM which you needed to pass the data.