Question

Timman_Job_Trans_API.Prepare_Week__ - How to use it with .NET Provider

  • 26 March 2021
  • 2 replies
  • 207 views

Userlevel 2
Badge +5

Hi,

 

We are using a custom application to fill timesheet. When I try to retrieve data for current month I first run Prepare_Week__ procedure (I don’t have any clue of what this function is doing has there is NOT documentation on it) and then I retrieve work

 

string PREPAREWEEK_QUERY = "&AO.Timman_Job_Trans_API.Prepare_Week__(:COMPANY_ID, :EMP_ID, :WEEK_START, :WEEK_END, 0, :SESSION_ID);";

FndPLSQLCommand cmdPrepW = new FndPLSQLCommand(_connection, PREPAREWEEK_QUERY);
// [...]
prepareWeekCollection.Add(cmdPrepW);


FndPLSQLSelectCommand cmdSelect= new FndPLSQLSelectCommand(_connection, GET_WORK_QUERY);
// [...]
workCollection.Add(cmdSelect);

The connection is still the same, those lines are in loop for each week in a month.

I created two FndPLSQLCommandCollection variable, one for prepareWeek and the other for the select command. Once the collections are full I Invoke  prepareWeekCollection and the other one. I get an error on the work collection :

Ifs.Fnd.FndTransactionIdMismatchException : 'The server transaction has expired. Please redo your changes.'

I weird because I retrieve after that all expenses there is no error (with the same connection object)

Do you have any idea?

Thx


This topic has been closed for comments

2 replies

Userlevel 2
Badge +5

Up !

Userlevel 7
Badge +11

Hi @antoine1003 , 

 

I hope you have granted  access for above methods with related to your client file.

Ex: Security_SYS.New_Pres_Object_Sec('frmABCDE', 'TIMMAN_JOB_TRANS_API.Prepare_Week__', 'METHOD', '2', 'Auto');

 

prepare_week__ is a procedure, not a function. And I couldn’t find a proper documentation, but the mentioned procedure’s purpose goes as “Calls Module related PrepareWeek methods and writes to the TimmanTransWeek object”.

 

If you do want to call the procedure, then you could do so by using DbPLSQLTransaction.

Ex:

DbPLSQLTransaction(cSessionManager.c_hSql, 
    "DECLARE\r\n" +
    "BEGIN\r\n" +
    "   &AO.Timman_Job_Trans_API.Prepare_Week__(:i_hWndFrame.frmABCDE.Company_VARIABLE IN, :i_hWndFrame.frmABCDE.EmpNo_VARIABLE IN, \r\n" +
    "   :i_hWndFrame.frmABCDE.dtAccountDate_VARIABLE IN, :i_hWndFrame.frmABCDE.dtSunday_VARIABLE IN, :i_hWndFrame.frmABCDE.nShowHidden_VARIABLE IN, \r\n" +
    "   :i_hWndFrame.frmABCDE.sSession IN);\r\nEND");

 

 

But if you wish to use FndPLSQLCommand, you could write something like below;

Ex:

FndPLSQLCommand cmd = new FndPLSQLCommand(cSessionManager.ActivityContext);
cmd.CommandText = "&AO.Timman_Job_Trans_API.Prepare_Week__ (:b1, :b2, :b3, :b4, :b5, :b6)";
cmd.BindVariables.AddFndBinaryVariable("b1", this.<YOUR_VALUE>, FndBindVariableDirection.In);
cmd.BindVariables.AddFndBinaryVariable("b2", this.<YOUR_VALUE>, FndBindVariableDirection.In); //repeat for all the 6 parameters from b1 to b6
cmd.ExecuteNonQuery();
cmd.BindVariables.Clear();

 

Hope this will be helpful for you to modify your code.

 

- Nalaka -