Sequence Number Generation with Global Container
Hi ALL,
Can any plz send me the steps of using global container for generation seqence number's
And also if possible send me the code.
Thanks & Regards
Rupash
Hi Rupesh,
chack this code:
public String seqNumber(Container container)
int i;
GlobalContainer global=container.getGlobalContainer();
String getnum=(String)global.getParameter("a");
if(getnum==null){
global.setParameter("a","1"); i=1;
else{
i=Integer.parseInt(getnum); i++;
global.setParameter("a",String.valueOf(i));
return String.valueOf(i);
**Reward points if helpful
--Sankar Choudhury
Similar Messages
-
Enq: TX - row lock contention in forms 10g sequency number generation
Iam Getting the Deadlock issue in oracle formdeveloper 10g database is 11g Acutually in our small Hospital organization using different forms generating entrying labrequest form finally save time
one sequency number will generated i have give procedure below every save criteria form using below procedure some time iam getting lock iam using blocksession query i have find out some
OSUSER
MACHINE
TERMINAL
PROGRAM
SQL_ID
LOGON_TIME
BLOCKING_SESSION_STATUS
BLOCKING_SESSION
EVENT
user423
UMCCDOM\LEVEL4-MICU
LEVEL4-MICU
PrjMcr.EXE
0ccngw7dfkmgb
23/09/2013 11:34:41 AM
VALID
277
enq: TX - row lock contention
SYSTEM
WORKGROUP\PRIAPPSVR
PRIAPPSVR
frmweb.exe
0ccngw7dfkmgb
23/09/2013 11:32:50 AM
VALID
186
enq: TX - row lock contention
SYSTEM
WORKGROUP\PRIAPPSVR
PRIAPPSVR
frmweb.exe
0ccngw7dfkmgb
22/09/2013 2:49:47 PM
VALID
277
enq: TX - row lock contention
SYSTEM
WORKGROUP\PRIAPPSVR
PRIAPPSVR
frmweb.exe
0ccngw7dfkmgb
23/09/2013 7:00:22 AM
VALID
186
enq: TX - row lock contention
user290
UMCCDOM\LEVEL2-N
LEVEL2-N
PrjMcr.EXE
0ccngw7dfkmgb
23/09/2013 10:28:06 AM
VALID
277
enq: TX - row lock contention
lock are happen after open the code i have find out used FOR UPDATE in procedure please tell me any alternative for this every labrequest form saving time using this procedure for generating prefix sequence number multiple user using with different systems
PROCEDURE Gsp_GenSeqNum (I_SvPrefixCd IN VARCHAR2,I_SvUserName IN VARCHAR2,
O_SvSeqNum OUT VARCHAR2) IS
--This Procedure generates the sequence number
--by retrieving the prefix based on the code
--supllied to the procedure.
CURSOR crSeqGenerator IS
SELECT Gsn_prefix_last_num, Gsn_prefix_year
FROM G_SEQUENCE_NUMBER
WHERE Gsn_prefix_Cd = I_SvPrefixCd
AND Gsn_prefix_year = TO_CHAR(SYSDATE,'YYYY')
FOR UPDATE OF Gsn_prefix_last_num;
udSeqNum G_SEQUENCE_NUMBER.Gsn_Prefix_last_num%TYPE;
udNextSeqNum G_SEQUENCE_NUMBER.Gsn_Prefix_last_num%TYPE;
udYear G_SEQUENCE_NUMBER.Gsn_Prefix_year%TYPE;
udPrefix G_SEQUENCE_PREFIX.Gsp_Prefix_Value%TYPE;
BEGIN
SELECT Gsp_Prefix_Value
INTO udPrefix
FROM G_SEQUENCE_PREFIX
WHERE Gsp_Prefix_Cd = I_SvPrefixCd;
OPEN crSeqGenerator;
FETCH crSeqGenerator
INTO udSeqNum,
udYear;
IF crSeqGenerator%FOUND THEN
udNextSeqNum :=udSeqNum + 1;
O_SvSeqNum := udPrefix||'/'||TO_CHAR(SYSDATE,'YY')
||'/'||LPAD(TO_CHAR(udNextSeqNum),6,'0');
ELSE
INSERT INTO G_SEQUENCE_NUMBER VALUES(I_SvPrefixCd,TO_CHAR(SYSDATE,'YYYY'),0,I_SvUserName,SYSDATE);
udSeqNum :=0;
udNextSeqNum :=udSeqNum + 1;
O_SvSeqNum:=UdPrefix||'/'||TO_CHAR(SYSDATE,'YY')
||'/'||LPAD(TO_CHAR(udNextSeqNum),6,'0');
END IF;
UPDATE G_SEQUENCE_NUMBER
SET Gsn_Prefix_last_num=udNextSeqNum
WHERE Gsn_Prefix_Cd = I_SvPrefixCd
AND Gsn_Prefix_year=TO_CHAR(SYSDATE,'YYYY');
CLOSE crSeqGenerator;
END Gsp_GenSeqNum;
Thanks
subbuThis application is inbuit with some modules VB (cath ,cardio)and oracle forms for required sequence number generation different time used this procedure whereever required the sequence Prefix generation.If i replace the procedure sequene to oracle standard sequency if the user cannot save the form unnessary sequency generated order is missing from sequence.
-
Help needed with Global Container usage
Hi All,
In a scenario, we are using a Global container.
we are using setParameter and getParameter methods to set and get values from the Global Container.
The problem we are facing is that although we are setting the value for a parameter before getting it but it always returns "null".
Please find attached the code:
SetVar:
GlobalContainer myGlobalContainer;
myGlobalContainer = container.getGlobalContainer();
myGlobalContainer.setParameter(b.toUpperCase(), a);
return a;
GetVar:
GlobalContainer myGlobalContainer;
myGlobalContainer = container.getGlobalContainer();
if (myGlobalContainer.getParameter(a) == null) {
return "";
else {
return (String)myGlobalContainer.getParameter(a.toUpperCase());
We have also tried putting the string value excplicitly in "" but of no use.
We also read the blog by Michael but i think the problem is a little different.
If any body can help us with where to look for Global Container related errors, it would be of great help.
Regards,
Varun JoshiVarun,
The Signature of setParameter() is,
void
setParameter
(String parName, Object obj);
Taking this into account,
GlobalContainer myGlobalContainer;
myGlobalContainer = container.getGlobalContainer();
myGlobalContainer.setParameter(b.toUpperCase(), a);
return a;
In this method you are settting parameter b with value a.
But, in the get
GlobalContainer myGlobalContainer;
myGlobalContainer = container.getGlobalContainer();
if (myGlobalContainer.getParameter(a) == null) {
return "";
else {
return (String)myGlobalContainer.getParameter(a.toUpperCase());
You are trying to use get(a) when it should be get(b).
Regards
Bhavesh -
Help me in sequence number generation
hi
i had written a JSP which reads and displays the all the directories in that pertucular folder
when i click on a perticular folder it should read each and every file in that folder and it should rename it with a sequence number
i.e file0001,file0002,file0003 etc....
the sequence should be reset for each folder and if i add some new files in to diretory it should remember last sequence number and it should assign next number onwards to those files.
at any point of time i may move or deete any file
but each and every foler i should keep track of last sequence number assigned so that next onwards i can reame new files from that number
another constraint is i may delete the files in that directory
i am new to java
so PLZ help me how effeciantly i can write a program
if so PLZ provide me an example
thanks in advancewhen i click on a perticular folder it should read
each and every file in that folder and it should
rename it with a sequence numberShould the files in the underlying file system be renamed or is this "renaming" just an abstraction layer you maintain yourself? In that case you can use JTree of Swing to maintain an own file structure on top of the OS. You just map "your" filenames to the real file names underneath. -
Problem on forms for serial number generation with last record next_record.
Hi Experts,
currently i'm facing one problem like :
i'm populating one receipt detail in Multi block , like when user key in one receipt number that time record should go in first record ,and if they key in second receipt number then record should go in second record . mean to say every time record go in last record ..but the problem is i want to generate Serial no correspondence to every last record ..
here is my approch :
cursor c1 is
select * from table
where cname =:blk_name.clm_name.
Last record;
next_record;
for v1 in c1 loop
processed record;
next_record;
end loop;
last_record;
go_block(___);
first_record;
:sno := system.cursor_record ;
next_reocrd;
end loop;
first_record;
And in block level i'm writing code for Serial number generation when user key in manual entry for receipt detail:
:blk_name.coulumn_name := :system. cursor_record;
so in this approach their is no problem it is working properly but the problem is that
when user fetch one receipt automatically and then after he want to enter next record manually and he decided to go in detail block ,
and once he reached in detail block that time block level trigger i firing .ans serial number 2 generated and then suddenly he came to know no i want to fetch next record automatically mean to say now user going again master block and fetching next receipt detail ,
but the problem is when user leaving seccond sr no and going in master block and population next receipt detail that time cursor going on 3 record
but logically have to replace the second Serial no and generate the again serial number 2 record population .mean to say its not refreshing last_record..
so i'm appreciating is anyone if came accoross this type of issue please corrrect my code and send updated code ..plsssssssssssssssssssssssssssssss
Thanks
Abhishek
[email protected]hi
I put this below code on when_new_record_instance on block level..
:blk_name.column_name :=system.cursor_record;
so can you please help me.....
Thanks
Abhishek -
Sequence Number Generation in XML Form Buider??????
Hi All,
I want to generate some Sequence Number for each XML Form Generated by the XML Form Builder Application?
Ex: my XML Form Builder Application is "MYAPP". Using this I filled data and Save, then an XML will be created, then it should have some unique Number(say 1234), then if I fill the differennt Data and Save, then another XML will be created. For this the Number should be 1235, next 1236, ........
I can use the XML Form ID, but that is not User friendly format. Becaz I need to display this Number to the End User.
(Example: 10b2ae7b-e269-2b10-d88e-ddade2e62015.xml)
If anybody have idea on this, Please guide me...
Thanks&Regards||
Ashok M.
Edited by: Ashok Kumar Munugoti on Oct 16, 2008 8:04 AMclosing this Thread.
-
Hi,
I want to generate sequence number to Particular Column whenever a new record is created .i.e when i create SR the column value should be 1,2, 3....
how to achieve autogeneration of number while creating recordsThe reason why you can't do this is because, system referes the Row id while creating the SR number. which comes from the database table. you can not control that. As venky suggested, you can achieve this by using webservices to call the external system which will generate the SR number in series and assign it to your CRM SR.
All the best.
Nisman -
Sequence number start with 00001
hi all
i want to create sequence i want it starts with 000001,and after creating of sequence it return the values like this 000002,000003,000004 and so on
is it possible that it start with 000001?
CREATE SEQUENCE SARAHSEQuence
INCREMENT BY 1
START WITH 000001
Sarah
opps i posted in form forum sorry
Edited by: SarahSarahSarah on Sep 3, 2009 1:20 AM
Edited by: SarahSarahSarah on Sep 3, 2009 1:20 AMYou can also use the To_Char() function.
A sequence gives you a number, so you can transform it with format mask to string:
Declare
n number
s varchar2(10);
Begin
select seq.nextval into n from dual ;
s := To_Char(n, '000000') ;
End;Note that this question has nothing to do with Forms.
Francois -
Help on counter (Sequence number generation)
Hi all,
Need to ask smething about the counter to generate the sequence numbers and pass it to the target field.
If we use the Global containers, then say if the app server goes down, the current count will also vanish. Am I correct?
So thats the case, then we should use the DB lookup for the same?
Also, the INDEX function in the Statistics part in the GUI of Message Mapping, how much that is helpful?
Respond back at the earliest possible.
Thanks in advance.
NeeteshHi,
just one point about your sentence: <i>If we use the Global containers, then say if the app server goes down, the current count will also vanish. Am I correct?</i>
For me you are wrong, if your application server shut down during your mapping execution, then you will <b>NOT</b> have an inbound message for your target system, because your system is stopped. And you will have a red flag inside SXI_MONITOR.
Mickael
one question: what is the direction/sense of your flow? "XI -> ZZ" or "ZZ -> XI" ?
Message was edited by: Mickael Huchet -
Random number generation with format 18XX88YYYYY
I have been tryig to generate random numbers having
format 18xx88yyyyy
here
18 followed by two random number then 88 followed by five random number. here 18 and 88 are fixed at location one,two,five and sixth position.
but I am unable to get the logic .
So please help
Thanx
AchyotAfter changing the column from number to varchar2 I am getting my correct result...
create or replace function generateRandom return varchar2 is
random varchar2(11);
begin
SELECT '18'|| lpad(ROUND (DBMS_RANDOM.VALUE (0, 100)),2,'0')|| '88'|| lpad(ROUND (DBMS_RANDOM.VALUE (0,
100000)),5,'0')
into random FROM DUAL;
return random;
end;
create or replace procedure insertRandom is
getNum varchar2(11);
x number(3);
cnt number;
cursor checkpk is
select random_no n from rand_no;
begin
cnt:=0;
while (cnt<3054) loop
x:=0;
getNum:=generateRandom;
for pkcheck in checkpk loop
if getNum=pkcheck.n then
x:=x+1;
end if;
end loop;
if x=0 then
insert into rand_no values(getNum);
end if;
select count(*) into cnt from rand_no;
end loop;
commit;
end insertRandom;
output:
RANDOM_NO
18388817929
18658842315
18028870847
18898822037
18678818255
18248878003
18558852407
18878870907
18998892135
18538876212
18908820740
Thanx you everyone... -
MDM number generation with length limitation
Dear experts,
I'm currently working on an MDM project, and creating a repository that will auto-generate Project Master number.
The tricky part is that the project number is alphanumeric: it is a combination of AABBCCCC.
AA = Site code (like CZ, XJ, etc)
BB = year (like 14)
CCCC = 4 digits auto ID (0001, 0002, ...., 9999)
I'm thining of using calculated fields, but I'm not sure how I can control the length of auto-id.
Any suggestions?
Thank you!
Best regards,
AZHi AZ,
You can't control the length of auto-d, because its automatic generated unique integer key repersenting the count of the record in the table. The autoid is non editable and once deleted you can not get the code back for other records.
Kindly note there is no limitation for Autoid, as much records get created in the MDM table where autoid field is called,that much Autoid will get generated.
the below calculation you can use to achive your result.
Note:In the calculation field Right (Autoid,4) is holds value 4 so the autocodes will only generated till autoid9999. If you want to increase you can increment the value to 5, by that you can get the autocode till 99999.....
As you know any modification to the calculation field you require to stop the repository, to avoid this you can achieve this by using Assignment.
the below thread will explain and give you some idea regarding calling the assignment in the workflow.
http://scn.sap.com/thread/3521976
Regards -
Sequnce Number generation in Message Mapping..
Hello All,
I am using this thread as a reference for declaring a Counter for unique sequence number generation...
Sequence Number in XI Mapping
-> define a global variable by clicking the JAVA_SECTION_TOOLTIP icon on the design tab of source message type of ur message mapping.
enter the following in the GlobalVariables Section
Integer counter =0;
-> define a user defined function (SeqGen let's say)
write the following code in it.
Integer seq = 0;
GlobalContainer globalContainer = container.getGlobalContainer();
a = globalContainer.getParameter("counter");
seq = globalContainer.getParameter("counter");
seq = seq + 1;
globalContainer.setParameter("counter",seq);
return a;
now use this user defined function (SeqGen)in all ur mappings to the sequence no of ur line items.
If u could just elaborate on creation of UDF.. on what are we goin to pass in the variable 'a'... while creating the UDF. ??
Harpreet..!!Hi harpeet,
A UDF can be of two types a Simple UDF and Adavnced UDF.
This is a case of a simple UDF,
A simple UDF returns only 1 element as an output.
here 'a' is such an generated output. you can assign this to any numeric filed of ur target stucture
This UDf does not require any input Field from the message.
These functions are known as generating functions.
Hope this explains.
Reward points if useful.
Regards,
Abhishek -
How to Customize Employee Number Generation?
m trying to generate a custom employee,applicant numbers through a dummy business group.
I've created on Application: Oracle E-Business 11.5.10.2 the work structure and am now on the step of customizing the employee generating number.
I followed the link steps:
Below steps already done:
Technical Side:
1- Create New Sequence in DB.
-----Sequence Code----------
DROP SEQUENCE APPS.APPSLEAD_CUST_NUMB;
CREATE SEQUENCE APPS.APPSLEAD_CUST_NUMB
START WITH 1
MAXVALUE 999999999999999999999999999
MINVALUE 0
NOCYCLE
NOCACHE
NOORDER;
2- Create New Package for issuing the numbers.
----------Package Code--------------
Create or replace package appslead_package as
Function get_emp_custom_number (
p_business_group_id IN number
,p_legislation_code IN varchar2
,p_person_type IN varchar2
,p_person_number IN varchar2
,p_party_id IN number
,p_person_id IN number
,p_national_id IN varchar2
,p_date_of_birth IN date
) return varchar2;
end appslead_package;
Create or replace package body APPSLEAD_PACKAGE as
Function GET_EMP_CUSTOM_NUMBER (
p_business_group_id IN number
,p_legislation_code IN varchar2
,p_person_type IN varchar2
,p_person_number IN varchar2
,p_party_id IN number
,p_person_id IN number
,p_national_id IN varchar2
,p_date_of_birth IN date
) return varchar2 as
/*Check if the person id is exists on the system or not*/
cursor person_exists is
select employee_number,applicant_number,npw_number
from per_all_people_f
where party_id = p_party_id;
--and p_effective_date between effective_start_date and effective_end_date;
lseq_num number;
l_next varchar2(30);
l_emp_num varchar2(30);
l_apl_num varchar2(30);
l_npw_num varchar2(30);
begin
open person_exists;
fetch person_exists into l_emp_num,l_apl_num,l_npw_num;
if person_exists%notfound then
Select to_char(Appslead_Cust_Numb.Nextval) Into lseq_num From Dual;
l_next := 'AppsLead-'||lseq_num;
return l_next;
Else
If p_person_type = 'EMP' then
l_next := l_emp_num;
Elsif p_person_type = 'APL' then
l_next := l_apl_num;
Elsif p_person_type = 'CWK' then
l_next := l_apl_num;
End if;
End if;
Close person_exists;
return l_next;
end get_emp_custom_number;
End appslead_package;
Functional Side:
1- Create or Modify Business Group Employee numbering method to Manual.
2- Create New Formula Function.
3- Create New Formula EMP_NUMBER_GENERATION with Type "Person Number Generation"
------Formula Script--------
EMP_NUMBER_GENERATION
Create Custome formula for generation employee number*/
DEFAULT FOR Person_Number IS ' '
DEFAULT FOR Party_ID IS 0
DEFAULT FOR Person_ID IS 0
DEFAULT FOR National_ID IS ' '
DEFAULT FOR DATE_OF_BIRTH IS '1900/01/01 00:00:00' (date)
DEFAULT FOR Hire_Date IS '1900/01/01 00:00:00' (date)
INPUTS ARE
Legislation_Code (text),
Person_Type (text),
Person_number (text),
Party_id,
Person_id,
Date_of_birth (date),
Hire_date (date),
National_ID (text)
Next_Number = '0'
Invalid_msg = ' '
IF Person_Type = 'EMP' then
Next_Number = TO_CHAR(Get_Emp_Custom_Number(Legislation_Code,Person_Type,Person_Number,Party_Id,Person_Id,National_ID,Date_Of_Birth))
Else
Invalid_msg = 'This is not an person_type of Employee!'
Return Next_Number
Now, when I create a new employee I need the employee number to appear as
"AppsLead-Emp-00001"
But its not, and the screen of employee master is not allow to create an employee without filling the number.
How to do the same?
What should be the Employee Number Generation ?
1- Automatic generation with Global Sequencing
2- Manual
If your answer is manual, in the employee master screen, the employee id is required and when you create the employee the id should be entered.there are some fast formula you can use.
Please check metalink -
How to Create an Custom Employee Number Generation ...
Dear Friends,
We are Implementing HRMS Suite Version12i, for one of the Client in Middle east.
One question about Custom Person Numbering.
How to create custom employee numbering Based on the User Person Type?
Example:
Two person types
o Permanent Employee
o Probationary employees
We Need to give two different numbering schemes for each person type.
eg Permanent Employee will use a seq begin 100000 whereas Probationary employees (other user type) will use a sequence beginning 200000.. Can any pls let me know how to handle the Custom Employee Number Generation (with Setups)
With regards
SwpanaHi,
Could you please help me to write/or send a sample of a Person Number Generation Formula.
I don't see the noteid : 279458.1 on metalink,I get the following message:
Article or Bug cannot be displayed. Possible reasons are:
The article Id or bug number was entered incorrectly. Please check and try again.
The article Id or bug number does not exist (was referenced incorrectly).
The article or bug is not classified as publicly accessible ("non-public").
The content is being updated and it is temporarily unavailable but will be made available again soon.
If you still have questions about why you could not access this article or bug, please use Feedback.
Please help!! -
FInding missing sequence number
Dear All
I have a column in table like this (actually its just a sample):
TAB
MMxxxx9988
MMxxxx9990
MMxxxx9995
MMxxxx9998
MMxxxx9999
MMxxxx0000
MMxxxx0001
MMxxxx0003
MMxxxx0004
MMxxxx0005
MMxxxx0008
xxxx is variable
last four digit is a sequence number start with 0000 and end with 9999.
when the last four digit exceeds 9999 it reset to 0000
My question is : how can we find the missing sequence number for that column.
example:
for the above table , it should give the below result:
TAB
MMxxxx9989
MMxxxx9991
MMxxxx9992
MMxxxx9993
MMxxxx9994
MMxxxx9996
MMxxxx9997
MMxxxx0002
MMxxxx0006
MMxxxx0007
ThanksOne another way of doing it:
For ease of verification, I have removed the records from 0001 to 9988.
with data as
select 'MMxxxx9988' col from dual union all
select 'MMxxxx9990' col from dual union all
select 'MMxxxx9995' col from dual union all
select 'MMxxxx9998' col from dual union all
select 'MMxxxx9999' col from dual
-- select 'MMxxxx0000' col from dual union all
-- select 'MMxxxx0001' col from dual union all
-- select 'MMxxxx0003' col from dual union all
-- select 'MMxxxx0004' col from dual union all
-- select 'MMxxxx0005' col from dual union all
-- select 'MMxxxx0008' col from dual
select distinct col, nxt_val, substr(col, 1, 6) || to_char(st_with + level, 'fm00009') miss_seq
from (
select col, nxt_val, col_num st_with, nxt_col_num end_with
from (
select col, lead(col) over (partition by substr(col, 1, 6) order by substr(col, -4, 4)) nxt_val,
to_number(substr(col, 7, 4)) col_num, to_number(substr(lead(col) over (partition by substr(col, 1, 6) order by substr(col, -4, 4)), 7, 4)) nxt_col_num
from data
where abs(col_num - nxt_col_num) > 1
connect by level <= (end_with - st_with) - 1
and prior col = col
and prior sys_guid() is not null
order by col;
COL NXT_VAL MISS_SEQ
MMxxxx9988 MMxxxx9990 MMxxxx09989
MMxxxx9990 MMxxxx9995 MMxxxx09991
MMxxxx9990 MMxxxx9995 MMxxxx09992
MMxxxx9990 MMxxxx9995 MMxxxx09993
MMxxxx9990 MMxxxx9995 MMxxxx09994
MMxxxx9995 MMxxxx9998 MMxxxx09996
MMxxxx9995 MMxxxx9998 MMxxxx09997
7 rows selected
Maybe you are looking for
-
Questions to understand the process of clearing GR/IR clearing account and how T-Codes MR11 and F.13 works. First MR11: Executing MR11 will give a list of Pos to be cleared by reading differences in GR/IR quantities for each PO showing a list of POs
-
How to Print PDF using BI Publisher or Apache FOP in APEX 4.0.1
Hi friends. I have a problem with APEX and print report in ouput of PDF. My configuration is: 1. Database: Oracle 11gR2 Standart Edition 2. APEX version: 4.0.1 3. APEX Listener version: 1.0.2.238.15.24 4. Oracle WebLogic Server version: 10.1.3.3.0 5.
-
Regarding the availability of a drop down(like we have on browser 'File')
Hi, I have a requirement wherein I have to provide a functionality similar to what we have in web browsers or for that matter in any application. For Eg. on the web browser we have menu bar which has options like 'File', 'Edit', 'View'..etc. When we
-
Track Changes Acrobat 9 Professional
In Adobe Acrobat 9 Pro, is it possible to track the change history of a PDF document? We can not seem to be able to do this. Using Windows XP. Thank you for any suggestions
-
Lexmark scanner doesn't work with mac os x
I have a problem with my scanner lexmark p4330. For two weeks now it doesn't work with my imac. I have the imac os x 10.7.5. When I try to scan, my printer displays "the all in one driver did not respond" and in Image Capture it displays "lexmark lan