简体   繁体   中英

How to remove all displayed columns of ALV layout

I am using a script to export data from SAP to Excel. The goal is to make this macro work for anyone that would attempt to run it, however, if they have a different SAP layout then the macro is messed up. Digging through the code it looks like SAP is assigning a number value to each row. So the macro runs the SAP transaction, then changes the layout and dumps all of the displayed columns in the layout over to the right based on which number it's referencing. Now this works fine when I run it because the final column is always the same, but if someone with a different layout were to run it then they would only remove some of the fields.

What I'm wondering is if there is a way in VBA to select all of the rows or completely clear the "Displayed Columns" bucket, rather than the current code which is:

session.findById(PLACEHOLDER).selectedRows = "0-27"

Basically, I need a blank slate to have the macro set up the export properly but I'm struggling to give everyone the same blank slate if they have a different SAP layout.

显示列 - 空

Any help is appreciated.

Thanks.

Found the answer shortly after posting. Instead of using:

.selectedRows = "0-27"

I used:

.selectAll

This grabbed everything in the field so I could then repopulate with the information I needed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM