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: 
100564339788
Explorer
The purpose of this article is to explain the developers how standard MCF service(ERP_ISU_UMC) can be utilized to  incorporate the custom requirements.

SAP NetWeaver Gateway  Service model extensibility can be achieved on different levels :

  1. OData entity structure extension(Using append structure to add custom fields)

  2. OData entity logic extension(for example , adding additional validations)

  3. Addition of new OData entities


So now let’s move to our example.

Scenario : Fetch few additional custom fields from Account Contacts and customize the logic(Point 1 and 2)

Step 1 : Go to SEGW and open project ERP_ISU_UMC, Right Click and Select ‘Copy Project’


Step 2 :  Enter the custom Project name , Change the Package and click Ok.


Step 3 : To include the additional fields in entity AccountContact

  • Identify the structure being used for that particular entity


In this case , structure ISUS_UMC_CONTACT is used for Entity AccountContact.

Enhance the above structure using .Append


Step 4: After enhancing the structure with .Append, select the Entity AccountContact and click Import->Properties, to fetch the additional fields  from the append structure.

Select all the required fields and click on Next and Finish .



Step 5 :Then generate the service, using the Generate Runtime Objects Button.


Rename the classes as per naming convention and click ok. Note : Keep the  ‘Overwrite Base/Extended Services’ check box unchecked.


Step 6 : Open your DPC_EXT Class and redefine the method ‘GET_SERVICE_IMPL’ with the code shown below.
  METHOD get_service_impl.
DATA: lr_badi TYPE REF TO isu_umc_odata.
IF mv_no_commit = abap_true. "batch processing is active
mo_context->set_parameter( EXPORTING iv_name = 'CHANGESET_ACTIVE' iv_value = abap_true ).
ENDIF.
mo_context->set_parameter( iv_name = 'DPC' iv_value = me ).
mo_context->set_parameter( iv_name = 'RECDET' iv_value = mr_request_details ).


GET BADI lr_badi
FILTERS
entity_name = iv_entity_name
service_name = iv_service_name.
CALL BADI lr_badi->get_instance
EXPORTING
ir_context = mo_context
CHANGING
cr_service_impl = rr_result.

ENDMETHOD.


Step 7 : Now to write our custom logic we must enhance BAdI : ISU_UMC_ODATA.

In this  E.g.  we are  enhancing the  logic for AccountContact Entity.

Below are the steps to enhance the BAdI

Step 7.1 : Create a Custom Class (  with ‘CL_FKK_UMC_ODATA_ACCCONTACT’ as superclass ) and mark it as Final


Step 7.2 : Go to SE19 , enter the standard BAdI name(ISU_UMC_ODATA) and click Create Implementation


Step 7.3 : Give your Custom implementation name  and click on OK.


Step 7.4 : On the Next Screen, add details as shown.


Step 7.5 : Mark this custom implementation as ‘Default Implementation’ , add Filter values and Activate.

Note : Filter Values are the Entity and EntitySet names for which the enhancement should be triggered.



Step 8 : Then go back to your Custom Class  and redefine the required methods(GET/GETENTITYSET/CREATE etc. )to write the custom logic.

In this example we have redefined the GET and CREATE Methods.


Step 9 : After activating all our custom developments , Next step is to Register/Maintain Service and then test the service.

  • Maintain Service


Go to Transaction /N/IWFND/MAINT_SERVICE and click add services.


On the Next screen , Provide the service name along with the system Alias name and click on Get Services.

After the Service name appears on the Select Backend Services section , Select the service, and click on Add Selected Services.


 

  • Once the service is registered, we can now test in using the transaction /N/IWFND/GW_CLIENT


Let’s start with fetching Contact details for a particular Partner and then creating a new Contact note for a Partner. Below are the details for the same.

To Fetch Contact Note Details for Particular Partner

Note : Since we do not have field Partner in the our AccountContact Entity we can make use of the existing Association between Accounts and AccountContact for our requirement.

URI :   sap/opu/odata/sap/ZXXXX_SRV/Accounts(AccountID='0000000000')/AccountContacts


After Execution , below is the response


 Note : Since PartnerID field is not present in the Entity, we are making use of the existing association between Entity Accounts and AccountContacts to fetch Contact Note details for a particular Partner ID.

To Create Contact Note for a Partner

URI : /sap/opu/odata/sap/ZXXXX_SRV/AccountContacts


Request Body(json Format) :
{

"AccountContactID" : " ",

"AccountID" : "0000000000",

"ContactClassID" : "0001",

"ContactActionID" : "0001",

"ContactPriorityID" : "",

"ContactDate" : "\/Date(1615939200000)\/",

"Note" : "Test12347867\r\nTest5686987\r\nTest56789\r\nTest56789\r\nTest56789\r\nTest56789\r\nTest56789",

"ContactTypeID" : "4",

"IncomingFlag" : true ,

"ContactTime" : "PT11H25M05S",

"CreatedBy" : "XXXXX"

}


After Execution ,we can see a new Contact Note is created .


 

Note :

1 major issue faced during Get or Post is shown in the screenshot below


The above error can be resolved in 3 ways

  1. First way is to maintain the Partner IDs in your User profile .


To do so follow the below mentioned steps:

Go To Tcode SU01 ->Select Go to from toolbar ->References and maintain the below values. Key should have your Partner Values.





  1. Second way is to comment out the CHECK_USER_AUTHORISATION method present in your redefined methods of your custom class .



3. Third way is to configure the User Group. The User Group parameter can be used to configure a user group for the agent as the user. The responsive Web application validates if the user is the agent. By default, this feature is delivered inactive.


To configure the business process follow the below path in SPRO
SAP Utilities --> Customer Service --> SAP Multichannel Foundation for Utilities --> Maintain Settings for Business Processes -->Select the Process ID and maintain the values.



Note :


  • The User Group which is maintained here should also be assigned to your User( Can be checked using SU01) .

  • Business Process ID for Co-browsing is 0010.


For more information check the below link
https://help.sap.com/viewer/SAP%20MCF%20for%20PS/e21be454ee576374e10000000a44538d.html

https://help.sap.com/viewer/SAP%20MCF%20for%20PS/17d5e454e0b46474e10000000a44538d.html

Now our next concern would be how to find the right superclass for our custom class.

Its simple, Super Class for your Custom Class can be found from the standard implementations

E.g. In our Case we were implementing Custom Logic for AccountContact
So the standard Enhancement for the above entity is ‘ISU_UMC_ODATA_ACCOUNTCONTACT’(Can be found by checking the implementation for BAdI ISU_UMC_ODATA).


Open the above Implementation and check for its implementing class



Open the Implementing Class to check its Superclass.


 

Incase you are creating a new Entity, the superclass in that case should be CL_ISU_UMC_ODATA_ABSTRACT.

 

More information on other Entities for ERP_ISU_UMC can be found on

https://help.sap.com/saphelp_umc100/helpdata/en/ef/f410529e239c60e10000000a44176d/frameset.htm

Conclusion :


This blog post should help you get started on how standard MCF can be extended for our custom requirement.

Please feel free to suggest if any changes or mistakes encountered.

Thank you 🙂
6 Comments
Labels in this area