Delete records from internal table using another internal table

HI,
I have two internal tables itab1 and itab2 which have same records initially.Later some records of itab2 are deleted .Then i want to delete those records from itab1 also ie,those records not found in itab2 .Is there any method other than looping.
So that itab1 again becomes equal to itab2.
Thanks in advance.
Sowmya.

Soumya,
Itab1 , Itab2 .
Before deleting the records from itab2  move those records to one more internal table itab3.
Now you have deleted records  of itab2  in itab3.
SORT ITAB3,ITAB1 by your main key field.
LOOP AT itab3.
  READ TABLE ITAB1 WITH KEY key field = itab3-
  keyfield.
IF sy-subrc EQ 0.
DELETE itab1 where keyfield eq itab3-keyfield.
ENDIF.
ENDLOOP.

Similar Messages

  • I deleted photos from my Iphone5 using the 'internal storage' in windows with the phone plugged in. Why are all the photos still in photostream when they don't show up as a file in windows anymore?

    Hi all,
    I plugged in my phone, went to my computer, iphone, storage, and deleted photos from there. But in my phones photostream, they are still there. Why is that?
    Cheers

    Hi Isaacprobert,
    Thanks for the question. Based on what you stated, it seems like you still have photos in Photostream. I would recommend that you read this article, it may be able to help the issue.
    My Photo Stream FAQ - Apple Support
    Photos in My Photo Stream are saved on the iCloud server for 30 days.
    Thanks for using Apple Support Communities.
    Cheers,
    Mario

  • Deleting records from a Database using JTable

    Hello!
    I have a JTable that displays records from a database and a Jbutton .
    If i press the button i want that the record coresponding to selectedRow(from the JTable) to be erased from the database.How can i manipulate selectedRow from JTable to do that?
    Pls any suggestions (and if it's possible +code)?
    Thanks!

    Hi Margot,
    Let's assume that you have created a table using vectors. Simply remove the element from the vector at row selected and redraw. Maybe not the greatest solution but should work.
    Vector rowData = new Vector();
    //read in values for each row
    Vector headers = new Vector();
    //add your headers
    JTable table = new JTable(rowData, headers);
    int row = table.getSelectedRow();
    rowData.removeElementAt(row);
    table = new JTable(rowData, headers);HTH,
    Chris

  • Dynamic Internal table using another internal table values

    Hello All,
    I have an internal table ITAB1, which will get populated inside the program. This ITAB1 will have only one field.
    I want to create an internal table dynamically with the values of ITAB1( single field internal table ) as fields.
    Thanks in advance.
    Best Regards,
    Sasidhar Reddy Matli.

    at this wiki
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/abap/individualcellcoloringindynamic+alv
    you can find an example where I build an internal table
    you can look at the coding where I loop though the internal table and at the value to the fieldname.
    * dynamic fields
    LOOP AT ta_pernrs INTO wa_pernrs.
    WRITE wa_pernrs-pernr TO h_ri_pernr.
    is_lvc_cat-fieldname = wa_pernrs-pernr.
    is_lvc_cat-ref_field = 'massn'.
    is_lvc_cat-ref_table = 'PERNR'.
    is_lvc_cat-just = 'C'.
    CONCATENATE it_0002-inits it_0002-nachn(1) INTO is_lvc_cat-scrtext_s SEPARATED BY space.
    CONCATENATE it_0002-inits it_0002-nachn INTO is_lvc_cat-scrtext_m SEPARATED BY space.
    CONCATENATE it_0002-inits it_0002-nachn INTO is_lvc_cat-scrtext_l SEPARATED BY space.
    APPEND is_lvc_cat TO it_lvc_cat.
    and then ofcourse the creation of the table which is also mentioned in the earlier reply
    CALL METHOD cl_alv_table_create=>create_dynamic_table
    EXPORTING
    it_fieldcatalog = it_lvc_cat
    IMPORTING
    *ep_table = ta_output.*** Create a new Line with the same structure of the table.
    ASSIGN ta_output->* TO <ta_output>.*
    CREATE DATA new_line LIKE LINE OF <ta_output>.
    ASSIGN new_line->* TO <l_line>.
    kind regards
    arthur de smidt

  • Deleting records from ztable??

    hi there....
    i have arequirement to delete records from a ztable using coding .....
    i hav tried the delete command but its not working properly.
    can anyone suggest a proper method for this....
    urgent requirement.... useful ans wil be rewarded.
    regards'

    DELETE { {FROM target [WHERE sql_cond]}
           | {target FROM source} }.
    PARAMETERS p_carrid TYPE sflight-carrid.
    DELETE FROM sflight
    WHERE  carrid = p_carrid AND
           fldate = sy-datum AND
           seatsocc = 0.
    PARAMETERS p_carrid TYPE sflight-carrid.
    TYPES: BEGIN OF sflight_key,
             mandt  TYPE sflight-mandt,
             carrid TYPE sflight-carrid,
             connid TYPE sflight-connid,
             fldate TYPE sflight-fldate,
          END OF sflight_key.
    DATA sflight_key_tab TYPE TABLE OF sflight_key.
    SELECT carrid connid fldate
           FROM sflight
           INTO CORRESPONDING FIELDS OF TABLE sflight_key_tab
           WHERE carrid = p_carrid AND
                 fldate = sy-datum AND
                 seatsocc = 0.
    DELETE sflight FROM TABLE sflight_key_tab.

  • Deleting records from internal tabl

    Hi All,
    Here i need delete records from one internal table, from another internal table. both contains same field as name1, so here , i need to delete records from t_itab , the records which are existed in t_itab1.
    first internal table t_itab contains
    vinesh01
    vinesh02
    vinesh03
    vinesh04
    second internal table t_itab1 contains
    vinesh01
    vinesh02
    here i need to delte t_itab1 entries from t_itab.
    regards,
    vinesh.

    Hi,
    try this code.
    first internal table t_itab contains
    vinesh01
    vinesh02
    vinesh03
    vinesh04
    second internal table t_itab1 contains
    vinesh01
    vinesh02
    loop at t_itab1.
    loop at t_itab.
    if t_itab-name1 = t_itab1-name1.
    delete t_itab.
    (OR)
    delete itab where t_itab-name = t_itab1-name.
    endif.
    endloop.
    endloop.
    regards.
    sriram.

  • Delete records from internal table

    hi all,
    i want to delete records from intenal table which are starting with a particular starting number .
    eg internal table
    10000
    20000
    90000
    91000
    92000
    88880
    i want delete the records starting with 9 i.e. 90000 91000 92000.
    Thanks in Adv
            RAJ

    You can test this piece of code.
    DATA:
    i_tab TYPE STANDARD TABLE OF mara,
    wa_tab TYPE mara.
    wa_tab-matnr = '1000'.
    APPEND wa_tab TO i_tab.
    CLEAR wa_tab.
    wa_tab-matnr = '1001'.
    APPEND wa_tab TO i_tab.
    CLEAR wa_tab.
    wa_tab-matnr = '1002'.
    APPEND wa_tab TO i_tab.
    CLEAR wa_tab.
    wa_tab-matnr = '1003'.
    APPEND wa_tab TO i_tab.
    CLEAR wa_tab.
    wa_tab-matnr = '2001'.
    APPEND wa_tab TO i_tab.
    CLEAR wa_tab.
    wa_tab-matnr = '3001'.
    APPEND wa_tab TO i_tab.
    CLEAR wa_tab.
    wa_tab-matnr = '4010'.
    APPEND wa_tab TO i_tab.
    CLEAR wa_tab.
    <REMOVED BY MODERATOR>
    Edited by: Alvaro Tejada Galindo on Aug 8, 2008 4:49 PM

  • Moving few contents of one internal table to another internal table

    Hi
    I want to move some contents of one internal table to another internal table, which records match our condition
    (without loop)
    Example:
    1  aa
    2  aa
    3  aa
    4  bb 
    5  cc
    6  aa
    7  cc
    8  dd
    now i want to move records which contain aa to one internal table  without using loop.
    is there any statemnt to achieve this
    Reagrds
    Srinivasu

    Hi Srinivasu,
    Just create an another internal table say itab2 having the same structure.
    Then use the following code:
    itab2[] = itab1[]
    delete itab2 where field2 <> 'aa'.
    Hope this will help.
    Regards,
    Nitin.
    Edited by: Nitin Karamchandani on Nov 21, 2008 8:51 AM

  • Delete records from multiple table

    Hi,
    I need to delete records from multiple tables using a single delete statement. Is it possible ? If so please let me know the procedure.
    Kindly Help.
    Thanks,
    Alexander.

    Hi Tim,
    Syntax of DELETE statement does not allow for multiple tables to be specified in this way. Infact, none of the DMLs allow you to specify table names like this.
    Technically, there are other ways of deleting from multiple tables with one statement.
    1. "Use a trigger":
    What was probably meant by this is that you have a driving-table on which you create a on-delete trigger. In this trigger, you write the logic for deleting from other tables that you want to delete from.
    This does mean a one-time effort of writing the trigger. But the actual DML operation of deleting from all the tables would be simply triggered by a delete on driving-table.
    2. Dynamic SQL:
    Write a PL/SQL code to open a cursor with table-names from which you want the data to be deleted from. In the cursor-for loop, write a dynamic SQL using the table-name to delete from that table.
    3. Using Foreign-Key constraint with Cascade-Delete:
    This I feel is a more 'cleaner' way of doing this.
    Having to delete data from multiple tables means that there is some kind of parent-child relationship between your tables. These relationships can be implemented in database using foreign-key constraints. While creating foreign-key constraint give the 'on delete cascade' clause to ensure that whenever data is deleted from parent-table, its dependent data is deleted from child-table.
    Using foreign-key constraint you can create a heirarchy of parent-child relationships and still your DELETE would be simple as you would only have to delete from parent-table.
    IMPORTANT: Implementing foreign-key constraints would also impact other DML operations that you should keep in mind.

  • How to append Header of an internal table to another internal table

    Hello Experts,
    Can we append the header of an internal table to another internal table? Do we have have to use work area for this?
    Thanks.

    Wrong - it will append only the header. If you want to append the whole table, you would:
    APPEND LINES OF itab1 TO itab2.
    If you need more help, please press F1 on APPEND.
    Rob
    Edited by: Rob Burbank on Mar 3, 2008 4:06 PM

  • Transfering from one Internal Order to another Internal order

    Hi
    I need to transfer part of internal order from one location to another internal order to a different location (not physically, but in the system). Budget is only one
    Can somebody let me know if we have this functionality in the Controlling. Each Internal Order is assigned to different CWIP.
    Prasad

    I want to transfer the Budget and Actuals also. The actual scenario is like this:
    We have a budget for 10lakhs. We purchased some materials. Please remeber this is CWIP related thru internal order. Part of the Budget is used (for 1 lakh) and purchased material against this. Part of this material purchased say 40000 is to be transfered to another location Physically, for similar activity.
    As a i am transfering this material, part of my internal order is also has to be transfered to the other location, but remember the budget will be the same.
    So I need to transfer actuals and budget to another location.
    Prasad

  • How to pass data from one internal session to another internal session

    hi all sap experts ,
    How to pass data from one internal session to another internal session and from oneExternal session to another external session.
    Except : Import and Export parameters and SPA/GPA parameters.
    Tell me the otherWay to pass data ..
    Plz
    Thanks in advance

    hi,
      abap memory management u will understand about this concept.
    the import /export parameter will help u that passing data between two internal sessions by using abap memory.
      for syntax
    Passing Data Between Programs
    There are two ways of passing data to a called program:
    Passing Data Using Internal Memory Areas
    There are two cross-program memory areas to which ABAP programs have access (refer to the diagram in Memory Structures of an ABAP Program) that you can use to pass data between programs.
    SAP Memory
    SAP memory is a memory area to which all main sessions within a SAPgui have access. You can use SAP memory either to pass data from one program to another within a session, or to pass data from one session to another. Application programs that use SAP memory must do so using SPA/GPA parameters (also known as SET/GET parameters). These parameters can be set either for a particular user or for a particular program using the SET PARAMETER statement. Other ABAP programs can then retrieve the set parameters using the GET PARAMETER statement. The most frequent use of SPA/GPA parameters is to fill input fields on screens (see below).
    ABAP Memory
    ABAP memory is a memory area that all ABAP programs within the same internal session can access using the EXPORT and IMPORT statements. Data within this area remains intact during a whole sequence of program calls. To pass data to a program which you are calling, the data needs to be placed in ABAP memory before the call is made. The internal session of the called program then replaces that of the calling program. The program called can then read from the ABAP memory. If control is then returned to the program which made the initial call, the same process operates in reverse. For further information, refer to Data Clusters in ABAP Memory.
    Filling Input Fields on an Initial Screen
    Most programs that you call from other programs have their own initial screen that the user must fill with values. For an executable program, this is normally the selection screen. The SUBMIT statement has a series of additions that you can use to fill the input fields of the called program:
    Filling the Selection Screen of a Called Program
    You cannot fill the input fields of a screen using additions in the calling statement. Instead, you can use SPA/GPA parameters. For further information, refer to Filling an Initial Screen Using SPA/GPA Parameters.
    Message was edited by:
            sunil kumar
    Message was edited by:
            sunil kumar

  • Deleting records from a recursive table query

    Hi All,
    I have the follow query, I would like to ask for your help, please: we use recursive tables for various purposes and one of them may have 100,000's records.
    What would be the best approach to delete records from such a table?
    I was thinking about two below, but any additional one will be more than welcome as well:
    (1) I can DELETE FROM my_table WHERE my_table_id IN (SELECT my_table_id FROM my_table START WITH my_table_parent_id = X CONNECT BY PRIOR my_table_id = my_table_parent_id, but it means that I will run on my_table twice, no?
    (2) I thought also to create a Foreign Key of my_table_id REFERENCES my_table_parent_id, but then I am afraid it will effect DML commands on that table.
    Thank you in advance

    Hi,
    kdwolf wrote:
    ... (1) I can DELETE FROM my_table WHERE my_table_id IN (SELECT my_table_id FROM my_table START WITH my_table_parent_id = X CONNECT BY PRIOR my_table_id = my_table_parent_id, but it means that I will run on my_table twice, no?Sorry, I'm not sure whqt you mean by "I will run on my_table twice". Assuming you don't already have a foreign key constraint (as you described below) I don;t know any other way, let alone a more efficient way, to get the same results.
    (2) I thought also to create a Foreign Key of my_table_id REFERENCES my_table_parent_id, but then I am afraid it will effect DML commands on that table.You're right; a foreign key constraint always costs a little whenever you do DML. Someone who knows your application and your system as well as you do will have to decide if the benefit of having accurate, consistent data justifies that additional cost. If you're not sure, I suggest you add the constraint.
    One advantage of having a foreign key constraint is that you can create it with the "ON DELETE CASCADE" option. Then, if you simply say "DELETE FROM my_table WHERE my_table_patrent_id = X", all the descendants of those rows will automatically be deleted, exactly as you requested in (1) above.

  • Deleting Records from Referential Tables

    Hi,
    Can anyone help me in deleting records from tables in a hierarcial manner. For e.g C refers B and B refers A. I need to delete data from all three tables related to a where clause in A.I tried using User_constraints and User_cons_columns views. But i am not able to find a hierarchial delete statement.
    Venkatesh

    Did you look into the option of specifying ON DELETE CASCADE for your foreign key constraints. That way, if you delete a
    row from the master table Oracle will automatically go and delete the child rows. Take a look at the following script.
    Here, when I delete a row from table A for NUM = 1 the child rows from table B (WHERE num = 1) are automatically deleted.
    drop table b
    drop table a
    create table a (num number, name varchar2(40))
    create table b (num number, name varchar2(40))
    alter table a add constraint pk_a primary key(num)
    alter table b add constraint fk_b_num foreign key (num) references a(num) on delete cascade
    insert into a values (1, 'Test#1')
    insert into a values (2, 'Test#2')
    insert into b values (1, 'Referes#1')
    insert into b values (2, 'Referes#2')
    select * from a
    select * from b
    delete from a where num = 1
    select * from a
    select * from b
    Sridhar,
    Thanks a lot for your help.My exact need was to delete records in 50 tables starting with the key table for a specific condition in the key table.
    Assume table A has 100 records,B 200 records,C 150 records,D 400 records, etc
    When i want to delete some records in table A, i will not be able to do that as child records exists in table B and this structure will carry on till that last table in my application. How do i delete those specific records
    Venkatesh

  • Delete records from tableA which are not in tableB

    Table A contains milions of records which is the best way to delete records from tableA which are not in tableB
    delete from tableA where empno not in (select empno from tableb)
    or
    delete from tableA where empno not exists (select empno from tableb
    where b.empno=a.empno)
    any help

    Hi
    If you can do this, do with this:
    create table tableC
    as select a.*
    from tableA a,
    (select empno from tableA
    minus
    select empno from tableB) b
    where a.empno = b.empno;
    drop table tableA;
    rename table tableC to tableA;
    Ott Karesz
    http://www.trendo-kft.hu

Maybe you are looking for

  • Adobe Acrobat Pro 9 (CS5 Suite) -Deployment Silent Install

    Hello! Has anyone managed to get Adobe Acrobat Pro 9.0 for Mac to deploy with any level of reliability through tools such as Apple Remote Desktop?

  • Is there ANYWAY to get pictures off a destroyed iPhone that can't sync?

    My boyfriend has an iphone that was never synced with a computer (I know, I've taken care of that with his new phone) but that phone contains pictures that are very precious to him. Not just every day pictures that he'll miss....But the photos of his

  • Need help understanding Folders.

    I am extremely new at using iMac OS X Leopard Desktop. I work with a lot of photos and when importing with my camera I have difficultly adding them in one place where I can find them when using Disk Utility for burning to CD. I would like to import m

  • Log & Transfer Spanned Reel?

    I'm trying to Log & transfer clips and I get a message on one clip that is 5 minutes in length that reads (Spanned) with Red caution sign. The footage was captured on one P2 card. I thought spanned meant when taping moves from 1 card to a 2nd card. C

  • Need clarification on using the NodeFunctions in mapping

    Hi All, Can we use UseOneAsMany & Remove context functions in mapping of one field?? My requirement is, from Idoc one of the Header segment(E1ADRM1) will repeat 3 times with qualifier as "WE"   "AG"  & "AS". I have to mapp the NAME1 field of header s