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

Threding problem

Former Member
0 Likes
624

Hi ABAP Gurus,

Now i'm facying the problem of kunnr repitition and according to KUNNR other fields also goes to repet.Pls help me.

Thanks & Regards

Atul

TABLES : kna1.

DATA : BEGIN OF project,

ort01 TYPE kna1-ort01, "customer city

kunnr TYPE kna1-kunnr, "customer code

name1 TYPE kna1-name1, "customer name

stras TYPE kna1-stras, "customer street

pstlz TYPE kna1-pstlz, "city zip-code

END OF project.

DATA itab LIKE project OCCURS 0 WITH HEADER LINE.

SELECTION-SCREEN : BEGIN OF BLOCK blk1 WITH FRAME TITLE t1.

SELECT-OPTIONS : customer FOR kna1-kunnr.

SELECTION-SCREEN : END OF BLOCK blk1.

INITIALIZATION.

t1 = 'Customer List'.

customer-low = '1410'.

customer-high = '2410'.

APPEND customer.

START-OF-SELECTION.

SELECT kunnr name1 stras ort01 pstlz INTO CORRESPONDING FIELDS OF TABLE itab FROM kna1

WHERE kunnr IN customer.

END-OF-SELECTION.

SORT itab BY ort01.

LOOP AT itab.

AT NEW ort01.

WRITE : /1 sy-vline, 'city:-', 8 itab-ort01,

35 sy-vline,

90 sy-vline,

100 sy-vline.

WRITE : /1(100) sy-uline.

ENDAT.

LOOP AT itab WHERE ort01 = itab-ort01.

WRITE : /1 sy-vline, 21 itab-kunnr,

35 sy-vline, 36 itab-name1,

90 sy-vline, 91 itab-pstlz,

100 sy-vline.

WRITE : / sy-vline, 35 sy-vline, 50 itab-stras, 90 sy-vline, 100 sy-vline.

ENDLOOP.

ENDLOOP.

4 REPLIES 4
Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
606

Hello Atul,

What exactly is your requirement?

Please close your [Previous Post|; or continue with it.

Do you want to print only unique records ?

BR,

Suhas

Edited by: Suhas Saha on Jan 30, 2009 11:56 AM

Read only

Former Member
0 Likes
606

Hi,

After sort of internal table use,

DELETE ADJACENT DUPLICATES FROM itab BY COMPARING ALL FIELDS.

Read only

Former Member
0 Likes
606

Hey,

See ur previous post i gave the solution for ur problem,

Thanks.

Read only

Former Member
0 Likes
606

You are looping your table itab twice that why data is repiting

do it this way:

END-OF-SELECTION.

SORT itab BY ort01." kunnr.
LOOP AT itab.
AT NEW ort01.
*AT NEW kunnr.
WRITE : /1 sy-vline, 'city:-', 8 itab-ort01,
35 sy-vline,
90 sy-vline,
100 sy-vline.
WRITE : /1(100) sy-uline.
ENDAT.

*LOOP AT itab WHERE ort01 = itab-ort01. " remove this

WRITE : /1 sy-vline, 21 itab-kunnr,
35 sy-vline, 36 itab-name1,
90 sy-vline, 91 itab-pstlz,
100 sy-vline.
WRITE : / sy-vline, 35 sy-vline, 50 itab-stras, 90 sy-vline, 100 sy-vline.

*ENDLOOP.       " remove this 
ENDLOOP.

With luck,

Pritam.