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




There are additional data fields (like the full name of the user who changed the object the last time) which shall be displayed at ECTR objects e.g. document or material master.





Show a special classification fields in ECTR level 1 data.


Show plant related or storage related data from several views in ECTR.





In the Backend a BAdI has to be implemented to determine that special data and return it to the frontend. This can be done with the following BAdI.



The value which should be added to an object has to be appended to the table out_customer_data.

Please see the example below how to fill this return table.

If you decide to use customer fields for a type of object in ECTR, you have to fill these fields for all instances of this object. E.g. it will have strange side effects if you fill a customer field key only for documents of dtype "PINT", but not for dtype "PEXT".

Example code for document info records:

DATA:       ls_document       TYPE /dscsag/doc_infolder,            ls_doc_data            TYPE bapi_doc_draw2,
            ls_return            TYPE bapiret2,
            ls_customer_data  TYPE  /dscsag/name_value_dokob,
            lv_classname         TYPE classname,   "<-- ARBITRARY CLASS NAME
            lv_charname       TYPE atnam,          "<-- ARBITRARY CHARACTER NAME
            lv_classtype         TYPE klassenart VALUE '017', "<-- ARBITRARY CLASS TYPE
            lt_char_val       TYPE TABLE OF bapi_characteristic_values,
            lt_cl_alloc       TYPE TABLE OF bapi_class_allocation.
FIELD-SYMBOLS: <ls_cl_char>  TYPE bapi_characteristic_values.
LOOP AT out_document INTO ls_document.
     CLEAR: ls_doc_data, ls_return,lt_cl_alloc[], lt_char_val[].
         documenttype         = ls_document-dokar
         documentnumber       = ls_document-doknr
         documentpart         = ls_document-doktl
         documentversion      = ls_document-dokvr
         getclassification    = 'X'
         GETDOCFILES          = SPACE
         INHERITED            = 'X'
         documentdata         = ls_doc_data
         return               = ls_return
         characteristicvalues = lt_char_val
         classallocations     = lt_cl_alloc.
     IF ls_return-type CA 'EA'.
 *          APPEND ls_return TO attr_returns[].
*    Always fill the name for the attribute
     CLEAR: ls_customer_data.
     ls_customer_data-dokob = 'DRAW'.
     MOVE ls_document-dokar TO ls_customer_data-objky+0(3).
     MOVE ls_document-doknr TO ls_customer_data-objky+3(25).
     MOVE ls_document-dokvr TO ls_customer_data-objky+28(2).
     MOVE ls_document-doktl TO ls_customer_data-objky+30(3).
     ls_customer_data-name = 'ARBITRARY_NAME'.   "<- CAN BE CHARACTER NAME HERE
     IF lt_cl_alloc[] IS NOT INITIAL AND
        lt_char_val[] IS NOT INITIAL.
       READ TABLE lt_cl_alloc TRANSPORTING NO FIELDS  WITH KEY classtype = lv_classtype classname = lv_classname.
       IF sy-subrc EQ 0.
         READ TABLE lt_char_val ASSIGNING <ls_cl_char>  WITH KEY charname  = lv_charname.
         IF sy-subrc EQ 0.
           ls_customer_data-value = <ls_cl_char>-charvalue.
       ENDIF. "lt_class_alloc
     APPEND ls_customer_data TO out_customer_data.  "<- ALSO ATTRIBUTE  WITH EMPTY VALUE CAN BE APPENDED

Performance Disclaimer

DISCLAIMER: This is an example to show how to use the BAdI Interface. The usage of the "fat" BAPI_DOCUMENT_GETDETAIL2 to read the classification in a loop will slow down performance of ECTR.
If you know what you have to do, better make a direct select from AUSP table to read the classification values with "FOR ALL ENTRIES IN".

Please don't open an SAP Incident complaining about performance issues if the cause is an implementation of this BAdI. The bad BAdI performance can be identified in apilog which e.g. looks like that:

           | DSC_BADI | 332160873 | FOL_OPENDETAILS_AFTER       | 0        | 20200320153238 | 
