Page tree
Skip to end of metadata
Go to start of metadata

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

  1. Create a new macro document
  2. Right mouse click (RMB) on the newly created document and click “Edit Macro”
  3. In the popup window paste the following code inside the { } of function main()

    1. 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
      	}
  4. Result
  5. Now highlight one or more documents in the Desktop or Assemblies window and click the green arrow in the macros window.
  6. 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() )
  • ...

For more information about SAP ECTR macros :


  • No labels