Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Access contents of Field symbol table type generic table

calvinkarlo
Explorer
0 Kudos
428

Hi how to access a column of an internal table.

FIELD-SYMBOLS: <gfs_line>,<gfs_line1>,
<gfs_dyn_table> TYPE STANDARD TABLE ,
<fs1>.
.......

.......
LOOP AT GT_INTERN ASSIGNING FIELD-SYMBOL(<fs_int>) WHERE ROW >= 2.
Loop AT gt_component INTO ls_component.
Loop at GT_INTERN ASSIGNING FIELD-SYMBOL(<fs_col>) WHERE ROW = 1.
IF <fs_col>-col EQ <fs_int>-col.
READ TABLE T_FRT_VLD
WITH KEY Z_HEADER = <fs_col>-Value

Z_CONDTYPE = ls_component-name
ASSIGNING FIELD-SYMBOL(<fs_frtvld>).
IF sy-subrc = 0.
ASSIGN COMPONENT ls_component-name OF STRUCTURE <gfs_line> TO <fs1>.
IF <fs1> IS ASSIGNED.
<fs1> = <fs_int>-Value.
UNASSIGN <fs1>.
ENDIF.
ENDIF.
ENDIF.
CLEAR : wa_zdemo1.
ENDLOOP.
ENDLOOP.
AT END OF ROW.
APPEND <gfs_line> TO <gfs_dyn_table>.
CLEAR: <gfs_line>.
CLEAR: wa_zdemo, wa_zdemo1.
ENDAT.
ENDLOOP.
Loop at <gfs_dyn_table> ASSIGNING FIELD-SYMBOL(<fs_gfs>).
SELECT SINGLE VBELV, VBELN
FROM VBFA
INTO @DATA(TS_VBFA)
WHERE VBELV EQ @<fs_gfs>-DELIVERY
AND VBTYP_N EQ '8'
AND VBTYP_V EQ 'J'.
IF sy-subrc EQ 0.
Endloop.

I'm having an error that <fs_gfs>-DELIVERY is unknown.

2 REPLIES 2

DominikTylczyn
Active Contributor
357

Hello calvinkarlo

<fs_gfs> type is determined based on the line type of <gfs_dyn_table>. <gfs_dyn_table> is defined without any components, it is a generic table. Thus <fs_gfs> doesn't have any components either at compile time. The components appear only during runtime but the compiler has no way to know that, hence the error.

You need to access DELIVERY component of <fs_gfs> dynamically with

ASSIGN COMPONENT ... OF STRUCTURE ... TO ... .

statement.

Best regards

Dominik Tylczynski

Sandra_Rossi
Active Contributor
357

Difficult to understand your question.

You mean, you have a syntax error while activating the program (i.e. compiling) due to "<fs_gfs>-DELIVERY" (although you see that the component DELIVERY exists at runtime after compiling without the faulty SELECT statement):

            SELECT SINGLE VBELV, VBELN
            FROM VBFA
            INTO @DATA(TS_VBFA)
            WHERE VBELV EQ @<fs_gfs>-DELIVERY               
             AND VBTYP_N EQ '8'
             AND VBTYP_V EQ 'J'.

This question has been answered one hundred times in the forum, provided that you search the exact syntax error message.