I am working on interfacing data into Finance module through GURFEED. I need to set the GURFEED_DOC_CODE column in the GURFEED table. Is there an api that I can call to get the next document number?
I don't know of an API to use. A SunGard consultant gave me a chunk of SQL Code that I re-worked into the following function (which is part of a package).
-- f_RetrieveNextDocNumber begin ----------------------------------------------
FUNCTION f_RetrieveNextDocNumber(SystemID VARCHAR2)
RETURN VARCHAR2
AS
v_DocCode GURFEED.GURFEED_DOC_CODE%TYPE;
BEGIN
/*Lookup the next document number*/
SELECT fobfseq_docno_prefix || lpad(fobfseq_maxseqno, 6, '0')
INTO v_DocCode
FROM fobfseq
WHERE fobfseq_system_id = SystemID;
/*Increment the SEQ table now that we grabbed the number.*/
UPDATE fobfseq
SET fobfseq_maxseqno = fobfseq_maxseqno + 1
, fobfseq_user_id = USER -- currently logged in user
, fobfseq_activity_date = SYSDATE
WHERE fobfseq_system_id = SystemID;
RETURN v_DocCode;
EXCEPTION
WHEN OTHERS THEN
RETURN null;
END;
-- f_RetrieveNextDocNumber end ------------------------------------------------
Comments
Here's code I used...
I don't know of an API to use. A SunGard consultant gave me a chunk of SQL Code that I re-worked into the following function (which is part of a package).
-- f_RetrieveNextDocNumber begin ---------------------------------------------- FUNCTION f_RetrieveNextDocNumber(SystemID VARCHAR2) RETURN VARCHAR2 AS v_DocCode GURFEED.GURFEED_DOC_CODE%TYPE; BEGIN /*Lookup the next document number*/ SELECT fobfseq_docno_prefix || lpad(fobfseq_maxseqno, 6, '0') INTO v_DocCode FROM fobfseq WHERE fobfseq_system_id = SystemID; /*Increment the SEQ table now that we grabbed the number.*/ UPDATE fobfseq SET fobfseq_maxseqno = fobfseq_maxseqno + 1 , fobfseq_user_id = USER -- currently logged in user , fobfseq_activity_date = SYSDATE WHERE fobfseq_system_id = SystemID; RETURN v_DocCode; EXCEPTION WHEN OTHERS THEN RETURN null; END; -- f_RetrieveNextDocNumber end ------------------------------------------------