<P>*&---------------------------------------------------------------------*<BR>*& Report YUSR11_Z05_013 *<BR>*& *<BR>*&---------------------------------------------------------------------*<BR>*& *<BR>*& *<BR>*&---------------------------------------------------------------------*</P>
<P>REPORT YUSR11_Z05_013 .</P>
<P>TYPES: BEGIN OF line,<BR> COL1(3) TYPE C,<BR> COL2 TYPE I,<BR> END OF line.</P>
<P>DATA<BR>ITAB LIKE STANDARD TABLE OF LINE.<BR>DATA I_IDX TYPE I.</P>
<P>PERFORM fill CHANGING ITAB.</P>
<P>PERFORM OUT USING ITAB.</P>
<P>*---------------------------------------------------------------------*<BR>* FORM FILL *<BR>*---------------------------------------------------------------------*<BR>* ........ *<BR>*---------------------------------------------------------------------*<BR>* --> F_ITAB *<BR>*---------------------------------------------------------------------*<BR>FORM FILL CHANGING F_ITAB LIKE ITAB.<BR> DATA F_LINE LIKE LINE OF F_ITAB.<BR> DO 5 TIMES.<BR> I_IDX = SY-INDEX MOD 2.<BR> IF I_IDX = 0.<BR> F_ITAB-COL1 = 'KIM'.<BR> F_ITAB-COL2 = SY-INDEX.<BR> APPEND F_ITAB.<BR> ELSE.<BR> F_ITAB-COL1 = 'LEE'.<BR> F_ITAB-COL2 = SY-INDEX.<BR> APPEND F_ITAB.<BR> ENDIF.<BR> ENDDO.<BR>ENDFORM.</P>
<P>*---------------------------------------------------------------------*<BR>* FORM OUT *<BR>*---------------------------------------------------------------------*<BR>* ........ *<BR>*---------------------------------------------------------------------*<BR>* --> VALUE(F_ITAB) *<BR>*---------------------------------------------------------------------*<BR>FORM OUT USING VALUE(F_ITAB) LIKE ITAB.<BR> DATA F_LINE LIKE LINE OF F_ITAB.<BR> LOOP AT F_ITAB INTO F_LINE.<BR> WRITE :/ F_LINE-COL1, F_LINE-COL2.<BR> ENDLOOP.<BR>ENDFORM.</P>
<P><BR>MOVE itab[] TO jtab.</P>
<P>PERFORM out TABLES jtab.</P>
<P>*---------------------------------------------------------------------*<BR>* FORM fill *<BR>*---------------------------------------------------------------------*<BR>* ........ *<BR>*---------------------------------------------------------------------*<BR>* --> F_ITAB *<BR>* --> DO *<BR>* --> 5 *<BR>* --> TIMES *<BR>*---------------------------------------------------------------------*<BR>FORM fill TABLES f_itab LIKE itab[].<BR> DO 5 TIMES.<BR> l_idx = sy-index MOD 2.<BR> IF l_idx = 0.<BR> f_itab-col1 = 'kim'.<BR> f_itab-col2 = sy-index.<BR> APPEND f_itab.<BR> ELSE.<BR> f_itab-col1 = 'LEE'.<BR> f_itab-col2 = sy-index.<BR> APPEND f_itab.<BR> ENDIF.<BR> ENDDO.<BR>ENDFORM.</P>
<P>*---------------------------------------------------------------------*<BR>* FORM out *<BR>*---------------------------------------------------------------------*<BR>* ........ *<BR>*---------------------------------------------------------------------*<BR>* --> F_ITAB *<BR>*---------------------------------------------------------------------*<BR>FORM out TABLES f_itab LIKE jtab.<BR> LOOP AT f_itab.<BR> WRITE:/ f_itab-col1, f_itab-col2.<BR> ENDLOOP.<BR>ENDFORM.</P>
<P> </P>
<P> </P>
<P>ROW 36</P>
<P>"F_ITAB" is a table without a header line and therefore has no component called "COL1".</P>
<P> </P>
<P>에러가 나네요..</P>
<P>header line 없어서 나는 에러인듯 싶은데..</P>
<P>그래서 위에 itab 에 with header line을 넣고 하였더니</P>
<P> </P>
<P>ROW 32</P>
<P>"F_ITAB" is not an internal table.</P>
<P> </P>
<P>에러가 나네요</P>
<P>REPORT YUSR11_Z05_013 .</P>
<P>TYPES: BEGIN OF line,<BR> COL1(3) TYPE C,<BR> COL2 TYPE I,<BR> END OF line.</P>
<P>DATA<BR>ITAB LIKE STANDARD TABLE OF LINE.<BR>DATA I_IDX TYPE I.</P>
<P>PERFORM fill CHANGING ITAB.</P>
<P>PERFORM OUT USING ITAB.</P>
<P>*---------------------------------------------------------------------*<BR>* FORM FILL *<BR>*---------------------------------------------------------------------*<BR>* ........ *<BR>*---------------------------------------------------------------------*<BR>* --> F_ITAB *<BR>*---------------------------------------------------------------------*<BR>FORM FILL CHANGING F_ITAB LIKE ITAB.<BR> DATA F_LINE LIKE LINE OF F_ITAB.<BR> DO 5 TIMES.<BR> I_IDX = SY-INDEX MOD 2.<BR> IF I_IDX = 0.<BR> F_ITAB-COL1 = 'KIM'.<BR> F_ITAB-COL2 = SY-INDEX.<BR> APPEND F_ITAB.<BR> ELSE.<BR> F_ITAB-COL1 = 'LEE'.<BR> F_ITAB-COL2 = SY-INDEX.<BR> APPEND F_ITAB.<BR> ENDIF.<BR> ENDDO.<BR>ENDFORM.</P>
<P>*---------------------------------------------------------------------*<BR>* FORM OUT *<BR>*---------------------------------------------------------------------*<BR>* ........ *<BR>*---------------------------------------------------------------------*<BR>* --> VALUE(F_ITAB) *<BR>*---------------------------------------------------------------------*<BR>FORM OUT USING VALUE(F_ITAB) LIKE ITAB.<BR> DATA F_LINE LIKE LINE OF F_ITAB.<BR> LOOP AT F_ITAB INTO F_LINE.<BR> WRITE :/ F_LINE-COL1, F_LINE-COL2.<BR> ENDLOOP.<BR>ENDFORM.</P>
<P><BR>MOVE itab[] TO jtab.</P>
<P>PERFORM out TABLES jtab.</P>
<P>*---------------------------------------------------------------------*<BR>* FORM fill *<BR>*---------------------------------------------------------------------*<BR>* ........ *<BR>*---------------------------------------------------------------------*<BR>* --> F_ITAB *<BR>* --> DO *<BR>* --> 5 *<BR>* --> TIMES *<BR>*---------------------------------------------------------------------*<BR>FORM fill TABLES f_itab LIKE itab[].<BR> DO 5 TIMES.<BR> l_idx = sy-index MOD 2.<BR> IF l_idx = 0.<BR> f_itab-col1 = 'kim'.<BR> f_itab-col2 = sy-index.<BR> APPEND f_itab.<BR> ELSE.<BR> f_itab-col1 = 'LEE'.<BR> f_itab-col2 = sy-index.<BR> APPEND f_itab.<BR> ENDIF.<BR> ENDDO.<BR>ENDFORM.</P>
<P>*---------------------------------------------------------------------*<BR>* FORM out *<BR>*---------------------------------------------------------------------*<BR>* ........ *<BR>*---------------------------------------------------------------------*<BR>* --> F_ITAB *<BR>*---------------------------------------------------------------------*<BR>FORM out TABLES f_itab LIKE jtab.<BR> LOOP AT f_itab.<BR> WRITE:/ f_itab-col1, f_itab-col2.<BR> ENDLOOP.<BR>ENDFORM.</P>
<P> </P>
<P> </P>
<P>ROW 36</P>
<P>"F_ITAB" is a table without a header line and therefore has no component called "COL1".</P>
<P> </P>
<P>에러가 나네요..</P>
<P>header line 없어서 나는 에러인듯 싶은데..</P>
<P>그래서 위에 itab 에 with header line을 넣고 하였더니</P>
<P> </P>
<P>ROW 32</P>
<P>"F_ITAB" is not an internal table.</P>
<P> </P>
<P>에러가 나네요</P>
다음과 같이 소스를 사용하세요~
REPORT z05_013.
TYPES: BEGIN OF line,
col1 TYPE char3,
col2 TYPE i,
END OF line.
DATA itab TYPE STANDARD TABLE OF line .
DATA l_idx TYPE i.
PERFORM fill CHANGING itab.
PERFORM out USING itab.
FORM fill CHANGING f_itab LIKE itab.
DATA f_line LIKE LINE OF itab.
DO 5 TIMES.
l_idx = sy-index MOD 2.
IF l_idx = 0.
f_line-col1 = 'KIM'.
f_line-col2 = sy-index.
APPEND f_line TO f_itab.
ELSE.
f_line-col1 = 'LEE'.
f_line-col2 = sy-index.
APPEND f_line TO f_itab.
ENDIF.
ENDDO.
ENDFORM. "fill
FORM out USING value(f_itab)
LIKE itab.
DATA f_line LIKE LINE OF f_itab.
LOOP AT f_itab INTO f_line.
WRITE: / f_line-col1, f_line-col2.
ENDLOOP.
ENDFORM. "out