Click here to Skip to main content
15,176,221 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to copy data from excel file and paste it in my clipboard so i can then copy that in SAP...presently what i have is copy each row and paste and that is very time consuming..I want to copy all rows and paste at one go

What I have tried:

string excelpath = @"File_path.xlxs"
                        List<Dictionary<string, object>> excel = Sytem.SPA.Excel.Excel.LoadRows(excelpath, "Tab_name", null);
                        List<string> sapTable = excel.Skip(1).Select(r => r["A"].ConvertTo<string>()).Distinct().ToList();
                        sapInstance.SetMultipleSelection(sapInstance.FindPathID("btn%_CN_PROJN_%_APP_%-VALU_PUSH"), new Selection("Project", sapTable));
Updated 8-Sep-20 21:17pm
BillWoodruff 8-Sep-20 2:35am
Is there a way you can perform a select all via your interop code ? Perhaps query Excel to determine rows actually in use, and only copy those ?
Rao17 8-Sep-20 3:12am
not sure..could you help please
Rao17 8-Sep-20 3:13am
also the rows will change every month so I cannot give a fixed range
BillWoodruff 9-Sep-20 1:58am
that's why I suggested you use 'SelectAll ... or use the WorkSheet 'UsedRange:
Rao17 8-Sep-20 23:36pm
That posts Does not seem to help me :(

1 solution

I'd strongly suggest to start here: Excel with SAP - An overview - ABAP Development - Community Wiki[^] and this: Reading/Importing Excel into SAP[^]

There's few ways to import data from Excel file:
2. Microsoft OLE
3. Function Module TEXT_CONVERT_XLS_TO_SAP
5. JavaExcel API (via PI)
6. 3rd Party Converter

I'm pretty sure that you can import data into SAP without using clipboard!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900