Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Fetch Excel sheet records to a function module??

Former Member
0 Likes
888

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
796

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.

5 REPLIES 5
Read only

Former Member
0 Likes
796

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.

Read only

amit_khare
Active Contributor
0 Likes
796

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.

Read only

Former Member
0 Likes
796

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.

Read only

Former Member
0 Likes
796

HI

Use this FM : ALSM_EXCEL_TO_INTERNAL_TABLE to upload the data from excel.

Read only

Former Member
0 Likes
797

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.