cancel
Showing results for 
Search instead for 
Did you mean: 

Using SAPSetFormat with HierarchyNode

0 Kudos

Hello All,

I am trying to use SAPSetFormat using a HierarchyNode to create a Design Rule that styles the data of top node.

Below code is not working.

lResult7 = Application.Run("SAPSetFormat", "Style7", "DS_1", "Good", "HierarchyNode", "ZPROFCTR", "SW_PCA", "SW100")

lResult8 = Application.Run("SAPSetFormat", "Style8", "DS_1", "Good", "TUPLE", "HierarchyNode;ZPROFCTR;SW_PCA;SW100")

My hierarchy is on ZProfCtr where parent node is SW_PCA and SW100 is Profitcenter

Please help.

Regards,

MLPN

Accepted Solutions (0)

Answers (3)

Answers (3)

former_member283567
Participant
0 Kudos

I figured it out.
The following SAPSetFormat syntax can be used for a hierarchy text node:

Dim sResult As String
sResult = Application.Run("SAPSetFormat", , "DS_1", "SAPExceptionLevel5", "HIERARCHYNODE", "/ERP/GL_ACCT;Z410111100;Text Node")

  • It seems you cannot use wildcards to format multiple nodes at once.

I figured out it is all much easier than I thought:

Just create Excel styles with the naming convention SAPHierarchyCell0 - SAPHierarchyCell7.
When they exist, they are automatically used by AfO! It can't be easier 🙂

Be aware:

  • Hierarchy level 1 gets style SAPHierarchyCell0, etc.
    If hierarchy styles with the correct naming convention exist until level 3 (
  • If hierarchy styles with the correct naming convention exist until level 3 (SAPHierarchyCell2) AfO also uses this lowest style for the lower hierarchy levels.

To my understanding (I might be wrong):
If you just want an alternating hierarchy row style: Make sure no Excel styles exist in your style set with the naming convention SAPHierarchyCell0 - SAPHierarchyCell7 (delete them if they exist) and create hierarchy styles SAPHierarchyCell and SAPHierarchyCellOdd, just with Excel style functionality.

SAP cell styles

former_member283567
Participant
0 Kudos

Hello,
What is the SAPSetFormat syntax for a hierarchy text node?

I tried the following with no success:

Dim lResult As Variant
lResult = Application.Run("SAPSetFormat", "Format_14", "DS_1", "SAPExceptionLevel5","HIERARCHYNODE", "/ERP/GL_ACCT;Z410111100;0HIER_NODE")

Debugging SAPListOfDesignRules gives me:
HierarchyNode(/ERP/GL_ACCT;+Z410111100(Text Node)) + Dimension(/ERP/GL_ACCT)

Dim lResult As Variant
lResult = Application.Run("SAPListOfDesignRules", "DS_1", "Format")

However, copying the exact string does not work either.
Help is much appreciated.

Regards,
Bart.

0 Kudos

If you have a hierarchy on product group (0D_NW_PRDGP) like on the screenshot below, the product category (0D_NW_PRDCT) T is a hierarchy node.

use the following makro to format it in the crosstab:

Sub SetFormat()

Dim sResult As String

sResult = Application.Run("SAPSetFormat", "Format1", "DS_1", "SAPExceptionLevel5", "HIERARCHYNODE", "0D_NW_PRDGP;T;0D_NW_PRDCT")

End Sub

It is helpful to set the format manually and then debug it with SAPListOfDesignRules to check the parameters used.