Skip to Content

Email Notes are standard feature available in SAP (XK01/XD01) but are not available in MDG UI. Make this feature available.


Email Notes are standard functionality in ECC (Vendor/Customer). All the Notes/Remarks against email will get saved in the ADRT Table. However, this feature is not available in the MDG (till v9.0). As many of the current organization still uses the Notes/Remarks, so it kind of important to have this feature available in MDG UIs.

Requirement / Screen Overview:

Let’s take an example of ERP Vendor Screen on MDG. Below Screen overview will give you comparison of MDG screen with Current & Expected Screen after the solution.

Current MDG Screen:-


Expected MDG Screen:-



The below solution is done for Notes/Remarks field only for Email Segment. As we all know Telephone and Fax can also have their own Remarks field. The same solution can be extended to make it available for Telephone & Fax respectively.

Solution is divided into 6 steps. follow them carefully.

Step 1) Standard Structure which can carry the Notes Data & hold it during the CR preparation. This structure is used in the Handler Class to transfer the Data.

Good think about this development, that back-end structures already contains the REMARKS Table which can hold the Notes provided in the E-mail section. We are going to re-use those structures. Field representation is given in the below structures. Have a look at that.

In structure MDG_BS_BP_TT_ECC_EXTERN identify the relevant substructure.

Structure: BUS_EI_EXTERN


Actual Navigation Stack mentioned down below

Structure for Remark

We are going to use the highlighted field to store the Notes in the API.


Step 2) Active(Reuse) Area for Notes.

For this Development, we are going to use ADRT table as active area for Notes. Just have a look at the table/field which will be used.


Step 3) Extend the MDG-S/C data model with new attribute “Notes” under Email Entity.

While change requests are in process, the data is stored in the MDG staging area. Therefore, you must extend the BP data model accordingly. The necessary steps are outlined in this section.  As we are enhancing the standard entity, We just need to create one custom attribute and generate the structures.

Add Custom Attribute under AD_EMAIL entity. (The Structure BSS_ADIL_COMM_EMAIL_ATTR is enhanced in Step 4. Just Activate the data model with blank reference & later after Step 4, come back again & put the reference structure & activate it again).

Activate the Data Model, after activation, you should see the Staging Area for this entity like below:-

To Check the Staging Area: Use SE38.

Double Click on the Entity Type

After the above step, Generate the Data Model Structures

Select these 5 below and press Generate Button

After successful generation, you will have the custom field created in the standard structures created in the system

Last point in this step is to ADJUST THE STAGING AREA (optional), but it is important to perform this step if data model is changed



Step 4) Genil Model – As this is a Standard Entity/Object, we need to extend the attribute structure used by Genil Object for E-mail



Open Enhancement: BUPA_CUSP

Double Click the Attribute Structure.

In the Standard structure, Use Append Structure technique to Append a new structure ZMDG_SMTP_NOTES_GENIL like Below

Activate the structure.

NOTE: If you remember this Genil Structure is used in the data model against that custom attribute ZZNOTE used for highlighting changes.


Step 5) Extending the MDG-S User Interface to incorporate this Field in the List UIBB for Workplace E-mails

1. Start transaction SE80.

2. Search for Web Dynpro Component FPM_LIST_UIBB

3. Locate and open the Component Configuration BS_BP_ADDRESS_EMAILS

4. Display the Configuration

5. Create new customizing: – New field is coming from the Genil structure. Use that to create a new column

6. Save your changes



You have extended MDG-S to handle a new field ZZNOTE. Till this step, you can do all the functionality, add a new row, delete a row or change a row (with Notes) and save the CR. All the data is saved in the Staging Tables. You can open the CR and check the data again in the list. Everything is working fine. Except this solution is only half complete. When the CR is approved, the data would be removed from the Staging Area and because no SMT Mapping is available, so data will not move into active area (ADRT).

The Next Step (6) is the rest of the solution. It will move the staging data to the active area (ADRT), and bring the active area data to the UI.


Step 6) Custom Handler Class to do the mapping from Active Area(ADRT) to the UI and then During Approval, API to Active Area (ADRT)

  • Create Your Own Handler Class



  • Register the Handler Class to the BP Data Model

T:Code – SM30

  • Implement the Custom Handler to do the SMT Mapping.

