Step 1. Add Global temporary table variable that stores recIds from
list
ASTmpRecIdFilter recIdFilter; // Copy of TmpRecIdFilter but without country code
Step 2. Add Process method
/// <summary>
/// Contains the code that does the actual job of the class.
/// </summary>
/// <param name = "_contract">Data contract</param>
public void process(SampleDataContract _contract)
{
#OCCRetryCount
try
{
this.initParameters(_contract);
ttsbegin;
this.processRecords();
ttscommit;
Info("@SYS9265");
}
catch (Exception::Deadlock)
{
retry;
}
catch (Exception::UpdateConflict)
{
if (appl.ttsLevel() == 0)
{
if (xSession::currentRetryCount() >= #RetryNum)
{
throw Exception::UpdateConflictNotRecovered;
}
else
{
retry;
}
}
else
{
throw Exception::UpdateConflict;
}
}
}
Step 3. Add initParameters method that converts RecId list to temporary
table
/// <summary>
/// Inits parameters from data contract
/// </summary>
/// <param name = "_contract">Data contract</param>
internal void initParameters(SampleDataContract _contract)
{
List recordIdList = _contract.parmRecordIdList();
if (recordIdList && recordIdList.elements() > 0)
{
ListEnumerator le = recordIdList.getEnumerator();
while (le.moveNext())
{
recIdFilter.RefRecId = le.current();
recIdFilter.insert();
}
}
}
Step 4. Add processRecords method with request
internal void processRecords()
{
TableName common;
while select common
exists join recIdFilter
where recIdFilter.RefRecId == common.RecId
{
// some logic
}
}