Creation of Views

Hai Experts,
             I'm new to the ABAP development area. I am learning about tables, buffers etc. And now i want to know about Views and the creation of Views. So can anybody give me the steps involved in the creation of views?
Regards,
P.Shanthi

Creating a Maintenance View
http://help.sap.com/saphelp_40b/helpdata/en/cf/21ed2d446011d189700000e8322d00/content.htm
http://help.sap.com/saphelp_nw04/helpdata/en/5a/0c88924d5911d2a5fb0000e82deaaa/content.htm
https://www.sdn.sap.com/irj/sdn/wiki?path=/display/abap/abap+dictionary&focusedcommentid=39861
Enter the name of the view in the initial screen of the ABAP Dictionary, select object class Views and choose Create. A dialog box appears, in which you must choose the type of the view. Select the type Maintenance view.
The maintenance screen for maintenance views appears. You will see three input areas for tables, join conditions and view fields. Carry out the following actions in this screen:
Enter a short explanatory text in the field Short text.
In Tables, enter the primary tables of the view.
If required, include more tables in the view. In a help view you can only include tables which are linked to one another with foreign keys.
Position the cursor on the primary table and choose Relationships. All existing foreign key relationships of the primary table are displayed. Check the foreign keys you require and choose Copy. The secondary tables involved in such a foreign key are included in the view. The join conditions derived from the foreign keys ( Foreign Key Relationship and Join Condition) are displayed.
You can also include tables which are linked to one of the previously included secondary tables with a foreign key. To do this, position the cursor on the secondary table and choose Relationships. Then proceed as described above.
You can only select foreign keys in which the secondary table for the primary table or for the secondary table which transitively preceded it is in an n:1 relationship. This is the case if the secondary table is the check table of the base table and the foreign key was not defined generically. If the base table is the check table, the foreign key fields must be key fields of a text table or the foreign key must have cardinality of n:1 or n:C.
The foreign keys violating these conditions are displayed at the end of the list under the header Relationships with unsuitable cardinality.
Select the fields which you want to include in the view.
You can enter the field names directly. If you do not know the field names, you can copy them from the tables. To do this, position the cursor on a table and choose TabFields. The fields of the table are now displayed in a dialog box. You can copy fields from here by marking the first column and choosing on Copy.
Formulate the selection conditions. To do this choose Goto ® Selection condition. The input area for the selection conditions appears in place of the input areas for the fields. Maintain the selection condition as described in Maintaining the Selection Condition for a View. You can then switch back to the fields display with Goto ® View fields.
Activate the view with View ® Activate. A log is written during activation. You can display it with Utilities ® Activation log. If errors or warnings occurred during the activation of the view, you branch directly to the activation log.
Create the documentation for the view with Goto ® Documentation. This documentation is output for example when you print the view with View ® Print.
Branch to transaction SE54 with Environment ® Tab.maint.generator. From the view definition you can generate maintenance modules and maintenance interfaces there which distribute the data entered with the view to the base tables. You can find more information about using this transaction in the documentation Generating the Table Maintenance Dialog.
Optional Settings
You can make the following optional settings:
Change data element of a view field:
Select the Mod column (modify) for the view field and choose Enter. The Data element field is now ready for input. Enter the new data element there. This data element must refer to the same domain as the original data element. With the F4 help key for the Data element field, you can display all the data elements which refer to the domain of the field. If you want to assign the original data element again, you only have to reset the Mod flag and choose Enter.
Change maintenance status:
The Maintenance Status defines how you can access the view data with the standard maintenance transaction (SM30). Choose Extras ® Maintenance status. A dialog box appears in which you can select the maintenance status of the view.
Define the delivery class of the view:
Choose Extras ® Delivery class. A dialog box appears in which you can enter the delivery class of the maintenance view.
Define the maintenance attribute of a view field
The maintenance attribute defines special access modes for the fields of the view. You can make the following entries in field F in the input area for the view fields:
R : Only purely read accesses are permitted for fields with this flag. Maintenance with transaction SM30 is not possible for such fields.
S : Fields with this flag are used to create subsets when maintaining view data. Only a subset of the data is displayed. This subset is defined by entering the corresponding value in this field.
H : Fields with this flag are hidden from the user during online maintenance. They do not appear on the maintenance screen. You have to ensure in a separate procedure that each such field has the correct contents. Otherwise, they are left empty.
: There are no restrictions on field maintenance.
Check functions:
With Extras ® Runtime object ® Check you can determine whether the definition of the view in the ABAP Dictionary maintenance is identical to the specifications in the runtime object of the view. With Extras ® Runtime object ® Display you can display the runtime object of the view.
Display foreign key of a view field:
If a foreign key which was automatically included in the view definition is defined for the field of the base table, you can display it. To do so, position the cursor on the view field and choose Extras ® Foreign keys.
Display foreign key on which a join condition is based:
If a join condition was derived from a foreign key, you can display its definition. To do so, position the cursor on the join condition and choose Extras ® Foreign keys.
See also:
Maintenance Views