Redefine all the below method of the class.

NOTE: We are not redefining the SAVE_ADDITIONAL_OBJECT_DATA! Remember we are using the standard structures in the Step 1. This is the reason of using Standard structures, if we populate these structures in this Class, Standard will take care of saving the data directly into ADRT table. As it’s a standard flow of data

Method Redefinition below:

  METHOD if_mdg_bs_bp_access_handler~read_object_data.
    DATA : lv_adrnr  TYPE ad_addrnum,
           lt_return TYPE TABLE OF bapiret2,
           lt_adrt   TYPE TABLE OF adrt.

    CALL METHOD super->if_mdg_bs_bp_access_handler~read_object_data
        it_idlist   = it_idlist
        iv_read_all = iv_read_all.

* Read the Vendor Number
    READ TABLE it_idlist ASSIGNING FIELD-SYMBOL(<ls_idlist>) INDEX 1.
    CHECK sy-subrc EQ 0.

    DATA(lv_bp) = <ls_idlist>-bpartner.

* Get the ADRT Data into the internal structures
    READ TABLE gt_bp_data_db ASSIGNING FIELD-SYMBOL(<ls_data>)
          WITH KEY partner-header-object_instance-bpartner = lv_bp
          BINARY SEARCH.
    IF <ls_data> IS ASSIGNED.
      "Read the Address of the Business Partner
      READ TABLE <ls_data>-partner-central_data-address-addresses ASSIGNING FIELD-SYMBOL(<fs_address>) INDEX 1.
      CHECK sy-subrc = 0.

      IF <fs_address>-data-communication-smtp-smtp IS NOT INITIAL.   "Fetch the ADRT data only for the 1st Time.
* Read the ADRNR from the BP number
        "ADRT Data should be fetched based on the ADRNR & CONSNO.
        <fs_address>-data-zzsmtp_notes-CURRENT_STATE = abap_true.
        DATA(lv_error)  = abap_false.
            businesspartner       = lv_bp
            standardaddressnumber = lv_adrnr
            return                = lt_return.

        LOOP AT lt_return INTO DATA(ls_reutrn) WHERE type EQ 'E'.
          lv_error  = abap_true.

        CHECK lv_error EQ abap_false.

* Read the ADRT Data for this Address Number
        SELECT * FROM adrt INTO TABLE lt_adrt WHERE addrnumber = lv_adrnr
                                              AND persnumber EQ space.
        IF sy-subrc EQ 0 AND lt_adrt IS NOT INITIAL.

          " Fill the REMARKS structure of the SMTP Componenet of the Internal Strucutre
          LOOP AT <fs_address>-data-communication-smtp-smtp ASSIGNING FIELD-SYMBOL(<fs_smtp>).
            READ TABLE lt_adrt INTO DATA(ls_adrt) WITH KEY consnumber = <fs_smtp>-contact-data-consnumber.
            IF sy-subrc = 0.
              READ TABLE <fs_smtp>-REMARK-remarks ASSIGNING FIELD-SYMBOL(<fs_remark>) INDEX 1.
              IF sy-subrc = 0.
                <fs_remark>-data-langu      = sy-langu.
                <fs_remark>-data-langu_iso  = 'EN'.
                <fs_remark>-data-comm_notes = ls_adrt-remark.
  METHOD if_mdg_bs_bp_access_handler~get_object_data_by_entity.
    CALL METHOD super->if_mdg_bs_bp_access_handler~get_object_data_by_entity
        iv_entity    = iv_entity
        iv_partner   = iv_partner
        er_data      = er_data
        ef_not_found = ef_not_found.

    CASE iv_entity.
      WHEN if_mdg_bp_constants=>gc_bp_model_entity-address_email.       "AD_EMAIL entity
        "search the requested business partner in the buffer
        READ TABLE gt_bp_data_db ASSIGNING FIELD-SYMBOL(<ls_data>)
          WITH KEY partner-header-object_instance-bpartner = iv_partner
          BINARY SEARCH.
        IF <ls_data> IS ASSIGNED.
          GET REFERENCE OF <ls_data> INTO er_data.
          ef_not_found = abap_false.
          CLEAR er_data.
          ef_not_found = abap_true.
