Deknor
15th September 2015, 07:05
Hi All,
May i ask something?
What is meaning error SQL: Unexpected token 'for' , Error: 'selectdo' not expected, and Error: 'endselect' not expected in program script erpln?
For example:
pwhwmd450m0000( 72): Warning: Missing selectdo; break generated.
pwhwmd450m0000( 158): Error SQL: SQLState 42I00: Unexpected token 'for' (error 302)
pwhwmd450m0000( 194): Error: 'selectdo' not expected.
pwhwmd450m0000( 204): Error: 'endselect' not expected.
Your kindness i'm really appreciated,
bhushanchanda
15th September 2015, 08:43
Hi,
Please start threads in the related forums. Moved to Tools Development forum.
Please post your code to make people understand the problem.
bdittmar
15th September 2015, 13:49
Show your Statement is someone should help.
Generic:
select <field(s)>
from <table(s)>
where <condition>
selectdo
selectempty
endselect
Regards
Deknor
17th September 2015, 03:29
I'm sorry. This is the example of code which is give error :
function read.main.table()
{
long i,i2,x
trx.date()
|read files
select whwmd400.*,tcibd100.*,whinp100.*
from whwmd400,tcibd100,whinp100
where whwmd400._index1 inrange {:item.f} and {:item.t}
and whinp100.item refers to tcibd100
and tcibd100.item refers to whwmd400
|order by whwmd400.item |add item group
order by whwmd400._index1
|if = stop execute
| Planned Qty
for x = 1 to 31
if whinp100.date = date.title(x) then
if whinp100.kotr = 2 then
QtyReceipt(x) = QtyReceipt(x) + whinp100.qana
TotalReceipt = TotalReceipt + whinp100.qana
else
QtyIssue(x) = QtyIssue(x) + whinp100.qana
TotalIssue = TotalIssue + whinp100.qana
endif
endif
endfor
|calc.Qty()
BQty = SOH + TotalReceipt - TotalIssue
rprt_send()
endselect
}
function trx.date()
{
long i,i2
for i = 1 to 31 | initialize transaction date
if date.title (i) = date.f + (i+1) then
selectdo
if date.title(i) = date.t then
i2 = i
i = 31
break
else
i2 = i
endif
endselect
endif
endfor
}
Your kindness I'm very appreciate,
bhushanchanda
17th September 2015, 06:52
Hi,
1. You are missing the selectdo for the select statement
2. You have incorrectly placed seelctdo and endselect for the "for loop"
3. Indentation is necessary for good code health!
function read.main.table()
{
long i,i2,x
trx.date()
|read files
select whwmd400.*,tcibd100.*,whinp100.*
from whwmd400,tcibd100,whinp100
where whwmd400._index1 inrange {:item.f} and {:item.t}
and whinp100.item refers to tcibd100
and tcibd100.item refers to whwmd400
|order by whwmd400.item |add item group
order by whwmd400._index1
selectdo |# Added selectdo
|if = stop execute
| Planned Qty
for x = 1 to 31
if whinp100.date = date.title(x) then
if whinp100.kotr = 2 then
QtyReceipt(x) = QtyReceipt(x) + whinp100.qana
TotalReceipt = TotalReceipt + whinp100.qana
else
QtyIssue(x) = QtyIssue(x) + whinp100.qana
TotalIssue = TotalIssue + whinp100.qana
endif
endif
endfor
|calc.Qty()
BQty = SOH + TotalReceipt - TotalIssue
rprt_send()
endselect
}
function trx.date()
{
long i,i2
for i = 1 to 31 | initialize transaction date
if date.title (i) = date.f + (i+1) then
|selectdo |# Why a selectdo here?? Not required for for loops
if date.title(i) = date.t then
i2 = i
i = 31
break
else
i2 = i
endif
|endselect |# Not required for for loops
endif
endfor
}
Deknor
17th September 2015, 07:11
Hi,
I already add the 'selectdo' and remove the misplaced 'selectdo' in mycode. But there're another error comes out.
The error are:
pwhwmd450m0000( 72): Warning: Missing selectdo; break generated.
pwhwmd450m0000( 141): Error: Illegal type combination: 'enum = long'
pwhwmd450m0000( 141): Error: Illegal type combination: 'enum = long'
Your kindness I'm very appreciate,
bhushanchanda
17th September 2015, 07:20
Hi,
Its caused by this -
if whinp100.kotr = 2 then
So, either convert 2 into enum or whinp100.kotr to long
Try this -
if whinp100.kotr = tckotr.requirement then
or
if whinp100.kotr = ltoe(2)
Deknor
17th September 2015, 07:23
Hi,
Thank you very much. It's work..