Thomas Weller
Thomas Weller

Reputation: 59279

Difference between getColumnHeaders(), getColumnNames() and getColumnTitles()

I am automating tests using Silk4J. For the SapTree [MicroFocus] class, there are the methods getColumnHeaders() [Microfocus], getColumnNames() [MicroFocus] and getColumnTitles() [MicroFocus].

The description of them is very similar and I'm trying to understand the differences.

What I found out so far:

This is how my tree looks like in SAP GUI (called a column tree):

SAPTree screenshot

This is the difference between name and header - in my case is just in the first column:

Column name:   ZMAPP_STEXT
Column header: HierarchyHeader
Column name:   ORG_OBJID
Column header: ORG_OBJID
Column name:   ORG_SHORT
Column header: ORG_SHORT
Column name:   ORG_BEGDA
Column header: ORG_BEGDA
Column name:   ORG_ENDDA
Column header: ORG_ENDDA
...

I have tried:

So, what is the difference between getColumnHeaders(), getColumnNames() and getColumnTitles()? In which situation do I need which method? Does it depend on the tree type?

Upvotes: 1

Views: 1387

Answers (1)

Thomas Weller
Thomas Weller

Reputation: 59279

This answer is for Silk4J only, I have not tried to use the SAP scripting directly.

getColumnHeaders()

getColumnHeaders() returns a list of all columns which are theoretically available. Some of them may have been unselected by the user via column configuration. Even if unselected, this method returns all technical column names, not the human readable names displayed on the screen.

SAP GUI column configuration

Some checkboxes in the column configuration dialog correspond to two columns in the tree. In the screenshot above, the checkbox at Gültigkeitszeitraum triggered both ORG_BEGDA and ORG_ENDDA columns. So the number of columns in the tree is not 1:1 related to the number of checkboxes in the column configuration.

It is not possible for the user to remove the first column, reported as HierarchyHeader by this method. There is no checkbox for it in the dialog.

Example column headers to compare with other methods:

HierarchyHeader // this seems to be a fixed text for the first column
COL2 // here: ORG_OBJID for the Id column 
COL3
COL4
COL5 // here: ORG_SHORT for the "Kürzel" column
...
COL14

getColumnNames()

getColumnNames() returns a list of those columns currently displayed in the tree, i.e. selected by the user via the column configuration.

Important to know: the column names list is then padded to the left with null items. You cannot call getColumnIndexFromName() and getColumnTitleFromName() with null as parameter.

Example output:

COL1 // corresponds to HierarchyHeader but is not the string "HierarchyHeader"
COL2 // here: ORG_OBJID
COL5 // here: ORG_SHORT
COL9 // here ORG_BEGDA
COL10 // here: ORG_ENDDA
null
...
null

getColumnTitles()

getColumnTitles() in Silk4J returns exactly the same result as getColumnHeaders(). This is a bit odd, because the method getColumnTitleFromName() returns the human readable text displayed on the screen, which suggests that getColumnTitles() should do that as well.

This does not seem to be a bug in Silk4J, since it uses the correct property name to get it from the SAP scripting automation (decompiled JAR):

Silk4J decompiled JAR

Upvotes: 2

Related Questions