rohan_rege
21st October 2002, 21:29
Following i have posted the code i am using to try to match the invoices in session tfacp1131s000 ...
but the problem is , apart from the first Receipt ....all other receipts dont get updated .
infact i checked the return value of the stpapi.update but it shows a sucessful update value of 1 .
i am using stpapi.browse.set to get to the PO# , Position No.# and Sequence # that i want to update ,then i mark it and then go ahead and put the fields for Qty , amount and type of Matching , but ...apart from the first Receipt , it doesnt at all match the remaining receipts.
i found that stpapi.browse.set gets me to the correct record...
also after i mark , it and put field value and update ..it does so sucessfully..
but after update and save , when i issue get.field stmts and use a message () statement it shows me the Match = NO ,QTY = 0 and Amount = the amount i put for the first record..
when it shud show Match = Competely ,...and so on.
I tried stpapi.find earlier , but since the find available in this session is only on tdpur045.orno , pono ...while the key field for any record is tdpur045.orno , pono , srnb...so it always find the wrong record...so i had to resort to stpapi.browse.set to get to the correct record.....
but though it seems to be getting the correct record...it just wudnt update the record correctly
any suggestions
string ornot(8)
string ponot(4)
string srnbt(2)
ornot=""
ponot=""
srnbt=""
while ret <> 1 and count.find < 11
ret = stpapi.browse.set("tfacp1131s000" , "first.set" , error.mess)
count.find = count.find + 1
endwhile
while not(found)
stpapi.get.field("tfacp1131s000","tdpur045.orno",ornot )
stpapi.get.field("tfacp1131s000","tdpur045.pono",ponot )
stpapi.get.field("tfacp1131s000","tdpur045.srnb",srnbt )
if (ornot = read.orno) and (ponot = read.pono) and (srnbt = read.srnb) then
found = 1
ret = stpapi.mark("tfacp1131s000" , error.mess)
else
ret = stpapi.browse.set("tfacp1131s000" , "next.set" , error.mess)
endif
endwhile
domain tdpur.matc matc_to_check_partial
matc_to_check_partial=f1131s000.get.Matched( )
|If the Partial matching has already been done and current then go for Multiple Invoices session processing
if (matc_to_check_partial=tdpur.matc.partial) then
ret = ap1_multiple_invoices(read.qty , read.inv.amt,msg)
ret = stpapi.save( "tfacp1131s000", error.mess )
return(ret)
else
if matc_to_check_partial=tdpur.matc.no then
|FOLLOWING is to put values into tfacp1131s000 for complete or partial match
| to find the PO line using PO# , PO line and PO Sequence No.
count.find = 1
ret = 0
found = 0
ornot=""
ponot=""
srnbt=""
while ret <> 1 and count.find < 11
ret = stpapi.browse.set("tfacp1131s000" , "first.set" , error.mess)
count.find = count.find + 1
endwhile
while not(found)
stpapi.get.field("tfacp1131s000","tdpur045.orno",ornot )
stpapi.get.field("tfacp1131s000","tdpur045.pono",ponot )
stpapi.get.field("tfacp1131s000","tdpur045.srnb",srnbt )
if (ornot = read.orno) and (ponot = read.pono) and (srnbt = read.srnb) then
found = 1
ret = stpapi.mark("tfacp1131s000" , error.mess)
else
ret = stpapi.browse.set("tfacp1131s000" , "next.set" , error.mess)
endif
endwhile
| if the record is found then mark it to update its Match field to either Partial or Complete
|also if its a partial field then Invoice QTy and Invoice amount for that particular line have to be entered
if found = 1 then
long match_code
read.match = shiftl$(shiftr$(read.match))
ON CASE read.match
CASE "no": match_code=1
BREAK
CASE "complete":match_code=2
BREAK
CASE "partial": match_code=3
BREAK
ENDCASE
domain tdpur.matc match
match = ltoe(match_code)
stpapi.put.field( "tfacp1131s000", "tdpur045.matc", str$(match))
stpapi.put.field( "tfacp1131s000", "tdpur045.iqan", read.qty )
stpapi.put.field( "tfacp1131s000", "inv.amt.inv.curr", read.inv.amt )
|Update and save the record in tfacp1131s000
ret = stpapi.update("tfacp1131s000",1 , error.mess)
ret = stpapi.save( "tfacp1131s000", error.mess )
|to check values of the fields tdpur045.iqan and inv.amt.inv.curr
domain tcqrd1 qty
qty=f1131s000.get.Invoiced_Quantity( )
message(str$(qty))
domain tfgld.amnt amt
amt= f1131s000.get.Invoiced_Amount( )
message(str$(amt))
domain tcorno orno
orno=f1131s000.get.Purchase_Order( )
message(str$(orno))
string match_str(8)
match=f1131s000.get.Matched( )
match_str=enum.descr$("tdpur.matc" , match)
message(match_str)
but the problem is , apart from the first Receipt ....all other receipts dont get updated .
infact i checked the return value of the stpapi.update but it shows a sucessful update value of 1 .
i am using stpapi.browse.set to get to the PO# , Position No.# and Sequence # that i want to update ,then i mark it and then go ahead and put the fields for Qty , amount and type of Matching , but ...apart from the first Receipt , it doesnt at all match the remaining receipts.
i found that stpapi.browse.set gets me to the correct record...
also after i mark , it and put field value and update ..it does so sucessfully..
but after update and save , when i issue get.field stmts and use a message () statement it shows me the Match = NO ,QTY = 0 and Amount = the amount i put for the first record..
when it shud show Match = Competely ,...and so on.
I tried stpapi.find earlier , but since the find available in this session is only on tdpur045.orno , pono ...while the key field for any record is tdpur045.orno , pono , srnb...so it always find the wrong record...so i had to resort to stpapi.browse.set to get to the correct record.....
but though it seems to be getting the correct record...it just wudnt update the record correctly
any suggestions
string ornot(8)
string ponot(4)
string srnbt(2)
ornot=""
ponot=""
srnbt=""
while ret <> 1 and count.find < 11
ret = stpapi.browse.set("tfacp1131s000" , "first.set" , error.mess)
count.find = count.find + 1
endwhile
while not(found)
stpapi.get.field("tfacp1131s000","tdpur045.orno",ornot )
stpapi.get.field("tfacp1131s000","tdpur045.pono",ponot )
stpapi.get.field("tfacp1131s000","tdpur045.srnb",srnbt )
if (ornot = read.orno) and (ponot = read.pono) and (srnbt = read.srnb) then
found = 1
ret = stpapi.mark("tfacp1131s000" , error.mess)
else
ret = stpapi.browse.set("tfacp1131s000" , "next.set" , error.mess)
endif
endwhile
domain tdpur.matc matc_to_check_partial
matc_to_check_partial=f1131s000.get.Matched( )
|If the Partial matching has already been done and current then go for Multiple Invoices session processing
if (matc_to_check_partial=tdpur.matc.partial) then
ret = ap1_multiple_invoices(read.qty , read.inv.amt,msg)
ret = stpapi.save( "tfacp1131s000", error.mess )
return(ret)
else
if matc_to_check_partial=tdpur.matc.no then
|FOLLOWING is to put values into tfacp1131s000 for complete or partial match
| to find the PO line using PO# , PO line and PO Sequence No.
count.find = 1
ret = 0
found = 0
ornot=""
ponot=""
srnbt=""
while ret <> 1 and count.find < 11
ret = stpapi.browse.set("tfacp1131s000" , "first.set" , error.mess)
count.find = count.find + 1
endwhile
while not(found)
stpapi.get.field("tfacp1131s000","tdpur045.orno",ornot )
stpapi.get.field("tfacp1131s000","tdpur045.pono",ponot )
stpapi.get.field("tfacp1131s000","tdpur045.srnb",srnbt )
if (ornot = read.orno) and (ponot = read.pono) and (srnbt = read.srnb) then
found = 1
ret = stpapi.mark("tfacp1131s000" , error.mess)
else
ret = stpapi.browse.set("tfacp1131s000" , "next.set" , error.mess)
endif
endwhile
| if the record is found then mark it to update its Match field to either Partial or Complete
|also if its a partial field then Invoice QTy and Invoice amount for that particular line have to be entered
if found = 1 then
long match_code
read.match = shiftl$(shiftr$(read.match))
ON CASE read.match
CASE "no": match_code=1
BREAK
CASE "complete":match_code=2
BREAK
CASE "partial": match_code=3
BREAK
ENDCASE
domain tdpur.matc match
match = ltoe(match_code)
stpapi.put.field( "tfacp1131s000", "tdpur045.matc", str$(match))
stpapi.put.field( "tfacp1131s000", "tdpur045.iqan", read.qty )
stpapi.put.field( "tfacp1131s000", "inv.amt.inv.curr", read.inv.amt )
|Update and save the record in tfacp1131s000
ret = stpapi.update("tfacp1131s000",1 , error.mess)
ret = stpapi.save( "tfacp1131s000", error.mess )
|to check values of the fields tdpur045.iqan and inv.amt.inv.curr
domain tcqrd1 qty
qty=f1131s000.get.Invoiced_Quantity( )
message(str$(qty))
domain tfgld.amnt amt
amt= f1131s000.get.Invoiced_Amount( )
message(str$(amt))
domain tcorno orno
orno=f1131s000.get.Purchase_Order( )
message(str$(orno))
string match_str(8)
match=f1131s000.get.Matched( )
match_str=enum.descr$("tdpur.matc" , match)
message(match_str)