Use Case
A where-used list should be made for each of the selected documents. The result is displayed per document in a separate SAP ECTR object list.
Solution
How to create the „where used“ macro
- Create a new macro document
- Right mouse click (RMB) on the newly created document and click “Edit Macro”
In the popup window paste the following code inside the { } of function main()
kl = KEYLIST_FROM_CONTEXT( "active", "selected", "doc" ) // Get all selected documents for (var i=0; i<=kl.length-1; i++) { // Loop over all selected documents is = CREATE_SET(kl[i]) // Create a Set per document os = TRANSFORM_SET( is, "where_used") // Perform the "where used" search rl = KEYLIST_FROM_SET( os ) // Put the result in a Keylist WRITE_OBJECTLIST(rl, kl[i] ) // Create an object list per document with the results inside }
- Result
- Now highlight one or more documents in the Desktop or Assemblies window and click the green arrow in the macros window.
- As a result for each highlighted document an object list is created.
Remarks
This macro is just a demonstrator. It has to be refined. For example:
- Error handling
- Do not return folders
- Better naming of object lists
- Creating contextual menu entries ( fnc.execute.macro() )
- ...
Links
For more information about SAP ECTR macros :
- Macros in SAP ECTR - Theory and Practice (a short Tutorial) - Product Lifecycle Management - Community Wiki
- SAP Engineering Control Center - SAP Help Portal
- look for the Operations Guide