Business Function

nick_bc

nick_bc

Active Member
Hello List,

I have created my first business function using NER. When I am trying to run it, I am getting the following information in the log file and dont have any output from the function I have created.

1496/2500 MAIN_THREAD Thu Aug 31 15:15:12.563000 Jdb_ctl.c3488
Starting OneWorld

1496/2872 WRK:Starting jdeCallObject Thu Aug 31 15:20:15.829000 Jdb_exef.c3913
JDB3300020 - Fetch not allowed. Prior successful Select operation required for this request.

Can any one explaing what is wrong here. the code for business function is as follows.

Listing of ER for Named ER: N5508012


=======================================================================
NAMED ER: DBA Transaction History Calculator
=======================================================================
evt_jdWorkDateF0618_DWK
evt_mnGrossPayF0618_GPA
evt_jdWorkDateF0719_DWK
evt_mnGrossPayF0719_GPA
evt_mnHoursWork_PHRW
0001 // Programmer -
0002 // Aug 29, 2006
0003 // Depending on the PDBA code, the emplyee's history will be grabed from two
0004 // differenct sources:
0005 // From the F0618 table, if PDBA code is less then 1000; otherwise from the
0006 // F0719.
0007 //
0008 BF mnAmtGrossPay = "0"
0009 BF mnHoursWork = "0"
0010 If BF mnPayDeductBenAccType is less than "1000"
0011 F0618.Select
BF mnAddressNumber = TK Address Number
BF mnPayDeductBenAccType = TK DBA Code
BF jdDateBeginningEffective <= TK Date - Worked
0012 F0618.Fetch Next
VA evt_mnHoursWork_PHRW <- TK Hours Worked
VA evt_mnGrossPayF0618_GPA <- TK Amount - Gross Pay
VA evt_jdWorkDateF0618_DWK <- TK Date - Worked
0013 While SV File_IO_Status is equal to CO SUCCESS
0014 If VA evt_jdWorkDateF0618_DWK is less than or equal to BF jdDateEndingEffective
0015 BF mnAmtGrossPay = [BF mnAmtGrossPay]+[VA evt_mnGrossPayF0618_GPA]
0016 BF mnHoursWork = [BF mnHoursWork]+[VA evt_mnHoursWork_PHRW]
0017 End If
0018 F0618.Fetch Next
VA evt_mnHoursWork_PHRW <- TK Hours Worked
VA evt_mnGrossPayF0618_GPA <- TK Amount - Gross Pay
VA evt_jdWorkDateF0618_DWK <- TK Date - Worked
0019 End While
0020 Else
0021 F0719.Select
BF mnAddressNumber = TK Address Number
BF jdDateBeginningEffective <= TK Date - Worked
BF mnPayDeductBenAccType = TK DBA Code
0022 F0719.Fetch Next
VA evt_jdWorkDateF0719_DWK <- TK Date - Worked
VA evt_mnGrossPayF0719_GPA <- TK Amount - Gross Pay
VA evt_mnHoursWork_PHRW <- TK Hours Worked
0023 While SV File_IO_Status is equal to CO SUCCESS
0024 If VA evt_jdWorkDateF0719_DWK is less than or equal to BF jdDateEndingEffective
0025 BF mnAmtGrossPay = [BF mnAmtGrossPay]+[VA evt_mnGrossPayF0719_GPA]
0026 BF mnHoursWork = [BF mnHoursWork]+[VA evt_mnHoursWork_PHRW]
0027 End If
0028 F0719.Fetch Next
VA evt_jdWorkDateF0719_DWK <- TK Date - Worked
VA evt_mnGrossPayF0719_GPA <- TK Amount - Gross Pay
VA evt_mnHoursWork_PHRW <- TK Hours Worked
0029 End While
0030 End If


Thanks in advance.

Naveen

E1 8.11
Windows 2003/SQL 2000
 
Naveen,

It would appear that either line 12 or 22 is causing the problem when the previous select, line 11 or 21, does not actually select anything -no rows in the table match the select criteria. Try something like this:

Naveen,

It would appear that either line 12 or 22 is causing the problem when the previous select, line 11 or 21, does not actually select anything -no rows in the table match the select criteria. Try something like this:

0001 // Programmer -
0002 // Aug 29, 2006
0003 // Depending on the PDBA code, the emplyee's history will be grabed from two
0004 // differenct sources:
0005 // From the F0618 table, if PDBA code is less then 1000; otherwise from the
0006 // F0719.
0007 //
0008 BF mnAmtGrossPay = "0"
0009 BF mnHoursWork = "0"
0010 If BF mnPayDeductBenAccType is less than "1000"
0011 __ F0618.Select
__________ BF mnAddressNumber = TK Address Number
__________ BF mnPayDeductBenAccType = TK DBA Code
__________ BF jdDateBeginningEffective <= TK Date -Worked
0012 __ If SV File_IO_Status is equal to CO SUCCESS
0013 _____ F0618.Fetch Next
_____________ VA evt_mnHoursWork_PHRW < -TK Hours Worked
_____________ VA evt_mnGrossPayF0618_GPA < -TK Amount -Gross Pay
_____________ VA evt_jdWorkDateF0618_DWK < -TK Date -Worked
0014 __ End If
0015 __ While SV File_IO_Status is equal to CO SUCCESS
0016 _____ If VA evt_jdWorkDateF0618_DWK is less than or equal to BF jdDateEndingEffective
0017 ________ BF mnAmtGrossPay = [BF mnAmtGrossPay]+[VA evt_mnGrossPayF0618_GPA]
0018 ________ BF mnHoursWork = [BF mnHoursWork]+[VA evt_mnHoursWork_PHRW]
0019 _____ End If
0020 _____ F0618.Fetch Next
_____________ VA evt_mnHoursWork_PHRW < -TK Hours Worked
_____________ VA evt_mnGrossPayF0618_GPA < -TK Amount -Gross Pay
_____________ VA evt_jdWorkDateF0618_DWK < -TK Date -Worked
0021 __ End While
0022 Else
0023 __ F0719.Select
__________ BF mnAddressNumber = TK Address Number
__________ BF jdDateBeginningEffective <= TK Date -Worked
__________ BF mnPayDeductBenAccType = TK DBA Code
0024 __ If SV File_IO_Status is equal to CO SUCCESS
0025 _____ F0719.Fetch Next
_____________ VA evt_jdWorkDateF0719_DWK < -TK Date -Worked
_____________ VA evt_mnGrossPayF0719_GPA < -TK Amount -Gross Pay
_____________ VA evt_mnHoursWork_PHRW < -TK Hours Worked
0026 __ End If
0027 __ While SV File_IO_Status is equal to CO SUCCESS
0028 _____ If VA evt_jdWorkDateF0719_DWK is less than or equal to BF jdDateEndingEffective
0029 ________ BF mnAmtGrossPay = [BF mnAmtGrossPay]+[VA evt_mnGrossPayF0719_GPA]
0030 ________ BF mnHoursWork = [BF mnHoursWork]+[VA evt_mnHoursWork_PHRW]
0031 _____ End If
0032 _____ F0719.Fetch Next
_____________ VA evt_jdWorkDateF0719_DWK < -TK Date -Worked
_____________ VA evt_mnGrossPayF0719_GPA < -TK Amount -Gross Pay
_____________ VA evt_mnHoursWork_PHRW < -TK Hours Worked
0033 __ End While
0034 End If
 
This error occurs when you use a different index in ER for Table I/O "Select" and "Fetch Next". Use the same index.
Good luck
Gigi
 
have to agree with gigi on this one, peterbruce. it shouldn't matter how many records (0 or >0) satisfy the criteria in the select-statement.
 
I concur with Gigi.
From all my years of debugging, I never had to surround my Fetch Next with a
condition. To my knowledge, the Select will always return a Success. At least
to my experience, I've never encountered a Select that returned Error...
 
I can think of two instances where the Select statement coulda/should fail.

A - if the file does not physically exist in the database. You create the specs, but do not generate the table - I'd think the Select returns failure (I'd need to try, to confirm - anyone???)

B - if there is no data (not a single record) in the file. I have seen selects and fetches cause a report to IPC Error and die (with no messages) when a table has been initialized. The issue was in a C-Function that used C-Code to do a select/fetch.next/while... (Again - I'd need to try, to confirm that the issue occurs with an ER Select/Fetch.next)

Either way - it is best to ALWAYS use the following logic for Select/Fetch.Next(s):

Select.filename (and criteria)
Fetch.Next.Filename
Do While I/O Successful
* Put all your code in here
Fetch.Next.Filename
End Do While

Always put a fetch before the Do While and as the LAST STATEMENT BEFORE THE END DO.

My two cents!

(db)
 
Thanks for the reply list,

I have applied all the logic and wont able to pin point where the error is.

Thats my first business fuction i have created so far with the following specs.

Source Languate = NER
Parent DLL = CDesign
Business Function Location = Both Client & Server

Now will be doing more investigation on the select and fetch, even i tried a simple statement in the select, I am still have fetch error. Is there any resctriction of a business function to access / select any table.

Thanks every one for putting their suggestions.
 
Thanks a lot Gigi,

My problem is sovled.

I was using 2 different indexes for select and fetch statement.
 
remo,

[ QUOTE ]
have to agree with gigi on this one, peterbruce.

[/ QUOTE ]

So do I. I missed the inconsistant indexes.
blush.gif
 
Back
Top