Application Development and Automation 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: 
Read only

code error

Former Member
0 Likes
452

CONCATENATE 'WTG0' LV_MON INTO LV_FNAME.

ASSIGN (LV_FNAME) TO <FS>.

SELECT SINGLE <FS> FROM COSP INTO LV_SAPRST

WHERE OBJNR = LV_OBJ AND GJAHR = LV_YEAR AND WRTTP = '4' AND KSTAR

= GT_INOUT-SAKNR

Error message :

Unknown column name "<FS>" . field list. . field list.

field list.

actually , if i use if command, i can do, but i want to use simple

code by fieldsymbol.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
423

I think you are mixing a few things up here. The field symbol <fs> is

now pointing at a field (that does not exist), for example WTG001.

I think the statement should be: SELECT SINGLE (lv_fname) FROM COSP INTO

<fs>

(lv_fname) is called a dynamic token and replaced at runtime by the

fieldname .

Actually, I also think the field-symbol assignment doesn't work either.

Just check the sy-subrc after the assign statement! You also need the

COSP- part of the name.

Have a look at this example:

DATA: wa_t001

TYPE t001.

DATA: tp_fieldlist TYPE string VALUE 'BUKRS'.

DATA: tp_fieldname TYPE string VALUE 'WA_T001-BUKRS'.

FIELD-SYMBOLS: <fs> TYPE ANY.

ASSIGN (tp_fieldname) TO <fs>.

IF <fs> IS ASSIGNED.

SELECT SINGLE (tp_fieldlist) FROM t001 INTO <fs>.

WRITE <fs>.

ENDIF.

Just check help on SELECT statement.

2 REPLIES 2
Read only

aabhas_wilmar
Contributor
0 Likes
423

Sashi

Try using the addition NO-GAPS (or NO GAPS) in the Concatenate statement.

Reward if it helps.

Regards,

Aabhas

Read only

Former Member
0 Likes
424

I think you are mixing a few things up here. The field symbol <fs> is

now pointing at a field (that does not exist), for example WTG001.

I think the statement should be: SELECT SINGLE (lv_fname) FROM COSP INTO

<fs>

(lv_fname) is called a dynamic token and replaced at runtime by the

fieldname .

Actually, I also think the field-symbol assignment doesn't work either.

Just check the sy-subrc after the assign statement! You also need the

COSP- part of the name.

Have a look at this example:

DATA: wa_t001

TYPE t001.

DATA: tp_fieldlist TYPE string VALUE 'BUKRS'.

DATA: tp_fieldname TYPE string VALUE 'WA_T001-BUKRS'.

FIELD-SYMBOLS: <fs> TYPE ANY.

ASSIGN (tp_fieldname) TO <fs>.

IF <fs> IS ASSIGNED.

SELECT SINGLE (tp_fieldlist) FROM t001 INTO <fs>.

WRITE <fs>.

ENDIF.

Just check help on SELECT statement.