Premahari
20th November 2018, 09:33
Hi, I want to move all rejected item to quarantine through AFS. For serialised items, in move to quarantine session i have to select serials. It will open timfc0110m100 session with all serials selected, just to click save and exit button. But there is no AFS for save and exit. I tried with stpapi.update followed by stpapi.endsession. But still not working. Can anyone please tell how to move to quarantine for serialised items.
Thanks in advance
I have shared my code

stpapi.put.field( "tisfc0130m000", "tisfc010.pdno", temp.orno)
stpapi.put.field( "tisfc0130m000", "tisfc010.opno", str$(temp.opno) )
ret = stpapi.find( "tisfc0130m000" , error)
if ret = 1 then
stpapi.form.command( "tisfc0130m000", 2, "tisfc0209m000", error )
stpapi.handle.subproc( "tisfc0209m000", "timfc0110m100", "modify" )
stpapi.form.command( "tisfc0209m000", 5, "select.serial.numbers", error )
stpapi.update( "timfc0110m100", 1, error )
stpapi.end.session("timfc0110m100")
stpapi.put.field( "tisfc0209m000", "f.dir.proc.wo", str$(tcyesno.yes) )
stpapi.form.command( "tisfc0209m000", 5, "reject.to.quarantine", error )
stpapi.end.session("tisfc0209m000")
else
dal.get.error.message (error)
abort.transaction()
message(error)
endif

giggty
20th November 2018, 11:39
Try making some change to timfc0110m100 like unselect a serial and then select it back before doing stpapi.update(),
And what is the purpose of stpapi.handle.subproc( "tisfc0209m000", "timfc0110m100", "modify")?

Premahari
20th November 2018, 12:06
Thanks giggty for you reply.
But there is no option to select serials and unselect serials by AFS.
Can you give some other option. When i update through stpapi.update its giving error session not available. But the session i checked its there.

giggty
20th November 2018, 13:58
Ah, so stpapi.update is giving you error? And what does it return into error variable exactly? Also can you show me a screenshot of timfc0110m100?

mark_h
20th November 2018, 16:20
Assuming it finds the record I kind of expected to see something like this just to get the sessions controlled correctly (from my 4c4 perspective]


stpapi.handle.subproc( "tisfc0130m000", "tisfc0209m000", "add" ) | So tisfc013m000 controls tisfc0209m000
stpapi.form.command( "tisfc0130m000", 2, "tisfc0209m000", error ) | This then launches tisfc0209m000
stpapi.handle.subproc( "tisfc0209m000", "timfc0110m100", "add" ) | Then tisfc0209m000 controls timfc0110m100
stpapi.form.command( "tisfc0209m000", 5, "select.serial.numbers", error ) | Launches tifmc0110m100
| At this point I would expect a put, a select or something - really nothing to update, maybe a stpapi.mark or something
stpapi.update( "timfc0110m100", 1, error )


Since I am not familiar with the sessions I can't really say what should happen. My guess is if running manually you would mark a record, hit continue(or something) to return to the previous screen, then push maybe a quarantine buttom.

Premahari
21st November 2018, 07:45
I have attached both screen shots.
1. When I manually select serials for move to quarantine
2. Through AFS, trying to select serials
There are many serials how to mark all serials through AFS.

mark_h
21st November 2018, 15:24
Well it looks like you might be able to use stpapi.mark to quarantine them one at a time. But still not sure what you do after you select them. I assume there is a save or something under the action drop down.

giggty
21st November 2018, 18:56
Can't you debug it in LN Studio? If you could you would see whether timfc0110m100 is actually started after stpapi.form.command( "tisfc0209m000", 5, "select.serial.numbers", error ).

And as Mark said you have to use stpapi.mark and mark (no pun intended :)) all serials in a loop because there is no stpapi command to mark all occurences. After that update might work. As the matter of fact I had a similar situation and I tackled it just like this.

Premahari
22nd November 2018, 06:52
Thanks for your reply. No there is no option under Action and no Save option also.

Premahari
22nd November 2018, 07:20
Thank for your reply giggty. I tried by marking all serials in loop also but its not working. No error but not moving to quarantine also

giggty
22nd November 2018, 11:33
Soo, stpapi.update doesn't spit an error message now? Try getting error messages with stpapi.get.mess.code like this:

while true
error.code = stpapi.get.mess.code("timfc0110m100", error.msg)
if isspace(error.msg) then
break
endif
message(error.msg)
endwhile

Also try calling stpapi.continue.process() (or stpapi.form.command("timfc0110m100", 5, "exec.cont.process", error)) instead of stpapi.end.session.