Acorel
To Acorel.nl
Acorel background

Service Request Templates Solution for C4C

Mark Peeters, 05 October 2016

The service solution of SAP C4C is growing rapidly with every release. An often requested piece of functionality, Service Ticket Templates, is however currently not yet available in the standard. Service Templates are often used to speed up the process of order entry by automating tasks that occur frequently. You can think of a standard list of spare parts for a specific broken machine or setting default values in your tickets based on the Categorization. So let’s take a look at how can we improve the efficiency of our service department.
In last weeks blog, we have told you about actions in C4C. In this blog we will show how it can be used to create the template solution that so many customers require.

First we need to be able register a template Service Ticket in C4C. For this we can create a Document Type. Since we cannot authorize on these document types you might need to use a code list restriction to prevent end users from creating Service Ticket of this type, and only let for instance key users create and update templates.

The coping of the template to the ticket will be done with an SDK Action, in order to trigger this Action we will implement a Workflow. In this case the template needs to be copied after we have filled in the Resolution Category in the Ticket.

For details on how to create an action in de SDK please see the before mentioned blog. The action that we require will consist of two parts, First we need to find the template and then we need to copy the contents of the template to the current ticket.

Querying for the templates can be done with this code snippet:

//Query Template Service Requests
var query = ServiceRequest.QueryByElements;
var selectionParams = query.CreateSelectionParams();
selectionParams.Add(query.ProcessingTypeCode, “I”,“EQ”,“ZABU”);
selectionParams.Add(query.ServiceIssueCategoryMainActivityCategoryKey.ServiceIssueCategoryID.content, “I”,“EQ”, catkeyid);
var resultData = query.ExecuteDataOnly(selectionParams);
ticket = resultData.GetFirst();
if (ticket.IsInitial() == false )
       {
       var template = ServiceRequest.Retrieve(ticket.UUID);
       foreach (var tempitem in template.Item)
             {
             if (tempitem.ItemProduct.IsSet() )
                    {
                    prodid = tempitem.ItemProduct.ProductInternalID;
                    }
             }
       }

Adding products to the current can be done with this code snippet:

//Add Product to Ticket.
var lineID = 10;
foreach (var tempitem in template.Item)
     {
     if (tempitem.ItemProduct.IsSet() )
         {
         prodid = tempitem.ItemProduct.ProductInternalID;
  if ( prodid.IsInitial() == false )
              {
              servitem.ID = lineID.ToString();
              servitem.UserServiceTransactionProcessingTypeCode= “Z001”;
              var institem = this.Item.Create(servitem);
              var quantity = 1;
              if (! institem.ItemProduct.IsSet())
                    {
                    proditem.ProductKey.ProductID.content = prodid.content;
                    institem.ItemProduct.Create(proditem);
                    }
              else
                    {
                    institem.ItemProduct.ProductKey.ProductID.content=                               prodid.content;
                    }
   
              if (! institem.FirstRequestedItemScheduleLine.IsSet())
                     {
                    scheditem.Quantity.content= 1;
                    institem.FirstRequestedItemScheduleLine.Create(scheditem);
                    }
              else
                    {
                     institem.FirstRequestedItemScheduleLine.Quantity.content= 1;
                     }
             lineID = lineID + 10;
              }
       }

Now we have all the tools to create a flexible Service Ticket Template solution that can help a lot of customer improve on their Service Ticket entry process.

Mark Peeters

Read all my blogs

Receive our weekly blog by email?
Subscribe here: