Save selected records?

hi
I want to save selected reocrd in my table i write these line in when button pressed commit button
begin
     go_block ('blockname');
     if :kcheck <> 'Y' then
     do_key ('delete_reord');
     else
     commit;
end if;
end;
but save all the records.
I have master and detail block.

If you insist on using a loop then try this:
begin
  go_block ('blockname');
  first_record;
  loop
    if :kcheck <> 'Y' then
      clear_record;
    else
      Exit When :System.Last_Record = 'TRUE';
      Next_Record;
    end if;
  end loop;
  commit;
end;clear-record will move the cursor to the next record without an explicit next_record.
How about putting this in the button:
commit;and this in the on-update trigger:
    if :kcheck <> 'Y' then
      clear_record;
    else
      update_record;
    end if;and letting forms do its thing? (code untested)

Similar Messages

  • How to save the selected records from Table control in dialog programming

    Hiiiiiiii Every1
    Actually the problem is like this:-
    I have to select some records from table control and then want to save the selected records in DB table.
    Example
    I have some rows having inforamtion bout employees...
    Now what i want is that when i click on 'SAVE' button then these selected rows should be moved into DB table.
    Sachin Dhingra

    see below example, I have added INSERT option after DELETE option.
    REPORT demo_dynpro_tabcont_loop_at.
    CONTROLS flights TYPE TABLEVIEW USING SCREEN 100.
    DATA cols LIKE LINE OF flights-cols.
    DATA: ok_code TYPE sy-ucomm,
          save_ok TYPE sy-ucomm.
    DATA: itab TYPE TABLE OF demo_conn.
    TABLES demo_conn.
    SELECT * FROM spfli INTO TABLE itab.
    LOOP AT flights-cols INTO cols WHERE index GT 2.
      cols-screen-input = '0'.
      MODIFY flights-cols FROM cols INDEX sy-tabix.
    ENDLOOP.
    CALL SCREEN 100.
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'SCREEN_100'.
    ENDMODULE.
    MODULE cancel INPUT.
      LEAVE PROGRAM.
    ENDMODULE.
    MODULE read_table_control INPUT.
      MODIFY itab FROM demo_conn INDEX flights-current_line.
    ENDMODULE.
    MODULE user_command_0100 INPUT.
      save_ok = ok_code.
      CLEAR ok_code.
      CASE save_ok.
        WHEN 'TOGGLE'.
          LOOP AT flights-cols INTO cols WHERE index GT 2.
            IF  cols-screen-input = '0'.
              cols-screen-input = '1'.
            ELSEIF  cols-screen-input = '1'.
              cols-screen-input = '0'.
            ENDIF.
            MODIFY flights-cols FROM cols INDEX sy-tabix.
          ENDLOOP.
        WHEN 'SORT_UP'.
          READ TABLE flights-cols INTO cols WITH KEY selected = 'X'.
          IF sy-subrc = 0.
            SORT itab STABLE BY (cols-screen-name+10) ASCENDING.
            cols-selected = ' '.
            MODIFY flights-cols FROM cols INDEX sy-tabix.
          ENDIF.
        WHEN 'SORT_DOWN'.
          READ TABLE flights-cols INTO cols WITH KEY selected = 'X'.
          IF sy-subrc = 0.
            SORT itab STABLE BY (cols-screen-name+10) DESCENDING.
            cols-selected = ' '.
            MODIFY flights-cols FROM cols INDEX sy-tabix.
          ENDIF.
        WHEN 'DELETE'.
          READ TABLE flights-cols INTO cols WITH KEY screen-input = '1'.
          IF sy-subrc = 0.
            LOOP AT itab INTO demo_conn WHERE mark = 'X'.
              DELETE itab.
            ENDLOOP.
          ENDIF.
        WHEN 'INSERT'.
          READ TABLE flights-cols INTO cols WITH KEY screen-input = '1'.
          IF sy-subrc = 0.
            LOOP AT itab INTO demo_conn WHERE mark = 'X'.
              itab1 = itab.
              modify itab1.
            ENDLOOP.
          ENDIF.
          if not itab1 is initial.
            INSERT dbtab FROM TABLE itab1.
          endif.
      ENDCASE.
    ENDMODULE.

  • HoW do I save a recording that has been sent to me via text message? Thanks

    HoW do I save a recording that has been sent to me via text message? Thanks

    You will need a document storage, player, or manager to save the file (DropBox, File Manager, Box, VLC, MoliPlayer for example).
    To actually save the file, with it open in iMessage, tap the file icon (lower left) and select the app to save it in.

  • How to Save Multiple Records In Data Block

    Hi All,
    I Have Two Blocks --> Control Block,Database Block
    Please Any Idea How to Save Multiple Records In Data Block when User changed Data in Control Block.
    Thanks For Your Help
    Sa

    Now i have to use each record of control block(ctl_blk) as where condition in data base block(dat_blk)and display 10 records from database table.>
    Do you want this coordination to be automatic/synchronized or only when the user clicks a button or something else to signal the coordination? Your answer here will dicate which trigger to put your code in.
    As to the coordination part, as the user selects a record in the Control Block (CB), you will need to take the Key information and modify the Data Block's (DB) "DEFAULT_WHER E" block property. The logical place to put this code is the CB When-New-Record-Instance (WNRI) trigger. You code will look something like the following:
    /* Sample WNRI trigger */
    /* This sample assumes you do not have a default value in the BLOCK WHER E property */
    DECLARE
       v_tmp_dw    VARCHAR2(250);
    BEGIN
       v_tmp_dw := ' DB_Key_Column1 = '||:CONTROL.Key_Column1||' AND DB_Key_Column2 = '||:CONTROL.Key_Column_2;
       Set_Block_Property('DATA_BLOCK', DEFAULT_WHER E, v_tmp_df);
       /* If you want auto coordination to occur, do the following */
       Go_Block('DATA_BLOCK');
       Execute_Query;
       /* Now, return to the Control Block */
       Go_Block('CONTROL_BLOCK');
    END;
    The Control block items are assigned with values in Form level (Key_exeqry).If your CD is populated from a single table, it would be better to create a Master - Detail relationship (as Abdetu) describes.
    Hope this helps,
    Craig B-)
    If someone's response is helpful or correct, please mark it accordingly.

  • Save selection criteria in payment wizard

    Hello,
    Does anyone know what the option 'Save selection criteria only' at the end of the payment wizard actually means?  Does it mean it will save the criteria you choose e.g selecting a specific property and BP group or does it mean it will save the results returned from your selection criteria the previous time you ran it?
    Many thanks,
    Kate

    Hi Gordon,
    I thought the same however when I tested this it did not seem to work in this way.  I selected property 6 which returned one business partner which was correct and when I got to the last step of the payment wizard i chose 'Save selection criteria only'.  I then went into the BP master data record of a different supplier and ticked property 6.  When I went back into the payment wizard and went through the one I had just saved, the second business partner was not displayed.  If i then start a new payment run and choose property 6 in the selection criteria, both suppliers were shown.  It seems to only be saving the results that it returns from the selection criteria rather than the selection criteria itself.
    Kind regards,
    Kate

  • OBIEE11g Save Selection Requirement

    Hi,
    we have a requirement where we need to save search criteria in database and make all those search criteria make it available to end users as link on every dashboard.
    There would a different search/prompt page where users will search the criteria and all those selections are saved when clicked on SAVE button to database. We are thinking of using webservices to update all those selection in database.
    But my doubt is, if I retrieve all those selection from database as a link, how can I make sure that once user click on any link (Search1,Search2) my current dashboard page takes the saved criteria and refresh my dashboard page? Links remain same for all the dashboard.
    Let me know if you have any idea on this.
    Thanks in advance.

    Hi Gordon,
    I thought the same however when I tested this it did not seem to work in this way.  I selected property 6 which returned one business partner which was correct and when I got to the last step of the payment wizard i chose 'Save selection criteria only'.  I then went into the BP master data record of a different supplier and ticked property 6.  When I went back into the payment wizard and went through the one I had just saved, the second business partner was not displayed.  If i then start a new payment run and choose property 6 in the selection criteria, both suppliers were shown.  It seems to only be saving the results that it returns from the selection criteria rather than the selection criteria itself.
    Kind regards,
    Kate

  • Restrict Form & Reports Pages but allow users to Save their Records

    Hi
    I have a database with Forms & editable Reports pages.
    I have also created a table with certain 'Admin Levels' of access so that users with the 'ADMIN_LEVEL' = 1 cannot access the editable reports pages.
    I find that applying the below restriction stops those users from accessing the reports but also won't allow those users to save any records.
    select USER_ID
    from USERS
    where USER_ID=:APP_USER
    and ADMIN_LEVEL > 1
    I then thought I could create a new page of the report but make it uneditable & use the 'Create' button to save the record to the table, but this doesn't work.
    My question is, how can I restrict access to a reports page but still allow records from restricted users to be saved?
    Thanks

    Hi,
    Firstly, you should look into Authorization Schemes: [http://download.oracle.com/docs/cd/E14373_01/appdev.32/e11838/sec.htm#BABCAGAB]
    I would suggest you create a scheme to identify admin users called, say, ADMIN_USER. This could be an EXISTS SQL query scheme of something like:
    SELECT 1
    FROM USERS
    WHERE UPPER(USER_ID) = UPPER(v('APP_USER'))
    AND ADMIN_LEVEL = 1Then, on any item within your application, you have an Authorization Scheme setting. You can then set this to either "ADMIN_USER" or "{not}ADMIN_USER" to determine which user can have access to that item. "{not}ADMIN_USER" is any user where the above query would return no records.
    Using this, you could grant access to a page, but stop access to a button and/or process. You don't, for example, have to set a scheme for the page itself (you can leave the setting as "- No Authorization Required -", so everyone can get to the page), but you can then set a Scheme for a button on that page. If the user is an ADMIN_USER and you have set a button for {not}ADMIN_USER, that user won't get the button on the page (you should also make the same setting on any process that this button triggers).
    But, if you set the page's Scheme to {not}ADMIN_USER, any ADMIN_USER will not even be able to get to the page.
    Andy

  • DELETE - Save deleted records

    Hello guys,
    I have a process that before deleting records from a table saves them in a backup table. I know, it could be easier to manage with a flag or so, but for now, I can not change the structure of the tables. I have to save some records before deleting them.
    The process goes like this:
    CREATE TABLE my_data
      id_data NUMBER(15),
      field_1 VARCHAR2(100),
      field_2 VARCHAR2(100)
    INSERT INTO my_data
      SELECT level, dbms_random.string('a', 100), dbms_random.string('a', 100)
        FROM dual
      CONNECT BY level <= 10;
    CREATE TABLE my_data_bkp
      id_data NUMBER(15),
      field_1 VARCHAR2(100),
      field_2 VARCHAR2(100)
    BEGIN
      DBMS_ERRLOG.create_error_log (dml_table_name => 'my_data_bkp');
    END;
    INSERT INTO my_data_bkp
      SELECT * from my_data WHERE id_data IN (2, 4, 5);
    DELETE my_data WHERE id_data IN (2, 4, 5) LOG ERRORS INTO err$_my_data_bkp REJECT LIMIT UNLIMITED;But I wonder if it is possible to work with the returning clause of the delete. This could be better because there could be an exception during the delete and it would be handled by the DML error handling. But the first INSERT SELECT to backup the data that are going to be deleted is not in sync. So I was wondering if any of you have any suggestion to improve this? I am working on Oracle 10g (10.2.0.5)
    Thanks,

    since you are using error logging anyway, you might as well get additional benefits from it. Assuming that you want the rows that were successfully deleted deleted, and that you want to know why the other did not get deleted, then change your log errors call to something like:
    DELETE my_data
    WHERE id_data IN (2, 4, 5)
    LOG ERRORS INTO err$_my_data_bkp ('some tag to ID this run')
       REJECT LIMIT UNLIMITED;Then after the delete do:
    delete from my_data_bkp
    where id_data in (select id_data
                      from err$_my_data_bkp
                      where ORA_ERR_TAG$ = 'some tag to ID this run');Just be sure that your copy to my_data_bkp was actually successful before you run the delete.
    John
    Edited by: John Spencer on Nov 6, 2012 2:09 PM
    Had the problem reversed.

  • Is there any provision to view the selected record using SYS_REFCURSOR?

    hi friends ,
    I was using SQL Server . now i am shifting to Oracle . so we are changing the Stored Procedures in SQLServer to Oracle SP's. I have given the structure of procedure given below . If possible , i want to see the output of select statement in the TOAD editor . If any body knows please help me
    CREATE OR REPLACE PROCEDURE PS_AON
    P_STATUS OUT VARCHAR2,
    P_CUR OUT SYS_REFCURSOR
    AS
    BEGIN
    OPEN P_CUR FOR
              select colum1,column2,column3 from Table 1;
    EXCEPTION
                   WHEN OTHERS THEN
                   P_STATUS:=SQLERRM;
    END;
    This is one of the model of stored procedures i am using . And the editor i am using is TOAD 7.3.0 and oracle 9i. Is there any provision to view the selected records by running this procedure in TOAD editor
    thanks & regards

    (assuming you have relatively recent version of TOAD).
    Write a small block to call the procedure (or use Toad's 'execute procedure' option) as in the example below. Note the ':' in front of 'v_cur_out'. When you run the block, TOAD will prompt you for a value / datatype for 'v_cur_out'. Ignore the value, set the datatype to 'Cursor' and click OK. The resultset (if any) will be displayed in the Data Grid window below.
    DECLARE
       v_status VARCHAR2 (32767);
    BEGIN
       ps_aon (v_status, :v_cur_out);
       DBMS_OUTPUT.PUT_LINE ('v_status => ' || v_status);
    END;
    /

  • How to get selected record details when single selection is used in a table

    Hi All,
    Inside a query region I have created a table using region wizard,for this table I have added a singleSelection Item. What I want is , on selection of a particular record i want to update or view that record in a new page , for this I have added update and view icons in each row.
    But I am unable to get the particular selected record
    OATableBean tableBean = (OATableBean)webBean.findChildRecursive("ResultTableRN");
    OASingleSelectionBean singleSelection = (OASingleSelectionBean)tableBean.getTableSelection();
    For this singleSelection object I was unable to find any method which will give the value of the view attribute associated with it.
    Anybody any suggestions regarding it ?
    Thanks in advance,
    Anant NImbalkar.

    Hi Anant,
    here is how you have to do it
    1) you need to enable PPR on that Singl selection , by changining the Action type =fireAction.
    2) define the envent , EVENT
    3) define paramters for that event. This is place that gives you handle to the Attribute of VO.
    So you can define paremters such
    Name = PARAM1
    value =${oa.EqxContactPrivEOVO1.ContactPrivilegeId}
    You can define as many paramters as you can for the vo field that u wanted to have.
    Now in the procesformRequest() , all you do it handle the event EVENT and get the parameters
    if ("EVENT".equals(pageContext.getParameter(EVENT_PARAM)))
    String accountid= pageContext.getParameter("PARAM1");
    You can refer developer guide for further details.

  • WHERE ... IN ... SELECT records for a given list of PKs (or FKs)

    Hello folks,
    Many times we need to retrieve records for given lists of PKs (or FKs), as:
    p_pk_list := '11,22,33';
    We work in 10g
    A co-worker of mine had a good idea (I thought) to "help" the optimizer and build a recordset in the FROM clause and use it later in WHERE
    SELECT ...
    FROM tableName a,
    (SELECT REGEXP_SUBSTR(p_pk_list, '[^,]+',1,ROWNUM) p_pk_id
    FROM dual
    CONNECT BY ROWNUM <= LENGTH(p_pk_list ) - LENGTH(REPLACE(p_pk_list ,','))) d_pk
    WHERE
    a.ID=d_pk.p_pk_id; -- (1)
    The tragedy is that it takes 4 seconds to retrieve 5 records from the table (no other joins). The table has about 40 columns though and there are about 51000 records. With the SELECT REGEXP_SUBSTR in the WHERE clause, it's a bit worse.
    If (1) is replaced by:
    a.ID IN (11,22,33,44,55);
    the execution takes 0.04 seconds.
    My questions are:
    1. Is this a bad idea to select records for a given list of PKs or FKs? Should one just go for one PK/FK instead?
    2. Why the stiff performance penalty?
    3. Ideally, it would be nice if this would work:
    a.ID IN (p_array);
    where p_array would be an array of integers
    Any elegant sollutions?
    Thanks a lot.
    Dan

    Check the explain plan for both statements.
    I would wager that the overhead you experience is due to the fact that you are comparing apples to oranges here.
    (SELECT REGEXP_SUBSTR(p_pk_list, '[^,]+',1,ROWNUM) p_pk_id
    FROM dual
    CONNECT BY ROWNUM <= LENGTH(p_pk_list ) - LENGTH(REPLACE(p_pk_list ,','))) d_pkreturns a string.
    a.ID IN (11,22,33,44,55);Is a list of numbers.
    If you check the explain plan for the regexp version, you should see an implicit conversion being done for you (converting the number column into a string for comparison) which means you can't use any indexes defined on a.id.
    If you want to use an array of numbers here's an approach using a built in array of numbers.
    declare
       v_number_list  sys.odcinumberlist   default sys.odcinumberlist();
    begin
       v_number_list.extend;
       v_number_list(v_number_list.count) := 100;
       v_number_list.extend;
       v_number_list(v_number_list.count) := 200;
       for vals in
          select *
          from all_objects
          where object_id in
             select column_value
             from table(cast(v_number_list as sys.odcinumberlist))
       loop
          dbms_output.put_line(vals.object_name);
       end loop;
    end;
    25  /
    I_TYPED_VIEW1
    I_NTAB2
    PL/SQL procedure successfully completed.
    ME_XE?Otherwise do an explicit TO_NUMBER on the regexp query so that you can use any indexes defined on the table in question.

  • How to select records in ALV using FM

    Hi guys,
    How to select records in ALV using FM. Not the OO method. Thx in advance!
    Kun

    hI
    by using REUSE_ALV_FIELDCATALOUG_MERGE. Iys fill field catalouge table as per internal table description. Then use REUSE_ALV_GRID_DISPLAY for display ALV REPORT.
    **Please reward suitable points***
    With Regards
    Navin Khedikar

  • I can't save the record in a new/empy table of sqlserver in the entity Framework 5.0

    Hi guys ,
    I have tried to become a database expert in Entity Framework but I can't. because I am not able to save the record in a fresh/ empty table of sql server 2008 r2 database. for that I have watched the video tutorials step by steps that how to save the record.
    I followed the tutorials step by step and at the end the result is negative.
    I tried a simple way given below. please some one help me that where and what I missing the.
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using EmployeesLib;
    namespace EmpApplication
    public partial class Form1 : Form
    private EMPEntities _dbContext;
    public Form1()
    InitializeComponent();
    private void Form1_Load(object sender, EventArgs e)
    _dbContext = new EMPEntities();
    var sql = _dbContext.Employees;
    this.employeeBindingSource.DataSource = sql.ToList();
    private void employeeBindingNavigatorSaveItem_Click(object sender, EventArgs e)
    this.Validate();
    _dbContext.SaveChanges();
    I have used datagrid addid a row by Click Add button on the NavigationBindingsource entered an employee name
    and clicking the save button on the NavigationBindingSource. When I am restarting the application I nothing founding on the Datagrid I am saving before.
    below is the Connection String in the App.config file both in the project.
    APP.CONFIG connection string
        <add name="EMPEntities" connectionString="metadata=res://*/EmpModal.csdl|res://*/EmpModal.ssdl|res://*/EmpModal.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=(local);initial catalog=Inventory;integrated
    security=True;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />

    humm, I falling the ball to the batsman(sqlserver) but it getting "NOBALL" in response(not saving). Ok it my be problem in visual studio I am struggling to remove my operating System, VS2013 and sql server, by reinstalling it might works.
    because i havent any other computer where these application are installed for the test.
    If you create and send me a small project that contain minimum of two columns of table( in sql server ) which can saving new data from datagrid so i will thankfull of you.
    it is just for confirmation that either the problem is in OS or VS.
    I doubt that any of it has anything to do with the issue. If you think it does, then you can post to the forums.
    https://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=vssetup
    https://social.msdn.microsoft.com/Forums/sqlserver/en-US/home?category=sqlserver
    I think you are riding a bad horse (that tutorial) you are using, and you need to change horses. I think the 'modified' state is not being rasied on the entity bound to the grid when it has changed, and EF is not going save any entity that's not in a modified
    state.

  • How to edit the selected record through a popup page

    Hi, can anyone help me to handle the case ?
    1) In main page, there is a datatable showing the record list. Click a commandLink in the selected record to popup a screen for user edit.
    2) The data is validated and then saved into database after clicking the submit button in the popup.
    3) Finally, the main page is refreshed with the latest record list.
    Thanks

    Just like any other servlet or form-processing script. What would a mere HTML page know about "systems"? Put the URL into the form destination attribute and be done.

  • Performance problem with selecting records from BSEG and KONV

    Hi,
    I am having performance problem while  selecting records from BSEG and KONV table. As these two tables have large amount of data , they are taking lot of time . Can anyone help me in improving the performance . Thanks in advance .
    Regards,
    Prashant

    Hi,
    Some steps to improve performance
    SOME STEPS USED TO IMPROVE UR PERFORMANCE:
    1. Avoid using SELECT...ENDSELECT... construct and use SELECT ... INTO TABLE.
    2. Use WHERE clause in your SELECT statement to restrict the volume of data retrieved.
    3. Design your Query to Use as much index fields as possible from left to right in your WHERE statement
    4. Use FOR ALL ENTRIES in your SELECT statement to retrieve the matching records at one shot.
    5. Avoid using nested SELECT statement SELECT within LOOPs.
    6. Avoid using INTO CORRESPONDING FIELDS OF TABLE. Instead use INTO TABLE.
    7. Avoid using SELECT * and Select only the required fields from the table.
    8. Avoid nested loops when working with large internal tables.
    9. Use assign instead of into in LOOPs for table types with large work areas
    10. When in doubt call transaction SE30 and use the examples and check your code
    11. Whenever using READ TABLE use BINARY SEARCH addition to speed up the search. Be sure to sort the internal table before binary search. This is a general thumb rule but typically if you are sure that the data in internal table is less than 200 entries you need not do SORT and use BINARY SEARCH since this is an overhead in performance.
    12. Use "CHECK" instead of IF/ENDIF whenever possible.
    13. Use "CASE" instead of IF/ENDIF whenever possible.
    14. Use "MOVE" with individual variable/field moves instead of "MOVE-
    CORRESPONDING" creates more coding but is more effcient.

Maybe you are looking for