Spend Management Blogs by Members
Check out community member blog posts about spend management and SAP Ariba, SAP Fieldglass, and SAP Concur solutions. Post or comment about your experiences.
Showing results for 
Search instead for 
Did you mean: 
Former Member

When our customers have a requirement to create a lot of clauses in the application, they prefer to use an import capability that we have provided. Our import capability is a multi-step process:

  1. The actual word documents used for the clause content must be available on the application server where the import runs
  2. A csv to create the clause is first uploaded to create the clause object (clause import)
  3. A second csv to add the “content” to the clause is imported (content import). This adds the word document to the clause object created in step 2


The issue becomes that each of the clauses created in this way is in a status of “draft”. The customers then need to manually change each of the objects to “approved” in the user interface.

The concept that I have in mind is to: Allow the customer to import another file after adding the content that will result in the clause phase being changed to Approved.

The basic design for this is as follows:

  1. Add a Boolean Approve Clause extension to the clause object that indicates the clause should be approved. This flag should default to false after the phase has been updated.
  2. Make the extension read-only in the user interface, via a page customization
  3. Have a script on the clause validation that indicates the clause should be approved when the flag in #1 is true. The script should set the flag to false at the end.


With this approach, the users could import a new CSV after the content is uploaded with 2 fields in it: Name and the “Approve Clause” Boolean set to TRUE. The import will trigger the validate script which will approve the clause.

Before you start

Ensure that the Company and Enterprise workbooks have been imported into your system as the correct users and that in particular the Company workbook contractgen.Phase phases have been set as these are what the script will be drawing from.


Adding an Extension to the clause object

Logged in as user that is a member of the company the clauses will be for and navigate to Setup –Configuration Extension Definition and create a new extension definition.

In the screen below you can see the two localized values created and the attributes created to enable the desired functionality.


Attribute Internal name


Display Name

Clause Approval Extension

Attribute Description


 Save this.

Creating the script

Go to Setup – Integration –Script Definition and create a New Script.

Select ‘Import Lifecycle Event’ as we want the script to trigger when an import event occurs.

This is what the fields relating to the script should look like.


import com.sap.eso.api.contractgen.*;
import com.sap.eso.api.contractgen.phase.PhaseIBeanHomeIfc;

// get the clause phase from the import

logMsg = Logger.createLogMessage(session);

//get the phase ibean for approved
phaseHome = IBeanHomeLocator.lookup(session, PhaseIBeanHomeIfc.sHOME_NAME);
approvedPhase = phaseHome.findUniqueByDisplayName("Approved");

approvedClauseFlag = doc.getExtensionField("CLAUSEAPPROVALEXT").get();

//Check if clause has attachment if not do not attempt advance.

if (hasValue(approvedClauseFlag) && approvedClauseFlag.booleanValue() == true)
//Set the Phase to approved

//Uncheck the Clause Approval Extension

Save the code and then test the process.