안녕 하세요. 밑의 식
식이 너무 많아서 필드 심볼을 사용하여 라인의 수를 줄일려고 하고 있습니다.
형변환도 해야 하고 식만 프린트 되고 계산은 안되는건지 계산을 할수 있다면 어떤 방식으로
계산하여 그값이 출력되면 ALV로 뿌릴수 있는지 궁금 합니다.
질문 드립니다.
또 밑의 DO 문을
ASSIGN D_CAL TO
ENDDO.
PERFORM INPUT USING : '10', '11', '12', '13', '20', '21',
'22', '30', '31', '32', '33', '34', '35', '36', '37', '38',
'40', '41', '42', '43' ,'44','50', '51', '52'.
이런식으로 표현 했는데 구현되지 않아서 저렇게 CASE문을 썼습니다. 해결 방안이 있을까요 ??
*----- 원래 질문식
FORM WINTER.
CONCATENATE `gs_amt_fix` Z_DATE `-amt_` Y_CAL INTO E_CAL.
CONCATENATE `gs_amt_fix-amt_` Y_CAL INTO F_CAL.
ASSIGN D_CAL TO
ASSIGN E_CAL TO
ASSIGN F_CAL TO
DAT1
형변환 문제와 저식이 바로 계산 되지 않습니다.
월래의 식은 모두 CURR형인데
TYPE ANY로 선언 했습니다.
ENDFORM.
DATA: BEGIN OF gt_seq OCCURS 0,
seq(2),
END OF gt_seq.
FORM INPUT USING p_seq. "p_seq.
"clear : gt_seq-seq , p_seq.
clear gt_seq-seq. "DO 24 TIMES.
gt_seq-seq = p_seq.
APPEND gt_seq.
CLEAR : gt_seq.
"ENDDO.
ENDFORM.
FORM AUTO. " using input. "CHANGING p_a p_b p_c.
* FIELD-SYMBOLS :
* FIELD-SYMBOLS :
* FIELD-SYMBOLS :
*
**DEFINE DIVIDE_MAC.
**
** if &1 = 0. &3 = 0.
**
** else.
** &3 = ( &2 / &1 - 1 ) * 100.
** endif.
** if &DAT3 = 0. &DAT1 = 0.
**
** else.
** &DAT1 = ( &DAT2 / &DAT32 - 1 ) * 100.
** endif.
*
**end-of-definition.
*
* DATA : A_CAL(2),
* D_CAL(30),
* E_CAL(30),
* F_CAL(30),
* Z_CAL(2),
* Y_CAL(2).
*
*
* DATA : Z_DATE(2) TYPE C."LIKE P_DATE.
Z_DATE = P_DATE+4(2).
DO 24 TIMES.
ADD 1 TO A_CAL.
IF A_CAL LT 10.
CONCATENATE 'gs_amt_profit-amt_0' A_CAL INTO D_CAL.
ELSEIF A_CAL GE 10.
CONCATENATE 'gs_amt_profit-amt_' A_CAL INTO D_CAL.
ENDIF.
ENDDO.
Z_CAL = 0. " 초기화
DO 24 TIMES.
ADD 1 TO Z_CAL.
CASE Z_CAL.
WHEN 1.
CLEAR Y_CAL. Y_CAL = 10.
PERFORM WINTER.
WHEN 2.
CLEAR Y_CAL. Y_CAL = 11.
PERFORM WINTER.
WHEN 3.
CLEAR Y_CAL. Y_CAL = 12.
PERFORM WINTER.
WHEN 4.
CLEAR Y_CAL. Y_CAL = 13.
PERFORM WINTER.
WHEN 5.
CLEAR Y_CAL. Y_CAL = 20.
PERFORM WINTER.
WHEN 6.
CLEAR Y_CAL. Y_CAL = 21.
PERFORM WINTER.
WHEN 7.
CLEAR Y_CAL. Y_CAL = 22.
PERFORM WINTER.
WHEN 8.
CLEAR Y_CAL. Y_CAL = 30.
PERFORM WINTER.
WHEN 9.
CLEAR Y_CAL. Y_CAL = 31.
PERFORM WINTER.
WHEN 10.
CLEAR Y_CAL. Y_CAL = 32.
PERFORM WINTER.
WHEN 11.
CLEAR Y_CAL. Y_CAL = 33.
PERFORM WINTER.
WHEN 12.
CLEAR Y_CAL. Y_CAL = 34.
PERFORM WINTER.
WHEN 13.
CLEAR Y_CAL. Y_CAL = 35.
PERFORM WINTER.
WHEN 14.
CLEAR Y_CAL. Y_CAL = 36.
PERFORM WINTER.
WHEN 15.
CLEAR Y_CAL. Y_CAL = 37.
PERFORM WINTER.
WHEN 16.
CLEAR Y_CAL. Y_CAL = 38.
PERFORM WINTER.
WHEN 17.
CLEAR Y_CAL. Y_CAL = 40.
PERFORM WINTER.
WHEN 18.
CLEAR Y_CAL. Y_CAL = 41.
PERFORM WINTER.
WHEN 19.
CLEAR Y_CAL. Y_CAL = 42.
PERFORM WINTER.
WHEN 20.
CLEAR Y_CAL. Y_CAL = 43.
PERFORM WINTER.
WHEN 21.
CLEAR Y_CAL. Y_CAL = 44.
PERFORM WINTER.
WHEN 22.
CLEAR Y_CAL. Y_CAL = 50.
PERFORM WINTER.
WHEN 23.
CLEAR Y_CAL. Y_CAL = 51.
PERFORM WINTER.
WHEN 24.
CLEAR Y_CAL. Y_CAL = 52.
PERFORM WINTER.
ENDCASE.
ENDDO.
ENDFORM.
질문이 잘 이해가 안갑니다...
CONCATENATE `gs_amt_fix` Z_DATE `-amt_` Y_CAL INTO E_CAL. CASTING . . " DECIMALS sy-index. . " DECIMALS sy-index.
= ( DAT2 / DAT3 - 1 ) * 100.
CONCATENATE `gs_amt_fix-amt_` Y_CAL INTO F_CAL.
ASSIGN D_CAL TO
ASSIGN E_CAL TO
ASSIGN F_CAL TO
DAT1
에서 dat1,2,3가 갑자기 어디서 나온건지...