Purpose
Possibility to filter the folderstructure based on a specifc folder in structure with spoecific filter criterias (e.g. released folders based on the status).
The following page describes a step-to-step guide.
1 Create a Macro Document
Folder -> New -> Document
Select DType Group “MACRO” and DType “Script Macro”
2 Define the Macro
Select Macro Document -> Edit Macro
Add the following Macro Script:
folder = KEYLIST_FROM_CONTEXT("ctx_desk", "selected", "DOC")
inputFolder = CREATE_SET(folder)
// collect all subfolders
allComponents = TRANSFORM_SET(inputFolder, "expand_structure")
// remove top folder (inputFolder)
subfolders = OPERATION_SET("symmdiff", allComponents, inputFolder)
// filter subfolders
filterParameters = PARAMETER_MAP( "doc_filter_fields" )
filterParameters.DOKAR = "FOL"
filterParameters.DOKST = "FR"
filteredComponents = FILTER(subfolders, "DOC", filterParameters)
// add objects to object list
filteredFolders = KEYLIST_FROM_SET(filteredComponents)
WRITE_OBJECTLIST(filteredFolders, "Filtered Folder")
3 Add Macro as Function in the Menu
It is possible to add a macros as function in the menu.
Therefore a generic function is in place:
fnc.execute.macro(<SAP-KEY>)
In our Example the Macro is stored in the Document with the SAP-KEY AUX000000000000000100011263300MCR
The function has to be added in the menu.guidef (...\customize\config\) as fnc.execute.macro(AUX000000000000000100011263300MCR):
4 Dictionary
Add dictionaries in customer.txt (...\customize\dictionary\<language> \):
fnc.execute.macro(AUX000000000000000100011263300MCR) = Filter Folderstructure as Object List
5 Icons
Add icons in customer_icons.txt (...\customize\aux-files):
fnc.execute.macro(AUX000000000000000100011263300MCR) = {0}/sap/filter
6 Use Function
The function can be used:
The function explodes the folderstructure (based on selected folder) on specific parameters (in our case Status = “FR”) and shows all folders with the specific parameters single level in an object list.
Note: The current solution explodes the folderstructure multi-level but shows the filtered folders as a single-level list.