The API command SAPInsertLine is available since version 2.2 SP3 of Analysis for Office. With this function you can insert a new line into a crosstab. There are five input-parameters available:
- RuleID
- Data Source Alias
- Position
- PositionBy
- PositionBy parameters
You can define the RuleID, if you do not define an ID, the system generates one automatically. As Data Source Alias, you have to enter the data source alias, e.g. DS_1. As Position you can choose between Before, After, BelowHeader or BesideHeader. For PositionBy you can enter one of the following elements:
- Dimension
- DimensionResult
- DimensionGroup
- DimensionMember
- HierarchyNode
- Tuple
Here is an example code, more detail information can be found in my book. This code insert a new line after the dimension 0Material.
1 2 |
Dim ret As String ret = Application.Run("SAPInsertLine", "NewLine1", "DS_1", "After", "DIMENSION", "0MATERIAL") |

This example code insert a new line before the dimension 0Material.
1 2 |
Dim ret As String ret = Application.Run("SAPInsertLine", "NewLine1", "DS_1", "Before", "DIMENSION", "0MATERIAL") |

More examples can detailed information can be found in my book SAP Analysis for Office - The Comprehensive Guide.
These posts might also be interesting:
author.
I am Tobias, I write this blog since 2014, you can find me on twitter and youtube. If you want you can leave me a paypal coffee donation. You can also contact me directly if you want.


Write a comment