Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Duplicate Store Numbers

Former Member
0 Likes
1,382

Hi,

I have to give the list of duplicate store numbers from EDPAR table, Store Num is INPNR. Please help me to solve this.

Thanks,

Veni.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,353

Hello

Try this

select * into corresponding fields of t_edpar from edpar.

sort t_edpar by inpnr.

Gabriel

10 REPLIES 10
Read only

Former Member
0 Likes
1,353

Veni,

Use transaction se16 to display the data in this table and sort by INPNR.

Dawn

Read only

Former Member
0 Likes
1,354

Hello

Try this

select * into corresponding fields of t_edpar from edpar.

sort t_edpar by inpnr.

Gabriel

Read only

0 Likes
1,353

Hi,

Thank you Dawn & Gabriel.

I went in to se16 and sorted on store num, but the table has 21,000 rows for single customer. The user wants only the list of duplicate store numbers, so I manually took all duplicate store numbers from SE16 values and copied in to Excel file and gave to user. Is there any way we can get the info of duplicate store numbers (by mistake entered twice or thrice by user).

Thanks,

Veni.

Read only

0 Likes
1,353

Hello,

Is it only once or many times?

afer the code i gave you you can:

Delete adjacent duplicates from t_edpar.

You will get a list of all the rows on your table w/out duplicates.

and then download the table to you pc...

hope this helps...

Gabriel

Message was edited by:

Gabriel Fernando Pulido V.

Read only

0 Likes
1,353

Hi,

You can create an ABAP report displaying the store numbers for the user which are duplicated.

Selection screen parameter can be 'Username'.

select * from EDPAR into gt_edpar where kunnr = selection screen parameter.

sort gt_edpar by INPNR.

gt_edpar_temp[] = gt_edpar[].

delete adjacent duplicates from gt_edpar comparing inpnr.

loop at gt_edpar_temp into wa_edpar_temp.

read table gt_edpar into wa_edapr with key

inpnr = wa_edpar_temp-inpnr.

if sy-subrc = 0.

wa_final-inpnr = wa_edapr-inpnr.

append wa_Final to gt_final.

endif.

endloop.

This table gt_final will give you the records/store numbers that are duplicated.

I hope this helps you.

Thanks,

Seema Dakle

Read only

0 Likes
1,353

Hi Seema,

It is displaying all store numbers, instead of duplicate store numbers. I am attaching the program. Please look at it once.

I will appritiate your help.

Thanks,

Veni.


REPORT ZSD_ADDCHG NO STANDARD PAGE HEADING
       LINE-SIZE 132
       LINE-COUNT 60.

TABLES: EDPAR.

TYPES: BEGIN OF type_final,
         KUNNR LIKE EDPAR-KUNNR,   "Customer Number
         INPNR LIKE EDPAR-INPNR.   "Store Number
TYPES: END OF type_final.

TYPES: BEGIN OF TYPE_EDPAR.
        INCLUDE STRUCTURE EDPAR.
TYPES: END OF TYPE_EDPAR.

* Internal tables

DATA: gt_edpar TYPE STANDARD TABLE OF type_edpar,
      gt_edpar_temp TYPE STANDARD TABLE OF type_edpar,
      gt_final TYPE STANDARD TABLE OF type_final.

* Work areas

DATA: wa_edpar_temp TYPE type_edpar,
      wa_edapr TYPE type_edpar,
      wa_final TYPE type_final.

* Selection Screen

SELECTION-SCREEN BEGIN OF BLOCK one WITH FRAME TITLE text-001.

PARAMETERS: p_kunnr LIKE edpar-kunnr OBLIGATORY.

SELECTION-SCREEN END OF BLOCK one.

select * from EDPAR into table gt_edpar where kunnr = p_kunnr.
sort gt_edpar by INPNR.

gt_edpar_temp[] = gt_edpar[].

delete adjacent duplicates from gt_edpar comparing inpnr.

loop at gt_edpar_temp into wa_edpar_temp.

  read table gt_edpar into wa_edapr with key
  inpnr = wa_edpar_temp-inpnr.

  if sy-subrc = 0.
    wa_final-inpnr = wa_edapr-inpnr.
    append wa_Final to gt_final.
  endif.
  clear: wa_final.
endloop.

FORMAT COLOR 1.
ULINE.
WRITE:/1 'DUPLICATE STORE NUMBERS FOR'.
WRITE:30 p_kunnr.
ULINE.
WRITE:/1 'Store Number'.
ULINE.
LOOP AT gt_final INTO wa_final.
  FORMAT COLOR 2.
  WRITE:/1 wa_final-inpnr.
ENDLOOP.
FORMAT COLOR OFF.

Read only

0 Likes
1,353

Hi,

Can some one please correct me, if I am doing something wrong. It is giving me all store numbers instead of duplicate store numbers.

Thanks,

Veni.

Read only

0 Likes
1,353

Hi,

Can some one please guide me on getting the duplicate store numbers.

Thanks,

Veni.

Read only

0 Likes
1,353

Try this.


REPORT zsd_addchg NO STANDARD PAGE HEADING
       LINE-SIZE 132
       LINE-COUNT 60.

TABLES: edpar.

TYPES: BEGIN OF type_final,
         kunnr LIKE edpar-kunnr,   "Customer Number
         inpnr LIKE edpar-inpnr,   "Store Number
         count TYPE i.
TYPES: END OF type_final.

TYPES: BEGIN OF type_edpar.
        INCLUDE STRUCTURE edpar.
TYPES: END OF type_edpar.

* Internal tables

DATA: gt_edpar TYPE STANDARD TABLE OF type_edpar,
      gt_final TYPE STANDARD TABLE OF type_final.

* Work areas

DATA: wa_edapr TYPE type_edpar,
      wa_final TYPE type_final.

* Selection Screen

SELECTION-SCREEN BEGIN OF BLOCK one WITH FRAME TITLE text-001.

PARAMETERS: p_kunnr LIKE edpar-kunnr OBLIGATORY.

SELECTION-SCREEN END OF BLOCK one.

SELECT * FROM edpar
         INTO TABLE gt_edpar
        WHERE kunnr = p_kunnr.

LOOP AT gt_edpar INTO wa_edapr.
  wa_final-kunnr = p_kunnr.
  wa_final-inpnr = wa_edapr-inpnr.
  wa_final-count = 1.
  COLLECT wa_final INTO gt_final.
  CLEAR: wa_final.
ENDLOOP.

DELETE gt_final WHERE count LE 1.
FORMAT COLOR 1.
ULINE.
WRITE:/1 'DUPLICATE STORE NUMBERS FOR'.
WRITE:30 p_kunnr.
ULINE.
WRITE:/1 'Store Number'.
ULINE.
LOOP AT gt_final INTO wa_final.
  FORMAT COLOR 2.
  WRITE:/1 wa_final-inpnr.
ENDLOOP.
FORMAT COLOR OFF.

Read only

0 Likes
1,353

Thankyou Srinivas. It is givining me only duplicate store info now.

I really appritiate your help.

Regards,

Veni.