METHOD if_mdg_bs_bp_access_handler~map_data_2sta.

    DATA: lo_data TYPE REF TO   data,
          ls_smtp TYPE bus_ei_bupa_smtp.

    FIELD-SYMBOLS: <fs_gt_bp_data> TYPE mdg_bs_bp_t_fnd_extern,
                   <fs_partner>    TYPE bus_ei_extern,
                   <fs_remark>     TYPE bus_ei_bupa_comrem,
                   <fs_address>    TYPE bus_ei_bupa_address.

    CHECK <fs_partner> IS ASSIGNED.
    READ TABLE <fs_partner>-central_data-address-addresses ASSIGNING <fs_address> INDEX 1.
    IF sy-subrc = 0.


    CREATE DATA lo_data LIKE LINE OF ct_data.
    ASSIGN lo_data->* TO FIELD-SYMBOL(<ft_data>).
    CHECK <ft_data> IS ASSIGNED.

    CASE iv_entity.
      WHEN if_mdg_bp_constants=>gc_bp_model_entity-address_email.       "AD_EMAIL entity
        "search the requested business partner in the buffer
        " Read the Data from IS_DATA and push them in CT_DATA.
        LOOP AT ct_data ASSIGNING FIELD-SYMBOL(<fs_data>).
          CHECK <fs_bp> IS ASSIGNED.
          IF <fs_bp> IS NOT INITIAL.
            CHECK <fs_consno> IS ASSIGNED AND <fs_consno> IS NOT INITIAL.
            READ TABLE <fs_address>-data-communication-smtp-smtp INTO ls_smtp WITH KEY contact-data-consnumber = <fs_consno>.
            IF sy-subrc = 0.
              ASSIGN COMPONENT 'ZZNOTE' OF STRUCTURE <fs_data> TO FIELD-SYMBOL(<fs_zznote>).
              IF <fs_zznote> IS ASSIGNED.
                READ TABLE ls_smtp-remark-remarks ASSIGNING <fs_remark> WITH KEY data-langu = sy-langu.
                IF sy-subrc = 0 AND <fs_remark> IS ASSIGNED.
                  <fs_zznote> = <fs_remark>-data-comm_notes.

METHOD if_mdg_bs_bp_access_handler~prepare_ei_header_map_2api.
    CALL METHOD super->if_mdg_bs_bp_access_handler~prepare_ei_header_map_2api
        iv_entity   = iv_entity
        iv_task     = iv_task
        is_data     = is_data
        er_data_ext = er_data_ext
        ct_data_ext = ct_data_ext.
METHOD if_mdg_bs_bp_access_handler~map_data_2api.

    DATA : ls_notes_data        TYPE bus_ei_bupa_comrem.            " We are using Existing REMARKS structure which are already in API to store the chanegd data

    FIELD-SYMBOLS: <fs_partner> TYPE bus_ei_extern,
                   <fv_consno>  TYPE ad_consnum.

    CASE iv_entity.
      WHEN if_mdg_bp_constants=>gc_bp_model_entity-address_email.       "AD_EMAIL entity
        ASSIGN COMPONENT 'PARTNER' OF STRUCTURE cs_data_ext TO <fs_partner> .
        CHECK <fs_partner> IS ASSIGNED.

        READ TABLE <fs_partner>-central_data-address-addresses ASSIGNING FIELD-SYMBOL(<fs_address>) INDEX 1.
        CHECK sy-subrc = 0.

        " Get the CONS NO from the IS_DATA
        ASSIGN COMPONENT 'AD_CONSNO' OF STRUCTURE is_data TO <fv_consno>.
        CHECK <fv_consno> IS ASSIGNED AND <fv_consno> IS NOT INITIAL.

        " Get the ZZNOTES from the IS_DATA
        CHECK <fv_note> IS ASSIGNED AND <fv_note> IS NOT INITIAL.

        " Read the SMTP line based on the CONSNO.
        READ TABLE <fs_address>-data-communication-smtp-smtp ASSIGNING FIELD-SYMBOL(<fs_smtp>)
                                                             WITH KEY contact-data-consnumber = <fv_consno>.
        IF sy-subrc = 0.
* Task
          ls_notes_data-task = iv_task.
* Data
          ls_notes_data-data-langu       =  sy-langu.
          ls_notes_data-data-langu_iso   =  'EN'.
          ls_notes_data-data-comm_notes  =  <fv_note>.

