baan.kmurali
29th January 2014, 13:20
Hi experts,
i am doing Service order through AFS. while run the below coding i'm getting the error message as "Series number must be greater than 0". But i have passed the value. Thanks in advance...



string error(80)
error =""
ser = 96
sma.grno = 0
stpapi.put.field("tssma3101m000", "sma.grno",str$(ser))
stpapi.put.field("tssma3101m000","tssma301.desc","test")
stpapi.put.field("tssma3101m000", "tssma301.swor", str$(etol(tssma.sert.other)))
stpapi.put.field("tssma3101m000", "tssma301.sert", str$(etol(tssma.sert.call)))
stpapi.put.field("tssma3101m000", "tssma301.cctp", "106")
stpapi.put.field("tssma3101m000", "tssma301.cuno", "E00263")
stpapi.put.field("tssma3101m000", "tssma301.ddt1", str$(date.num()))
stpapi.put.field("tssma3101m000", "tssma301.cloc", "RLY")
stpapi.put.field("tssma3101m000", "tssma301.care", "720")
stpapi.put.field("tssma3101m000", "tssma301.prno", "001")
stpapi.put.field("tssma3101m000", "tssma301.csym", "NPM")

stpapi.insert("tssma3101m000",1,error)
stpapi.end.session("tssma3101m000")

Regards,
Murali

mark_h
30th January 2014, 01:04
Moved to the correct forum. You can search on tmssma3101m000, but I only found 3 threads. Looks like one user was putting 0 in the series number and I think it looked like it would hit the series field and then just exit the program.

The first question I would ask is - do you own source code for tmssma3101m000 where you can debug what is happening?

There are other things you can try - like after the insert get the series field and see if something reset the value. I have had that happen - but not on something that looks critical to a session. You can also try an update versus an insert just to see what happens - really best if you had source code to look at.

Maybe someone else has a solution they can share. But what you posted looks correct from me just glancing at our version of the session.

baan.kmurali
30th January 2014, 14:37
Hi Mark... Where you moved this forum. I think its related to programming na....
Actually i initialized the series, But i getting the error
"Series number must be greater than 0". Please advice

ser = 96
sma.grno = 0
stpapi.put.field("tssma3101m000", "sma.grno",str$(ser))

ERROR : Series number must be greater than 0

Regards,
Murali

mark_h
3rd February 2014, 01:27
Like I stated it would be best if you had the source code to debug what is happening. As I also mentioned after the insert you can get the series number to see if something blanked it. You can also try a stpapi.update instead of an insert. Sometimes you just have to play with the api code to find out what is going on and what will work.

My suspicion is there is a piece of code getting activated when the insert is hit that resets the series number back to 0. You can try putting the series number followed by update or save - see what happens. It can be a combination of these things. We do not use these sessions so I can't really help.

bhushanchanda
3rd February 2014, 07:42
Hi,

Check if you are putting the data in the correct field. We don't have this session so cant test it. Also check the domain of the field.

May be its an inconsistent domain or field name which is causing the problem.

baan.kmurali
4th February 2014, 06:47
Can anybody send the service order(tssma3101m000) AFS coding.

Session field is sma.grno and domain is "tcgrno" which is "3" digit position("ZZ9")

But in the session this field has defined as two digit like "Z9"

Can you help me that how can i assign now?

Coding

stpapi.put.field("tssma3101m000", "sma.grno","96")

in debugger, while insert it the below error message is occurred

ERROR : Series number must be greater than 0

Regards,
Murali

bhushanchanda
4th February 2014, 11:05
Hi,

Try stpapi.get.field() right after assigning the value. I am still guessing its the data type that's causing the issue.

baan.kmurali
4th February 2014, 11:18
i tried get function which is returns series no.

stpapi.put.field("tssma3101m000", "sma.grno","96")
stpapi.get.field("tssma3101m000", "sma.grno",sgrno) - its returns "96" Not an issue. while insert it the below error message is occurred.


ERROR : Series number must be greater than 0

Please find the full coding

stpapi.put.field("tssma3101m000", "sma.grno","96")
stpapi.get.field("tssma3101m000", "sma.grno",sgrno)
stpapi.put.field("tssma3101m000", "tssma301.desc", "test")
stpapi.put.field("tssma3101m000", "tssma301.swor", str$(etol(tssma.sert.other)))
stpapi.put.field("tssma3101m000", "tssma301.sert", str$(etol(tssma.sert.call)))
stpapi.put.field("tssma3101m000", "tssma301.cctp", "106")
stpapi.put.field("tssma3101m000", "tssma301.cins", "Z01118/202920")
stpapi.put.field("tssma3101m000", "tssma301.cuno", "E00263")
stpapi.put.field("tssma3101m000", "tssma301.cjob", "OIL-100")
stpapi.put.field("tssma3101m000", "tssma301.telp", "258")
stpapi.put.field("tssma3101m000", "tssma301.ncmp", "100")
stpapi.put.field("tssma3101m000", "tssma301.refe", "13482")
stpapi.put.field("tssma3101m000", "tssma301.ddt1", str$(date.num()))
stpapi.put.field("tssma3101m000", "tssma301.dtm1", "1613")
stpapi.put.field("tssma3101m000", "tssma301.ddt5", str$(date.num()+3))
stpapi.put.field("tssma3101m000", "tssma301.dtm5", "1613")
stpapi.put.field("tssma3101m000", "tssma301.cloc", "RLY")
stpapi.put.field("tssma3101m000", "tssma301.care", "720")
stpapi.put.field("tssma3101m000", "tssma301.prno", "001")
stpapi.put.field("tssma3101m000", "tssma301.csym", "NPM")
stpapi.insert("tssma3101m000",true,err.msg)

if isspace(err.msg) then
stpapi.get.field("tssma3101m000","tssma301.orno",ordno)
else
message("Error in Sevice order Header",err.msg)
stpapi.end.session("tssma3101m000")
end()
endif
stpapi.end.session("tssma3101m000")

baan.kmurali
4th February 2014, 11:43
issue solved...

Service order header AFS Coding...

stpapi.put.field("tssma3101m000", "sma.grno","96")
stpapi.put.field("tssma3101m000", "tssma301.desc", "test")
stpapi.put.field("tssma3101m000", "tssma301.cctp", "106")
stpapi.put.field("tssma3101m000", "tssma301.cins", "Z01118/202920")
stpapi.put.field("tssma3101m000", "tssma301.cuno", "E00263")
stpapi.put.field("tssma3101m000", "tssma301.cjob", "OIL-100")
stpapi.put.field("tssma3101m000", "tssma301.prno", "001")
stpapi.put.field("tssma3101m000", "tssma301.csym", "NPM")
stpapi.insert("tssma3101m000",true,err.msg)

if isspace(err.msg) then
stpapi.get.field("tssma3101m000","tssma301.orno",ordno)
else
message("Error in Sevice order Header",err.msg)
stpapi.end.session("tssma3101m000")
end()
endif
stpapi.end.session("tssma3101m000")

Thanks & Regards,
Murali

bhushanchanda
4th February 2014, 12:05
Good.

Please post what the issue was so that people having the same difficulty will get an idea of it.

mark_h
4th February 2014, 15:35
Glad you got it solved - it looks basically the same with fewer fields put to the form. Was there a specific field that you put casuing the issue?

baan.kmurali
11th February 2014, 06:54
I removed the unwanted fields in put.field.

Regards,
Murali