How to compare two entries in the same internal table

Hi
I hav e an internal table. I want to compare the entries in the internal table and delete the entries which is duplicates from the internal table. for ex. if plant 1000 is repeated two times. Then both the record of plant 1000 should be removed .
Please suggest some idea.
Thanks
Subha

Hi,
Apply this code.
include one more field in itab & jtab as delete_flag(1) type c.
move itab to jtab.
Loop at itab into wa_itab.
lv_tabix = sy-tabix.
Loop at jtab into wa_jtab where plant = wa_itab-plant.
if sy-tabix ne lv_tabix.
wa_itab-delete_flag = 'X'.
endif.
Endloop.
modify itab from wa_itab transporting delete_flag.
clear: wa_itab,wa_jtab.
endloop.
delete itab where delete_flag = 'X'.
Now you have filtered ITAB with your desired results.
It will surely help.
Edited by: Adarsh Jain on Aug 18, 2010 7:57 AM
Edited by: Adarsh Jain on Aug 18, 2010 7:58 AM

Similar Messages

  • How to compare two fields from the same table in the select statement

    Hi, friends
    I try to compare tow fields from the same table, but no result,
    For example, this
    data: cptotchek tyep i.
    select count(*) into cptotchek
    from aufk where erdat = aufk-idat2 .
    The result is  cptotchek = 0, but there are the records in aufk , where,  aufk-erdat = aufk-idat2.
    Please, help me, i don't use the loop statement for optimize my program.
    Regards

    Hi  ,
           it will not return  any value   when you are using   column of same table 
           such as Date Field   , Because  while Using Aggregate Function  it will not check with self column
    .      For that you have to take data in one internal table and then you can work on it  .
         And if you are worried about Performance  it will not affect  , untill you are selecting only required data  .
    you can try this way  .
    data: cptotchek type i.
    types : begin of  w_aufk.
            include structure aufk  .
          types : end of  w_aufk .
    data : it_aufk type standard table of w_aufk with header line  .
    select * into corresponding fields of table it_aufk
    from aufk  .
    loop at it_aufk .
    if it_aufk-erdat  = it_aufk-idat2 .
    write : / it_aufk-erdat , it_aufk-idat2 .
    else .
    delete it_aufk .
    endif  .
    endloop.
    Regards
    Deepak.

  • Compare two members from the same dimension in HFR

    Hi,
    Is it possibe to compare two members from the same dimension in HFR? The requirement is to compare Year and Week members from the same dimension. The Week date will be selected from POV. The corresponding Year date should be displayed in the report. Week dates are in the format W2008-03-07 and Year dates are in YTD2008-03-07.
    The dates are same except the preceding character.I am unable to compare these two. In my understanding there's no substring or replace functions in HFR.
    Kindly help. Thanks in advance.
    Regards,
    Uma

    Hi,
    How is your database structured? it may be possible to use the 'RelativeMember' function if it will always be the same number of steps between the 'W' member and the 'YTD' member, e.g. if your hierarchy is something like:
    Time
    .Weeks
    ..W2008-03-07
    ..W2008-03-10 etc.. for 52 weeks
    .YTD
    ..YTD2008-03-07
    ..YTD2008-03-10 etc.. for 52 weeks
    In your report select 'Current Point of View for Time' in one row/column and in the other use:
    RelativeMember set up as follows:
    Member: Current Point of View for Time
    Offset: 52
    Hierarchy: Time
    RelativeMemberList: Lev0, Time
    UseFirstDescendant: leave unselected
    Hope this helps
    StuartGame
    www.analitica.co.uk

  • How to run two query  in the same preparedStatement

    Hi all,
    Please tell me how to run two queries in the same preparedStatement object ?
    In my module I have to run two queries and I don't want to make two methods for running two different queries.
    I just want to call this method for both of my queries.
    methodName(long param)
    Connection conn=null;
    PreparedStatement pstmt=null;
    //////////////// some coding
    Please Help !
    Thanks in advance
    amitindia

        public void foo()
            Connection connection = null;
            PreparedStatement stmt = null;
            try {
                connection = ...get from pool...;
                stmt = connection.prepareStatement("...");
                ...fetch results...;
                stmt.close();
                stmt = null; // So the finally statement works if there is an exception
                stmt = connection.prepareStatement("...");
                ...fetch results...;
            } finally {
                if (stmt != null) ..close it...;
                if (connection != null) ..return it to pool...;
        }

  • How to get two parameters in the same line of selection screen?

    hello
    i need to get my selection csreen like bellow.
    r1 radiobuttion  -some space --p1 parameter
    i should not get the parameter in the next line of  radiobuttion.
    how to get two parameters in the same line of selection screen?

    hi....
    modify the following code
    it will work
    SELECTION-SCREEN BEGIN OF BLOCK SL1 WITH FRAME TITLE TEXT-003.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 10(15) TEXT-001
                     FOR FIELD P1.
    SELECTION-SCREEN POSITION POS_LOW.
    PARAMETERS : P1 TYPE   C USER-COMMAND R2 RADIOBUTTON GROUP R2 DEFAULT 'X',
      P2 TYPE SCARR-CARRNAME,
      P3 TYPE CHAR1 RADIOBUTTON GROUP R2.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN END OF BLOCK SL1.

  • HOW TO PUT TWO PANNEL IN THE SAME PAGE

    HI ALL
    I NEED TO KNOW HOW TO PUT TWO PANNEL IN THE SAME PAGE TO FULLY UTILIZE FULL PAGE AREA BECAUSE THE PANNEL WIDTH IS TOO SMALL , SO I WANT TO MAKE THE PAPER CONTAIN TO PANNELS VERTICALLY.
    THANK YOU

    So Barb,
    I like to use multiple desktops and move back and forth between then using gestures. At the moment I have 5 open: Chrome, Firefox, Safari, Photoshop CS 6 and a desktop. I use "gestures" to navigate between them:
    Mac Basics: Multi-Touch gestures - Apple Support
    and I use Mission Control (F3) to move the various desktops around in the order I want them.
    Mac Basics: Mission Control - Apple Support
    So say I'm searching for a photo to open in CS 6, I find it on the open desktop then hit select "open" in CS 6 and go to that folder in the select pane.
    Even right now I'm typing this in Safari and "gesturing" back to Chrome where I did the search about multi touch and mission control. I drag copy the URL there  and gestured back here to paste the URL into this text.
    If you did a lot of photo searches, I set professional clients of mine in Chicago up with dual monitors (In this case you'd have an external monitor on extended desktop.). So all you need to do is just glance over at the second monitor slide your cursor over there open stuff up find your photo and go back to Photoshop and open it up.
    Hope this helps.

  • How to write two item in the same line?

    In the smartforms,how to write two item in the same line?
    eg
    1   *************                                    2  *****************
    3  **************                                   4  ******************
    5  ***************
    Anyone got any idea to do this.
    Thanks in advance

    Hi,
    In the smartform the main windows is 20cm.I use the table output my data.Because the output is two item in same line,I define two rows in the table line type.
    Question:
    Should I define the table width 20cm?
    In the main area of table , should I define two folders and each of folder include a line? The second item I had already defined as Append Directly,but the item 1 and item 2 don't in the same line.
    Regards

  • With in the internal table can I READ the same internal table for a record?

    With in the internal table can I READ the same internal table?
    For Suppose
    LOOP AT itab.
    can I do as below
    READ TABLE itab with key bukrs = itab-bukrs
                       belnr = itab-belnr.
    *and I have to compare
    IF itab-shkzg = itab-shkzg_ia.
    ENDIF.
    ENDLOOP.

    Hi,
    Yes..But use work area to differentiate..
    EX.
    DATA: WA LIKE ITAB.
    DATA: WA_READ LIKE ITAB.
    LOOP AT itab <b>INTO WA</b>.
    can I do as below
    READ TABLE itab <b>INTO WA_READ</b>
               with key bukrs = itab-bukrs
    belnr = itab-belnr.
    *and I have to compare
    IF <b>WA</b>-shkzg = <b>WA_READ</b>-shkzg_ia.
    ENDIF.
    ENDLOOP.
    Please reward for helpful answers.
    Thanks,
    Naren

  • Compare two results from the same table

    i have two results from the same table that i would like to compare. below is my query and the results i want to compare
    SELECT tblItemRoutingBOM.ItemRevID, tblItem.ItemID, tblItem.PartNum, tblItem.ItemName, tblItem.ManufacturerPartNum AS [Mfg Part#], tblItemRoutingBOM.Quantity
    FROM tblItemRouting
    INNER JOIN tblItemRoutingBOM ON tblItemRouting.ItemRoutingID = tblItemRoutingBOM.ItemRoutingID
    INNER JOIN tblItem ON tblItemRoutingBOM.ItemID = tblItem.ItemID
    WHERE tblItemRoutingBOM.ItemRevID in (61,70)
    as you can see i am returning two records using the where clause
    ItemRevID, ItemID, PartNum, ItemName, Manufacturer, Mfg Part#, Quantity
    61,121,331503,.233 Aluminum Sheet,,1
    70,121,331503,.233 Aluminum Sheet,,3
    now what i am looking for is to combine these two together into one row with the following added.  two columns for each QTY, QTY1 = 1 and QTY2 = 3 with a third column added that is the difference between the two QTY Diff = 2
    Any thoughts?

    Here are the two statements that i want to combine, results for each are attached
    SELECT tblItem.ItemID, Sum(tblItemRoutingBOM.Quantity) AS SumOfQuantity, tblItem.PartNum AS [Part #],
    tblItem.ItemName, tblManufacturer.ManufacturerName AS Manufacturer, tblItem.ManufacturerPartNum AS [Mfg Part#]
    FROM tblItemRouting
    INNER JOIN tblItemRoutingBOM ON tblItemRouting.ItemRoutingID = tblItemRoutingBOM.ItemRoutingID
    INNER JOIN tblItem ON tblItemRoutingBOM.ItemID = tblItem.ItemID
    INNER JOIN tblUnits ON tblItem.UnitID = tblUnits.UnitID
    LEFT JOIN tblManufacturer ON tblItem.ManufacturerID = tblManufacturer.ManufacturerID
    WHERE tblItemRoutingBOM.ItemRevID=61
    GROUP BY tblItem.ItemID,tblItem.PartNum,tblItem.ItemName,tblManufacturer.ManufacturerName,tblItem.ManufacturerPartNum
    SELECT tblItem.ItemID, Sum(tblItemRoutingBOM.Quantity) AS Quantity, tblItem.PartNum AS [Part #],
    tblItem.ItemName, tblManufacturer.ManufacturerName AS Manufacturer, tblItem.ManufacturerPartNum AS [Mfg Part#]
    FROM tblItemRouting
    INNER JOIN tblItemRoutingBOM ON tblItemRouting.ItemRoutingID = tblItemRoutingBOM.ItemRoutingID
    INNER JOIN tblItem ON tblItemRoutingBOM.ItemID = tblItem.ItemID
    INNER JOIN tblUnits ON tblItem.UnitID = tblUnits.UnitID
    LEFT JOIN tblManufacturer ON tblItem.ManufacturerID = tblManufacturer.ManufacturerID
    WHERE tblItemRoutingBOM.ItemRevID=70
    GROUP BY tblItem.ItemID,tblItem.PartNum,tblItem.ItemName,tblManufacturer.ManufacturerName,tblItem.ManufacturerPartNum
    114,11,55002,Pepsi Blue Cap,NULL,
    117,5,331501,Marigold Yellow For ABS,NULL,
    121,1,331503,.233 Aluminum Sheet,NULL,
    125,2,331504,Velvet Vinyl .008,NULL,
    114,33,55002,Pepsi Blue Cap,NULL,
    117,15,331501,Marigold Yellow For ABS,NULL,
    121,3,331503,.233 Aluminum Sheet,NULL,
    125,6,331504,Velvet Vinyl .008,NULL,
    my returned result should combine above with two extra columns (two extra columns because i have two results to combine)
    114, 11, 33, 22, 55002, Pepsi Blue Cap, NULL,
    117, 5, 15, 10, 331501, Marigold Yellow For ABS, NULL
    121,1, 3, 2, 331503, .233 Aluminum Sheet, NULL
    125, 2, 6, 4, 331504, Velvet Vinyl .008, NULL
    Columns go as such, ID, QTY1 (for 61), QTY2 (for 70), Diff (QTY1-QTY2), PartNum, ItemName, Mfg, Mfg Part#
    IF the results from one of those two are empty then i would see something like this
    114, 11, 0, 11, 55002, Pepsi Blue Cap, NULL,
    117, 5, 0, 5, 331501, Marigold Yellow For ABS, NULL
    121,1, 0, 1, 331503, .233 Aluminum Sheet, NULL
    125, 2, 0, 2, 331504, Velvet Vinyl .008, NULL

  • How to put two files with the same name into the same folder?

    How can I put two files with the same name and the same extention into the same directory?
    Is this even possible?
    Thanks in advance. 

    Are you sure? I would be very surprised if that was the case.
    How does the computer/filing system differentiate the files, if not by their names?
    How do you tell the computer which one you want? (On the command line.)

  • How to insert  two queries in the same workbook in new BI 7.0 Bex web analy

    Hi
    Can you please advise how to insert multiple queries in the same workbook in BI 7.0 web analyser.
    Sarah

    Hi,
    You need to switch to design mode (BEx Analyser Menu - Design Toolbar - Design Mode). For each query that you want to embed, insert an analysis grid item in the workbook. Link each analysis grid to its corresponding data provider (query).
    Hope this helps.
    Regards,
    Rajkandula

  • How to add an entry in the currency conversion table

    Hi all,
    I am loading data to ODS from 2LIS_11_VAITM. i am getting an error as below in a record.How do we enter a missing entry in the currency conversion table? Please help.
    Kind Regards,
    Shanbagavalli.S
    Enter rate EUR / EUR rate type 00000000 for 2200016564 in the system settings     
    Message no. SG105
    Diagnosis
    For the conversion of an amount into another currency, an entry is missing in the currency conversion table.
    Procedure
    Add the missing entry in the currency conversion table.
    Execute function
    You can then continue to process the commercial transaction.

    Hi,
    Goto RSA1 -> source system -> R/3 source system -> transfer exchange rates.
    Bye
    Dinesh

  • Can it be possible to use SUM twice for the same internal table

    Hi Guru,
    my requirement is follewing.
    I need to use a SUM for the same internal twice. 
    itab.
    first : like SUM  will sum up all the value
    and second like
    if  wa_tab-field = ' S'
    sum.
    ...some logic
    else  if wa_tab-field = h
    some logic
    endif.
    can i use  SUM in above way.
    Many thanks,
    Anuj.

    Hi,
    yes it could be use multiple time.
    Here example.
    sort GT_COLLECTHI by atnam ATWRT.
      loop at GT_COLLECTHI into gs_collecth.
        at end of ATWRT.
          sum.
          append gs_collecth to gt_collecth.
          clear:gs_collecth.
          sum.
        endat.
        at end of ATNAM.
          sum.
          append gs_collecth to gt_collecth.
          clear:gs_collecth.
          sum.
        endat.
      endloop.
    Thank you
    Jan

  • How can I compare two collections at the same time? (View two grid views)

    I have two collections containing some of the same images. (My Nikon D70 did not put an end-of-file on some images. I recovered them into a different collection.) Now I want to display both collections side-by-side in grid view. I will select those images in the "recovered" collection that correspond to the bad images in the "main" collection, add the ratings etc, and move just these to another collection.
    It is extremely frustrating to have to bounce back and forth between collections, remembering each image one by one and selecting it in the "recovered" collection. (The image names are not preserved in the "recovered" collection -- I have to go by what the image looks like.)
    LightRoom allows me to compare photos in the compare view. I want to compare collections in two grid views.

    CaptureTheLight,
    you have ran into a situation when you have to compare two sets of images and now you're wondering how come Lightroom doesn't have such "obviously necessary" functionality? But you have to admit it, this is not such a common situation in a photographer's workflow recovers broken files and tries to compare them against themselves. I think it's a pretty specific feature you need. Still, Lightroom has enough powerful tools for editing and sorting images.
    For example...
    You could just put them all - "main" and "recovered" - into a single collection or into the Quick Collection. Label the entire "recovered" collection with, say, red and sort by capture time. Now you'll have everything side by side, ordered chronologically. The "recovered" images will stay next to the "main" images since their capture time will be the same, and they will also stand out since they have the red label.
    Make the thumbnails bigger and set up the grid view so it tints the thumbnail cell are tinted with the label color. Now, you can go quickly through them visually checking labeled vs unlabeled.

  • How to run two icalenders on the same computer?

    How can i run two separate icalenders on the same computer? I have my own icalender with work, home, etc, and it's totally full. I am now running an artists collective and will publish the collectives icalender on the web. I don't, however, want to mix what will be a pretty busy calender with my own already too full one. Is it possible to run two totally separate calenders on the same computer?
    macbook   Mac OS X (10.4.8)  

    trsv,
    Welcome to Apple Discussions.
    Create two Groups...
    Calendar 1:
    Work
    Home
    etc
    Calendar 2:
    Collective Calendar
    You can then switch which groups you wish to display by activating/deactivating the check mark in the Calendar source window.
    That will also allow you to selectively publish the Collective Calendar.
    ;~)

Maybe you are looking for

  • Sysprep and Windows 8.1 -- missing Metro apps after reboot?

    So, I'm trying to figure out an issue with Sysprep and a clean-install Windows 8.1 64 Enterprise system: When I sysprep the computer from my admin account with my unattend.xml file, when it reboots, I'm only getting 7 Metro apps at the start screen a

  • Why does Photoshop display colors differently from the other applications even in sRGB mode ?

    Hello all ! Here is my problem : Photoshop is set to use sRGB workspace (in edit/colors.../workspace/RVB). If I understand correctly this is how all native windows applications work. This means Photoshop and the other applications should display the

  • PCs unable to open PDFs created with Mac

    Hello! I do hope this is the correct place for this question. I spent most of last night taking some InDesign documents, saving them as PDFs, uploading them to my website and letting my customers know they are on the website for the taking. I have he

  • E71 Wifi Intellisync

    Dear All, I have installed a software on this device (intellisync for S60) in order to sync my emails through an Outlook Exchange account securised with intellisync. The download of the emails using GPRS connection is fine, but I try unsuccessfully t

  • "hello world" - my first MIDlet is not working .......

    Hi There, I have downloaded J2ME toolkit recently and wrote a "hello world" MIDlet which is as follows import javax.microedition.midlet.*; import javax.microedition.lcdui.*; public class HelloWorld extends MIDlet implements CommandListener private Co