Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
former_member230136
Contributor

Introduction:


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:-



 

Solution:


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



Structure: BUS_EI_CENTRAL_DATA















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

RUN the report USMD_ADJUST_STAGING

 

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


GENIL ENHANCEMENT:

T-code: GENIL_MODEL_BROWSER or GENIL_MODEL_EDITOR

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


 

Result

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


Class: ZCL_MDG_BS_BP_HANDLER



 

  • 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
EXPORTING
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.
CALL FUNCTION 'BAPI_BUPA_ADDRESSES_GET'
EXPORTING
businesspartner = lv_bp
IMPORTING
standardaddressnumber = lv_adrnr
TABLES
return = lt_return.

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

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.
ENDIF.
ENDIF.
ENDLOOP.
ENDIF.
ENDIF.
ENDIF.
ENDMETHOD.

  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
EXPORTING
iv_entity = iv_entity
iv_partner = iv_partner
IMPORTING
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.
ELSE.
CLEAR er_data.
ef_not_found = abap_true.
ENDIF.
WHEN OTHERS.
RETURN.
ENDCASE.
ENDMETHOD.

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.

ASSIGN COMPONENT 'PARTNER' OF STRUCTURE is_data TO <fs_partner>.
CHECK <fs_partner> IS ASSIGNED.
READ TABLE <fs_partner>-central_data-address-addresses ASSIGNING <fs_address> INDEX 1.
IF sy-subrc = 0.

ENDIF.

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>).
ASSIGN COMPONENT 'BP_HEADER' OF STRUCTURE <fs_data> TO FIELD-SYMBOL(<fs_bp>).
CHECK <fs_bp> IS ASSIGNED.
IF <fs_bp> IS NOT INITIAL.
ASSIGN COMPONENT 'AD_CONSNO' OF STRUCTURE <fs_data> TO FIELD-SYMBOL(<fs_consno>).
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.
ENDIF.

ENDIF.
ENDIF.
ENDIF.
ENDLOOP.
WHEN OTHERS.
RETURN.
ENDCASE.
ENDMETHOD.

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
EXPORTING
iv_entity = iv_entity
iv_task = iv_task
is_data = is_data
IMPORTING
er_data_ext = er_data_ext
CHANGING
ct_data_ext = ct_data_ext.
ENDMETHOD.

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
ASSIGN COMPONENT 'ZZNOTE' OF STRUCTURE is_data TO FIELD-SYMBOL(<fv_note>).
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.
ENDIF.

cv_xchange = abap_true.
WHEN OTHERS.

ENDCASE.
ENDMETHOD.





 

Result


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.
26 Comments
dnande
Explorer
0 Kudos
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?

Deepali

 
former_member230136
Contributor
0 Kudos
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.

Thanks,
Rohit
amol_korde
Explorer
0 Kudos
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
Runtime Errors UNCAUGHT_EXCEPTION
Except. CX_SY_STRUCT_COMP_NAME
ABAP Program CL_MDG_BS_GUIBB_DQUERY========CP
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>-data-communication-smtp-current_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!

Regards

Amol
former_member230136
Contributor
0 Kudos
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.

Thanks,
Rohit

 
dnande
Explorer
0 Kudos
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.

 
former_member230136
Contributor
0 Kudos
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.

 

Cheers,
Rohit
0 Kudos
Hi Deepali,

Try to use entity AD_POSTL in place of BP_ADDR, working fine for me.

Thanks

Sachin Kapoor
Former Member
0 Kudos
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.
former_member230136
Contributor
0 Kudos
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.

Thanks,

Rohit
former_member220448
Participant
0 Kudos
Hi Rohit,

This is a very good post, Congrats!!

I need to display infotype BP3100, and already implamented CL_MDG_BS_BP_HANDLER class, I wonder which of the methods are mandatory to display the data I need?

Any input will be much appreciated.

Regards,

Nico.-
0 Kudos
Hi Deepali,

 

May I know the steps you take to get this work? I have the same requirement for Remarks field for ADRCT.

 

Regards,

Onyx
former_member348109
Discoverer
0 Kudos
Hi Sreenivas,

We are facing the same issue. Could you please let us know if you did any changes to code to to make it work with multiple E-mail IDs.

 

Thanks in advance.

 

Regards,

Ramana
0 Kudos
Hi Deepali,

 

