REPORT z_dong_standard_list .
DATA: BEGIN OF LINE,
COL1 TYPE C,
COL4 TYPE C,
COL2 TYPE I,
COL3 TYPE I,
END OF LINE.
DATA ITAB LIKE LINE OCCURS 10.
LINE-COL1 = 'A'.
LINE-COL4 = 'A'.
DO 3 TIMES.
LINE-COL2 = SY-INDEX.
LINE-COL3 = SY-INDEX ** 2.
APPEND LINE TO ITAB.
ENDDO.
LINE-COL1 = 'B'.
LINE-COL4 = 'B'.
DO 3 TIMES.
LINE-COL2 = 2 * SY-INDEX.
LINE-COL3 = ( 2 * SY-INDEX ) ** 2.
APPEND LINE TO ITAB.
ENDDO.
LINE-COL1 = 'A'.
LINE-COL4 = 'B'.
DO 3 TIMES.
LINE-COL2 = SY-INDEX.
LINE-COL3 = SY-INDEX ** 2.
APPEND LINE TO ITAB.
ENDDO.
* SORT ITAB BY COL4 ASCENDING.
LOOP AT ITAB INTO LINE.
WRITE: / LINE-COL1, LINE-COL2, LINE-COL3,LINE-COL4.
* AT NEW COL4.
** SUM.
* ULINE.
* write : sy-tabix.
* WRITE: / LINE-COL1, LINE-COL2, LINE-COL3,LINE-COL4.
* SKIP.
* ENDAT.
* AT END OF COL4.
** SUM.
* ULINE.
* write : sy-tabix.
* WRITE: / LINE-COL1, LINE-COL2, LINE-COL3,LINE-COL4.
* SKIP.
* ENDAT.
* AT FIRST.
** SUM.
* ULINE.
* write : sy-tabix.
* WRITE: / LINE-COL1, LINE-COL2, LINE-COL3,LINE-COL4.
* ENDAT.
* AT last.
** SUM.
* ULINE.
* write : sy-tabix.
* WRITE: / LINE-COL1, LINE-COL2, LINE-COL3,LINE-COL4.
* ENDAT.
ENDLOOP.
DATA : LINE1 LIKE LINE,
ITAB1 LIKE TABLE OF LINE,
z_index type i.
*clear line.
*clear line1.
*clear itab1.
*clear z_index.
*sort itab by col1 ASCENDING col4 ASCENDING.
*LOOP AT ITAB INTO LINE.
*
*if sy-tabix = 1.
* line1 = line.
* append line1 to itab1.
* z_index = z_index + 1.
* CONTINUE.
* endif.
*
* if line1-col1 = line-col1
* and line1-col4 = line-col4.
* if line1-col2 > line-col2.
* line1-col2 = line-col2.
* endif.
* if line1-col3 < line-col3.
* line1-col3 = line-col3.
* endif.
* MODIFY itab1 from line1 INDEX z_index TRANSPORTING col2 col3.
* else.
* line1 = line.
* append line to itab1.
* z_index = z_index + 1.
* endif.
*
* clear line.
*
*ENDLOOP.
*
*DATA : DD1 TYPE I,
* DD2 TYPE I,
* NAME1 TYPE C,
* NAME2 TYPE C.
*sort itab by col1 ASCENDING col4 ASCENDING.
*
*clear z_index.
*loop at itab into LINE.
* NAME1 = LINE-COL1.
* NAME2 = LINE-COL4.
* DD1 = LINE-COL2.
* DD2 = LINE-COL3.
* at new col4.
* line1-col2 = DD1.
* line1-col3 = DD2.
* endat.
*
* if line1-col2 >= LINE-COL2.
* line1-col2 = LINE-COL2.
* endif.
* if line1-col3 =< LINE-COL3.
* line1-col3 = line-COL3.
* endif.
*
* at end of col4.
* line1-col1 = NAME1.
* line1-col4 = NAME2.
* line1-col2 = line1-col2 .
* line1-col3 = line1-col3.
* append line1 to itab1.
* endat.
* clear LINE.
* endloop.
* loop at ITAB1 into line1.
* WRITE : / line1-COL1,line1-COL4,line1-COL2,line1-COL3.
* endloop.
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/13973563/viewspace-752283/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/13973563/viewspace-752283/