ABAP – Hierarchical View Clusters

SAPThis article is a tutorial on how to create a View Cluster on top of SAP tables. It is extremly useful when you have several SAP tables with hierarchical dependency. This hierarchy is nicely visible on eg. MARA -> MARC -> MARD tables where the KEY grows from MATNR (MARA table) to MATNR + WERKS (MARC) to MATNR + WERKS + LGORT (MARD). To view/edit data using this hierarchy folding you can use the “View clusters” approach.

What is View Cluster

  • View cluster is a set of objects (views, reports or tables) which belong to one business function.
  • The underlying data can be arranged either hierarchically or non-hierarchically in view cluster.
  • A view-cluster transaction edits the complex cross-table data in a view cluster.
  • The transaction navigation box shows the complex business object with its components or sub objects.

Steps to create View Cluster on SAP tables

  1. Create Maintenance views for all tables to be involved in the view cluster (ZMM_VMARA, ZMM_VMARC, ZMM_VMARD).
    Create maintenance viewsView on MARA table

    Fields to be displayed in view

  2. For MARC and MARD set the maintenance attribute ‘P’ for fields MANDT and MATNR (for MARC), MANDT, MATNR and WERKS for MARD to value ‘S’ – this means that such fields will be used from the upper hierarchy levels and will not be displayed in detail view.
    Field Maintenance statusField Maintenance status set for MARD view
  3. Run Table Maintenance Generator on all created Views and let the code be generated into one common FUGR called let’s say ZMM_FG_MATMAS
    Each view will have one-step maintenance type and each view must have different maint.screen number (let’s say, 0001 for ZMM_VMARA, 0002 for ZMM_VMARC and 0003 for ZMM_VMARD)
    Maintenance generator for view on MARA 

    Maintenance generator for view on MARC Maintenance generator for view on MARD

  4. Create View Cluster
    1. Run TCode SE54 and create new View (ZMM_VC_MATMAS)
      Creating View cluster
    2. Navigate to “Object Structure”, add your views with proper dependencies(predecessor), position, short description and other parameters and select the starting view
      View cluster setup
    3. For each line with View details in “Object Structure” select the row and click on “Field Dependencies” button to generate dependent fields automatically
      Generating field dependencies
    4. Save and Activate your new View Cluster
      Activating view cluster

Testing View Cluster

Run TCode SE54, go to Edit View Cluster screen, type in your cluster view name and press the Test button.

Testing view cluster

We created the view cluster on tables MARA, MARC and MARD. Therefore we can see that all three levels are visible in the left side pannel. The screenshot below displayes entries of the table MARA.

View cluster on MARA
In order to see the corresponding Plant details for some material, just select an entry and double click on Plant details in the left navigation.

The plant details are now visible, but in our example screenshot the selected material is not maintained on any plant. In the header of the right part of screen you can see the material – dependent field transferred automatically from MARA view after our selection.

View cluster on MARC

Using the same approach you can see the storage location details – you just select an entry in the list on right side and double click on Storage details in the left navigation window.

If we had enough testing data the Material selected in the Material details view and the Plant selected in the Plant details view would be displayed on top of the right part of screen as header entries.

One thought on “ABAP – Hierarchical View Clusters

  1. Thank you very much for the guide. It is very complete. I have only one problem and I would like to consult. Whenever I navigate between folders the system asks me to enter the client number. What should I do to avoid this?

Leave a Reply