*&---------------------------------------------------------------------*
*& Report YTEST16
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT YTEST16.
DATA: BEGIN OF WA_1 ,
CALDAY TYPE /BI0/OICALDAY,
AMOUNT TYPE /BI0/OIAMOUNT,
end of WA_1.
DATA lt_1 LIKE TABLE OF WA_1 WITH HEADER LINE.
DATA: BEGIN OF WA_2 ,
CALDAY TYPE /BI0/OICALDAY,
CALMONTH TYPE /BI0/OICALMONTH,
MAX TYPE /BI0/OIAMOUNT,
MIN TYPE /BI0/OIAMOUNT,
end of WA_2.
DATA lt_2 LIKE TABLE OF WA_2 WITH HEADER LINE.
DATA lt_3 LIKE TABLE OF WA_2 WITH HEADER LINE.
WA_1-CALDAY = '20100101'.
WA_1-AMOUNT = 1000.
MOVE WA_1 TO lt_1.
APPEND lt_1 .
CLEAR lt_1.
WA_1-CALDAY = '20100121'.
WA_1-AMOUNT = 2000.
MOVE WA_1 TO lt_1.
APPEND lt_1 .
CLEAR lt_1.
WA_1-CALDAY = '20100102'.
WA_1-AMOUNT = 1400.
MOVE WA_1 TO lt_1.
APPEND lt_1 .
CLEAR lt_1.
WA_1-CALDAY = '20100212'.
WA_1-AMOUNT = 1399.
MOVE WA_1 TO lt_1.
APPEND lt_1 .
CLEAR lt_1.
WA_1-CALDAY = '20100218'.
WA_1-AMOUNT = 1454.
MOVE WA_1 TO lt_1.
APPEND lt_1 .
CLEAR lt_1.
WA_1-CALDAY = '20100113'.
WA_1-AMOUNT = 800.
MOVE WA_1 TO lt_1.
APPEND lt_1 .
CLEAR lt_1.
CLEAR WA_1.
*LOOP AT lt_1.
*
* wa_2-calmonth = lt_1-calday(6).
* collect wa_2 into lt_3.
*
*ENDLOOP.
LOOP AT lt_1.
wa_2-calday = lt_1-calday.
wa_2-calmonth = lt_1-calday(6).
collect wa_2 into lt_3.
ENDLOOP.
*LOOP AT lt_1.
* wa_2-CALMONTH = lt_1-CALDAY+0(6).
* READ TABLE lt_2 INTO lt_2 with key CALMONTH = wa_2-CALMONTH .
* if sy-subrc ne 0.
* lt_2-calmonth = lt_1-CALDAY+0(6).
* lt_2-MAX = lt_1-amount.
* lt_2-MIN = lt_1-amount.
* APPEND lt_2.
* else.
* if lt_2-MAX < lt_1-amount.
* lt_2-max = lt_1-amount.
* modify table lt_2 from lt_2.
* elseif lt_2-min > lt_1-amount.
* lt_2-min = lt_1-amount.
* modify table lt_2 from lt_2.
* endif.
*
*
* endif.
*ENDLOOP.
*field-symbols <fs_1> like wa_2.
*
*
*
*loop at lt_3 assigning <fs_1>.
* loop at lt_1 where calday(6) = <fs_1>-calmonth.
* if <fs_1>-max < lt_1-amount.
* <fs_1>-max = lt_1-amount.
* endif.
*
* if <fs_1>-min is initial or <fs_1>-min > lt_1-amount.
* <fs_1>-min = lt_1-amount.
* endif.
* endloop.
*
*endloop.
field-symbols <fs_1> like wa_2.
loop at lt_3 assigning <fs_1>.
loop at lt_1 where calday(6) = <fs_1>-calmonth.
if <fs_1>-max < lt_1-amount.
<fs_1>-max = lt_1-amount.
endif.
if <fs_1>-min is initial or <fs_1>-min > lt_1-amount.
<fs_1>-min = lt_1-amount.
endif.
endloop.
endloop.
break-point.
loop at lt_1.
WRITE : / lt_1-CALDAY , lt_1-AMOUNT.
endloop.
loop at lt_3.
write : / lt_3-calmonth, lt_3-max, lt_3-min.
endloop.
test
最新推荐文章于 2021-05-17 15:51:43 发布