ABAP SORT

SORT MAN1 BY HIGH WEIGHT DESCENDING.

SORT MAN1 DESCENDING BY HIGH WEIGHT.
효과가 다르다.
REPORT  YTEST20160527.
DATA:BEGIN OF MAN,
  NAME(20) TYPE C,
  HIGH TYPE P DECIMALS 2,
  WEIGHT TYPE P DECIMALS 2,
END OF MAN.

DATA: MAN1 LIKE HASHED TABLE OF MAN WITH UNIQUE KEY NAME.

MAN-NAME = 'JAY'.
MAN-HIGH = '1.68'.
MAN-WEIGHT = 120.
INSERT MAN INTO TABLE MAN1.


MAN-NAME = 'ADOLF'.
MAN-HIGH = '1.69'.
MAN-WEIGHT = 100.
INSERT MAN INTO TABLE MAN1.

MAN-NAME = 'BABO'.
MAN-HIGH = '1.70'.
MAN-WEIGHT = 130.
INSERT MAN INTO TABLE MAN1.

LOOP AT MAN1 INTO MAN.
  WRITE:/ MAN-NAME,MAN-HIGH,MAN-WEIGHT.
ENDLOOP.

SORT MAN1 BY HIGH WEIGHT DESCENDING.
SKIP.
ULINE.
LOOP AT MAN1 INTO MAN.
  WRITE:/ MAN-NAME,MAN-HIGH,MAN-WEIGHT.
ENDLOOP.

SORT MAN1 DESCENDING BY HIGH WEIGHT.
SKIP.
ULINE.
LOOP AT MAN1 INTO MAN.
  WRITE:/ MAN-NAME,MAN-HIGH,MAN-WEIGHT.
ENDLOOP.

결과는 다음과 같습니다.
결론:
SORT MAN1 BY HIGH WEIGHT DESCENDING.--------------------WEIGHT 필드만 내림차순, 기타 필드 또는 기본 오름차순
SORT MAN1 DESCENDING BY HIGH WEIGHT.--------------------BY 뒤에 있는 모든 필드는 내림차순입니다.
여러 필드 정렬

좋은 웹페이지 즐겨찾기