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

No print the same value

Former Member
0 Likes
780

Hello Gurus,

I`d like to print records of Internal table.

Here is an example

Date Id number

20080328 a 123

20080329 b 456

20080329 c 789

20080329 d 321

20080330 e 654

20080330 f 987

20080401 g 357

These are the records in the Internal table.

I'd like to print there record like below.

Date Id number

20080328 a 123

20080329 b 456

c 789

d 321

20080330 e 654

f 987

20080401 g 357

which means that I want not to print the same values in Date column.

Is this related to Internal table control, WRITE or something else?

Here is code below

LOOP AT TBL_LIST INTO STR_LIST.

N = SY-TABIX - 1.

READ TABLE TBL_LIST INTO STR_LIST2 INDEX N.

WRITE: /1 ' '.

IF STR_LIST-KEIJYODT <> STR_LIST2-KEIJYODT.

WRITE: 3 STR_LIST-KEIJYODT.

ENDIF.

WRITE: 22 STR_LIST-Date,

42 STR_LIST-Id,

92 STR_LIST-Number,

HIDE STR_LIST.

ENDLOOP.

Edited by: KIM EIHWAN on Mar 28, 2008 7:01 AM

1 ACCEPTED SOLUTION
Read only

dhruv_shah3
Active Contributor
0 Likes
760

Hi,

Move the loop over the child table and then use read table for parent table with key.

And then use the Write statement for displaying.

HTH

Regards,

Dhruv Shah

Hello Gurus,

I`d like to print records of Internal table.

Here is an example

Date Id number

20080328 a 123

20080329 b 456

20080329 c 789

20080329 d 321

20080330 e 654

20080330 f 987

20080401 g 357

These are the records in the Internal table.

I'd like to print there record like below.

Date Id number

20080328 a 123

20080329 b 456

c 789

d 321

20080330 e 654

f 987

20080401 g 357

which means that I want not to print the same values in Date column.

Is this related to Internal table control, WRITE or something else?

Here is code below

LOOP AT TBL_LIST INTO STR_LIST.

N = SY-TABIX - 1.

READ TABLE TBL_LIST INTO STR_LIST2 INDEX N.

WRITE: /1 ' '.

IF STR_LIST-KEIJYODT <> STR_LIST2-KEIJYODT.

WRITE: 3 STR_LIST-KEIJYODT.

ENDIF.

WRITE: 22 STR_LIST-Date,

42 STR_LIST-Id,

92 STR_LIST-Number,

HIDE STR_LIST.

ENDLOOP.

Edited by: KIM EIHWAN on Mar 28, 2008 7:01 AM

5 REPLIES 5
Read only

dhruv_shah3
Active Contributor
0 Likes
761

Hi,

Move the loop over the child table and then use read table for parent table with key.

And then use the Write statement for displaying.

HTH

Regards,

Dhruv Shah

Read only

Former Member
0 Likes
760

HI,

Use

loop at itab.

at new v_date.

endat.

endloop.

Read only

Former Member
0 Likes
760

Hi,

please use control break statements as follows.

data : itab <your internal table>,

is like itab,

cnt like sy-tabix.

select * <table> into itab.

sort itab by date.

loop at itab.

clear is.

move-corresponding itab to is.

at new date.

clear cnt.

write : /1 date.

endat.

cnt = cnt + 1.

if cnt = 1.

write : 14 is-value1, 20 is-value2.

else.

write : /14 is-value1, 20 is-value2.

endif.

endloop.

Now your requirement will meet.

Regards,

Sankar.

Read only

former_member210123
Active Participant
0 Likes
760

data : l_date type dats. " To hold previous date.

LOOP AT TBL_LIST INTO STR_LIST.

if l_date ne STR_LIST-Date.

write : / 1 STR_LIST-Date,

42 STR_LIST-Id,

92 STR_LIST-Number.

endif.

if l_date eq STR_LIST-Date.

write : / 42 STR_LIST-Id,

92 STR_LIST-Number.

endif.

l_date = STR_LIST-Date.

endloop.

Read only

Former Member
0 Likes
760

Thank you so much.

The answer was AT NEW XX and ENDAT.

You guys reminded me not to forget this.