jojovalenton
7th April 2015, 07:56
hi,
tdsls4243m000 ran successfully via afs but how can i get the generated production order number (SFC000070) within the script?
regards and thanks in advance,
jojo
mark_h
7th April 2015, 15:02
Once the order is created and displayed on one of the sessions just use stpapi.get.field. This will put it into a string field - then you can convert it to a long.
A snippet of code on one where I create a purchase order - nothing but an example for stpapi.get.field.
| You must save the record before getting the PO Number
rc = stpapi.save( "tdpur4101m000", fserr )
if(strip$(fserr)<>"") then
message("Error save: %s",fserr)
stpapi.end.session( "tdpur4101m000" )
return
endif
stpapi.get.field( "tdpur4101m000", "tdpur040.orno", dummy )
created.po = val(dummy)
jojovalenton
8th April 2015, 13:43
Hi Mark,
Thanks for your reply but what i mean is i need to get the production order number generated after the afs scripts run.
Regards,
Jojo
mark_h
8th April 2015, 15:45
Make it a library and return the order number. Most of my api code goes in libraries. So if I have a program that processes a batch file to create PO's I can use the following library below. It returns the order number to the calling session - maybe I am missing something on your request.
function extern domain tcorno create.po( domain tcorno po.series,
domain tcsuno po.suno,
domain tccotp po.type,
domain tcemno po.buyer,
domain tcdate po.date,
domain tcorno po.morn,
domain tccwar po.cwar,
domain tccfrw po.cfrw, | Forwarding Agent
domain tccplt po.cplt, | Competition code
domain tccdec po.cdec, | Terms of Delivery
ref string msg())
bhushanchanda
9th April 2015, 11:33
Hi,
On the second tab i.e. "Production Order" you have to put the production order series and number group. Using that you can obtain the generated production order.
But, if the session runs wide open, I think there is no way to get the production order numbers.
Mark,
This session takes in the inputs like Manufacturer, Sales Order No etc and generates production order against it.
Attached is the screenshot.
mark_h
9th April 2015, 15:32
Ahhh - now everything makes sense. I create and release orders manually in 4c4 not thru a transfer and release type session like this. Since we are on A&D I did it this way so users can transfer partial pegged quantities on a planned order.
Now if I read the screen shot correctly it will generate a report. In the report - you can actually go write the order numbers and other information to a table. Then you can read that table - it could be a temp table, a permanent table - what ever you design.
bhushanchanda
9th April 2015, 15:49
In the report - you can actually go write the order numbers and other information to a table. Then you can read that table - it could be a temp table, a permanent table - what ever you design.
Follow this and your job is done. A bit code in your report script at the right place with proper conditions and your are good to go.
jojovalenton
12th April 2015, 07:38
gentlemen,
thanks for all these inputs, i will explore these script and report result and let me see the outcome.
thanks,
jojo