Delete Multiple records in Table?

Hi ..
I need to perform delete operation in my table with multiple selection.
My coding is..
for(int i=wdContext.nodeDetails2().size()-1;i>=0;i--)
if(wdContext.nodeDetails2().isMultiSelected(i) || wdContext.nodeDetails2().getLeadSelection()==i)
wdContext.nodeDetails2().removeElement(wdContext.nodeDetails2().getDetails2ElementAt(i));
When i delete first record, It works fine and multiple selection also works fine.
But when i select last record(only one) to delete, Then All the records get deleted. ???? Why this happens???
Anybody help to solve this probelm..
Thnx in advance..
Regards,
GS

Hi Sathish,
Store the node size in a variable then try. To avoid problems with the index, the context is executed in reverse. Suppose in a table you have 10 rows and you are deleting row 2 the after deletion of row 2 row 3 will come to row 2,row 4 will come in row 3 in this way process will be continue up to last row.
Try this.
int n = wdContext.nodeDetails2().size();
int leadSelected = wdContext.nodeDetails2().getLeadSelection();
// loop backwards to avoid index troubles
for (int i = n - 1; i >= 0; --i) {
if (wdContext.nodeDetails2().isMultiSelected(i) || leadSelected == i) {
wdContext.nodeDetails2().removeElement(wdContext.nodeDetails2().getDetails2ElementAt(i));
Regards,
Mithu

Similar Messages

  • To delete multiple records

    hi all,
    Can any tell tell me how to delete multiple records in table control of a screen
    i have checked the multiple rows in table control attributed and assigned a name.I needhelp in writing code.
    Thanks

    hi,
    As you have marked multiple fields in the table control your table control is mulple selection enabled.
    <b>PROCESS AFTER INPUT.</b>
    loop at IT_CONF.
        field X_CONF-CHECK
          module TC_CONF_mark on request.
      endloop.
      module TC_CONF_user_command.
      MODULE USER_COMMAND_0102.
    *this modifies the internal table with check field as X
    module tc_conf_mark input.
      data: g_tc_conf_wa2 like line of it_conf.
      if tc_conf-line_sel_mode = 1.
        clear g_tc_conf_wa2.
        loop at it_conf into g_tc_conf_wa2
          where check = 'X'.
          g_tc_conf_wa2-check = ''.
          modify it_conf
            from g_tc_conf_wa2
            transporting check.
        endloop.
      endif.
      modify it_conf
        from x_conf
        index tc_conf-current_line
        transporting check.
    endmodule.
    module tc_conf_user_command input.
    * write code to handle table control scrolling /pageup/pagedown
    endmodule
    *Check the ok_code
    module user_command_0102 input.
        case ok_code.
          when 'DEL'.
           * Delete from internal table where check = X
        endcase.
    endmodule.                
    <b>PROCESS BEFORE OUTPUT.</b> 
      module TC_CONF_change_tc_attr.
      loop at   IT_CONF
           into X_CONF
           with control TC_CONF
           cursor TC_CONF-current_line.
        module TC_CONF_get_lines.
      endloop.
    module tc_conf_change_tc_attr output.
      describe table it_conf lines tc_conf-lines.
    endmodule.
    module tc_conf_get_lines output.
      g_tc_conf_lines = sy-loopc.
    endmodule.
    Thus you will delete the marked lines from the internal table in PAI and in PBO you can read the refreshed internal table without the table entries that are marked as deleted in the table control and display the same in the table control. This is another way.
    Regards,
    Richa

  • Deleting multiple records via html checbkoxes?

    I'm trying to delete multiple records in a table based on the
    selection of checkboxes.
    I have an html form with 4 checkboxes. If a user checks any
    box, I want to delete the associated records. and if they ucnheck
    something I want to insert multiple records. This form does not
    hold the primary keys but other unique parameters. Here is my sql
    statement.

    > and that keyword is not mentioned in the DELETE
    statement chapter.
    IN is not specific to DELETE statements. It can also be used
    with SELECT or UPDATE statements. It is a way of specifying
    multiple values in a single statement, instead of using multiple OR
    statements:
    http://www.w3schools.com/sql/sql_in.asp
    Since you are using cfqueryparam, you also need to use
    list="true" (ie you are passing in a list of values, not just one)
    <cfset listOfValues = "1,2,5,6,8">
    WHERE ColumnName IN
    <cfqueryparam value="#listOfValues#" list="true"
    cfsqltype="...">

  • Need to delete multiple records at a time

    Hi,
    My requirement is to delete multiple records at a time, i am using JDV11g and read only ADF table and rowSelection="multiple".
    i have taken command button and invoking the below method.
    RowKeySet rowKeySet = (RowKeySet)this.t1.getSelectedRowKeys();
    CollectionModel cm = (CollectionModel)this.t1.getValue();
    System.out.println("RowKeySet is: "+ rowKeySet.getSize());
    for (Object facesTreeRowKey : rowKeySet) {
    cm.setRowKey(facesTreeRowKey);
    JUCtrlHierNodeBinding rowData =
    (JUCtrlHierNodeBinding)cm.getRowData();
    System.out.println("RowData is : "+rowData.getAttribute("ParamValue7"));
    rowData.getRow().remove();
    Please do need full

    Hi,
    I don't understand what you mean by "+Please do need full+" , so I am ignoring this part. Here's a link that shows you best practices
    http://blogs.oracle.com/smuenchadf/examples/
    See example 134.
    Frank
    ps.: I suggest you bookmark the link

  • To delete multiple entries in table control in module pool

    Hi,
    Please help me out to know , <b>how to delete multiple entries from table control</b> when multiple lines in table control are selected.
    Regards,
    Irfan Hussain

    hai,
        you can do it inthis way.
    in the PAI event.
    loop at <table control name>
      module del_itab.
    endloop.
    in the nodule,write the folowing code.
    if <tablecontrol>-fieldname = 'X'.
    delete <tablecontrol-itab>
    endif.
    cheers

  • How to Delete Multiple Records using selectbox in jsf

    Hi!
    My Senario is I want to delete multiple records using checkbox. After selecting multiple records when i click the delete button the selected
    rows shuld be deleted.if am doing like this but the edit ,delete for each row functionality is not working.
    <h:selectBooleanCheckbox id ="bcb" value="#{item.empno}">
    </h:selectBooleanCheckbox>
    But other functionality is not wokring.
    Can any one plz tell how to select the multiple records and how to send the id to the serverside.
    I want code code for jsp and as well as backingBean how to accaess .
    Any Reply shuld be apreciated

    You may find this article useful as well: http://balusc.blogspot.com/2006/06/using-datatables.html
    Check the chapter "Select multiple rows" for two generic ways to select multiple rows in a datatable.

  • Delete multiple record in tabular with check box.

    Hello guys,
    I need your suggestion..
    I have master detail block. (INSTRUCTOR and SECTION)
    At detail block, I add check box item (name: RB_SECTION_ID) with Database Item "No", and value when check :SECTION_ID (on the property).
    I make a button DELETE. The trigger was DELETE from SECTION where section_id = :SECTION.RB_SECTION_ID and
    instructor_id = :INTRUCTOR.INSTRUCTOR_ID;
    but It not work.
    How we delete multiple record by check multiple check box then click DELETE button..??
    Regard.
    Nia..

    You datablock in the form cannot automaticaly refresh the changes you make with the SQL statements.
    For that you need to explicity call certain built-ins to refresh the data
    execute_query(no_validate) --> fetches the available data for that session. Here you deleted some records, so those records will not be available until you do a rollback in the same session(i.e, you exit the form without saving). But until you save, those deleted records will be avaiable for the users in other sessions)
    Also, your code works only because the records you deleted are all already saved ones.
    So it will be a good practice to use built-in of form builder rather than DML stmt.s
    Here you can do like this
    begin
    go_block('TRY_TABLE');
    first_record;
    loop
    if :TRY_TABLE.CCKBOX = 'Y' THEN
    delete_record;
    END IF;
    NEXT_RECORD;
    EXIT WHEN :SYSTEM.LAST_RECORD = 'TRUE';
    END LOOP;
    END;
    If your code is like above one, you can revert your deletion by simply giving a F7 (enter-query) and F8 (xecute query).

  • Urgent:                FORMS-III   Deleting Multiple Records By Marking X

    Deleting Multiple Records By Marking X
    In Forms III, i need to delete multiple records by marking X (in non database Item)
    i.e.
    ========================
    D Empno Ename Deptno
    ========================
    X 10001 ABC 10
    10002 DEF 10
    X 10003 GHI 20
    X 10004 JKL 20
    =======================
    How To Do????????????
    Rgds,
    Rashad

    Create a button say lable "delete" in a block other than the block from where u want to delete records.
    suppose the block's name is emp_blk
    now create a WHEN-BUTTON-PRESS trigger for delete button and write the following code
    begin
    go_block('emp_blk');
    first_record;
    loop
    if :emp_blk.d ='X' then
    delete_record;
    end if;
    if :system.last_record='TRUE' then
    exit;
    end if;
    next_record;
    end loop;
    end;
    filnally commit on save.

  • Delete Multiple Records from Item Master

    Hi,
    We received wrong master data which has been uploaded and two groups have to be deleted. All the items in those particular groups have also to be deleted. Can anyone suggest how to delete multiple records from Item Master?
    Currently I am navigating through each Item and doing a Right Click + Remove. It is very painful given the huge number of records.
    Regards
    Sudatt

    Hi Sudatt.....
    I recommend you not to run any kind of delete or update SQL query as it harms DB.
    You can create your own front end application with the help of any technical consultant which can be
    achieved very easily. Else such problems create a big problem during upgradation to next version.......
    Regards,
    Rahul

  • I cannot delete multiple entries from table

    Hi
    i am trying to delete multiple entries from table while keeping some data.
    for example I have the following table
    Plant                            Item
    US101                         777
    US101                         888
    US101                         999
    US101                         666
    I want to keep the  rows where the item is 777 and 888 for plant US101 and keep delete the rest data
    I wrote the following code
    Delete source_package where Plant = 'US101' and Item NE '777' or '888'.
    but all the rows get deleted.
    I tried deleting single row and it worked.
    Delete source_package where Plant = 'US101' and Item NE '777' .
    How can I delete multiple rows.
    thanks

    Hi Bhat Vaidya,
    Plz refer the following code.. IT will solve ur problem..
    REPORT  ZSDN_TEST.
    data: BEGIN OF it_data OCCURS 10,
            plant(4),
            item_num TYPE string,
          END OF it_data.
    data: str type string.
    data: it_final like it_data OCCURS 10 WITH HEADER LINE.
    it_data-plant = 'US01'. it_Data-item_num = 777.  append it_data.
    it_data-plant = 'US01'. it_Data-item_num = 888.  append it_data.
    it_data-plant = 'US01'. it_Data-item_num = 999.  append it_data.
    it_data-plant = 'US01'. it_Data-item_num = 666.  append it_data.
    delete it_data where plant = 'US01' and item_num ne 777 and item_num ne 888.
    LOOP AT it_data.
    write:it_data-plant,it_data-item_num.
    skip.
    ENDLOOP.
    Regards,
    Apoorv

  • Please Help! Deleting multiple record by using checkbox selected

    Hello everybody,
    I am a new to JSP. I really don't know how to delete multiple record by using checkbox selected and pressing submit button.
    For example, deleting webmailbox letters using checkbox selected and delete button. The mail we checked will delete from the inbox.
    I like to use my user account deleting system of my project like above example.
    How can I do in JSP? I will very please you if you share you knowledge and code for me.
    If you have URL address, could you share me for reference?
    Please help me...
    With Thanks and Regards,
    wtdahl

    Take a look at this thread, I thing it answers your question quite good:
    http://forum.java.sun.com/thread.jsp?thread=516658&forum=45&message=2463505

  • How to execute multiple records in table control

    HI.
    I have a requirement that in table control user will select more than one row and when he clicks 'SAVE' it should go and sit in a custom table. how to pass more than one records.
    thanks & regards.
    sandeep

    Hi Sandeep,
    I understand your requirement .......
    See this standard program........
    <b>" DEMO_DYNPRO_TABCONT_LOOP_AT "</b>
    <b>Understand how DELETE button is working,inorder to delete multiple lines....Copy this program if necessary..OK.
    Simply,Replace DELETE statement with your INSERT statement to push records into your custom table....very easily you can do it.</b>
    <b>Reward all helpful answers.</b><b>
    Hope you problem is solved.</b>
    Regards,
    V.Raghavender.

  • Delete multiple records with MDM WebService

    Hi everyone!
    I'm using an MDM Web Service with delete functionality. It identifies records to be deleted either by internal ID or by defined field value. The point is that i need this web service to delete all records with one specific value in specific field (lets say all the records with value "hidden" in field "VISIBILITY").
    But when I try to map value "hidden" of the field "VISIBILITY" to the web service input in BPM it says in tracing that there are multiple fields with that value in the table (certainly there are) and that it can't process them. Cause it doesn't support multiple processing. Is there any way to do that?
    Thanks in advance,
    Peter

    Hi Peter,
    I guess you can do that if you first retrieve the internalIDs of the to be deleted records:
    Do a search for the records with the field value.
    Then you will receive the internalIds of them.
    Then you can put these internalIds to the delete records webservice. Each in a new element of the record identification.
    I hope this helps!
    Best regards,
    Stefan Brauneis

  • How to delete the record in Table

    Hi Guru's,
    i have Table which contain no.of Records.
    i want to deleted one record. if i go to Table maint.Generator....from table itself..
    how to do that... when we deleting the record. can we create new TR for that?
    can anybody tell me.
    Thanks in Advance,
    venkat

    Hi,
    it is answered, here for my table there is no Table Maint.Generator.
    i just explained how i have done it.
    i just simply gone into Debug mode. there
    code = Dele.
    i have given. then i came out from debug mode to Table. there i just got Delete button on application tool bar.
    i selected the record then icliked on Delete button.
    it is got deleted.
    But it is not asking for any new Transport Request.
    Regards,
    Venkat

  • Multiple records of table from RFC to XI in single XML file

    Hi
    My Scenario is as following -->
    <b>RFC ---> Sender RFC Adapter ---> XI -
    > Rec SOAP adapter ---> Web Service</b>
    Now we need multiple records from RFC which can be put in single XML file & XI can transport the whole XML file to Web Service. All the configuration in XI, Web Service is complete & I tested my mapping which is able to accept multiple records.
    But when ABAPer is sending the records I am not getting it in XI, I checked that in message payload from RFC.
    He put the table name in TABLE tab of RFC. But not under Import Tab, as whatever he is providing under Import parameter & exporting it through report I am getting in message payload but not the table data.
    Did anyone try such scenario, can you tell me how can we achieve this.
    Pls. provide me your mail ID in case you need an attachment of the current RFC & report code & my mapping snapshot.
    Regards
    - lalit -

    Hi
    We have created the BAPI in which we are just describing the structure of the payload & which I am importing in Integration Repository.
    And we are calling this BAPI from another program using " Call function ... " command & also provinding the data in that program.
    Actually ethically ABAPers are against the idea of provinding the data into program they would like to provide it in BAPI but that won't work, you have to provide data in program which in turn populate the fields of BAPI.
    Let me know with your mail ID in case you need snapshot of function & programs.
    Regards
    - Lalit -

Maybe you are looking for

  • Report generation using Excel

    I created a VI for making a report in Excel. It works correctly, however when I built an executable files, it is unable to do the processing and announce 'error 7 open VI reference in Excel'! I was wondering if anybody can guide me that how I can fix

  • Multiple parent-shuttle pages

    Hi guys, I'm using Jdeveloper 10.1.2 and JHeadstart 10.1.2 (build 19). I've developed a page that contains a master view object and two detail view objects. What I want to do is to display both as parent shuttles on the same page. I have created 2 de

  • HT201263 i tried all that but when i connect my iphone to my itunes there is no restore button. why is this happening?

    i tried all that but when i connect my iphone to my itunes there is no restore button. why is this happening?

  • How to walk through an explain plan

    Hi Experts, I am on Oracle 11.2.0.2 on Linux, I have a query with an query plan as below. I am trying to understand the sequence in which the steps are executed, can you please help on it: variable v_client_oid varchar2(16); variable SYS_B_0 varchar2

  • Cost problem in PS

    Hi, Regarding cost in the projects, here i am getting two different cost in kp26 and kp06, the cost shown in kp06 is correct but in kp26 it is showing by dividing the amount with 12 months. can any one give me the reason to that ? Regards Karunakaran