View Single Post
  #3  
Old 16th May 2020, 12:37
DDPatel's Avatar
DDPatel DDPatel is offline
Member
 
Join Date: Dec 2018
Location: India,Gujarat,Umbergaon 396150
Posts: 33
DDPatel is on a distinguished road
Baan: LN10.3 - DB: SQL SERVER 2008 R2 - OS: WINDOW SERVER 2008 R2
Quote:
Originally Posted by bhushanchanda View Post
First thing I would try will be using segmented domain for item -

Code:
stpapi.put.field("ticpr0107m000","ticpr007.item.segment.2", trim$(fn.item))

Also, if you are just updating the cost prices, you don't need to use all the fields. And you will need to do a stpapi.find() to find the correct item. Here's the code you can use -

Code:
function extern domain tcbool calculate.cost.prize.for.item()
{
   domain    tcmcs.str100    error.msg, error

    stpapi.put.field("ticpr0107m000","ticpr007.item.segment.2", trim$(fn.item))
    ret = stpapi.find("ticpr0107m000")
   |** You can add validation if no record found (I've not added it)
    stpapi.form.command("ticpr0107m000", 5, "calculate", error.msg)
        if isspace(error.msg) then
         stpapi.end.session("ticpr0107m000",error)
            return(TRUE)
        endif
    stpapi.end.session("ticpr0107m000",error)
    return(FALSE)
 }
it's working....

I forgot "item.segment" and "find" part in my code....
I faced same issue in many script,Now it's look like all script has been solving...

Thank you Bhushan ji...
Reply With Quote