Thanks for your response Bharani.
This is the code present in controller class.I want to specify one more thing that the controller class main method is not called when the batch job is opened from batch job history form.Only method called in controller class is the new method.I will paste the code in controller class.Thanks.
class PMIPBillingScheduleCreateController extends SysOperationServiceController
{
public void new()
{
super();
this.parmClassName(classStr(PMIPBillingScheduleCreateService));
this.parmMethodName(methodStr(PMIPBillingScheduleCreateService, createBillingSchedule));
this.parmExecutionMode(SysOperationExecutionMode::Synchronous);
}
/// <returns>PMIPBillingScheduleCreateController</returns>
public static PMIPBillingScheduleCreateController construct()
{
PMIPBillingScheduleCreateController controller = new PMIPBillingScheduleCreateController();
return controller;
}
public static void main(Args _args)
{
PMIPBillingScheduleCreateController controller;
PMIPBillingScheduleCreateContract contract;
Query query;
PSAParameters psaParameters = PSAParameters::find();
PMIPBillingScheduleTable billingTable;
ProjInvoiceProjId callerProjInvoiceProjId;
ProjInvoiceTable projInvoiceTable;
controller = PMIPBillingScheduleCreateController::construct();
controller.parmArgs(_args);
controller.parmLoadFromSysLastValue(true);
contract = controller.getDataContractObject();
contract.parmCaller(_args.caller());
contract.parmAllowToDuplicateBillingPeriod(false);
if(psaParameters.PMIPActivateBillingSchedule == NoYes::No)
{
throw Global::warning("@AXP:AXP3307");
}
if (_args)
{
if (_args.dataset() == tableNum(PMIPBillingScheduleTable))
{
billingTable = _args.record();
callerProjInvoiceProjId = billingTable.ProjInvoiceProjId;
}
else if (_args.dataset() == tableNum(ProjInvoiceTable))
{
projInvoiceTable = _args.record();
callerProjInvoiceProjId = projInvoiceTable.ProjInvoiceProjId;
}
else
{
query = new Query(queryStr(PMIPContractBillingFrequencyQuery));
contract.setQuery(query);
}
if (callerProjInvoiceProjId)
{
query = new Query(queryStr(PMIPContractBillingFrequencyQuery));
QueryBuildDataSource qbds = query.dataSourceTable(tableNum(PMIPContractBillingFrequency));
SysQuery::findOrCreateRange(qbds,fieldNum(PMIPContractBillingFrequency,ProjInvoiceProjId )).value(callerProjInvoiceProjId);
contract.setQuery(query);
}
}
controller.startOperation();
controller.refreshCallingForm(_args);
}
private void refreshCallingForm(args _args)
{
FormRun callerForm = _args.caller();
if (callerForm)
{
if (callerForm.name() == formStr(PMIPBillingScheduleListPage) || callerform.name() == formStr(PMIPBillingSchedule))
{
callerForm.refreshForm();
}
}
}
}