Save required when adding record to avoid multiple record entries@same time

Hello, just wondering if anyone would be so kind as to help me out. I have a small problem that when a user is adding records to my form I want them to add one, then if they go on to add another at the same time (before commiting the first one) that they will be shown a prompt Which states something along the lines of "Before you add another record you must first save the first record, do you wish to do so" , yes will then commit the first record and allow the user to enter the second record, whilst cancel will not allow a second record to be entered.
If anyone would helpout i would be very grateful.

Hi
Here is my suggestion, the idea is to use a global variable to memorize the fact that a record has been created :
KEY-CREREC
begin
          if :GLOBAL.<BLOCK-NAME>RECORDCREATED = 'FALSE' then
               create_record;
               :GLOBAL.<BLOCK-NAME>RECORDCREATED := 'TRUE';
          else
               message('Commit or delete before inserting a new record');
               message('Commit or delete before inserting a new record');
          end if;
end;
=====================================================================
KEY-DELREC
begin
     if :system.record_status in ('NEW','INSERT') then
          :GLOBAL.<BLOCK-NAME>RECORDCREATED := 'FALSE';
     end if;
     delete_record;
end;
====================================================================
KEY-COMMIT
begin
     commit_form;
     :GLOBAL.<BLOCK-NAME>RECORDCREATED := 'FALSE';
end;
====================================================================
POST-SELECT
:GLOBAL.<BLOCK-NAME>RECORDCREATED := 'FALSE';
====================================================================
It's a bit more complicated if you allow the user to go beyond the last record for creating a new record, as KEY-CREREC and KEY-DELREC are not triggered.
In this case, my suggestion is the following :
KEY-CREREC
begin
          if :GLOBAL.<BLOCK-NAME>RECORDCREATED = 'FALSE' then
               if :system.last_record = 'TRUE'then
                    next_record;
               else
                    create_record;
                    :GLOBAL.<BLOCK-NAME>RECORDCREATED := 'TRUE';
               end if;
          else
               message('Commit or delete before inserting a new record');
               message('Commit or delete before inserting a new record');
          end if;
end;
===============================================================
WHEN-NEW-RECORD-INSTANCE
begin
     if :system.mode = 'NORMAL' then
          if :system.record_status = 'NEW' and :system.last_record = 'TRUE' then
               if :GLOBAL.<BLOCK-NAME>RECORDCREATED = 'TRUE' then
                    message('Commit or delete before inserting a new record');
                    message('Commit or delete before inserting a new record');
                    delete_record;
               end if;
          end if;
     end if;
end;
================================================================
KEY-DELREC
begin
     if :system.record_status in ('NEW','INSERT') then
          :GLOBAL.<BLOCK-NAME>RECORDCREATED := 'FALSE';
     end if;
     delete_record;
end;
=================================================================
KEY-COMMIT
begin
     commit_form;
     :GLOBAL.<BLOCK-NAME>RECORDCREATED := 'FALSE';
end;
===============================================================
WHEN-VALIDATE-RECORD
begin
     if :system.record_status = 'INSERT' and :system.last_record = 'TRUE' then
          :GLOBAL.<BLOCK-NAME>RECORDCREATED := 'TRUE';
     end if;
end;
==================================================================
POST-SELECT
:GLOBAL.<BLOCK-NAME>RECORDCREATED := 'FALSE';
================================================================

