Deleting Duplicate from ITAB without sorting????

Hi,
A challenging and interesting problem please help. I want to delete duplicates from an ITAB without sorting (so cant use delete adjacent duplicates)
data:  begin of dpp occurs 0,
        val type i,
        end of dpp.
        dpp-val = 13.
        append dpp.
        dpp-val = 15.
        append dpp.
        dpp-val = 26.
        append dpp.
        dpp-val = 15.
        append dpp.
        dpp-val = 27
        append dpp.
        dpp-val = 15.
        append dpp.
As you see 15 is duplicated in DPP,,,how can duplicated 15 entries be deleted without sorting
                   VAL
     13
     15
     26
     15
     27
     15
thhnx
Edited by: Salman Akram on Oct 12, 2010 3:54 PM

Hi,
Loop through your DPP itab then append to another. try this:
DATA: BEGIN OF dpp OCCURS 0,
val TYPE i,
END OF dpp.
dpp-val = 13.
APPEND dpp.
dpp-val = 15.
APPEND dpp.
dpp-val = 26.
APPEND dpp.
dpp-val = 15.
APPEND dpp.
dpp-val = 27.
APPEND dpp.
dpp-val = 15.
APPEND dpp.
DATA: BEGIN OF dpp1 OCCURS 0.
        INCLUDE STRUCTURE dpp.
DATA: END OF dpp1.
LOOP AT dpp.
  READ TABLE dpp1 WITH KEY val = dpp-val.
  IF sy-subrc NE 0.
    APPEND dpp TO dpp1.
  ELSE.
    CONTINUE.
  ENDIF.
ENDLOOP.
REFRESH dpp.
dpp[] = dpp1[].
thanks.

