DatinN
5th July 2017, 07:28
Hi All,

I have this report when I compile my report script :

rtdsqldelpo92:
repgen '2tdB61Oa drb sqldelpo9 ' -c 'tdB61Oa drb ' -o "D:\infor\erpln\bse\tmp/tmp076989690" -T 0 -z -qe "D:\infor\erpln\bse\tmp/tmp076989691" -x "D:\infor\erpln\bse\tmp/tmp076989692" -L
bic "D:\infor\erpln\bse\tmp/tmp076989690" -z -u -o rtdsqldelpo90 -f "D:\infor\erpln\bse\tmp/tmp076989689" -qe "D:\infor\erpln\bse\tmp/tmp076989691"
rtdsqldelpo9 ( 46): Error: '}' not expected.
tmp076989690( 31): Fatal Error: FUNCTION within function 'calc.cur' not expected.

my report script :

declaration:
table ttdpur401
extern domain tcamnt amount
detail.1:
before.layout:

calc.cur()

functions:

function void calc.cur()

{

IF strip$(tdpur400.ccur)= "JPY" THEN

amount = tdpur401.oamt / 25.86198

IF ELSE strip$(tdpur400.ccur)= "EUR" THEN

amount = tdpur401.oamt / 0.207314

IF ELSE strip$(tdpur400.ccur)= "SGD" THEN

amount = tdpur401.oamt / 0.322758

IF ELSE strip$(tdpur400.ccur)= "USD" THEN

amount = tdpur401.oamt / 0.233155
ELSE
amount = tdpur401.oamt

ENDIF

}

currently only this 4 currency rate that we use.
I know that user will change the rate from time to time and I should create this script to able trace forex rate from PO as per forex activation date.
for beginning, If I could deliver the query with fix rate, its fine . improvement of this report will be next stage.

hope some one could share idea on this.

Thank you

bdittmar
5th July 2017, 11:06
Hello,
try:
assign the amount value to variable on beginning
then check currancy
The ELSE Statements only are for secure calculation.


function void calc.cur()
{
amount = tdpur401.oam

IF strip$(tdpur400.ccur)= "JPY" THEN
amount = tdpur401.oamt / 25.86198
ELSE
amount = tdpur401.oam
ENDIF

IF strip$(tdpur400.ccur)= "EUR" THEN
amount = tdpur401.oamt / 0.207314
ELSE
amount = tdpur401.oam
ENDIF

IF strip$(tdpur400.ccur)= "SGD" THEN
amount = tdpur401.oamt / 0.322758
ELSE
amount = tdpur401.oam
ENDIF

IF strip$(tdpur400.ccur)= "USD" THEN
amount = tdpur401.oamt / 0.233155
ELSE
amount = tdpur401.oam
ENDIF
}


But, why not currency and rates from tcmcs002 and tcmcs008 ?


Regards

DatinN
6th July 2017, 05:53
Hi Bdittmar,

thank you for your time and effort.
the if else resolve as per your suggestion.
Yes, I planned to have the infor tcmcs008 to link as per active date but I failed to do so.
at moment this could assist my user.
however, I plan to explore this opportunity to use tcmcs008 .

Thank you