Thank you for the advice David. Prior to me posting, I was really hoping there was a conventional front-end way so I didn't have to mimic / recreate the NEXT_NEW from WOWDBB or from one of the VI programs you mentioned. But I did. This wasn't for V/I but rather for a mod that auto-releases Work Orders during W/O Traveler Printing.
Just so you know, you can never CALL or PERFORM to that routine not just b/c it's Legacy it's but Old Skool Legacy. Some old skool stuff is cool but mostly it's not (e.g. EXTRACT to lock records, Line Index files, 2 file scheme for data entry Batch header files, the Sy0ctl dumping ground to store most system data, on and on)
Also in case you ever need to do the same, it's a little different than what you mentioned:
* EXTRACT the [W/Oxxx] key in Sy0ctl and get the value of Next from superstring position (163,7 in this case). A copy of all WO0 recs as well as every legacy module's xx0 file recs are stored in here. Even when you select W/O Options that UI is showing you a copy of the Sy0ctl recs for it.
* Don't EXTRACT or READ from WO0
* If the Next Number is all numeric then add 1
* WRITE the updated Options record to Sy0ctl which releases the EXTRACT record lock
* WRITE the updated Options record to WO0 which was never EXTRACTed (and if you think this could make the 2 go out of sync you would be right it did!)
It also does all this SWAPCH and SWAFILE$ stuff for re-purposing same channel numbers. Eg On last step Ch 6 for Sy0ctl WRITE is re-purposed for the WO0 WRITE. This was done in the late 90s to support a Novell NLM compatibility for faster BBx code execution at the time. In spite of the NLM never being released from beta, that SWAP crap never get removed until modules went to Framework. Also I know from J/C Dev where we had to write a JC_Options_svc sub-class that inherited CI_NextNumber, you can't use the CI_NextNumber simply b/c W/O is not in Framework (which will change imminently but who knows how).
I appreciate your response and ideas!
------------------------------
Alnoor Cassim
Free Agent Developer and Consultant
CallForHelp.biz
Email:
alnoor@callforhelp.bizOrange County, CA
------------------------------
Original Message:
Sent: 05-10-2019 02:19
From: David Speck II
Subject: How to get Next Transaction Number in Work Order Transaction Entry import
I don't have a version that old so "Operation = Next" works for me in v2018.2. I attempted to try another route by using perform logic in the before assign event calling the same program and statement used by the transaction entry ui object, "../WO/WOWDBB;next_new" but this results in an error 47 at line 7045 in WOWDBB. Only way else i can see you accomplishing this is to use some perform logic to open the WO0 file, read the record for the "WOXXX" key, extract the next trans number, then either write your own increment logic or use the NextNumber function from the CI_NextNumber object if available. http://help-sage100.na.sage.com/2018/FLOR/index.htm#Object_Reference/CI/CI_NextNumber.html
Then piece together the full record with the incremented trans number and then write the record back to WO0.
You would need additional logic to determine if the current record is part of the previous record so you're not incrementing the trans number from one line to the next.
Another approach i suppose if you still have MD access would be to inspect these programs and the statements on a version where the "Next" feature works.

I couldn't find any indication that the "Next" functionality exists in the compiled vi job pictured above so i imagine it is happening in one of those referenced programs.
------------------------------
David Speck II
Tennessee Software Solutions
------------------------------