02-02-2015 4:37 AM
Hi All,
I have a doubt I refereed so many function modules to upload excel sheet but I need an function module that can upload excel sheet cell by cell.
Is there any FM like that or do you have any idea to write a code for this scenario.
Thanks,
Revanth
02-02-2015 4:45 AM
Hi Revanth,
Can you please explain your requirement in detail.
Regards,
Ashish.
02-02-2015 4:49 AM
Hi Ashish,
I want to upload excel sheet while uploading itself I want to do operations on it.
Ex. in 1st row I need data from 5th cell and data in other cells should be rejected. Is there any possibility of this situation.
I am new to ABAP I think you can understand me.
02-02-2015 4:54 AM
Hi Revanth,
Why can't you handle the same after uploading complete file into internal table in the program. I suggest you to upload complete file into internal table and do required operations and validations on that table. And move required data into another internal table.
Regards,
Vijay
02-02-2015 4:58 AM
Hi Revanth,
Its still not clear. Explain with example. Moreover, you can do operations on the data after taking the contents into internal table.
02-02-2015 4:58 AM
Hi Revanth,
I understood your question. But I still donot know as why do you want to do operations while uploading the file itself.
You can upload the Excel file into SAP. Convert the excel data into your internal data and thereafter you can modify it or play with the data.
Regards,
Ashish.
02-02-2015 6:10 AM
Hi Ashish,
Thanks I got it. And as I mentioned to you after uploading the data into internal table does it will be in rows and columns format or just single line format?
My requirement is after getting data into internal table as you mentioned..
In fifth row second column there will be data called WBGAMES GBP-USD in this text I need to search for 'GBP' and if this string is present I need to go further to upload remaining data otherwise I need to cancel the uploading.
Can you please suggest me How to do this?
02-02-2015 6:16 AM
Hi Revanth,
In table loop you can make use of SY-TABIX to identify row number and String comparison operator CS.
Regards,
Vijay
02-02-2015 6:21 AM
Hi Vijaykrishna,
But is it ok with two internal tables with different structures bcoz it will be having currency and date data types...
Thanks
Revanth
02-02-2015 6:27 AM
Here you will handle with work areas so, I believe that table structures will not affect this.
Regards,
Vijay
02-03-2015 2:38 PM
Hi Revanth,
Is your issue solved? Have you tried as I mentioned?
-Vijay
02-05-2015 2:38 AM
02-05-2015 3:54 AM
02-02-2015 4:47 AM
Hi Revanth,
What do you mean by "Cell by cell"? It would be better if you elaborate your query.
Regards,
Vijay
02-02-2015 4:59 AM
Hi,
You can use following FM for your requirement.
alsm_excel_to_internal_table.
02-02-2015 6:38 AM
hi Revanth,
you can try to use OLE method like below
create object xlapp 'EXCEL.APPLICATION'.
call method of xlapp 'Workbooks' = xlbook.
call method of xlbook 'Open' exporting #1 = (filen_name).
call method of xlapp 'Worksheets' = xlsheet exporting #1 = (sheet_name).
call method of xlsheet 'Activate'.
call method of xlsheet 'Cells' = scell exporting #1 = zrow
#2 = zcolumn.
get property of scell 'Value' = val. " this is the value.
free object scell.
02-02-2015 6:44 AM
Hi All,
I got an another doubt I have uploaded file and place it in AL11 directory by naming it as AMEX and now if I again do the same procedure with same file it should not accept it.
How can I solve it.?
02-02-2015 6:48 AM
02-02-2015 6:49 AM
Hi Revanth,
If you don't want to upload same file again, then create 2 folders instead on 1 in AL11 directory. Once called as upload and other as Archive. So, once the file is uploaded successfully, you can move that file to Archive folder and will be deleted from Upload folder.
Hope its clear.