아래가 교제 소스인데요~
REPORT z10_12.
PARAMETERS : p_tname(30) DEFAULT 'SFLIGHT'.
DATA: dref TYPE REF TO data.
FIELD-SYMBOLS: <fs1> TYPE ANY , <fs2> TYPE ANY.
CREATE DATA dref TYPE (p_tname).
ASSIGN dref->* TO <fs1>.
SELECT * FROM (p_tname) INTO <fs1> UP TO 3 ROWS.
DO.
ASSIGN COMPONENT sy-index OF STRUCTURE <fs1> TO <fs2>.
IF sy-subrc NE 0.
SKIP.
EXIT.
ENDIF.
WRITE: <fs2>.
ENDDO.
ENDSELECT.
*-------------------------------------------------------------------------*
요즘 SELECT~ENDSELECT 잘안쓰짆아요~
그래서 제가 살짝 고쳐봤는데,
FIELD-SYMBOLS <FS1> TYPE ANY TABLE.
FIELD-SYMBOLS <FS2> TYPE ANY.
FIELD-SYMBOLS <FS3> TYPE ANY.
DATA : DREF1 TYPE REF TO DATA.
PARAMETERS : P_TNAME TYPE CHAR30.
CREATE DATA DREF1 TYPE TABLE OF (P_TNAME).
ASSIGN DREF1->* TO <FS1>.
SELECT *
FROM (P_TNAME)
INTO CORRESPONDING FIELDS OF TABLE <FS1>
UP TO 10 ROWS.
LOOP AT <FS1> ASSIGNING <FS2>.
DO.
ASSIGN COMPONENT SY-INDEX OF STRUCTURE <FS2> TO <FS3>.
IF SY-SUBRC NE 0.
SKIP.
EXIT.
ENDIF.
WRITE : <FS3>.
ENDDO.
ENDLOOP.
FIELD-SYMBOLS <FS2> TYPE ANY.
FIELD-SYMBOLS <FS3> TYPE ANY.
DATA : DREF1 TYPE REF TO DATA.
PARAMETERS : P_TNAME TYPE CHAR30.
CREATE DATA DREF1 TYPE TABLE OF (P_TNAME).
ASSIGN DREF1->* TO <FS1>.
SELECT *
FROM (P_TNAME)
INTO CORRESPONDING FIELDS OF TABLE <FS1>
UP TO 10 ROWS.
LOOP AT <FS1> ASSIGNING <FS2>.
DO.
ASSIGN COMPONENT SY-INDEX OF STRUCTURE <FS2> TO <FS3>.
IF SY-SUBRC NE 0.
SKIP.
EXIT.
ENDIF.
WRITE : <FS3>.
ENDDO.
ENDLOOP.
이렇게 고쳐봤는데 괜찮나요??
예 잘 작동하고, 소스코드도 정리가 잘되었네요. 수고하셨습니다.