Skip to Content
Author's profile photo Former Member

C4C Extensibility Utilities – How to add custom logic during step navigation in Guided Process ( Move In/Move Out/Transfer)

The objective of this blog is to illustrate how to implement SDK logic in Guided Process while navigating from one step to another.

Please check the below blogs as preread to understand the basics of creating SDK solution for the guided process.

https://blogs.sap.com/2017/03/08/c4c-extensibility-utilities-how-to-add-kut-fields-to-guided-process-for-move-inmove-outtransfer/

https://blogs.sap.com/2017/03/08/project-extensions-for-the-guided-move-inout-and-transfer/

Any coding or configuration examples provided in this document are only examples and are NOT intended for use in a productive system. The example is only done to better explain and visualize the topic.

In this example, while navigating from Step2 to Step 3 of the Guided Process, message is raised with the current step name.

Output expected would be the display of the message with the current step name as shown in the screenshot below

  1. Create a Custom Solution as shown in screenshots

 

 

2. Extend the Business Object for Utilities Guided Process ( Move In/Move Out/Transfer )

 

2.1) BO UtilitiesActionBO is extended with the following

a) Contract node has a PDI extension field “Ext_Current_Step”. This field will be used later in the implementation to hold the current step name. So that custom logic specific to the step can be implemented based on conditional checks on this field. This field is also marked as Transient which means it will not be persisted in the BO.

b) Contract Node has a custom action “FireStepLogic”.

c) Contract Node raises message Info_Current_Step which has one placeholder to display the current step name.

 

 

Code snippet for easy copy and paste

import AP.Common.GDT;

import AP.CRM.Global;

[Extension] businessobject AP.CRM.Global:UtilitiesActionBo {

// You must activate this business object before you can access the extension fields

// or messages in script files, forms, and screens.

message Info_Current_Step text “Current Step is &1” :LANGUAGEINDEPENDENT_EXTENDED_Text;

node Contract raises Info_Current_Step {

[Transient][Label (“Current Step”)] element Ext_Current_Step:LANGUAGEINDEPENDENT_EXTENDED_Text;

action FireStepLogic;

}

node Installation {

node MeterReading {

}

}

node CustomerDetails {

}

node ContractAccountDetails {

}

}

 

2.2) Create script file for Action “FireStepLogic”.

 

 

 

2.3 Save and Activate the BO

 

3. Create a Embedded Component as shown in the screenshot below

3.1 Data Model of the embedded component.

a)  Bind the root of the embedded component to the Root of the UtilitiesActionBO. Create required fields in the data model of the embedded component.

In this example , we require a data structure named as “Inport” which has two data fields “UUID” and “CurrentStep”. When an embedded component loads, data is exchanged through the inport and the caller passes UUID and CurrentStep to this inport fields.

b) Also let’s create another data field “Ext_Current_Step” and bind it to the PDI extension field in the Contract node. Current step information that is received through inport is passed thru the UI field to the BO extension field.

 

3.2 Create inport and bind the parameters of the inport to the data model field ( in this case /Root/Inport/UUID and /Root/Inport/CurrentStep.

In the “OnFire” properties of the inport  , create a new event handler.

 

3.3. Create event handler Ev_StepLogic

a.  There can be multiple operations in an event. The first operation in this example is  a data assignment to set the value of the field Ext_Current_Step

 

b. The next operation in the event is to fire the BO action “FireStepLogic”

 

c. One could also add the step check as a condition in the event. Only if the condition is passed , further operations will be executed. ( Hint: How to derive the step name : “MeterReadingServices” in this example -> See next screenshot )

 

How to derive the step name — check the properties of each step

 

3.4 Save and Activate the embedded component

 

4. To include EC in the GAF. GAF floorplans are stored in the following path

/BYD_COD/IndustrySolution/Utilities/UI/Extensibility

a. Open Move In GAF and in Step 1 , please add the EC created. ( EC can be added to any step based on the trigger for the custom logic ). This is example it is added to Step1.

 

b. Add Embedded Component via extensibility explorer and bind the port. There is a public outport provided in the GAF carrying UUID of the current node and the current step.

 

EC is successfully added to the GAF

5. Output would be that GAF will display a message with a current step name when navigating from step2 to step 3. Unless this message is removed thru SDK logic , once raised the message stays for all the steps.

Now that current step name is available in the extension field “Ext_Current_Step” , at after modify event or OnFire of the embedded component , custom logic can be written after conditional check for the step name. This way custom logic will be executed while navigating from specific steps.

 

 

Assigned Tags

      2 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Sahil Arora
      Sahil Arora

      Is it possible to stop the step navigation and just display an error message instead based on a validation failure?

      Author's profile photo Safdar Imam
      Safdar Imam

      We have seen STEP name is incorrect when we navigate from 1 step to another in GUIDED TRANSFER

      Can someone help .