728x90
반응형
DATA: BEGIN OF LS_DATA,
VRSIO LIKE Z39SD_T014-VRSIO,
KUNNR LIKE Z39SD_T014-KUNNR,
MATNR LIKE Z39SD_T014-MATNR,
NETWRC01 LIKE Z39SD_T014-NETWR01,
NETWRC02 LIKE Z39SD_T014-NETWR01,
NETWRC03 LIKE Z39SD_T014-NETWR01,
NETWRC04 LIKE Z39SD_T014-NETWR01,
NETWRC05 LIKE Z39SD_T014-NETWR01,
NETWRC06 LIKE Z39SD_T014-NETWR01,
NETWRC07 LIKE Z39SD_T014-NETWR01,
NETWRC08 LIKE Z39SD_T014-NETWR01,
NETWRC09 LIKE Z39SD_T014-NETWR01,
NETWRC10 LIKE Z39SD_T014-NETWR01,
NETWRC11 LIKE Z39SD_T014-NETWR01,
NETWRC12 LIKE Z39SD_T014-NETWR01,
KWMENG01 LIKE Z39SD_T014-KWMENG01,
KWMENG02 LIKE Z39SD_T014-KWMENG01,
KWMENG03 LIKE Z39SD_T014-KWMENG01,
KWMENG04 LIKE Z39SD_T014-KWMENG01,
KWMENG05 LIKE Z39SD_T014-KWMENG01,
KWMENG06 LIKE Z39SD_T014-KWMENG01,
KWMENG07 LIKE Z39SD_T014-KWMENG01,
KWMENG08 LIKE Z39SD_T014-KWMENG01,
KWMENG09 LIKE Z39SD_T014-KWMENG01,
KWMENG10 LIKE Z39SD_T014-KWMENG01,
KWMENG11 LIKE Z39SD_T014-KWMENG01,
KWMENG12 LIKE Z39SD_T014-KWMENG01,
END OF LS_DATA,
LT_DATA LIKE TABLE OF LS_DATA,
LT_COLLECT LIKE TABLE OF LS_DATA.
DATA : LS_DISP TYPE TYS_DISP.
* DATA : LT_DISP TYPE TABLE OF TYS_DISP.
DATA: LV_INDEX(2) TYPE N.
FIELD-SYMBOLS: <LFS_NETWR>.
FIELD-SYMBOLS: <LFS_KWMENG>.
DATA : LV_NETWR(20).
DATA : LV_KWMENG(20).
SELECT VRSIO
KUNNR
MATNR
NETWRC01
NETWRC02
NETWRC03
NETWRC04
NETWRC05
NETWRC06
NETWRC07
NETWRC08
NETWRC09
NETWRC10
NETWRC11
NETWRC12
KWMENG01
KWMENG02
KWMENG03
KWMENG04
KWMENG05
KWMENG06
KWMENG07
KWMENG08
KWMENG09
KWMENG10
KWMENG11
KWMENG12
FROM Z39SD_T014
INTO CORRESPONDING FIELDS OF TABLE LT_DATA.
LOOP AT LT_DATA INTO LS_DATA.
COLLECT LS_DATA INTO LT_COLLECT.
CLEAR LS_DATA.
ENDLOOP.
LOOP AT LT_COLLECT INTO LS_DATA.
MOVE-CORRESPONDING LS_DATA TO GS_DISP.
GS_DISP-VERSI = LS_DATA-VRSIO. "버전
DO 12 TIMES.
LV_INDEX = LV_INDEX + 1.
CONCATENATE 'LS_DATA-NETWRC' LV_INDEX INTO LV_NETWR.
ASSIGN (LV_NETWR) TO <LFS_NETWR>.
CHECK SY-SUBRC = 0.
GS_DISP-ABSMG_1 = <LFS_NETWR>. "금액
CONCATENATE 'LS_DATA-KWMENG' LV_INDEX INTO LV_KWMENG.
ASSIGN (LV_KWMENG) TO <LFS_KWMENG>.
CHECK SY-SUBRC = 0.
GS_DISP-ABSMG = <LFS_KWMENG>. "수량
APPEND GS_DISP TO GT_DISP. "LT_DISP
ENDDO.
CLEAR: LS_DATA, LV_INDEX.
ENDLOOP.
세로데이터 가로로
IF LT_DATA[] IS NOT INITIAL.
*-- Collect
LOOP AT LT_DATA INTO LS_DATA.
COLLECT LS_DATA INTO LT_PLAN.
CLEAR: LS_DATA.
ENDLOOP.
SORT LT_PLAN BY VKORG VKGRP ZMON.
*-- 세로1~12월 -> 가로 1~12월로
LOOP AT LT_PLAN INTO DATA(LS_PLAN).
MOVE-CORRESPONDING LS_PLAN TO LS_DISP.
CONCATENATE 'LS_DISP-PLAN' LS_PLAN-ZMON INTO LV_FIELD.
ASSIGN (LV_FIELD) TO <LV_FS>.
CHECK SY-SUBRC = 0.
MOVE LS_PLAN-AMT TO <LV_FS>.
AT END OF VKGRP.
APPEND LS_DISP TO GT_DISP.
ENDAT.
CLEAR : LS_PLAN, LV_FIELD.
ENDLOOP.
728x90
반응형
'ABAP' 카테고리의 다른 글
[ABAP] 문자열 자릿수만큼 split (0) | 2024.11.27 |
---|---|
[ABAP] 자주 까먹는 구문 (0) | 2024.11.27 |
[New syntax] 정리 (0) | 2023.03.02 |
[New Syntax] COLLECT (0) | 2023.03.02 |
문자열 자릿수만큼 split (0) | 2023.03.02 |
댓글