May I know if you have solved this issue. I have the same issue for change process.

Your inputs would be of great help

Lav
0 Kudos
Hi All,

I tried to implement the above steps but I am facing the below dump when trying to add the custom handler in STEP-6.

Your inputs would be highly appreciated.

 

Thanks & Regards,

Selma Jose
former_member230136
Contributor
0 Kudos
Hi Aswin,

While implementing custom handler, the first thing that you need to do is just create a custom class with super class(as defined), and register this custom handler in view 'V_MDG_BS_BP_HDL' and then test. There should not be any dump.

Now add the custom code in each of the method which I mentioned. and then test again.

Cheers,

Rohit

 
0 Kudos
Hi Rohit,

 

I have completed till step 5 and could see the field in UI now but the moment I register the custom handler in the view ‘V_MDG_BS_BP_HDL‘ I get the below dump:


"UNCAUGHT_EXCEPTION" "CX_SY_STRUCT_COMP_NAME"

"CL_ABAP_STRUCTDESCR===========CP" or "CL_ABAP_STRUCTDESCR===========CM00E"

"CHECK_COMPONENT_TABLE"

Multiple Specification of the Name 'MCCITY1' as a Component Name (Component 3)


Could you please help me fix this?

Thanks & Regards,

Selma Jose
0 Kudos
Hi Selma, I resolved this issue redefining the GET_QUERY_PROPERTIES method in the Z Class, I Hope works.

Kind regards.

Martin Trejo.

0 Kudos
Hello Rohit,

Thanks for the wonderful document. We have implemented your steps, it works absolutely fine for the update scenario. The data transfer is also fine from staging to active area. But, when we try to create a new business partner, we are getting the error "BP role FLVN00 already exists for partner".

We debugged, we found out that the roles are getting updated twice, one from standard class and another from our custom handler class. Could you please let us know if there is a way to fix this.

We are getting the error from the class-"CL_MDG_BS_ECC_BP_CHECK"

 

Regards,

Prathipan
0 Kudos
HI Rohit,

 

We are on SAP MDG 1909 version. We followed all the steps mentioned in this blog but we are facing an issue.

 

The issue is that the value entered in the Notes field is getting cleared as soon as we hit the ENTER. Do you have any idea what might be causing it ?

 

Regards,

Srikanth
0 Kudos
Issue fixed after we redefined the method- IF_MDG_BS_BP_ACCESS_HANDLER~SORT_ENTITIES

 

Thanks,

Prathipan
former_member766001
Discoverer
0 Kudos
HI Deepali,

Have you found the solution. We have same issue and data disappears when adding remarks to existing Vendor. I tried changing task I but it does not work
former_member818539
Discoverer
0 Kudos
Facing the same issue. Have you found a solution for it?
former_member844700
Discoverer
0 Kudos

This is a late reply, but replying for others who would face issue and come here.

This document and solution is still valid in SAP MDG 2022 Version, considering other issue fixes mentioned in comments.

This particular issue of field getting cleared happens when you use the standard data element AD_REMARK2 in Data Model. Standard data element has default component in it as COMM_NOTES. So it empties the new custom field, and fills the standard UI field. Which fails the purpose.

Create a custom Data Element with Domain TEXT50.

Assuming rest of the steps are followed correctly.

 

 

Manikandaraja
Explorer
0 Kudos
For the issue field getting cleared.

If we are using custom data element at the Data Model level then we should use the same data element for that custom component at the Genil structure BSS_ADIL_COMM_EMAIL_ATTR.

Otherwise even with custom data element only at the data model level will not resolve this issue.

 

Thank you.

Regards

Mani
karthik_sub
Participant
0 Kudos
Hi Team,

I want to bring the So10 text model in mdg ui screen for 'Create Customer' screen.

So that i can feed long text(so10) in ui screen and can i have some suggestion to achieve the same.

I have planned to do the below model.

  1. To create a custom Entity with a attribute of String

  2. Follow the steps suggested in this.


Kindly suggest me the same.

 

Regards,

Karthik S
hardikbhatia
Discoverer
0 Kudos

Was anyone able to achieve the deletion scenario where there are multiple email addresses. In our case, On CR Activation, the deleted entries from the MDG UI, come back on the screen again and aren't removed from DB tables.

Labels in this area