* Append the Data
          APPEND ls_notes_data TO <fs_smtp>-remark-remarks.

        cv_xchange = abap_true.




This above solution is working for Email remarks, similarly telephone/fax entity can be enhanced with another custom field and using SMT mapping in custom handler, remarks can be populated against each field.

You must be Logged on to comment or reply to a post.
  • Hi Rohit,


    Thanks for detailed explanation step by step!

    I have similar requirement for ‘REMARK’ Address Notes Field in ADRCT Table.

    Therefore, wanted to know which Entity shall I enhance with custom field?



    • Hi Deepali,

      Go through the solution once. Understand each steps and you will understand that it is not only Entity but you need to check for the available back-end structures used in API. Corresponding Genil structure which you can use to map the field on the UI itself.

      To answer your question ‘BP_ADDR‘ is the entity which should be enhanced in order to accommodate the custom Remark attribute but then if you won’t understand the above solution, probably you will be finding it to difficult to map it to the relevant back-end structures in your custom handler.


  • Hello Rohit,

    Thanks a lot for the detailed step by step document.

    We have completed development up to step5 successfully. But after step 6 while opening Customer Search UIBB we are getting below exception via class/method CL_ABAP_STRUCTDESCR/CHECK_COMPONENT_TAB:

    Category ABAP Programming Error
    Application Component CA-MDG-AF

    Also for method READ_OBJECT_DATA we found one syntax error which we corrected by below code:

    *        <fs_address>-data-zzsmtp_notes-current_state = abap_true.  Commented 
    <fs_address>datacommunicationsmtpcurrent_state abap_true. Inserted 

    Need your valuable help in this regard to resolve above issue. Also please let us know if you faced similar issue after Registering the Handler Class to the BP Data Model.

    Thanks in advance!



    • Hi Amol,

      Thanks for correcting the syntax error. Yeah I used 2 systems and during copy code, got the wrong system code.

      As for the Exception during the Registering of Handler Class, it’s our custom code which sometimes can cause the Exception to appear.

      I didn’t face any exceptions during my POC, but yeah faced several exceptions (this type) during other custom entities. All I can say you need to debug the standard code.

      Issue is definitely coming from the Handler Class. Try by removing blank implementation of “IF_USMD_PP_BLOCKLIST~GET_BLOCKLIST_FOR_READ” & “IF_USMD_PP_BLOCKLIST~GET_BLOCKLIST_FOR_WRITE” methods.

      I implemented these methods because there was exception coming for my other entity & when I implemented these then exception goes away.

      Make sure you are using Super Class as “CL_MDG_BS_BP_HANDLER” and not “CL_MDG_BS_ECC_HANDLER”.

      Only Debugging can help here as in my system this solution is working fine.



  • Hello Rohit,


    I implemented the same for ‘REMARK’ Address Notes Field in ADRCT Table and its working correctly.


    Facing one issue – During BP creation process if Remark is empty during BP creation process then if I try to maintain Remark Value during BP change process then its getting cleared during change process.

    if Remark is maintained with some value during BP creation process then if I try to change Remark Value during BP change process then its working fine.


    To summarize the issue it is getting cleared during BP change process if I do not maintain any value during BP create process.


    • Hi Deepali,

      Please debug the handler class & put a breakpoint in the SAVE method when Approving the CR. The solution is working fine for both, create & change and for EMAIL ID, TELEPHONE, FAX everywhere.

      In your case, you are doing it for address. there must be something in there which is missing like IV_TASK value.



  • Hey Rohit,

    This solution doesn’t work when there are multiple addresses in address uibb. For example if i have 2 addresses under undress uibb and i have multiple E-Mail Addresses under each Address this doesn’t work. When i change one email notes it gets reflected to other address also. And deletion of an email address is also not working. The email address comes back. Tried a lot but couldn’t find any solution. Can you please test or let me know if you have faced this issue. Please check this scenario and let me know.

    • Hi Sreeni,

      Apologies for late reply, this solution is designed considering only 1 Address is available. However if you multiple address, then basically you need to find correct ADRNO for the address and emails linked to it. Then it should work.

      I can’t test the multiple address scenario, as we are strictly using 1 Address only and just to test multiple address, I need to change a lot in my box.