Not Able To call stored procedure from AX Job...Please assist..

Hi All,

I have stored procedure and if I execute it from DB side i am getting the data. and now the requirement is, if I call the stored procedure from the Table method ,the data which is retrieved by stored procedure should insert in the table.

To achieve this I have created one AOT table (Scob_AllPaymentsDump ) and in the table method I have written below code to call stored procedure and at the same time insert the data in table.

Connection Connection;
Statement Statement;
ResultSet ResultSet;
SqlStatementExecutePermission perm;
str sqlStatement = strFmt(‘exec ScobAllPayments ‘%1’,’%2’’,fromdate,todate);
RecordInsertList RecordInsertListScob_AllPaymentsDump;
Scob_AllPaymentsDump scob_AllPaymentsDump;
//String255 excrate;

RecordInsertListScob_AllPaymentsDump = new RecordInsertList(tableNum(Scob_AllPaymentsDump));
Connection= new Connection();
Statement= Connection.createStatement();
perm = new SqlStatementExecutePermission(sqlStatement);
ResultSet= Statement.executeQuery(sqlStatement);
while ( )
info(strFmt("%1", ResultSet.getString(1)));
scob_AllPaymentsDump.CompanyCode = ResultSet.getString(1);
scob_AllPaymentsDump.SCOBVendName = ResultSet.getString(2);
scob_AllPaymentsDump.CurrencyCode = ResultSet.getString(3);
scob_AllPaymentsDump.AmountCurDebit = str2num(ResultSet.getString(4));
scob_AllPaymentsDump.JournalNum = ResultSet.getString(5);
scob_AllPaymentsDump.JournalName = ResultSet.getString(6);



But when I execute it from the job by passing the fromdate and todate it giving the below error.


Kindly assist on this.

Thanks in advance