Similar Messages

  • Creation of view on single table?

    Hi Team,
    I have a requirement like for creaation of view on single table (QMEL) in SAP ECC side...
    Note: in this table i need 2o fields only....not all fields.
    First can we create view on single table?
    if  'Yes' can any one tell , How we can creat view on single table?
    While creation of view we have four options..
    1)Data base view
    2)Projection View
    3)Maintanace view
    4)Help view
    in these four options which tyep of view we can choose for creation?
    please can any one suggest me and do the need full..
    i am waiting your responce...

    I quickly skimmed the links provided by others; and in my short discussions with DBA friend of mine; and other sources... partition should be based on user needs, sql server resources, and partition maintenance time.
    Lets say you have 50 regions and 1) partition the data by region, AND 2) place each partition on a different disk, and 3) i am in Texas and only query data in the Texas region then performance will be increased because I am not scanning through the other
    49 regions.
    If you have temporal data (dependent on time - like say financial reports that are sent to the SEC) - the partitions are by time: 1) data from last 13 months is stored on SSD, 2) data 13 months - 3 years old is on HDD, and 3) data >3 years old is stored
    on compressed HDD.  (i say 13 months so you have an entire year and month to date)  --- accountants can get the current data VERY quickly, project managers who need to see a 3 year trend will not have to wait long, and when the SEC calls, who cares?,
    the reports can be queued and generated at night when no one is working. 
    I see partitions are giving the users the least amount of data to query which speeds their results.

  • Creation of view in a component

    Hi ,
    may I have the step by step procedure  for the creation of view in a component.
    I have created the Enhancement set .
    then in BSP_WD_CMPWB I enter the component and say enhance it took me to the area where all views are in display mode and after I selected the views and started the wizard of view creation .
    I require info on the data to be given in the wizard and the procedures after that.
    plz provide some inputs ,
    Thanks and regards,
    Sree.

    Hi Sree,
    In your view.htm are you using the code to get the configuration?
    Example:
    <%@page language="abap"%><%@ extension name="htmlb" prefix="htmlb"%><%@ extension name="xhtmlb" prefix="xhtmlb"%><%@ extension name="crm_bsp_ic" prefix="crmic"%><%@ extension name="bsp" prefix="bsp"%>
    <%@extension name="chtmlb" prefix="chtmlb" %>
    <%
      data: lv_xml    type string.
      lv_xml    = controller->CONFIGURATION_DESCR->GET_CONFIG_DATA( ).
    %>
    <chtmlb:config xml  = "<%= lv_xml %>"
                   mode = "RUNTIME" />
    Best regards,
    Caíque Escaler

  • How to prevent creation of view object rows when using browser refresh butt

    HI i have the following problem:
    I have a creation form using a partial submition. The problem is that if i have entered some value by using autosubmit , this value will be setted as attribute in the ViewObject . After that if i click refresh button of the browser then the new Row of the view object will be created and i will have a pending row with setted attribute. So if execute commit then the both rows will be tried to commit. How can i prevent this?
    Krasi

    Hi,
    If i've understood you have a invokeAction that create a new row, right? If yes put on condition that it invokeAction won't invoke if is a postback.
    Let me know if i miss understand your doubt.
    Best Regards

  • Problems with creation of views and indexes....but the connection is nice!!

    Hi everyone.
    I'm running a SQLServer7 migration using migration workbench. The only objects to migrate are: tables, users: views: indexes and foreign keys.
    It seesm to go fine with the migration, thus workbench is both connected to the SQLServer and the Oracle Workbench Repository in wich the Oracle Model is created. BUT, after a while and when the view creatiion should go on, I get this message (myhost is the host in wich target oracle instance would be the conversion).
    " Failed to connect to /@myhost:1525:MANU. Check the password in the users"s Creation Options in the Oracle Model to make sure it is correct."
    So it seems that It tries to connect as OS user...but it was working fine, so why is it trying to re-connect if data was migrating?
    any solution?
    thanks a lot!!

    See my previous reply on another thread.
    Donal

  • Enquiry in creation of view

    Hi all,
    I want to create a new view using wizard in the BP_HEAD component( CRM 2007) . How will I implement this?
    Can anyone plz help me in sorting out this problem.
    Regards,
    Nithu

    Hi,
    Just follow the below steps:-
    a) First of all, you need to do the groundwork. Design the view on paper, whether its a form/table view, how the data will flow into the view(from custom/component controller), what data will be displayed(which means what context nodes will be added).Table view can display data from only one context node while form view can display from multiple context nodes.
    b) Once the groundwork is done, enhance the component ICCMP_BT_INR.
    c) Add the view via the view creation wizard.Create the corresponding context nodes in the wizard itself or later after creating the view. Also you can bind the context nodes to the custom/component controller in the wizard itself or later.
    Inbound plugs are called when we enter the view while outbound plugs are called while leaving the view.Its not mandatory for a view to have inbound/outbound plugs.Only when there is some kind of a navigation, then we create these plugs. e.g while navigating away from a view, we call the navigation link in the outbound plug. To initialize certain global parameters while entering a view, we do it in inbound plugs.
    Hope it gives you some pointers to start with!
    Regards,
    Rohit

  • Regarding Creation of Views and Multiple Datasources.

    Dear All,
    I hv a COreport(Cost Center Report).the data is coming from tables of CO,FI,SD,MM.
    The Tables from CO are COEP,COSP,COSS,CSKS,CRHD,CSKU,CRCO,CSKB
    The tables from SD are VBRK,KNA1
    The Tables from MM are EKKO,LFA1.
    The table from FI are SKAT,BKPF,BSIK,BSAK.
    1)Can i create a view for these tables?Can a view be called a DS.
    2)With these tables i hv Multiple DS's.So can i use Multiple DS's to extract data
    3)Can i use FM to extract Data?If i use FM,vll i face errors during Support?
    4)Please Guide me how to create Views for these tables and How to handle Multiple Datasources.
    Thanks

    Noor,
    Have you checked suitable business content datasources.
    I think you have lot of options
    FIrst You need to have a multiple data source
    --> Check for suitable business content datasources
    --> check whether these details are already available in BW through any means (through other standard datasources to ODS)
    --> Create customized extractor finally as a last option
    All these tables are atandard and nost probably you would find a standard datasource ( again multiple) I am sure for costing you have standard
    Few or more standard datasources or already existing BW objexts with 1 or 2(rarely) customized extractor would do the purpose that you look for,....
    Good Luck !!!
    Regards
    VJ

  • Creation of view with clob column in select and group by clause.

    Hi,
    We are trying to migrate a view from sql server2005 to oracle 10g. It has clob column which is used in group by clause. How can the same be achived in oracle 10g.
    Below is the sql statament used in creating view aling with its datatypes.
    CREATE OR REPLACE FORCE VIEW "TEST" ("CONTENT_ID", "TITLE", "KEYWORDS", "CONTENT", "ISPOPUP", "CREATED", "SEARCHSTARTDATE", "SEARCHENDDATE", "HITS", "TYPE", "CREATEDBY", "UPDATED", "ISDISPLAYED", "UPDATEDBY", "AVERAGERATING", "VOTES") AS
      SELECT content_ec.content_id,
              content_ec.title,
              content_ec.keywords,
              content_ec.content content ,
              content_ec.ispopup,
              content_ec.created,
              content_ec.searchstartdate,
              content_ec.searchenddate,
            COUNT(contenttracker_ec.contenttracker_id) hits,
              contenttypes_ec.type,
              users_ec_1.username createdby,
              Backup_Latest.created updated,
              Backup_Latest.isdisplayed,
              users_ec_1.username updatedby,
              guideratings.averagerating,
              guideratings.votes
         FROM users_ec users_ec_1
                JOIN Backup_Latest
                 ON users_ec_1.USER_ID = Backup_Latest.USER_ID
                RIGHT JOIN content_ec
                JOIN contenttypes_ec
                 ON content_ec.contenttype_id = contenttypes_ec.contenttype_id
                 ON Backup_Latest.content_id = content_ec.content_id
                LEFT JOIN guideratings
                 ON content_ec.content_id = guideratings.content_id
                LEFT JOIN contenttracker_ec
                 ON content_ec.content_id = contenttracker_ec.content_id
                LEFT JOIN users_ec users_ec_2
                 ON content_ec.user_id = users_ec_2.USER_ID
         GROUP BY content_ec.content_id,
         content_ec.title,
         content_ec.keywords,
         to_char(content_ec.content) ,
         content_ec.ispopup,
         content_ec.created,
         content_ec.searchstartdate,
         content_ec.searchenddate,
         contenttypes_ec.type,
         users_ec_1.username,
         Backup_Latest.created,
         Backup_Latest.isdisplayed,
         users_ec_1.username,
         guideratings.averagerating,
         guideratings.votes;
    Column Name      Data TYpe
    CONTENT_ID     NUMBER(10,0)
    TITLE          VARCHAR2(50)
    KEYWORDS     VARCHAR2(100)
    CONTENT          CLOB
    ISPOPUP          NUMBER(1,0)
    CREATED          TIMESTAMP(6)
    SEARCHSTARTDATE     TIMESTAMP(6)
    SEARCHENDDATE     TIMESTAMP(6)
    HITS          NUMBER
    TYPE          VARCHAR2(50)
    CREATEDBY     VARCHAR2(20)
    UPDATED          TIMESTAMP(6)
    ISDISPLAYED     NUMBER(1,0)
    UPDATEDBY     VARCHAR2(20)
    AVERAGERATING     NUMBER
    VOTES          NUMBERAny help realyy appreciated.
    Thanks in advance
    Edited by: user512743 on Dec 10, 2008 10:46 PM

    Hello,
    Specifically, this should be asked in the
    ASP.Net MVC forum on forums.asp.net.
    Karl
    When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer.
    My Blog: Unlock PowerShell
    My Book: Windows PowerShell 2.0 Bible
    My E-mail: -join ('6F6C646B61726C40686F746D61696C2E636F6D'-split'(?<=\G.{2})'|%{if($_){[char][int]"0x$_"}})

  • Creation of View

    hiiiiiiiiiiiii alllllll,
    i want to create a view when i press buton on form.
    plz tell me it is possible.
    Regards
    Tayyab

    plz tell me it is possibleYes... it is ... Use the forms_ddl buit-in procedure....
    Greetings...
    Sim

  • Creation of View from Mutiple Tables (Union of result sets)

    Hi,
    I have started working on Information Steward very recently and Im working on creating some profiling rules in Data Insight.
    I’m working on bringing data in two tables together to apply some common rules, I have tried view option but I’m not sure how to create the views as below without joins.
    View should have common columns from Table1 and Table2  so I can perform below rules.
    Check uniqueness of primary key column across both the tables. Like Id – Unique in view below
    Combination of two different columns should be unique in both the tables. Like First name + Last Name Unique in view
    I would like to create a view which is can be done using Aggregator in Information PC and Merger in BODS.
    Permenent Employee
    Id
    First Name
    Last Name
    Age
    salary
    6
    Sachin
    Tendulkar
    41
    2000
    7
    Ajay
    Jadeja
    43
    2000
    9
    Rahul
    Dravid
    40
    2000
    Contracting Employee
    Id
    First Name
    Last Name
    Age
    salary
    1
    Sourav
    Ganguly
    41
    2000
    2
    Ajith
    Agarkar
    38
    2000
    3
    Anil
    Kumble
    43
    2000
    View
    Id
    First Name
    Last Name
    Age
    salary
    1
    Sourav
    Ganguly
    41
    2000
    2
    Ajith
    Agarkar
    38
    2000
    3
    Anil
    Kumble
    43
    2000
    6
    Sachin
    Tendulkar
    41
    2000
    7
    Ajay
    Jadeja
    43
    2000
    9
    Rahul
    Dravid
    40
    2000
    Please let me know you thoughts on how this can be achieved in SAP IS

    This is not possible in IS. You'll have to create a view at db level. Or merge all data into one table, using DS as you say.

  • Creation of view and use it as internal table

    dear community,
                   My questions is taht i am write a select quary in that data is very huge so that it cant inserted in to internal table(memory size of internal table) so i thing that i create aview same as data base table and when write the select quary use packsize and transfer recoerd ds in that view and use this view in my program
    is above logic can work or not
    also is size of view is greater than internal table memory size.

    Writing the large volume to another table(which a view is just a view of a table or group of tables) is not going to solve the problem.  You still have to select the data from the view(or table).  Like I said in your other threads, you need to read by package size, and do something with that subset, whether it is summaring, or writeing to another system via RFC.
    Regards,
    Rich Heilman

  • Dynamic creation of Views

    Hi All,
    I am new to web dynpro abap, I had a requirement that based on the user input I need to create views dynamically that is : if the user enters 3 I had to create three new views dynamically and like the same, also the UI elements of the view should be picked up based on the content of ztables dynamically as the entries in the ztables keep on changing.
    Is that possible. If so any one please help me out with some procedures.
    Thanks In avdvance,
    Regards,
    Sriratna.

    hi ,
      Dynamic UI developement it possible .
    This is link for dynamic programming blog.
    <a href="/people/thomas.szcs/blog/2005/12/28/dynamic-programming-in-web-dynpro-abap--introduction-and-part-i-understanding-ui-elements programming</a>
    <a href="http://Link 2">/people/thomas.szcs/blog/2006/01/03/dynamic-programming-in-web-dynpro-abap--part-ii-handling-viewelements
    but in my view I will not suggest to go for dynamic programming if you want create large no. of UI elements over view and large no. of views .
    Another thing is it is bit advanced concept in WD ABAP so as you are new to web Dynpro ABAP it self dont directly jump to it .
    I had similar complex requirement where UI over other view was based on inputs given in initial view .It was possible to address it with dynamic programming but I have not went for that .
    I made normal programming but gave feel like things are dynmic which was finally serving ultimate purpose .
    Weather one should go / should not go for dynamic programming is decided based on Volume of UI elememts , Supply function and nodes  needed .
    I can suggest you alternatives but Please give details of it else mail me .

  • Report Level Trigger and Creation of View

    Hello Experts!
    I want to know that is it possible to create view in database before running the report and after entering values in report's parameter?
    Regards.
    Oracle User.

    Look into the SRW.DO_SQL procedure.

  • In function module creation,table, view is better or structure is better  ?

    I am creating a new z function module.
    Under tables parameter, I need to create 'Profit_Center_Table'  which should contain combination of ztable and cepc fields.
    as
    Tables
    •     Profit_Center_Table – should contain List of ztable and cepc fields
    Is it okay, if I create a view with the combination of ztable and cepc fields
    And use the view under table’s tab page in my zfunction module ?
    Or it is better to create a structure with the combination of ztable and cepc fields

    hi,
    better to create structure or internal table with all the required fields.
    we can export and import  internal tables to function module by using TABLES parameter interface.
    if you create View, how can you pass to the function module.
    as per my knowledge no parameter interface is availabe to pass views to function module.
    for more information follow this link.
    http://help.sap.com/saphelp_nw2004s/helpdata/en/d1/801ef5454211d189710000e8322d00/frameset.htm
    regards,
    Ashokreddy
    Message was edited by:
            Ashok Reddy

  • About runtime sequence creation and view dare pre commmit.

    Dear All,
    My 2 New Question are:
    1)Could Oracle suggest to create sequence(DDL) from run-time.That means I need(My client requirement) regenerate of sequence(I know it is possible by cycle but i don't know MAX value when it will cycle)as monthly or a specific time so I want to drop sequence and create sequence by a)Programmetically runtime
    b) Oracle scheduler runtime .
    Have any good and better Idea? Any risk factor?
    Note that at a time possibly more than 100 users will data entry with our software.
    2)My New query is Could I view table data which was not yet COMMITTED from other session-other user.
    Regards and Thanking you,
    ZAKIR
    Analyst ,
    SynesisIT,
    www.Synesisit.com
    =====

    I tried that, but there are too many trouble.
    For only references.
    -- Usage
    Procedures
     execute periodic_seq.seq_def   create sequence
     execute periodic_seq.seq_undef drop sequence
    Functions
      periodic_seq.nextvalue
       get nextval of specified sequence
      periodic_seq.currvalue
       get currval of specified sequence
    seq_def
     in_seq_name varchar2 (30)
        sequence name (current schema)
     in_trunc_unit varchar2
      'yyyy','mm','dd','hh24','mi' : format on trunc(date)
    seq_def
     in_owner varchar2 (30)
      schema name
     in_seq_name varchar2 (30)
      sequence name
     in_trunc_unit varchar2
      'yyyy','mm','dd','hh24','mi' : format on trunc(date)
     incr_by integer (default:1)
      increment by
     start_with integer (default:1)
      start with
     maxvalue integer (default:to_number('1e27'))
      maxvalue
     minvalue integer (default:1)
      minvalue
     cycle varchar2 (default:'N')
      'Y':cycle/'N':nocycle
     cache integer (default:20)
      cache
     time_order varchar2 (default:'N')
      'Y':order/'N':noorder
    seq_undef
     in_seq_name varchar2 (30)
        sequence name (current schema)
    seq_undef
     in_owner varchar2 (30)
      schema name
     in_seq_name varchar2 (30)
      sequence name
    nextvalue
     in_seq_name varchar2 (30)
        sequence name (current schema)
    nextvalue
      in_owner varchar2 (30)
      schema name
     in_seq_name varchar2 (30)
      sequence name
    currvalue
     in_seq_name varchar2 (30)
        sequence name (current schema)
    currvalue
      in_owner varchar2 (30)
      schema name
     in_seq_name varchar2 (30)
      sequence name
    -- Source --
    -- Control table
    create table cycle_seq_ctrl
    (sequence_name varchar2(30) not null
    ,min_value integer
    ,max_value integer
    ,increment_by integer not null
    ,cycle_term varchar(10) default('dd') not null
    ,last_number integer not null
    ,reset_time date
    ,prev_nextval integer not null
    ,constraint pkey_cycle_seq_ctrl primary key (sequence_name)
    organization index
    create or replace
    package cycle_seq
    authid current_user
    is
    function nextvalue
    (seq_name varchar2
    ,in_date date := sysdate
    ) return integer
    function currvalue
    (seq_name varchar2
    ) return integer
    procedure seq_def
    (seq_name varchar2
    ,cycleterm varchar2 := 'DD' /* Defaults : reset by a day */
    ,incr_by integer := 1
    ,start_with integer := 1
    ,maxvalue integer := to_number('1e27')
    ,minvalue integer := 1
    procedure seq_undef
    (seq_name varchar2
    end; -- package cycle_seq
    create or replace
    package body cycle_seq
    is
      type currval_tab_type is table of integer index by varchar2(30);
      currval_tab currval_tab_type;
    function nextvalue
    (seq_name varchar2
    ,in_date date := sysdate
    ) return integer
    is
    pragma autonomous_transaction;
      timeout_on_nowait exception;
      timeout_on_wait_sec exception;
      pragma exception_init(timeout_on_nowait, -54);
      pragma exception_init(timeout_on_wait_sec, -30006);
      p_seqname cycle_seq_ctrl.sequence_name%type;
      p_ctrl cycle_seq_ctrl%rowtype;
      p_currtime date;
      p_nextval integer;
    begin
      p_currtime := in_date;
      p_seqname := upper(trim(seq_name));
      select *
        into p_ctrl
        from cycle_seq_ctrl
       where sequence_name = p_seqname
      for update wait 1
      if (p_ctrl.cycle_term<>'SS') then
        p_currtime := trunc(p_currtime,p_ctrl.cycle_term);
      end if;
      -- need to reset
      if (p_ctrl.reset_time < p_currtime) then
        if (p_ctrl.increment_by > 0) then
          p_nextval := p_ctrl.min_value;
        elsif (p_ctrl.increment_by < 0) then
          p_nextval := p_ctrl.max_value;
        else
          p_nextval := p_ctrl.last_number;
        end if;
        update cycle_seq_ctrl
          set last_number = p_nextval
             ,reset_time = p_currtime
             ,prev_nextval = last_number + increment_by
        where sequence_name = p_seqname
        currval_tab(p_seqname) := p_nextval;
        commit;
        return p_nextval;
      end if;
      -- already reseted (in a same second)
      if (p_ctrl.reset_time = p_currtime) then
        p_nextval := p_ctrl.last_number + p_ctrl.increment_by;
        update cycle_seq_ctrl
          set last_number = p_nextval
        where sequence_name = p_seqname
        currval_tab(p_seqname) := p_nextval;
        commit;
        return p_nextval;
      -- already reseted
      else
        p_nextval := p_ctrl.prev_nextval + p_ctrl.increment_by;
        update cycle_seq_ctrl
          set prev_nextval = p_nextval
        where sequence_name = p_seqname
        currval_tab(p_seqname) := p_nextval;
        commit;
        return p_nextval;
      end if;
    exception
      when no_data_found then
        raise_application_error(-20800,
           'cycle_seq.seq_def('''||seq_name
           ||''') has not been called.');
      when timeout_on_nowait or timeout_on_wait_sec then
        raise_application_error(-20899,
           'cycle_seq.nextvalue('''||seq_name
           ||''') is time out.');
      when others then
        raise;
    end
    function currvalue
    (seq_name varchar2
    ) return integer
    is
      p_seqname cycle_seq_ctrl.sequence_name%type;
    begin
      p_seqname := upper(trim(seq_name));
      return currval_tab(upper(seq_name));
    exception
      when no_data_found then
        raise_application_error(-20802,
           'cycle_seq.nextvalue('''
           ||seq_name||''') has not been called in this session.');
      when others then
        raise;
    end
    procedure seq_def
    (seq_name varchar2
    ,cycleterm varchar2 := 'DD'
    ,incr_by integer := 1
    ,start_with integer := 1
    ,maxvalue integer := to_number('1e27')
    ,minvalue integer := 1
    is
      p_seqname cycle_seq_ctrl.sequence_name%type;
      p_currtime date;
      p_cycleterm cycle_seq_ctrl.cycle_term%type;
    begin
      p_currtime := sysdate;
      p_seqname := upper(trim(seq_name));
      p_cycleterm := upper(trim(cycleterm));
      if (p_cycleterm<>'SS') then
        p_currtime := trunc(p_currtime,cycleterm);
      end if;
      insert into cycle_seq_ctrl
        (sequence_name
        ,min_value
        ,max_value
        ,increment_by
        ,cycle_term
        ,last_number
        ,reset_time
        ,prev_nextval
      values
        (p_seqname
        ,minvalue
        ,maxvalue
        ,incr_by
        ,p_cycleterm
        ,start_with - incr_by
        ,p_currtime
        ,start_with - incr_by
      commit; -- Because this is as like a DDL
    exception
      when dup_val_on_index then
        raise_application_error(-20955,
           'already defined with '
          ||'cycle_seq.seq_def('''||seq_name||''')');
      when others then
        raise;
    end
    procedure seq_undef
    (seq_name varchar2
    is
      p_seqname cycle_seq_ctrl.sequence_name%type;
    begin
      p_seqname := upper(trim(seq_name));
      delete from cycle_seq_ctrl
      where sequence_name = p_seqname
      commit; -- Because this is as like a DDL
    end
    end; -- package body cycle_seq
    /

Maybe you are looking for