Similar Messages

  • How to save more than 2 records at a time in tabular form?

    I have a table name SAMPLE_TABLE, which has SNO,NAME items and one sequence name is SEQ_SAMPLE.
    i have one form based on SAMPLE_TABLE. my form is in tabular format, which has 5 records.
    in the layout wizard only NAME is displayed. SNO doesnot displayed.
    in the layout wizard, there is one push button named as SAVE.
    the code of SAVE button(When_Button_Pressed) is
    insert into sample_table values(seq_sample.nextval,:sample_table.name);
    clear_record;
    commit;
    my problem is :
    when ever i want to save one record at a time there is no problem.
    if i want to save more than 2 records at a time then sequence number is alloted for last record. other records have no sequence numbers.
    for example i want to insert 2 names as XYZ,PQR then
    the table look like this:
    sno name
    1 PQR
    XYZ
    if SNO is primary key then it doesnot work because of null value.
    can any one solve my problem?
    Thanks
    Meegada

    Is the block a database block or a control block,
    1. if database block, assign the primary key on a
    trigger like new record instance for each record
    enteredour's is a control block, ididnt get your point clearly
    could you make it clear how to assign a primary key on a trigger
    our criteria is we are having two block as lov_values and lov_name
    lov_values:
    lov_values_id (sequence generated)
    lov_id will be same for the all the values for a particular lov_name
    lov_values will be which we enter in the form which will be the only visuble colums on the form
    lov_name block:
    lov_name
    lov_id(sequence generated)
    could you help me with the code
    thanks
    prasad

  • How to avoide multiple duplicate entries in adress book?

    How to avoide multiple duplicate entries in adress book? I can add the same contact name and number more than twice and the phone isn't warning me at all!!! I's quite a heck for me.

    not possible from inside AB AFAIK. but you can do the following. in finder open the folder /users/username/library/application support/address book/metdata. switch to the list mode and sort by date modified. quicklook the vcards at the top to see which ones they are.

  • How to avoid multiple listing for same artist?

    How to avoid multiple listing for same artist?

    Sounds like there might be blanks in the artist name.
    For instance "Lou Reed" and "Lou Reed_" will not match.
    (Pretend the underscore _ is a blank).
    Select all the Lou Reed songs, Get Info, and type "Lou Reed" in the artist field. That should fix it.

  • How to change Payment Terms in multiple orders at same time?

    How to change Payment Terms in multiple orders at same time?
    I have got 10,000 Order, I need to change the payment terms for all these Orders.
    Can I Know the way out for this.
    Regards,
    Dantham Conpolwedson
    Edited by: Dantham Conpolwedson on Mar 25, 2009 11:18 AM

    Hi
    There are as many options for that
    You can go for
    1)MASS t code
    2) LSMW  (by recording)
    3)BDC (by recording)
    and the most easiest way is by doing the MASS tcode
    goto MASS and enter the object type as BUS2032
    execute now select the sales order haeader data and execute and now enter the sales doc from and to range and execute now all the sales dox will be displayed
    and from the menu click on select fields  and select the terms of payment
    now select the terms of payment row and enter the new values  and click on carry out new changes
    regards

  • Low memory when using programs like iPhoto, office at the same time I have 4 GB ram

    low memory when using programs like iPhoto, office at the same time I have 4 GB memory ram 3000 graphics 384 mb

    Do you have a question?

  • HT1338 How can i use my data on windows or mac when i use one of them in the same time?

    Hi,
    i have a Mac book with 2 operating system, ( Windows& mac). How can i use my data on windows or mac when i use one of them in the same time?
    Thank you

    The following article(s) may help you.
    Resolving duplicate calendars
    Resolving duplicate contacts

  • My MacBook is almost two years old and has started running really slow. It gets bogged down when it is running different programs at the same time, like Safari and Pages. It didn't react this way until recently. Any advice would be very welcome.

    My MacBook is almost two years old and has started running really slow. It gets bogged down when it is running different programs at the same time, like Safari and Pages. It didn't react this way until recently. Any advice would be very welcome.

    Launch Disk Utility and select the icon of the internal drive (the drive itself, not the volume icons below it.) Is the SMART status "Verified?" If not, replace the drive immediately. If the status is "Verified," the drive may still be failing. Back up all data, if you haven't already done so. Reinstall Mac OS X, then run Software Update. Test with all wired peripherals disconnected. If it's still slow, you have a hardware problem.
    Mac OS X 10.6 Help: Reinstalling Mac OS X

  • -5002 error ("No Data ") when adding record to a UserTable

    B1 2007A
    Here's my code.  I've stripped it about as far as I could to try and solve this problem... but I must be missing something.  Basically, I referenced the UIDIBasicApp for the UserTables portion.
    In the "PopulateUserTable" subroutine, where I attempt to add the record with:
    lngRetCode = objUserTable.Add()
    ... lngRetCode comes back as "-5002".  The error message is "No Data ".
    I've added records with the same data into the table through B1 User-Defined Windows and it accepts the data without a problem.  I've been re-checking the code, and searching the forums and the help file since last week, and I haven't found any reference to a problem like this.
    Any ideas?  Thanks!
    Module Module1
        Public WithEvents objSboApp As SAPbouiCOM.Application
        Public WithEvents objSboCompanyDi As SAPbobsCOM.Company
        Public Sub Main()
            ConnectUI()
            ConnectDI()
            CreateUserTable("TP_WhereUsed")
            PopulateUserTable("TP_WhereUsed")
        End Sub
        Public Function ConnectUI()
            Dim objSboUiApi As SAPbouiCOM.SboGuiApi
            objSboUiApi = New SAPbouiCOM.SboGuiApi
            Dim sConnectionString As String
            sConnectionString = "0030002C0030002C00530041005000420044005F00440061007400650076002C0050004C006F006D0056004900490056"
            objSboUiApi.Connect(sConnectionString)
            objSboApp = objSboUiApi.GetApplication
        End Function
        Public Function ConnectDI()
            objSboCompanyDi = New SAPbobsCOM.Company
            Try
                objSboCompanyDi = objSboApp.Company.GetDICompany()
            Catch
                objSboApp.MessageBox(Err.Description)
                Exit Function
            End Try
        End Function
        Public Sub CreateUserTable(ByVal TableName As String)
            Dim lngRetCode As Long
            Dim lngErrCode As Long
            Dim strErrMsg As String
            Dim oUserTablesMD As SAPbobsCOM.UserTablesMD
            oUserTablesMD = objSboCompanyDi.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserTables)
            oUserTablesMD.TableName = TableName
            oUserTablesMD.TableDescription = TableName
            lngRetCode = oUserTablesMD.Add
            If lngRetCode <> 0 Then
                Select Case lngRetCode
                    Case Is = -2035
                        'Table already exists.
                        Exit Sub
                    Case Else
                        objSboCompanyDi.GetLastError(lngErrCode, strErrMsg)
                        objSboApp.MessageBox("Error - Table not created: " & strErrMsg)
                End Select
            Else
                objSboApp.SetStatusBarMessage("Table: " & oUserTablesMD.TableName & " was added successfully", SAPbouiCOM.BoMessageTime.bmt_Short, False)
            End If
        End Sub
        Private Sub PopulateUserTable(ByVal TableName As String)
            Dim lngRetCode As Long, lngErrCode As Long, strErrMsg As String
            Dim strCode As String, strName As String, intArrayCounter As Integer
            Dim objUserTable As SAPbobsCOM.UserTable
            objUserTable = objSboCompanyDi.UserTables.Item(TableName)
            intArrayCounter = 0
            Do Until intArrayCounter > 10
                strCode = "Code" & CStr(intArrayCounter)
                strName = "Name" & CStr(intArrayCounter)
                lngRetCode = objUserTable.Code = strCode
                lngRetCode = objUserTable.Name = strName
                lngRetCode = objUserTable.Add()
                intArrayCounter = intArrayCounter + 1
                objSboCompanyDi.GetLastError(lngErrCode, strErrMsg)
            Loop
        End Sub
    End Module

    Hi
    Try your code with the lines I've added to the code of your CreateUserTable function.  Hope it works!
        Public Sub CreateUserTable(ByVal TableName As String)
            Dim lngRetCode As Long
            Dim lngErrCode As Long
            Dim strErrMsg As String
            Dim oUserTablesMD As SAPbobsCOM.UserTablesMD
            oUserTablesMD = objSboCompanyDi.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserTables)
            oUserTablesMD.TableName = TableName
            oUserTablesMD.TableDescription = TableName
            lngRetCode = oUserTablesMD.Add
            If lngRetCode <> 0 Then
                Select Case lngRetCode
                    Case Is = -2035
                        'Table already exists.
                        Exit Sub
                    Case Else
                        objSboCompanyDi.GetLastError(lngErrCode, strErrMsg)
                        objSboApp.MessageBox("Error - Table not created: " & strErrMsg)
                        System.Runtime.InteropServices.Marshal.ReleaseComObject(oUserTablesMD)
                        oUserTablesMD = Nothing
                        GC.Collect() ' free occupied resource
                End Select
            Else
                objSboApp.SetStatusBarMessage("Table: " & oUserTablesMD.TableName & " was added successfully", SAPbouiCOM.BoMessageTime.bmt_Short, False)
    System.Runtime.InteropServices.Marshal.ReleaseComObject(oUserTablesMD)
                oUserTablesMD = Nothing
                GC.Collect() ' free occupied resource
            End If
        End Sub

  • How to avoid multiple LOGIN with same user in database.

    Hi All,
    Using database triggers how to control multiple logins of a pertiuclar user.
    thanks in advance

    Don't forget to activate the RESOURCE_LIMIT parameter, which default is FALSE :
    alter system set RESOURCE_LIMIT = true;
    Laurent, I had a similar problem some time ago : I didn't want to avoid multiple access, but only control who was doing what. That's because moving from Client/Server to Web the TERMINAL column in V$SESSION becomes useless.
    I tried your solution, but I had to give up with it, because in my Forms9i application some forms call Reports, which generate a new session.
    I decided to use DBMS_APPLICATION_INFO, and this is satisfactory for my requirements, but I'm interested to discover other solutions.
    P.S. with my solution I'm able to limit accesses, because in the CLIENT_INFO string I put, among other things, the
    application user, so I can control if an user is already connected. The problem is that existing applications have to be modified .....:-(

  • Error when sending multiple request at same time

    When we send multiple request at the same time, we get an error.
    Same scenario
    XIServer:AE_DETAILS_GET_ERROR:Error while reading from the secure store:
    ERROR_U: No service user password found for Adapter Engine
    The first request is processed OK, it's the second one that gives the error...
    Anybody any ideas?

    Check out the below thread : Re: No service user password found for Adapter Engine
    May be some of the solution from the thread will work for you.
    Thanks,
    Pooja Pandey

  • Why does Thunderbird hang when a login dialog is open at the same time as a file save dialog?

    This happens frequently. And if there is any open email I am composing at the same time, it is LOST. This appears to be a bug that would rarely trigger in the normal case, but I have several email accounts active at once and one of them sometimes throws up a login window. If I happen to simultaneously be trying to save an attachment, the save dialog pops up and neither "Save" nor "Cancel" buttons work anymore and it is impossible to get the login dialog to respond. Thunderbird cannot respond to window cycle requests, so I can't even get to the edit windows to screen-shot them. The only thing I can do is kill the process and lose everything.

    printscrn on the keyboard should still work unless the operating system is also dead.
    However, while it may be a bug please try the following steps to make sure.
    *Restart Thunderbird with add-ons disabled (Thunderbird Safe Mode). On the Help menu, click on "Restart with Add-ons Disabled". If Thunderbird works like normal, there is an Add-on or Theme interfering with normal operations. You will need to re-enable add-ons one at a time until you locate the offender.
    *Restart the operating system in '''[http://en.wikipedia.org/wiki/Safe_mode safe mode with Networking]'''. This loads only the very basics needed to start your computer while enabling an Internet connection. Click on your operating system for instructions on how to start in safe mode: [http://windows.microsoft.com/en-us/windows-8/windows-startup-settings-including-safe-mode Windows 8], [http://windows.microsoft.com/en-us/windows/start-computer-safe-mode#start-computer-safe-mode=windows-7 Windows 7], [http://windows.microsoft.com/en-us/windows/start-computer-safe-mode#start-computer-safe-mode=windows-vista Windows Vista], [http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/boot_failsafe.mspx?mfr=true" Windows XP], [http://support.apple.com/kb/ht1564 OSX]
    ; If safe mode for the operating system fixes the issue, there's other software in your computer that's causing problems. Possibilities include but not limited to: AV scanning, virus/malware, background downloads such as program updates.

  • 8620 scan- unable to scan multiple pics at same time & save in individual files

    Unable to scan multiple pictures at the same time on the glass flatbed & have saved into individual jpg files. Scans all the pics as one - one file. For jpgs under Advanced Settings - file tab. Checked but greyed out - create a separate file for each scanned image. I need to scan many pictures & I don't want to do them individually

    Hi Dhpakid,
    From the HP Officejet Pro 8620 software click on Scan a Document or Photo.
    Set the Scan Size as "Entire Scanner Glass".
    Change the Scan Sourse into "Flatbed Glass".
    Click the Advanced Settings button, Check the Auto-Crop option (if it is grayed out change the scan type into Photo) and click OK.
    Click the scan button and complete the scan, it will be cropped automatically into multiple files.
    Regards,
    Shlomi
    Say thanks by clicking the Kudos thumb up in the post.
    If my post resolve your problem please mark it as an Accepted Solution

  • Multiple Inst tracks recorded @ the same time

    I AM TRYIN TO RECORD TWO INST TRACKS AT THE SAME TIME USING TWO SEPERATE MIDI DEVICES. IS THIS POSSIBLE, AND IF SO HOW IS IT DONE ?
    THANKYOU.

    Ok, let's try step-by-step.
    I'm assuming you already have in the arrange window two instrument tracks for Inst1 and Inst2 such that you can play/record each instrument individually.
    Now proceed as follows
    1. Open the environment and choose the Audio layer. From the New menu choose the Channel Splitter. It appears on the window. Make sure that its Icon box is checked in the parameter box. Then draw cables from output1 to Inst1 and output2 to Inst2.
    2. Open the arrange window. Create a new track. Click and hold the track name, from the popup menu select (Channel Splitter). Voila, now we have the channel splitter track!
    3. Make sure the channel splitter track is selected.
    4. Make sure your midi devices are sending on midi channels 1 and 2.
    Now you should be able to play and record both devices at the same time. The recorded notes will first appear on the channel splitter track. After recording select the region and apply 'Demix by Event Channel'. This will create two new tracks containing the recorded notes of each instrument. For playback drag both regions to the original instrument tracks.
    Good luck! Feel free to ask if something doesn't work as expected.

  • URGENT Select Query Returning No Records take same time as that of insert

    Hello Everrybody,
    I am facing a wierd problem...
    I have table with 15 fields and I am selecting a record with some condition...
    for e.g
    select field1,field2,field3....... from tablea where field1=123
    Now I have index on field1
    When I do SQL Trace it show me time taken as
    00:00:00:60 in oracle 817 SQL PLUS
    and using
    oracle 92 sql plus it show as
    00:00:00:01 in oracle 817 SQL PLUS
    Now Query is what does this 60 denotes milliseconds or what in oracle 92 and in oracle 817 sql plus.....
    Also this query does not return any rows...
    When I run the SP that insert records in same table...That sp take about same time as that of select returning no rows......
    Why is ORACLE Taking so much time for that select ????
    Please help.....

    8i measures timings in 100th of a second but I believe that 9i measures stuff in 1000th of a second. However, from your output it looks like SQL*Plus trace is rounding up to the nearest centisecond.
    Time is a very poor way of judging performance when you're talking less than a second per operation. You'd be better off looking at CPU usage and IO activity.
    Anyway, here are some questions for you to research:
    (1) Is field1 a unique index?
    (2) How many rows does this table hold?
    (3) How fresh are the statistics on the table and the index?
    (4) What's the explain plan? What's the TKPROF output?
    (5) Are all of the above the same on both databases?
    Cheers, APC

Maybe you are looking for

  • Line item not updated for F-04

    Dear All,           Previously I have posted a receipt document with Bank account 'A'. The customer line item is cleared already. And I would like to do transfer posting from Bank 'A' account to Bank 'B' account by F-04. But the document number is no

  • In iPad air how do I delete recent addresses in mail

    when I go to put an address on an email a long list of recents comes up.  How can I delete these without doing it one at a time?

  • Activation of the activity fails u0096 no source files in the active workspace

    Dear All, I’m working on a NWDI installation since last month. The NWDI server (NW2004s) has been installed and configured with the following parameters: Some Details: -     Java Stack on SPS 12 -     No complete Developer Workplace, we only use the

  • RFC lookup in Integration Scenario

    Hi, I have a scenario where I need to do RFC lookup first and based on the values ( typically the lookup will give file path and file name), I need to send these values as variable substitution to file adapter to read the file. The above is in loop u

  • Hide Processor ID in PO release code

    Dear Experts, I have requirement to hide processor ID in PO release code. I have maintained user id as agent ID in PO release code workflow. And apparently, processor ID displayed in PO release strategy tab. I need to hide processor ID from release s