Setting key inside doDML function

Hi all,
I want to set the key inside doDML() with number retrieved from database sequence.
protected void doDML(int i, TransactionEvent transactionEvent) {
if (i == DML_INSERT) {
Key key= this.getKey();
DBSequence seq = (DBSequence)key.getAttribute(0);
if (seq.getSequenceNumber().compareTo(0) == -1 )
key.setAttribute(0,new DBSequence( getValueFromSequence("DB_SEQUENCE", getDBTransaction())));
super.doDML(i, transactionEvent);
When trying to set this key, I got this exception:
oracle.jbo.InvalidOperException: JBO-25221: Method Key.setAttribute not supported
I've tried another solution by getting the name of the key (i.e. key.getAttributeNames ()), and got this exception:
oracle.jbo.InvalidOperException: JBO-25221: Method Key.getAttributeNames not supported
Any solution??
Best Regards,
Bassam

Ok, try getting the key via the attribute definition.
        AttributeDef[] attrs = this.getEntityDef().getAttributeDefs();
        String nameKeyAttr = null;
        for (AttributeDef attr: attrs)
            if (attr.isPrimaryKey())
                nameKeyAttr = attr.getName();
                break;
        if (nameKeyAttr != null)
            SequenceImpl seq = new SequenceImpl("MY_SEQ", getDBTransaction());
            // assuming you have only one key
            this.setAttribute(nameKeyAttr, seq.getSequenceNumber());
        }Timo

Similar Messages

  • Using SET DATEFIRST inside a function to call into a view

    Hi,
    I need to use the statement SET DATEFIRST inside a function. This operation is not available, but I need to use this command into a function to call inside a view.
    How can I solve this issue?
    Thanks

    Eventually you will learn 2 very important things.  First, the term "working day" has no absolute definition and varies by country, organization, culture, etc.  Second is that circumstances will occur that change what should be considered a working
    day to a non-working day (or vice versa).  While you might attempt to create logic that "forecasts" whether a given date in the future is a working day, you cannot apply that logic to past dates.  The best solution is to create a calendar table for
    this purpose - some forum/internet searching will find many different variations.

  • Keyboard "use F-keys as standard function keys" setting gets reset on system restart

    Hi all,
    I have set in system preferences -> keyboard to "use f1, f2 etc. keys as standard function keys" or rather I want to keep this setting set but unfortunately this gets reset on each restart-
    I'm wondering what happened, this used to work initially with Lion. I may have set somewhere something that resets this on each start but I have no clue what that might be.
    Machine iMac mid 2011, keyboard Apple alu keyboard with cable (pre-Lion layout).

    Thanks BDAqua...sure looked like the function had disappeared over time and appreciate the confirmaion. Hard to understand why a function like that would be taken away. The program I run uses function keys f3,f7,f11 and f23(shifted f11) and I have all working okay by turning them off in keyboard and mouse menus. The f23 is causing issued in that when I use shifted f11 the screen scrolls upward instead of passing along the f23 function. Looks like I will have to work around this since the operating system will not allow the function keys to just work "standard"...thanks by the way for the welcome...!!

  • Is it possible to perform doDML functionality in ViewObject

    Hello,
    In Oracle Forms to ADF conversion, different forms is sharing same entity object. As a result,
    different pre-Insert, Pre-update, etc. is requied.
    Is is possible to perform doDML() functionality in ViewObject instead of the Entity Object?
    Thanks

    No, but what you could do is create a transient attribute in the EO, of which each VO sets a different value. Thus when the doDML method is called, it could check the value of the transient attribute, and execute different functionality based on the transient.
    CM.

  • For some reason the function keys on my mac book changed, I restored them and now the shift keys have the function of showing the desktop and all windows.  I there a way I can restore the original function?

    For some reason the function keys on my mac book changed, I restored them and now the shift keys have the function of showing the desktop and all windows.
    I there a way I can restore the original function?

    You do not tell us what OS version you have. In OS 10.8.2, do this:
    Apple Menu / System Preferences / Language and Text / Input Sources.
    Select the language you want. Mine is set to Canadian English.

  • The top row of keys (fn keys) stuck on function only?

    I was working normally on my Mac (Air with OS X Yosemite) and suddenly the top row of keys (such as volume, brightness etc.) stopped working normally. It acts as a function key only and I can't adjust volume, brightness etc. from there, which is annoying. I have checked I don't have the "use all F1, etc. keys as standard function keys" on in settings and I just don't know what to do.
    Does anyone knows the solution?
    Thank you

    Hello there, VeganB.
    When one or more keys are not responding, the following Knowledge Base article offers up some great steps for troubleshooting your keyboard:
    One or more keys on the keyboard do not respond - Apple Support
    Some keys don't work as expected
    From the Apple menu, choose System Preferences.
    From the View menu, choose Speech.
    Click the Text to Speech tab.
    If "Speak selected text when the key is pressed" is enabled, the key or key combination set to speak text cannot be used for other purposes or used to type text--click Set Key and change it to a less-commonly used key combination (try to use modifier keys such as Shift, Command, Option, and Control). Or, disable the "Speak selected text when the key is pressed" option.
    Click the Accessibilty or Universal Access pane in System Preferences, then click the Keyboard tab.
    Make sure that Slow Keys is turned off. With Slow Keys on, you need to press a key for a longer period of time for it to be recognized.
    In the Accessibilty or Universal Access pane, click the Mouse tab, and make sure Mouse Keys is turned off. With Mouse Keys enabled, you cannot use the Numeric Keypad to enter numbers--instead the keypad moves the pointer (cursor). (There is an option to enable Mouse Keys with five presses of the Option key; you may want to turn that option off to avoid accidentally enabling it.) If Mouse Keys is enabled and you are using a keyboard with no numeric keypad or Num Lock function, see Unable to type while Mouse Keys is enabled in Mac OS X.
    If the function keys on the top row of the keyboard are not working as expected, see Mac OS X: How to change the behavior of function keys.
    If the issue persists, use Keyboard Viewer to help isolate the issue:
    Click the Language & Text pane (Mac OS X v10.6) or International pane (Mac OS X v10.5.8 or earlier) in System Preferences.
    Click the Input Sources tab (or Input Menu tab in Mac OS X 10.5.8 or earlier).
    Click the Keyboard & Character Viewer "On" checkbox to select it (click the Keyboard Viewer "On" checkbox in Mac OS X 10.5.8 or earlier).
    From the Input (flag) menu, choose Show Keyboard Viewer.
    If the keyboard is connected and detected by OS X, the keys you type will highlight in the Keyboard Viewer window. Open TextEdit (or any text application), and try to type something using the keys that were previously not responding to see if they highlight in Keyboard Viewer.
    Start from the Mac OS X Install Disc, choose Terminal from the Utilities menu and test the keys which were previously not working.  If the keys work while started from the Install disc, then the keyboard itself is working correctly.  Use How to troubleshoot a software issue to isolate the software issue that may be causing the keys to not respond.
    Thanks for reaching out to Apple Support Communities.
    Cheers,
    Pedro.

  • Put pagination recordset inside a function

    Hi, I need some help if its possible.
    I'm using Dreamweaver's PHP code for selecting data from database and outputing them in pages ( Pagination ). I thought to create a very general record set and then put it in a function so I can re-use it,  and change only things like the query and the $maxRows_. So it looks like this:
    .....                                                                                                           ..... PreviousNext.....
    How can I make this??? Imean if I put all the php code (above the html tags) inside a function, what should my function return back, how will the output data inside the while loop will appear properly and also the pagin links???

    There are many scripts that are pre-made, tried & tested that you could use.
    There's a beautiful step-by-step tutorial along with source files here that you can easily follow: http://net.tutsplus.com/tutorials/php/how-to-paginate-data-with-php/
    -ST

  • My A1243 keyboard special keys don't function

    I have a Mac Pro and I just switched out my old wired keyboard (the one with the clear plastic casing) for the newer A1243 model, all sleek and aluminum and stuff. This includes the special functions for the function keys (volume control, expose, spaces, etc.) However, these don't work. They still do what I set them to do (F12 is dashboard, F11 All windows Exposé, etc.). And, before you say it, I've checked system preferences, and the box next to "Use all F1, F2, etc. keys as standard function keys" is UNCHECKED. This isn't too much of a problem, except that I currently can't change my volume from the keyboard. Any way to solve the problem? Happy to give more info.

    Alright, so assuming that for whatever reason there's no way I can make the Volume keys on my keyboard work to change the volume. How can I assign the unassigned function keys (so, f16, 17, 18, and 19) to be increase volume, decrease volume, and mute? I've found in the "Keyboard SHortcuts" section of the Keyboard and Mouse preference pane where you can assign new shortcuts, but I need the "exact name of the menu command" in order to do so. What can I put in there to be able to change the volume? I've tried "Increase Volume" "Increase System Volume" and "Mute" to no effect.
    Thanks.

  • How to set key fields in a Database view

    Hi guru's
    iam balaji,plz guide me with how to set key fields in a view.......that field is a non key field in the base table....
    thanks in advance,
    Balaji.S

    take a look at this:
    Diagnosis
        In the view, not all of the mandatory fields were included as key
        fields. The key of the view therefore is not unique.
    System Response
        All the fields are regarded as key fields in order to guarantee that th
        key lengths are unique.
    Procedure
        For views with a large number of fields, this could have a negative
        effect on the performance for the language construction described below
        In this case, all the mandatory key fields should be included in the
        view.
    regards

  • How to create a secondary list of alv grid inside the function module

    Hi All,
    My requirement is to create a RFC function module to display the alv grid of one table.
    i have created that.
    while clicking on the records of the alv it should open the secondary list of another table.
    My problem is it is not fetching the records of the internal table of the primary list since it is created inside the function module(FUNCTION...ENDFUNCTION).
    pls help me on this.
    Thanks in Advance.

    hi,
    READ TABLE sel_sheet INTO wa_sheet INDEX rs_selfield-tabindex.
    here sel_sheet is the internal table for the primary list..
    i called the function module "reuse_lav_grid_display" inside Function...Endfunction.
    so when i am using  READ TABLE sel_sheet INTO wa_sheet INDEX rs_selfield-tabindex.
    inside the user command perform therecords in this internal table is not populating..
    pls help me on this.
    thanks in advance.

  • Set Key Field in Import Manager

    Hi All,
    I have 2 fields in my source file(name,category) .category(look up Field) is the key field and name(display Field) is the matching field.
    I got file like this......
    Name                  category
    1                           A
    1                           B
    1                           C
    While importing i got an error stating that Import failed. The destination record was referred to by multiple source records. Duplicate source records should be merged before importing them.
    Import action: Update (All Mapped Fields)Source record no: 1
    But in this case my key field is Category based on category  then these 3 records will be 3 different records.
    Please let me know the  use of Set Key field in the Import Manager and how it works?

    Hi,
    It's not about set of key field in MDM Import Manager but the reason is that you can not select more than 1 category(Lookup Taxonomy) in maintable for one record. thats why error is coming because for this Property Multi-valued always No.
    Even, you can try this in Data Manager manually create three Category A, B and C in taxonomy mode on selecting Sub table Categories, then on selecting main table, when you select category field(which is lookup to categories table)for a particular record you could able to select only one category A, B or C.
    i would suggest make a Attribute of type text having three values A, B and C and mark this as Multi-Valued in Attribute Detail and link this Attribute with your category. in this way you can attach three values A, B and C with your Record.
    Other thing you can do,make this category field as (Lookup Hierarchy not lookup taxonomy) in main table to Subtable(Hierarchy) then for this field in main table you can set Property Multi-valued = Yes in MDM console and then after Import using MDM Import Manager finally only one record will get created in Data Manager as:
    Name Category
    1         A;B;C
    Hope it will Help you,
    Rewards if Useful.....
    Mandeep Saini
    Edited by: Mandeep Saini on Jun 20, 2008 8:46 AM

  • Renaming a file inside a function in PL/SQL

    Hi,
    I have a file called TMP_g2_response_data. I have some data in it. I read the data inside my function. Once I read the data, I want to move it to some another file. Basically I want to rename the file TMP_g2_response_data to TMP_g2_response_data.old. How can I do this from my PL/SQL code.
    Please help me out.
    Thanks in andvance

    Its appropriate.
    I just coded it this way. Have a look at it. Please tell me where I am going wrong.
    create or replace procedure fmov as
    log varchar2(300);
    logfile UTL_FILE.FILE_TYPE;
    newlog varchar2(300);
    cmd varchar2(300);
    begin
    log := 'test-log';
    logfile := utl_file.fopen('/tmp', log, 'W');
    utl_file.put_line(logfile,'Here we go');
    utl_file.frename('/tmp',logfile,'/tmp','test-log.old');
    utl_file.fclose(logfile);
    end;
    show errors;
    Thanks in advance

  • How to get al object's type used inside a function group

    Hello There,
    I want to create a program to get all the objects used inside a Function group, for example all the data structure type (not the field name of fieds ortable name used in import/export but their data types) used in import/export/table parameters of Function group or Function module inside that FG. I also want to know all the field types/function module/class/method etc used inside a FG.
    The main purpose is to create a program to know if a function group uses a object from a particular software component. we have a requirement in our project for example all the standard objects used in a program should belong to only sap_basis /sap_abap/sap_appl software component.
    I realy appreciate any help on the same.
    Mani

    Goto se80, provide the function group, double click on the object name, click on the main program button and get the function pool name. Now place this function pool name in se38 , go to menu utilities->environment analysis. You will get the list. If you would like to do this via custom program then see through debugging mode and check what is coded.
    Kesav

  • Mdx error : Query (11, 9) Two sets specified in the function have different dimensionality.

    Hi all
    i am getting the fallowing error for the below mdx , what may be the issue?
    Query (11, 9) Two sets specified in the function have different dimensionality.
    WITH SET LastSample AS TAIL(NONEMPTY([Date].[Hierarchy].members *[Time].[Hierarchy].members,[Measures].[Overall LU SR]))
    MEMBER [KPI Name] AS "Overall LU SR"
    MEMBER [KPI Value] As KPIValue("Overall LU SR")
    MEMBER [KPI Status] AS KPIStatus("Overall LU SR")
    MEMBER ObjectName as "Overall LU SR"
    MEMBER [Critical Threshold] as  [KPI Thresholds].[Threshold1].&[Overall LU SR].member_value
    MEMBER [Major Threshold] AS  [KPI Thresholds].[Threshold2].&[Overall LU SR].member_value
    MEMBER [Minor Threshold] AS 0
    MEMBER latestDate as [Date].[Hierarchy].membervalue, format_string = 'mm/dd/YYYY'
    MEMBER latestTime as [Time].[Hierarchy].member_caption
    SELECT  {latestDate,latestTime,ObjectName, [KPI Name], [KPI Value],[KPI Status],[Measures].[Critical Threshold],[Measures].[Major Threshold],[Measures].[Minor Threshold]} ON COLUMNS
    ,nonempty(LastSample) ON ROWS
    FROM [DRA]
    Surendra Thota

    hi all
    i got the solution . i have add measures dimension to the name  ie ,[Measures].[KPI Name],
    WITH SET LastSample AS TAIL(NONEMPTY([Date].[Hierarchy].members *[Time].[Hierarchy].members,[Measures].[Overall LU SR]))
    MEMBER [KPI Name] AS "Overall LU"
    MEMBER [KPI Value] As KPIValue("Overall LU SR")
    MEMBER [KPI Status] AS KPIStatus("Overall LU SR")
    MEMBER ObjectName as "Overall LU SR"
    MEMBER [Critical Threshold] as  [KPI Thresholds].[Threshold1].&[Overall LU SR].member_value
    MEMBER [Major Threshold] AS  [KPI Thresholds].[Threshold2].&[Overall LU SR].member_value
    MEMBER [Minor Threshold] AS 0
    MEMBER latestDate as [Date].[Hierarchy].membervalue, format_string = 'mm/dd/YYYY'
    MEMBER latestTime as [Time].[Hierarchy].member_caption
    SELECT  {latestDate,latestTime,ObjectName,[Measures].[KPI Name], [KPI Value],[KPI Status],[Measures].[Critical Threshold],[Measures].[Major Threshold],[Measures].[Minor Threshold]} ON COLUMNS
    ,nonempty(LastSample) ON ROWS
    FROM [DRA]
    Surendra Thota

  • Can we add the standard includes inside a function exit.

    Hi,
    Can we add the standard includes inside a function exit.
    I want to add 4 to 5 standard includes. If iam adding it it says report or program already exists.
    Can anyone tell me is it possible or we can modify the only the data which is coming to that function module .
    Please help me on this.
    Thanks,
    Rose.

    hi santhosh,
      The data needed for those includes are also exist in the funtion module exit. I want to add those includes and in one include just i want to add some 10 to 15 lines of code. Is it possible.
    If i include all those includes inside the function exit it says report or program name already exists. When i double clicked on the error it takes me to a line in 1 include which has function-pool statement.
    How can i eradicate this error.
    Can u please help me on this.

Maybe you are looking for

  • Credit memo with value date

    Hello Gurus,     for field " Credit memo with value date" in billing document,  field VALDT (fixed value date) in the credit memo request is filled with the payment deadline baseline date of the base billing document. where is that payment deadline b

  • Multiple Stickies databases? Open a few Stickies only per application?

    I love Stickies, but I hate having so many open at the same time. It's always the case that I need only a few stickies at a time, depending on the other apps I'm working on. For example, I might have a few "tips" stickies I created for myself when I

  • RMAN Backup with ASM and Standby in place

    Hi All, We are planning to upgrade our database from 10.2.0.2 to 10.2.0.3. We have ASM as storage on primary and phisical standby is in place. I want to make a cut of point for backup, i.e if I restore till that poit on primary standby should continu

  • Issue implementing Business security profile in IDT

    Hi, BO 4.1 SP3 I created a WebI Report with ADMIN privileges with 3 objects and published to Public Folder. Then I created a Business security profile in IDT and Denied USER1 access to 'Display Data' on one of the above 3 objects say Object3 (i.e. Gr

  • Labview 6 arbitrary function generator file format?

    Hi, I have old hardware (e.g. DAQcard1200) which I have to use with old versions of Labview (4 or 6) (as they run on "old" hardware - Pentium1 embedded boards with Win98 etc.). With Labview 8 I can load a file in .lvm format and use it as output for