332160873  => 332160 ms => 332 s => more then 5 min !

Example code for materials:

DATA: ls_material       TYPE /DSCSAG/MATERIAL_TAB,
      ls_return         TYPE bapiret2,
      ls_customer_data  TYPE  /dscsag/name_value_dokob.
LOOP AT out_matnums INTO ls_material.
  CLEAR: ls_customer_data.
  ls_customer_data-dokob = 'MARA'.
  MOVE ls_material-material TO ls_customer_data-objky.
  ls_customer_data-name = 'ZMSTAE'.   "<- Must match with config in dictionary
  ls_customer_data-value = 'your new great value'.
  APPEND ls_customer_data TO out_customer_data.  "<- ALSO ATTRIBUTE  WITH EMPTY VALUE CAN BE APPENDED



The additional data are read in the backend and returned to the frontend with the upper BAdI.

Now the frontend has to be configured how to show this additional data in ECTR. In the configuration a mapping for customer_data has to be defined.

In the customer dictionary file must be defined how the fields of the returned structure should be named in ECTR:

Dictionary mapping for customer data fields
 # Dictionary mapping for customer data fields
# Customer fields for documents
plm.customdata.field.DRAW.ZOWNER = Owner
# Customer field for change number (AENR)
# plm.customdata.field.AENR.TRUCKLIST = Trucks
# Customer fields for materials
plm.customdata.field.MARA.ZMSTAE = Z - Status


There are other data which is send from backend without any need to implement a BAdI. E.g. the append structure to the table AENR or the append structure to table STPO (via CI_STPO).

This data can be addressed in this way for materials and change numbers.



# Shop CI_STPO - fields in assemblies window
      plm.docstructure.showZfields = ZZBOMREL;  

# Show CI_STPO - fields in BOM window = ZZPFAD 



Mapping of Z fields in customer specific CI - dictionary
#Mapping of Z fields in customer specific AENR - append
plm.ecm.customerfield.ZZPSPNR = WBS Element
#Mapping of Z fields in customer specific CI_STPO for document structure window
plm.docstructure.mapping.ZZBOMREL = ZZ Bom Relevant
#Mapping of Z fields in customer specific CI_STPO for BOM window
plm.customdata.field.STPO.ZZPFAD = ZZ BOM Path


Adding a new property to materials (screenshots)

  1. Implement the example code for material as described above.
    Now ECTR has a new field:

    If this is the display, you have forgotten to add a specific name into the dictionary.

  2. Fill the customer.txt to name the field

  3. Open the Preferences in the Object Browser:

    The name has changed as intended

  4. Select your value, add it to displayed columns and press 'Apply':

  5. Now ECTR shows your value in the Object Browser:


  1. Former Member

    Hey Martin,

    I am trying to implement the above solution but I cant get this to work. I tried setting a break point in the code and it doesnt activate. Is there an updated badi / method that is used

    1. Hi Travis,

      this feature works at a lot of customers. (smile) Maybe your BAdI - Implementation is not activated.

      1. Hey Sebastian,

        i think Travis is right. The BADI  /DSCSAG/FOLDER_01 is called no more (since 2015) and the new BADI that should be used to accomplish this function is in the enhancement spot /DSCSAG/PLM_DOCUMENT → BADI Name /DSCSAG/ENH_DOC.  The Method call FOL_OPENDETAILS_AFTER  from the BADI /DSCSAG/FOLDER_01 is commented out in your code.

        1. Hi Andrzej,

          jup, you are right. But BAdI /DSCSAG/ENH_DOC has a fallback class /DSCSAG/CL_ENH_DOC which calls the old classic BAdI. In Method /DSCSAG/IF_ENH_DOC~FOL_OPENDETAILS_AFTER the classic BAdI /DSCSAG/FOLDER_01 with method fol_opendetails_after is called.

          But if there is an other implementation of BAdI /DSCSAG/ENH_DOC the fallback class is not called any more.