2008 Mar 28 5:59 AM
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
2008 Mar 28 6:04 AM
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
2008 Mar 28 6:04 AM
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
2008 Mar 28 6:06 AM
2008 Mar 28 6:08 AM
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.
2008 Mar 28 6:10 AM
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.
2008 Mar 28 6:36 AM
Thank you so much.
The answer was AT NEW XX and ENDAT.
You guys reminded me not to forget this.
| User | Count |
|---|---|
| 6 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |