‎2010 Sep 14 2:02 PM
Hi all -
I'm trying to find the end of my spreadsheet without looping through every row. I can do this in VBA as follows:
Selection.End(xlDown)
I tried to implement in ABAP like this. I have omitted the code where I set the selection, that is working & verified by setting my Excel application Visible.
CONSTANTS: c_xldown VALUE -4121.
DATA: w_xlrng TYPE ole2_object, w_xlendrng TYPE ole2_object.
GET PROPERTY OF w_xlrng 'End' = w_xlendrng
EXPORTING
#1 = c_xldown.
The above code sets SY-SUBRC to 4.
Does anyone know how to implment this capability?
Many thanks,
Tim
‎2010 Sep 14 3:32 PM
Can we know the reason for this.
May based on your requirement some other opition we can given.
‎2010 Sep 14 4:04 PM
Solved my own problem, which was caused by incorrect constant definition.
This works:
CONSTANTS: c_xldown TYPE i VALUE -4121.
" (code omitted) ... open file, position selection at row & column where data starts
GET PROPERTY OF w_xlrng 'End' = w_xlendrng
exporting
#1 = c_xldown.
The problem was, without TYPE i, the default data type was c, which resulted in incorrect information being sent to Excel.
My overall goal is to read a very large Excel spreadsheet into a table without running out of memory - I was getting short dumps when the system was unable to extend internal table space. The End(xlDown) property wasn't absolutely required, but I wanted to provide the user some feedback as to how we're progressing by counting rows before actually processing them.
Thanks,
Tim