Time Receipt json beas script executed twice
HI Expert,
I have json data used in beas script to create Time Receipt. the script is executed well but the scripts seems executed twice. that is why it create two documents in the system. How to prevent this function? I only call and execute the script once but the system execute it twice.


Thanks & Regards,
Alvin
-
Hi Alvin,
can you post the complete script? -
Hi Martin,
Thanks for the reply. Here is the whole script.
instance bsl b
#define ls_json
{"DocEntry":28,"LineNumber":130,"LineNumber2":260,"PersonnelId":"9","QuantityGood":1,"FromTime":"03:40","ToTime":"03:40","Duration":1,
"Issue":{"DocumentLines":[{"ItemCode":"601E10-000298","WhsCode":"3600","Quantity":2,"Price":0.00857,"IVersionId":"1","BaseLineNumber2":2,
"BatchNumbers":[{"DistNumber":"192018000108284","Quantity":2,"IVersionId":"1","BinCode":null}]},
{"ItemCode":"601E10-000300","WhsCode":"3600","Quantity":7,"Price":0.00857,"IVersionId":"1","BaseLineNumber2":4,
"BatchNumbers":[{"DistNumber":"19198000102414","Quantity":7,"IVersionId":"1","BinCode":null}]},
{"ItemCode":"601E10-000196","WhsCode":"3600","Quantity":52,"Price":0.00857,"IVersionId":"1","BaseLineNumber2":6,
"BatchNumbers":[{"DistNumber":"192016000106783","Quantity":52,"IVersionId":"1","BinCode":null}]},
{"ItemCode":"601E10-000311","WhsCode":"3600","Quantity":12,"Price":0.11594,"IVersionId":"1","BaseLineNumber2":8,
"BatchNumbers":[{"DistNumber":"19198000102232","Quantity":12,"IVersionId":"1","BinCode":null}]},{
"ItemCode":"601E11-000008","WhsCode":"3600","Quantity":5,"Price":0.17759,"IVersionId":"1","BaseLineNumber2":10,
"BatchNumbers":[{"DistNumber":"19197000100904","Quantity":5,"IVersionId":"1","BinCode":null}]},
{"ItemCode":"601E11-000034","WhsCode":"3600","Quantity":4,"Price":0.06532,"IVersionId":"1","BaseLineNumber2":12,
"BatchNumbers":[{"DistNumber":"19197000100984","Quantity":4,"IVersionId":"1","BinCode":null}]},
{"ItemCode":"601E12-000208","WhsCode":"3600","Quantity":2,"Price":0.80956,"IVersionId":"1","BaseLineNumber2":14,
"BatchNumbers":[{"DistNumber":"192017000107374","Quantity":2,"IVersionId":"1","BinCode":null}]},
{"ItemCode":"601E12-000034","WhsCode":"3600","Quantity":11,"Price":0.65483,"IVersionId":"1","BaseLineNumber2":16,
"BatchNumbers":[{"DistNumber":"19197000101273","Quantity":11,"IVersionId":"1","BinCode":null}]},
{"ItemCode":"601E12-000044","WhsCode":"3600","Quantity":4,"Price":0.18453,"IVersionId":"1","BaseLineNumber2":18,
"BatchNumbers":[{"DistNumber":"19196000100561","Quantity":4,"IVersionId":"1","BinCode":null}]},
{"ItemCode":"601E12-000035","WhsCode":"3600","Quantity":31,"Price":0.18085,"IVersionId":"1","BaseLineNumber2":20,
"BatchNumbers":[{"DistNumber":"191910000104050","Quantity":31,"IVersionId":"1","BinCode":null}]},
{"ItemCode":"601E12-000091","WhsCode":"3600","Quantity":5,"Price":2.58422,"IVersionId":"1","BaseLineNumber2":22,
"BatchNumbers":[{"DistNumber":"19198000102069","Quantity":5,"IVersionId":"1","BinCode":null}]},
{"ItemCode":"601E17-000010","WhsCode":"3600","Quantity":1,"Price":3.41093,"IVersionId":"1","BaseLineNumber2":24,
"BatchNumbers":[{"DistNumber":"19199000103647","Quantity":1,"IVersionId":"1","BinCode":null}]},
{"ItemCode":"601E14-000025","WhsCode":"3600","Quantity":2,"Price":5.23377,"IVersionId":"1","BaseLineNumber2":26,
"BatchNumbers":[{"DistNumber":"19197000100958","Quantity":2,"IVersionId":"1","BinCode":null}]},
{"ItemCode":"601E14-000019","WhsCode":"3600","Quantity":1,"Price":4.5328,"IVersionId":"1","BaseLineNumber2":28,
"BatchNumbers":[{"DistNumber":"19199000103740","Quantity":1,"IVersionId":"1","BinCode":null}]},
{"ItemCode":"601E14-000027","WhsCode":"3600","Quantity":1,"Price":15.84949,"IVersionId":"1","BaseLineNumber2":30,
"BatchNumbers":[{"DistNumber":"192015000106220","Quantity":1,"IVersionId":"1","BinCode":null}]},
{"ItemCode":"601E70-000043","WhsCode":"3600","Quantity":1,"Price":21.43068,"IVersionId":"1","BaseLineNumber2":32,
"BatchNumbers":[{"DistNumber":"19196000100378","Quantity":1,"IVersionId":"1","BinCode":null}]},
{"ItemCode":"601E10-000334","WhsCode":"3600","Quantity":15,"Price":0.11594,"IVersionId":"1","BaseLineNumber2":34,
"BatchNumbers":[{"DistNumber":"19196000100514","Quantity":15,"IVersionId":"1","BinCode":null}]},
{"ItemCode":"601E10-000339","WhsCode":"3600","Quantity":9,"Price":0.11594,"IVersionId":"1","BaseLineNumber2":36,
"BatchNumbers":[{"DistNumber":"19199000103209","Quantity":9,"IVersionId":"1","BinCode":null}]}]},
"Receipt":{"DocumentLines":[{"ItemCode":"601EEA-000057-6E03B","WhsCode":"3600","Quantity":1,"Price":546.57871,"IVersionId":"2","BaseLineNumber2":0,
"BatchNumbers":[{"DistNumber":"R002801300004","Quantity":1,"IVersionId":"2","BinCode":null}]}]}}
#end
b.post=TimeReceipt=<ls_json>
messagebox=<b.ret_code> <b.ret_text> <b.ret_value>
destroy=bResult are :
Time Receipt posted twice.
Receipt (OIGN) : Posted the first and second hit the error serial number ady in used.
Issue (OIGE): Posted twice with the doubled issue qty posted. also double document created.
On my observation the scripts above is run twice by the beas. but I only run it one using the Test Tool.
Thanks,
Alvin
-
wow. Nice to see that you use BSL and this complex function ;-) I hope you love it.
Can i've some information about the solution on which you're working? I'm always happy to become feedback.
For your problem:
is the script running correct in debug window?
if you send only a "messagebox=hola": Is this executed 2 times too?
-
Hi Martin,
When i sent "messagebox=hola" it executed once only.
Also, when i executed Issue & Receipt separately. it execute once only with no error and the documents created across to work order is correct. also when i executed Time Receipt alone with no Issue and Receipt on it, it executed correct. but when I used the above scripts to create Time Receipt with Issue & Receipt it executed twice, which is wrong bcoz will affect inventory movement in SAP B1.
Thanks & Regards,
Alvin
Please sign in to leave a comment.
Comments
4 comments