Similar Messages

  • DELETE ADJACENT DUPLICATES FROM itab

    Hi Frends, can any one explain me about
    <b>DELETE ADJACENT DUPLICATES FROM itab</b>
    and can any one give me sample program using the above statement.
    full points will be given for good example
    Thanks and Regards
    Vijaya

    i am sending 2 programs to  u:
    DESCRIPTION: INTERACTIVE REPORT FOR SALES DOCUMENT
    *FOR PRINTING SALES DOCUMENT HEADER, SALES DOCUMENT DETAILS, PARTNER
                 DETAILS, SCHEDULE LINE DATA.
             D A T A D E C L A R A T I O N S                             *
    INCLUDE z8vg_isro1.
    INITIALIZATION.
      v_chkbox = ' '.
      v_chkbox1 = ''.
                   S T A R T  O F  S E L E C T I O N                     *
      SELECTION-SCREEN BEGIN OF BLOCK bl1 WITH FRAME TITLE text-028.
      SELECT-OPTIONS: s_vbeln FOR i_vbak-vbeln.
      "FOR RANGE OF VALUES.
      SELECTION-SCREEN END  OF  BLOCK bl1.
      A T  S E L E C T I O N  S C R E E N ( V A L I D A T I O N S )      *
    AT SELECTION-SCREEN.
    Check if record exists or not.
      PERFORM  zf_validations.
                   S T A R T  O F  S E L E C T I O N                     *
    START-OF-SELECTION.
    *this is event blocks which is  executed when the user chooses the
    *corresponding function key
      REFRESH i_ucomm.
      CLEAR i_ucomm.
      i_ucomm-ucomm = 'G002'.                               " schdl data
      APPEND i_ucomm.
      SET PF-STATUS 'MENU2' EXCLUDING i_ucomm.
      " MENU BAR STATUS.
    *populating sales order header data , item data , partner data ,
    *schedule data
      PERFORM  zf_select_headerdata.
    AT USER-COMMAND.
    "This event is executed whenever the user presses a menu option 'execute
      "' in the list
      CASE sy-ucomm.
        WHEN 'EX01'.                            "Cancel
          LEAVE PROGRAM.
        WHEN 'GO01'.                            "for item data
          vflag = '0'.
          REFRESH i_ucomm.
          CLEAR i_ucomm.
          i_ucomm-ucomm = 'GO01'.                " item data
          APPEND i_ucomm.
          SET PF-STATUS 'MENU2' EXCLUDING i_ucomm .
          PERFORM zf_select_details.
        WHEN 'G002'.                            "for schedule data .
          REFRESH i_ucomm.
          CLEAR i_ucomm.
          i_ucomm-ucomm = 'G000'.
          APPEND i_ucomm.
          APPEND 'GO01' TO i_ucomm.
          APPEND 'G002' TO i_ucomm.
          SET PF-STATUS 'MENU2' EXCLUDING i_ucomm .
          PERFORM zf_scheduledata .
        WHEN 'G000'.
          "function code for displaying partner details.
          REFRESH i_ucomm.
          CLEAR i_ucomm.
          i_ucomm-ucomm = 'G000'.
          APPEND i_ucomm.
          APPEND 'GO01' TO i_ucomm.
          APPEND 'G002' TO i_ucomm.
          SET PF-STATUS 'MENU2' EXCLUDING i_ucomm .
          IF vflag = '1'.
            PERFORM zf_partnerdetails.
            " FOR PARTNER DETAILS OF HEADER
          ELSE.
            PERFORM zf_partnerdetails1.
            " FOR PARTNER DETAILS OF SALES ORDER ITEMS .
          ENDIF.
        WHEN 'BACK'.
          LEAVE PROGRAM.
      ENDCASE.
    *&      FORM TOP_OF_PAGE
    TOP-OF-PAGE DURING LINE-SELECTION.
    printing header for secondary list of report.
      PERFORM zf_tols.
    TOP-OF-PAGE.
    printing hearder for basic list of report
      PERFORM zf_top.
    *&      Form  VALIDATIONS
          subroutine to check whether record exists or not
    -->  p1        text
    <--  p2        text
    FORM zf_validations .
      SELECT  SINGLE vbeln  FROM vbak
                     INTO  i_vbak-vbeln
                           WHERE vbeln IN s_vbeln.
      EXIT.
    CHECK IF THE RECORD EXISTS OR NOT.
      IF sy-subrc <> 0.
        MESSAGE e001.
      ENDIF.
    ENDFORM.                    " VALIDATIONS
    *&      Form  SELECT_HEADERDATA
    subroutine for populating header data and other details.
    -->  p1        text
    <--  p2        text
    FORM zf_select_headerdata .
    *refreshing all the internal tables.
      CLEAR i_vbak.
      REFRESH i_vbak.
      CLEAR i_vbap.
      REFRESH i_vbap.
      CLEAR i_vbpa.
      REFRESH i_vbpa.
      CLEAR i_vbep.
      REFRESH i_vbep.
    *populating sales order header data , item data , partner data ,
    *schedule data
      SELECT vbeln
             erdat
             vkorg
             FROM vbak
            INTO TABLE i_vbak
                  WHERE vbeln IN s_vbeln.
      IF NOT i_vbak[] IS INITIAL.
        SELECT vbeln
               posnr
               matnr FROM vbap
               INTO TABLE i_vbap
               FOR ALL ENTRIES IN i_vbak
               WHERE vbeln = i_vbak-vbeln.
      ENDIF.
      IF sy-subrc <> 0.
        MESSAGE e004.
      ENDIF.
      SORT i_vbap BY vbeln posnr.
      " SORTING TABLE WITH KEY FIELDS .
      REFRESH i_mat.
      CLEAR i_mat.
    fetching of unique material numbers  corresponding sales orderno.
      LOOP AT i_vbap.
        i_mat-matnr = i_vbap-matnr.
        APPEND i_mat.
      ENDLOOP.
      SORT i_mat BY matnr.                      " sorting of material nos.
      IF sy-SUBRC = 0.
    deleting duplicate entries from table
      DELETE ADJACENT DUPLICATES  FROM i_mat
                               COMPARING matnr.
    *endif.
      REFRESH i_mat1.
      CLEAR i_mat1.
    populating material no and dscription .
      SELECT matnr
             maktx FROM makt
                    INTO TABLE i_mat1
                    FOR ALL ENTRIES IN i_mat
                    WHERE matnr = i_mat-matnr.
      SELECT  vbeln
              posnr
              parvw
              kunnr
              FROM vbpa
              INTO TABLE i_vbpa
              FOR ALL ENTRIES IN i_vbap
              WHERE vbeln = i_vbap-vbeln .
      SORT i_vbap BY vbeln posnr.
      REFRESH i_tvbpa.
      REFRESH i_tpartf.
      CLEAR i_tpartf.
    *FOR FETCHING UNIQUE PARTNER FUNCTIONS
      LOOP AT i_vbpa.
        i_tpartf-parvw = i_vbpa-parvw.
        APPEND i_tpartf.
      ENDLOOP.
      SORT i_tpartf BY parvw.
      DELETE ADJACENT DUPLICATES  FROM i_tpartf
                                COMPARING parvw.
      SELECT spras
             parvw
             vtext
             FROM tpart
             INTO TABLE i_tvbpa
             FOR ALL ENTRIES IN i_tpartf
             WHERE parvw = i_tpartf-parvw AND spras = sy-langu.
      IF NOT i_vbap[] IS INITIAL.
        SELECT vbeln
               posnr
               etenr
               ettyp
               lfrel
               edatu
               FROM  vbep
               INTO TABLE i_vbep
               FOR ALL ENTRIES IN i_vbap
               WHERE vbeln = i_vbap-vbeln.
      ENDIF.
      SORT i_vbap BY vbeln posnr.
    to fetch data from internal table to print report
      LOOP AT  i_vbak.
        WRITE:/1 sy-vline,10   v_chkbox AS CHECKBOX, i_vbak-vbeln,28
        sy-vline,
                30 i_vbak-erdat,48 sy-vline,
                50 i_vbak-vkorg, 132 sy-vline.
      ENDLOOP.
      ULINE.
    ENDFORM.                    " SELECT_HEADERDATA
    *&      Form  ZF_SELECT_DETAILS
         SUBROUTINE  FOR DISPLAYING SELECTED ITEM DETAILS DATA
    -->  p1        text
    <--  p2        text
    FORM zf_select_details .
      vflag = 0.
      WRITE:/1 sy-vline,10 text-006 COLOR 3,28 sy-vline,
            30 text-007 COLOR 3, 48 sy-vline,
            50 text-008 COLOR 3, 68 sy-vline,
            70 text-022 COLOR 3, 132 sy-vline.
      ULINE.
      CLEAR i_selvbap.
      CLEAR i_final.
      REFRESH i_selvbap.
      REFRESH i_final.
      CLEAR i_mat1.
      vnline = 7.
      DO.
        READ LINE vnline FIELD VALUE i_vbak-vbeln v_chkbox.
        " READING LINES FROM BASIC LIST.
        IF sy-subrc <> 0. " no lines read.
          EXIT.
        ENDIF.
        IF v_chkbox = 'X'.
          " checking of selected items from basic list.
    *alpha conversion function - During conversion from the external to the
    *internal format, the system checks to see
    *if input is purely nummeric or not ,if not all spaces to the left of
    *the value are filled with zeroes ('0').
          CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
            EXPORTING
              input  = i_vbak-vbeln
            IMPORTING
              output = i_selvbap-vbeln.
          APPEND i_selvbap.
          " appending values from header line to body.
          flag = flag + 1.
          " TO CHECK VALUE OF CHECKBOX.
          CLEAR i_vbak.
          " clearing of header line after appending.
        ENDIF.
        vnline = vnline + 1.
      ENDDO.
      IF flag <> 0.
        CLEAR i_final.
        CHECK NOT i_selvbap[] IS INITIAL.
        LOOP AT i_selvbap.
          LOOP AT i_vbap WHERE vbeln = i_selvbap-vbeln.
            READ TABLE i_mat1 WITH KEY matnr = i_vbap-matnr BINARY SEARCH.
         IF sy-subrc = 0.
            i_final-vbeln = i_vbap-vbeln.
            i_final-posnr = i_vbap-posnr.
            i_final-matnr = i_vbap-matnr.
            i_final-maktx = i_mat1-maktx.
            APPEND i_final.
            CLEAR i_mat1.
         ENDIF.
          ENDLOOP.
          CLEAR i_selvbap.
          CLEAR i_vbap.
          CLEAR i_final.
        ENDLOOP.
      ENDIF.
      IF flag = 0.
        MESSAGE e005.
      ENDIF.
    to fetch data from internal table to print report
      LOOP AT i_final.
       WRITE:/1 sy-vline,10 v_chkbox1 AS CHECKBOX,i_final-vbeln,28 sy-vline
             30 i_final-posnr, 48 sy-vline,
             50 i_final-matnr, 68 sy-vline,
             70 i_final-maktx,
             132 sy-vline.
      ENDLOOP.
      ULINE.
    ENDFORM.                    " ZF_SELECT_DETAILS
    *&      Form  ZF_TOLS
          text
    -->  p1        text
    <--  p2        text
    FORM zf_tols .
    *printing header of secondary list
      ULINE.
      WRITE:/10 text-023,20 text-001 COLOR 4, 45 text-019 COLOR 4.
      WRITE: 80 text-024,90  sy-datum .
      WRITE:/10 text-025,20 text-027,80 text-026,90  sy-pagno.
      WRITE:/.
      ULINE.
    ENDFORM.                    " ZF_TOLS
    *&      Form  ZF_TOP
          text
    -->  p1        text
    <--  p2        text
    FORM zf_top .
    *printing header of basic list
      ULINE.
      WRITE:/10 text-023,20 text-001 COLOR 4 ,45 text-002 COLOR 4.
      WRITE: 80 text-024, 90  sy-datum.
      WRITE:/10 text-025,20 text-027,80 text-026,90  sy-pagno.
      ULINE.
      WRITE:/1 sy-vline, 10 text-003  COLOR 3 ,28 sy-vline,
            30 text-004 COLOR 3 ,48 sy-vline,
            50 text-005 COLOR 3 ,132 sy-vline.
      ULINE.
    ENDFORM.                    " ZF_TOP
    *&      Form  ZF_PARTNERDETAILS
         SUBROUTINE  FOR DISPLAYING SELECTED PARTNER DETAILS DATA
    -->  p1        text
    <--  p2        text
    FORM zf_partnerdetails .
      IF vflag = 1.
        WRITE:/1 sy-vline,10 text-016 COLOR 3,28 sy-vline,
             30 text-017 COLOR 3,48 sy-vline,
               30 text-018 COLOR 3,48 sy-vline,
               70 text-021 COLOR 3, 132 sy-vline.
        ULINE.
        CLEAR i_selvbpa.
        REFRESH i_selvbpa.
        " clearing work area and body of internal tables
        REFRESH i_finalpd.
        vnline = 7.
        DO.
          CLEAR i_selvbpa.
          READ LINE vnline FIELD VALUE i_vbak-vbeln v_chkbox.
          " READING LINES FROM BASIC LIST.
          IF sy-subrc <> 0.
            " NO LINES READ
            EXIT.
          ENDIF.
          IF v_chkbox = 'X'.
            " if any value is selected
    *converts any number into a string fill with zeroes, with the number at
    *the extreme right.
            CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
              EXPORTING
                input  = i_vbak-vbeln
              IMPORTING
                output = i_selvbpa-vbeln.
            APPEND i_selvbpa.
            CLEAR i_vbak.
            flag = flag + 1.
          ENDIF.
          vnline = vnline + 1.
        ENDDO.
        IF flag <> 0.
          CHECK NOT i_selvbpa[] IS INITIAL.
          LOOP AT i_selvbpa.
            LOOP AT i_vbpa WHERE vbeln = i_selvbpa-vbeln.
             READ TABLE i_tvbpa WITH KEY parvw = i_vbpa-parvw BINARY SEARCH
         IF sy-subrc = 0..
              i_finalpd-vbeln = i_vbpa-vbeln.
              i_finalpd-posnr = i_vbpa-posnr.
              i_finalpd-parvw = i_vbpa-parvw.
              i_finalpd-vtext = i_tvbpa-vtext.
              APPEND i_finalpd.
              CLEAR i_tvbpa.
         ENDIF.
            ENDLOOP.
          ENDLOOP.
        ENDIF.
        IF flag = 0.
          MESSAGE e005.
        ENDIF.
        LOOP AT i_finalpd.
          WRITE:/1 sy-vline,10 i_finalpd-vbeln, 28 sy-vline,
              30 i_finalpd-posnr, 48 SY-VLINE,
                 30 i_finalpd-parvw, 48 sy-vline,
                 70 i_finalpd-vtext, 132 sy-vline.
        ENDLOOP.
        ULINE.
      ENDIF.
    ENDFORM.                    " ZF_PARTNERDETAILS
    *&      Form  ZF_SCHEDULEDATA
         SUBROUTINE  FOR DISPLAYING SELECTED ITEM  SCHEDULE  DATA
    -->  p1        text
    <--  p2        text
    FORM zf_scheduledata .
      vflag = 0.
      WRITE:/1 sy-vline,10 text-009 COLOR 3,18 sy-vline,
            20 text-011 COLOR 3,38 sy-vline,
            40 text-012 COLOR 3,58 sy-vline,
            60 text-013 COLOR 3,78 sy-vline,
            80 text-020 COLOR 3,98 sy-vline,
           100 text-015 COLOR 3,132 sy-vline.
      ULINE.
      CLEAR i_selvbep.
      REFRESH i_selvbep.
      vnline1 = 5.
      CLEAR flag.
      CLEAR i_final.
      REFRESH i_finalsd.
      DO.
        READ LINE vnline1 FIELD VALUE i_final-vbeln v_chkbox1 i_final-posnr
        .       " READING LINES FROM BASIC LIST.
        IF sy-subrc <> 0.
          EXIT.
        ENDIF.
        IF v_chkbox1 = 'X'.
    *converts any number into a string fill with zeroes, with the number at
    *the extreme right
          CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
            EXPORTING
              input  = i_final-vbeln
            IMPORTING
              output = i_selvbep-vbeln.
          i_selvbep-posnr = i_final-posnr.
          APPEND i_selvbep.
          CLEAR i_final.
          flag = flag + 1.
        ENDIF.
        vnline1 = vnline1 + 1.
      ENDDO.
      IF flag <> 0.
        CHECK NOT i_selvbep[] IS INITIAL.
        LOOP AT i_selvbep.
          LOOP AT i_vbep WHERE vbeln = i_selvbep-vbeln AND posnr =
          i_selvbep-posnr.
            i_finalsd-vbeln = i_vbep-vbeln.
            i_finalsd-posnr = i_vbep-posnr.
            i_finalsd-etenr = i_vbep-etenr.
            i_finalsd-ettyp = i_vbep-ettyp.
            i_finalsd-lfrel = i_vbep-lfrel.
            i_finalsd-edatu = i_vbep-edatu.
            APPEND i_finalsd.
            CLEAR i_selvbep.
            CLEAR i_vbep.
            CLEAR i_finalsd.
          ENDLOOP.
        ENDLOOP.
      ENDIF.
      IF flag = 0.
        MESSAGE e005.
      ENDIF.
      LOOP AT i_finalsd.
        WRITE:/1 sy-vline,10 i_finalsd-vbeln,18 sy-vline,
              20 i_finalsd-posnr, 38 sy-vline,
              40 i_finalsd-etenr, 58 sy-vline,
              60 i_finalsd-ettyp, 78 sy-vline,
              80 i_finalsd-lfrel, 98 sy-vline,
             100 i_finalsd-edatu,132 sy-vline.
        CLEAR i_finalsd.
      ENDLOOP.
      ULINE.
    ENDFORM.                    " ZF_SCHEDULEDATA
    *&      Form  ZF_PARTNERDETAILS1
          text
    -->  p1        text
    <--  p2        text
    FORM zf_partnerdetails1 .
      vflag = 1.
      WRITE:/1 sy-vline,10 text-016 COLOR 3,18 sy-vline,
              20 text-017 COLOR 3,38 sy-vline,
              40 text-018 COLOR 3,58 sy-vline,
              60 text-021 COLOR 3,78 sy-vline,
              132 sy-vline.
      ULINE.
      CLEAR i_selvbpa1.
      REFRESH i_selvbpa1.
      REFRESH i_finalpd1.
      vnline1 = 7.
      DO.
       CLEAR I_SELVBEP.
        READ LINE vnline1 FIELD VALUE i_final-vbeln v_chkbox1 i_final-posnr
        .       " READING LINES FROM BASIC LIST.
        IF sy-subrc <> 0.
          EXIT.
        ENDIF.
        IF v_chkbox1 = 'X'.
    *converts any number into a string fill with zeroes, with the number at
    *the extreme right
          CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
            EXPORTING
              input  = i_final-vbeln
            IMPORTING
              output = i_selvbpa1-vbeln.
          i_selvbpa1-posnr = i_final-posnr.
          APPEND i_selvbpa1.
          CLEAR i_final.
          flag = flag + 1.
        ENDIF.
        vnline1 = vnline1 + 1.
      ENDDO.
      IF flag <> 0.
        CLEAR i_vbpa.
        CLEAR i_finalpd1.
        CHECK NOT i_selvbpa1[] IS INITIAL.
        LOOP AT i_selvbpa1.
          LOOP AT i_vbpa WHERE vbeln = i_selvbpa1-vbeln.
            CLEAR i_finalpd1.
         IF sy-subrc = 0.
            i_finalpd1-vbeln = i_vbpa-vbeln.
            IF i_vbpa-posnr = 0 OR i_vbpa-posnr = ''.
              i_finalpd1-parvw1 = 'NO DATA EXISTS'.
            ELSE.
              i_finalpd1-posnr = i_vbpa-posnr.
              i_finalpd1-parvw = i_vbpa-parvw.
              i_finalpd1-vtext = i_vbpa-vtext.
              i_finalpd1-kunnr = i_vbpa-kunnr.
            ENDIF.
            APPEND i_finalpd1.
            IF i_finalpd1-vbeln = i_selvbpa1-vbeln.
              EXIT.
            ENDIF.
            CLEAR i_vbpa.
            CLEAR i_finalpd1.
          ENDIF.
          ENDLOOP.
        ENDLOOP.
      ENDIF.
      IF flag = 0.
        MESSAGE e005.
      ENDIF.
    fetching data from internal table for printing.
      LOOP AT i_finalpd1.
        WRITE:/1 sy-vline,10 i_finalpd1-vbeln,18 sy-vline,
             20 I_FINALPD1-POSNR, 38 SY-VLINE,
               40 i_finalpd1-parvw1,
             58 SY-VLINE,
               60 i_finalpd1-vtext,
             78 SY-VLINE,
               80 i_finalpd1-kunnr,
              132 sy-vline.
      ENDLOOP.
      ULINE.
    ENDFORM.                    " ZF_PARTNERDETAILS1
    2nd is :-
    REPORT  Z8NB_SHA10_1
            NO STANDARD PAGE HEADING
            LINE-COUNT 30
            LINE-SIZE 170
            MESSAGE-ID Z8NBSHADOW.
                  T A B L E    D E C L A R A T I O N                     *
    TABLES : LIKP. " Delivery Header.
                  T Y P E      D E C L A R A T I O N                     *
    **-- Type decleration for Delivery Header
    TYPES : BEGIN OF T_LIKP,
              VBELN LIKE LIKP-VBELN,    " Delivery Number
              ERDAT LIKE LIKP-ERDAT,    " Date on which record was craeted
              KUNNR LIKE LIKP-KUNNR,    " Sold-to-party
              KUNAG LIKE LIKP-KUNAG,    " Ship-to-party
              TRMTYP LIKE LIKP-TRMTYP,  " Means of transport
            END OF T_LIKP.
    **-- Type decleration for Delivery Items
    TYPES : BEGIN OF T_LIPS,
              VBELN LIKE LIPS-VBELN,    " Delivery Number
              POSNR LIKE LIPS-POSNR,    " Delivery Item Number
              MATNR LIKE LIPS-MATNR,    " Material Number
              LFIMG LIKE LIPS-LFIMG ,   " DELIVERED QTY
              MEINS LIKE LIPS-MEINS,    " Unit of Measurement
              BRGEW LIKE LIPS-BRGEW,    " Gross Weight
              GEWEI LIKE LIPS-GEWEI,    " Weight Unit
              VOLUM LIKE LIPS-VOLUM,    " Volumn
              VOLEH LIKE LIPS-VOLEH,    " Volumn Unit
            END OF T_LIPS.
    **-- Type decleration for Customer Details
    TYPES : BEGIN OF T_KNA1,
              KUNNR LIKE KNA1-KUNNR,    " Customer Number
              NAME1 LIKE KNA1-NAME1,                            " Name1
              NAME2 LIKE KNA1-NAME2,                            " Name2
              STRAS LIKE KNA1-STRAS,    " House/ Street Number
              REGIO LIKE KNA1-REGIO,    " Region
              ORT01 LIKE KNA1-ORT01,    " City
              LAND1 LIKE KNA1-LAND1,    " Country Key
              TELF1 LIKE KNA1-TELF1,    " First Telephone Number
           END OF T_KNA1.
    **-- Type decleration for Partner Function
    TYPES : BEGIN OF T_KNVP,
            KUNNR LIKE KNVP-KUNNR,      " Customer Number
            PARVW LIKE KNVP-PARVW,      " Partner Function
            KUNN2 LIKE KNVP-KUNN2,      " Cust no of business partner
            END OF T_KNVP.
    **-- Type decleration for Shipment Header
    TYPES : BEGIN OF T_VTTK,
            TKNUM LIKE VTTK-TKNUM,      " Shipment Number
            TNDR_CRNM LIKE VTTK-TNDR_CRNM,   " Carrier
            END OF T_VTTK.
    **-- Type decleration for Shipment Item
    TYPES : BEGIN OF T_VTTP,
            TKNUM LIKE VTTP-TKNUM,      " Shipment Number
            VBELN LIKE VTTP-VBELN,      " Order Number
            END OF T_VTTP.
    **-- Type decleration for Material Description
    TYPES : BEGIN OF T_MAKT,
            MATNR LIKE MAKT-MATNR,      " Material Number
            MAKTX LIKE MAKT-MAKTX,      " Material Description
            END OF T_MAKT.
    **-- Type decleration for Final table containing all item details
    TYPES : BEGIN OF T_FINAL,
            VBELN LIKE LIPS-VBELN,    " Delivery Number
            POSNR LIKE LIPS-POSNR,    " Delivery Item Number
            MATNR LIKE LIPS-MATNR,    " Material Number
            LFIMG LIKE LIPS-LFIMG ,   " DELIVERED QTY
            MEINS LIKE LIPS-MEINS,    " Unit of Measurement
            BRGEW LIKE LIPS-BRGEW,    " Gross Weight
            GEWEI LIKE LIPS-GEWEI,    " Weight Unit
            VOLUM LIKE LIPS-VOLUM,    " Volumn
            VOLEH LIKE LIPS-VOLEH,    " Volumn Unit
            MAKTX LIKE MAKT-MAKTX,    " Material Description
            END OF T_FINAL.
             C O N S T A N T     D E C E L E R A T I O N                 *
    CONSTANTS: C_RE(4) TYPE C VALUE 'RE',  "Bill-to-party
               C_EQ(4) TYPE C VALUE 'EQ',  "Equal To
               C_I(2) TYPE C VALUE 'I'.    "Inclusion
             V A R I A B L E     D E C E L E R A T I O N                 *
    DATA : V_SUM TYPE LIPS-LFIMG,       "For calculating total of Quantity.
           V_SUM_FINAL TYPE LIPS-LFIMG, "For displaying total
           V_DESC TYPE C LENGTH 20.     "Storing Description
              I N T E R N A L      D E C L A R A T I O N                 *
    **-- Internal table for delivery header data
    DATA: IT_LIKP TYPE STANDARD TABLE OF T_LIKP WITH HEADER LINE,
    **-- Internal table for delivery item data
          IT_LIPS TYPE STANDARD TABLE OF T_LIPS WITH HEADER LINE,
    **-- Internal table for bill-to-party details
          IT_KNA1 TYPE STANDARD TABLE OF T_KNA1 WITH HEADER LINE,
    **-- Internal table to store partner function data
          IT_KVNP TYPE STANDARD TABLE OF T_KNVP WITH HEADER LINE,
    **-- Internal table for shipment header data
          IT_VTTK TYPE STANDARD TABLE OF T_VTTK WITH HEADER LINE,
    **-- Internal table for shipmant item data
          IT_VTTP TYPE STANDARD TABLE OF T_VTTP WITH HEADER LINE,
    **-- Internal table for material description
          IT_MAKT TYPE STANDARD TABLE OF T_MAKT WITH HEADER LINE,
    **-- Internal table for final item details
          IT_FINAL TYPE STANDARD TABLE OF T_FINAL WITH HEADER LINE,
    **-- Temporary internal table for Shipment Item
          IT_VTTP_TEMP TYPE STANDARD TABLE OF T_VTTP WITH HEADER LINE,
    **-- Temporary internal table for delivery item
          IT_LIPS_TEMP TYPE STANDARD TABLE OF T_LIPS WITH HEADER LINE,
    **-- Temporary internal table for delivery header
          IT_LIKP_TEMP TYPE STANDARD TABLE OF T_LIKP WITH HEADER LINE.
    **-- Ranges for Inquiry/Quotation
    RANGES R_CUSTOMER FOR KNA1-KUNNR.
                  S E L C T I O N       S C R E E N                      *
    **-- Selection screen containing Delivery no as the obligatory field
    SELECTION-SCREEN BEGIN OF BLOCK CHARLY WITH FRAME TITLE TEXT-001.
    SELECT-OPTIONS : S_VBELN FOR LIKP-VBELN OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK CHARLY.
                         I N I T I A L I Z A T I O N                     *
    INITIALIZATION.
    **-- Clear all internal tables
      CLEAR : IT_LIKP,
              IT_LIPS,
              IT_KNA1,
              IT_KVNP,
              IT_VTTK,
              IT_VTTP,
              IT_MAKT,
              IT_FINAL,
              IT_VTTP_TEMP,
              R_CUSTOMER,
              V_SUM,
              V_SUM_FINAL,
              V_DESC.
    **-- Refresh all internal tables
      REFRESH : IT_LIKP,
                IT_LIPS,
                IT_KNA1,
                IT_KVNP,
                IT_VTTK,
                IT_VTTP,
                IT_MAKT,
                IT_FINAL,
                IT_VTTP_TEMP,
                R_CUSTOMER.
      A T  S E L E C T I O N  S C R E E N ( V A L I D A T I O N S )      *
    AT SELECTION-SCREEN.
    **-- Check the sales order number exists in the database table or not
      SELECT SINGLE VBELN
                    FROM LIKP
                    INTO IT_LIKP
                    WHERE VBELN IN S_VBELN.
    **-- If no single data selected display error message.
      IF SY-SUBRC <> 0.
        MESSAGE E000.
      ENDIF.
                   S T A R T    O F    S E L E C T I O N                 *
    START-OF-SELECTION.
    **-- Fetch data from the transprant tables into the internal tables
      PERFORM GET_DATA.
    **-- Final table for complete item data
      PERFORM FINAL_DATA.
                   E N D    O F    S E L E C T I O N                     *
    END-OF-SELECTION.
    **-- Display of Delivery Note
      PERFORM DISPLAY_DATA.
    *&      Form  GET_DATA
          text
    FORM GET_DATA .
    **-- Fetch data from Delivery Header Table ( LIKP )
      SELECT VBELN
             ERDAT
             KUNNR
             KUNAG
             TRMTYP
             FROM LIKP
             INTO TABLE IT_LIKP
             WHERE VBELN IN S_VBELN
             ORDER BY VBELN.
    **-- Check SY_SUBRC.
      IF SY-SUBRC <> 0 .
      ENDIF.
    **-- If record is present in IT_LIKP internal table then fetch data from
    **-- Delivery Item table (LIPS)
      IF  NOT IT_LIKP[] IS INITIAL.
        SELECT VBELN
               POSNR
               MATNR
               LFIMG
               MEINS
               BRGEW
               GEWEI
               VOLUM
               VOLEH
               FROM LIPS
               INTO TABLE IT_LIPS
               FOR ALL ENTRIES IN IT_LIKP
               WHERE VBELN = IT_LIKP-VBELN.
    **-- If record found, sort the internal table on delivery no and item no
        IF SY-SUBRC = 0.
          SORT IT_LIPS BY VBELN POSNR.
        ENDIF.
      ENDIF.
    **-- If record present in IT_LIPS internal table then fetch data from
    **-- Shipment Item Table where delivery number is same
      IF NOT IT_LIPS[] IS INITIAL.
        SELECT TKNUM
               VBELN
               FROM VTTP
               INTO TABLE IT_VTTP
               FOR ALL ENTRIES IN IT_LIPS
               WHERE VBELN = IT_LIPS-VBELN.
    **-- If record found, sort the internal table on shipment no
        IF SY-SUBRC = 0.
          SORT IT_VTTP BY TKNUM.
        ENDIF.
      ENDIF.
    **-- Move records in IT_LIPS to an temporary  internal table for
    **-- removing the duplicate entries of material number.
      IT_LIPS_TEMP[] = IT_LIPS[].
      SORT IT_LIPS_TEMP BY MATNR.
      DELETE ADJACENT DUPLICATES FROM IT_LIPS_TEMP
                                 COMPARING MATNR.
      IF NOT IT_LIPS_TEMP[] IS INITIAL.
    **-- Fetch Material description from MAKT for all materials in
    **-- IT_LIPS_TEMP
        SELECT MATNR
             MAKTX
             INTO TABLE IT_MAKT
             FROM MAKT FOR ALL ENTRIES IN IT_LIPS_TEMP
             WHERE MATNR = IT_LIPS_TEMP-MATNR.
    **-- If record found, sort the internal table on Matreial No.
        IF SY-SUBRC = 0.
          SORT IT_MAKT BY MATNR.
        ENDIF.
      ENDIF.
    **-- Transfer data in shipment item internal table to a temporary
    **-- internal table to delete duplicate entries of shipment number.
      IT_VTTP_TEMP[] = IT_VTTP[].
      SORT IT_VTTP_TEMP BY TKNUM.
      DELETE ADJACENT DUPLICATES FROM IT_VTTP_TEMP
                                 COMPARING TKNUM.
    **-- If record found in IT_VTTP_TEMP then fetch shipment no and carrier
    **--from Shipment Header Table(VTTK).
      IF NOT IT_VTTP_TEMP[] IS INITIAL.
        SELECT TKNUM
               TNDR_CRNM
               FROM VTTK
               INTO TABLE IT_VTTK
               FOR ALL ENTRIES IN IT_VTTP_TEMP
               WHERE TKNUM = IT_VTTP_TEMP-TKNUM.
    **-- If record found, sort the internal table on shipment no
        IF SY-SUBRC = 0.
          SORT IT_VTTK BY TKNUM.
        ENDIF.
      ENDIF.
    **-- Move the data of IT_LIKP to an internal table to remove the
    **-- duplicate entries of sold-to-party number.
      IT_LIKP_TEMP[] = IT_LIKP[].
      SORT IT_LIKP_TEMP BY KUNAG.
      DELETE ADJACENT DUPLICATES FROM IT_LIKP_TEMP
                             

  • Delete Duplicates from internal table with object references

    Hi
    How can I delete duplicates from an internal table in ABAP OO based on the value of one of the attributes?
    I have created a method, with the following code:
      LOOP AT me->business_document_lines INTO l_add_line.
        CREATE OBJECT ot_line_owner
          EXPORTING
            i_user      = l_add_line->add_line_data-line_owner
            i_busdoc = me->business_document_id.
          APPEND ot_line_owner TO e_line_owners.
      ENDLOOP.
    e_line_owners are defined as a table containing only object references.
    One of the attribute of the object in the table is called USER. And I would like to do a "delete ADJACENT DUPLICATES FROM e_line_owners", based on that attribute.
    How can do this?
    Regards,
    Morten Nielsen

    Hello Morten
    Assuming that the instance attribute is <b>public </b>you could try to use the following coding:
      SORT e_line_owners BY table_line->user.
      DELETE ADJACENT DUPLICATES FROM e_line_owners
        COMPARING table_line->user.
    However, I am not really sure (cannot test myself) whether <b>TABLE_LINE</b> can be used together with SORT and DELETE.
    Alternative solution:
      DATA:
         ld_idx    TYPE sy-tabix.
      LOOP AT e_line_owners INTO ls_line.
        ld_idx = syst-tabix + 1.
        LOOP AT e_line_owners TRANSPORTING NO FIELDS FROM ld_idx
                       WHERE ( table_line->user = ls_line->user ).
          DELETE e_line_owners INDEX syst-tabix.
        ENDLOOP.
      ENDLOOP.
    Regards
      Uwe

  • How to choose in Delete Duplicates from internal table?

    Now I need to delete Duplicates from internal table,
    So at first I sort
    than I delete duplicate
    Sort itab1 BY Company_Code  Asset_No Capital_Date.
          DELETE ADJACENT DUPLICATES FROM itab1 COMPARING Company_Code  Asset_No  Capital_Date
    Company_Code
    Asset_No
    Capital_Date
    Remark
    BC35
    1515593
    20021225
    Helen
    BC35
    1515593
    20021225
    Common Asset
    BC35
    1515594
    20030109
    Judy
    BC35
    1515594
    20030109
    Common Asset
    But here comes my problem~If I want to delete the Common Asset in Remark Column,how I let it choose the right one to do it?

    Hi Jack
    Try the below coding..
    Report zsamp.
    types: begin of t_tab,
            comp_code(4) type c,
            ***_no(7) type n,
            cap_date type d,
            remark type string,
            end of t_tab.
    data: i_tab type TABLE OF t_tab,
           w_tab type t_tab.
    w_tab-comp_code = 'BC35'.
    w_tab-***_no = '1515593'.
    w_tab-cap_date = '20021225'.
    w_tab-remark = 'Helen'.
    append w_tab to i_tab.
    w_tab-comp_code = 'BC35'.
    w_tab-***_no = '1515593'.
    w_tab-cap_date = '20021225'.
    w_tab-remark = 'Common Asset'.
    append w_tab to i_tab.
    w_tab-comp_code = 'BC35'.
    w_tab-***_no = '1515594'.
    w_tab-cap_date = '20030109'.
    w_tab-remark = 'Judy'.
    append w_tab to i_tab.
    w_tab-comp_code = 'BC35'.
    w_tab-***_no = '1515594'.
    w_tab-cap_date = '20030109'.
    w_tab-remark = 'Common Asset'.
    append w_tab to i_tab.
    sort i_tab by remark.
    delete ADJACENT DUPLICATES FROM i_tab COMPARING remark.

  • HT2905 I want to delete duplicates from my iTunes music but cannot see "Display Exact Duplicates" in File menu.

    Hi,
    I want to delete duplicates from my iTunes music but and iTunes help says to click on "Display Exact Duplicates" in File men but I don't appear to have this function.  Where else can I look?

    Thanks Kappy. I had just found it but thanks reply.  Next question is:  Is there a quick way to then delete the duplicates without having to select each one and delete?

  • Deleting duplicate from list

    What is the easy and fastest way to delete duplicate from
    list.
    My dynamic list is pretty small. Need to loop through and
    delete duplicate and give unique item list.
    We don't have a CF function yet?.

    What do I think? Well - I think your code has a few problems:
    1) It's not very re-usable
    2) It's not very easy to read (variables are named poorly)
    3) It's introduces unecessary usage of complex data types
    (structs)
    4) Functionally, it does not preserve the sort order of the
    original list.
    To elaborate on #4 above....once you have your list values
    stored as "keys" in a struct, you lose the original order of the
    list. Keys in a struct are completely unsorted. A call to
    StructKeyList will return a list of keys, with no guarantee on the
    order of the keys returned. The order in which the keys are
    inserted makes no difference. Once all of the keys are defined in a
    struct, they are all essentially un-ordered indexes.
    If order is not important to you for this particular usage,
    than you shouldn't have anything to worry about. Functionally, your
    code WILL work. But my honest opinion is that there are many
    "better" ways to approach this (see the example UDF I attached
    previously).
    Please bear in mind I'm not trying to be mean here, just
    offering some constructive criticism.

  • Deleting Duplicates from a table

    Its a huge table with 52 fields and 30k rows. I need to delete the duplicates based on one of the fields. GROUP BY is taking a lot of time. Is there a quicker way to delete the duplicates using SQL.
    Thanks.

    How many duplicates have you got? Do you have even a vague idea? 1%? 20%? 90%?
    One way would be to add a unique constraint on the column in question. This will fail, of course, but you can use the EXCEPTIONS INTO clause to find all the ROWIDs which have duplicate values. You can then choose to delete those rows using a variant on teh query already posted. You may need to run %ORACLE_HOME%\rdbms\admin\utlexcptn.sql to build the EXCEPTIONS table first.
    This may seem like some unnecessary work, but the most effective way of deleting duplicates from a table is to have relational integrity constraints in place which prevent you having duplicates in the first place. To paraphrase Tim Gorman, you can't get faster than zero work!
    Cheers, APC

  • How do I delete songs from Itunes without losing them in my IPOD?

    How do I delete songs from Itunes without losing them in my IPOD? I don't want 11gb of music stored on my computer when I already have it in my Ipod. Anyone have some info?

    You can Transfer music manually, then delete the files from the PC without having it sync to the iPod.
    HOWEVER.....
    Deleting songs off of iTunes or your computer is a very bad idea unless you have created one or more backup files of all your songs.
    Using the iPod as the sole repository of any of your songs is a very risky practice. When (not ‘if’) you need to restore the iPod, return the iPod for service, or it's song files are somehow lost or damaged, you will be re-ripping all your CDs back into iTunes and re-purchasing all your iTMS songs. Restoring the iPod is a common ‘fix’ to many small issues that arise.
    If you cannot store your songs on a PC or within iTunes, then you will need to have some storage medium in use (an external hard drive, DVDs or CDs). You should also consider a secondary backup medium for additional safety. Whether you keep your music in iTunes or on an external source – Multiple copies of your music files are a must!
    The iPod is really designed to be playback device - not a primary storage device (although it can be used as such), and certainly not as the only storage medium for all your music.
    Always backup your PC files: both music and data. Backup as frequently as possible. The usual ‘metric’ is to determine just how much work (hours, days, weeks) or money spent you are willing to repeat by extending out your time between backups. Your choice, your potential headache &/or loss.
    Many data-savvy folks have more than one backup and create incremental backups every time they add to or change their Library. Depending on the work I am doing, I may perform several backups during the same day. As they are incremental, and placed on my Backup ExHD – it is a very quick operation to perform several times a day, when needed.
    If you are heavily invested in your Library data (Playlists, Play Counts, Ratings, Last Played, Date Added, etc.), then:
    it is critical that you also make multiple backups of your ‘iTunes Library.itl’ file.
    iTMS REMINDER: While you can always take the time to re-rip the CDs you own to restore your iTunes music, if you lose your iTMS purchased music and have no backups, you will have to re-purchase them. Few exceptions are made to this rule – at least none that I am aware of.
    Here is a post on developing a backup strategy:
    http://discussions.apple.com/click.jspa?searchID=-1&messageID=1498152

  • TS4036 I deleted Pages from icloud on my iphone.  the next time i was on my ipad it flashed and all of the files disappeared.  did i deleted them from icould without realizing it?  are they gone forever or is there a way to restore them?

    I deleted Pages from icloud on my iphone.  the next time i was on my ipad it flashed and all of the files disappeared.  did i deleted them from icould without realizing it?  are they gone forever or is there a way to restore them?

    Welcome to the Apple Community.
    If you mean you deleted the files from Pages on your phone whilst using iCloud, then yes they will disappear from Pages on your iPad too.
    If you simply deleted the app from your phone, if you were using iCloud then they should not have disappeared from your iPad.
    It's not clear from your post, which of these you did.

  • How do i delete duplicates from my music library. After updating my iTunes the "Show Duplicates" option does not appear in the menu

    How do i delete duplicates from my music library. After updating my iTunes the "Show Duplicates" option does not appear in the menu

    If you are on Version 11.0.1 rather than 11 Apple put it back in
    View > Show Duplicates
    Option + View > Show Exact Duplicates
    so if you are on 11 upgrade to 11.0.1 and you will have it

  • How do you delete files from iCloud WITHOUT having them deleted from devices?

    I need to delete files from iCloud WITHOUT having those files deleted from all my devices.  How do I do that?

    Just got off the phone with Apple customer service.  It seems there is no around this problem.  Once you use iCloud, you're screwed. The day you decide you don't want to have certain files store in iCloud, but you still want the files accessible on your computer, you have to spend valuable time copying/hiding a set of files on each device, and then re-setting up those same files in each device they way they should be once you delete them out of iCloud.  Same thing if you decide to cancel your lCloud account. 
    No software should have the ability to hijack your data this way.   

  • How do I delete meetings from iCal without notifying everyone?

    How do I delete meetings from iCal without notifying everyone?  I've searched the Web and the only answer that comes back is to use a product that doesn't help me with Microsoft Exchange.  This seems like a fairly simple thing to fix, but has been outstanding for 3+ years.  Really?  Am I the only person who wants to remove old meetings from an Exchange calendar without whacking the entire calendar and its appointments and without having the original participants getting spammed?
    I'm using the built-in "delete events xx days after they have passed", which you would think wouldn't do this.  Guess again.  I cannot control the fact my clients use Exchange, and it's a fairly common e-mail system for enterprises to have.  Are there any solutions?
    Thanks!

    I was just experiencing this problem on Mountain Lion. The calendar I wanted to delete was on iCloud. So, I logged into iCloud from a web browser, and selected Calendar. On the current incarnation of iCloud Calendar the calendars are listed on the left. I selected the "Edit" link at the top of that list and chose delete. It indicated that the items would be deleted, but there was nothing about notifications. Then, when I went back to iCal on my Mac, I selected the calendar to be deleted, right clicked, and slected refresh...
    ... gone.
    It probably would have disappeared on it's own eventually. I'd be curious to see if theis works for others, so please confirm.
    Good luck.

  • How do I delete email from iPhone without deleting them from my Mac

    How do I delete email from iPhone without deleting them from my Mac?

    To remove a photo from iPhoto and your Mac:
    Put it in the iPhoto Trash, then enpty it. Then empty the system trash as well
    If you want to remove a photo from iPhoto but keep it on your Mac:
    First Export the file from iPhoto (File -> Export) to whereever you want it and then go through the steps above.
    Confusion arises as the notion that you would want to remove a pic from iPhoto but keep it doesn't make a whole lot of sense. It's like saying I want to remove one address from Address Book, but still keep it on my Mac. The point of iPhoto and such apps is that they are used to manage your photos. Anything that you need to do with the pics cn be done either with or via iPhoto.

  • How Can I Delete Albums From iTunes Without It Deleting Them From My iPod

    Please help!!!!
    How Can I Delete Albums From iTunes Without It Deleting Them From My iPod classic 160GB?

    Hi, welcome to Apple Discussions.
    I assume you've already consisdered manually managing your iPod's contents and rejected that idea.
    I wouldn't recommend it as a solution, but if you delete the files for the albums leaving the entries in the iTunes library you can carry on syncing normally. iTunes will complain that it can't sync the missing files but it won't remove the copies from your iPod. Once you're happy with how things work you can can choose to suppress the error message.
    While handy as a temporary workaround if space is an issue then it's probably time to look at moving your whole library to a bigger drive.
    tt2

  • How do I delete duplicates from my photo library.  I am sure I let the duplicates happen but do not know how to get rid of them.

    How do I delete duplicates from my photo library?  I am sure I let the duplicates happen but do not know how to get rid of them.

    For dealing with duplicates in iPhoto check out Duplicate Annihilator

Maybe you are looking for

  • Keyboard & Trackpad only work before booting, USB devices also not working

    Hi, Yesterday I installed MacFuse and NTFS-3G because I needed to store some things on an external drive for work. I rebooted as was instructed in the install docs and that's when things got ugly. When on the login screen I've got no keyboard or mous

  • Java.sql.SQLException: FATAL ERROR  for DB2

    Hi In my scenario IDOC-XI-DB2, When I am getting following error message in communication channel. I have checked all the field length, they are correctly displayed. Please let me know how to resolve the same. Message processing failed. Cause: com.sa

  • G/l account no with issue posting document

    isw there any report that can give issue doc no, issue material doc no with their respective g/l code

  • Link to ping iTunes now redirects to the iTunes store

    iTunes provided a link when it accepted my podcast feed in order to ping it when I've added a new episode. I've been using it for the last 35 episodes with little trouble, usually a few hours to a day after I ping it my episode will show up in iTunes

  • Command r doesn't work

    I have a 2006 mac pro 10.7.4. I have been trying to setup a startup flash drive for drive recovery. It worked fine on the macbook pro with 10.8, but nothing happens when I start with the command and r keys depressed on the mac pro. thanks for the hel