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: 

Field symbols are not asssigned

Former Member
0 Kudos

Hi all,

I have to us field symbols instead of work area, i am getting an error as field symbols are not assigned,

This is how i declared filed symbols.

DATA:TS_BKPF TYPE TABLE OF y_bkpf ,

FIELD-SYMBOLS: <fs_y_bkpf> TYPE ANY TABLE.

.FIELD-SYMBOLS: <fs> TYPE y_bkpf.

.

.

.

.

LOOP AT ts_bkpf ASSIGNING <fs>.

    e_struct1-bukrs = <fs>-bukrs.

when i debug, fs has no value assigned to it.

Please Help.

6 REPLIES 6

Former Member
0 Kudos


Hi Anisha,

This error could be due type mismatch of structures y_bkpf and ts_bkpf. Declare <fs> as TYPE ANY and try again.

Thanks,

Leena

Former Member
0 Kudos

Hello,

  1. IF ts_bkpf IS NOT INITIAL.
  2.   LOOP AT ts_bkpf ASSIGNING <fs>.
  3.     e_struct1-bukrs = <fs>-bukrs.
  4.   ENDLOOP.
  5. ELSE.
  6.   WRITE: 'The table TS_BKPF is empty'.
  7. ENDIF.

SharathSYM
Contributor
0 Kudos

Hi Anisha,

If you are working in ABAP 7.40, you could use the new pattern:-

LOOP AT t_bkpg ASSIGNING FIELD-SYMBOLS(<fs>).

ENDLOOP.

Could you please list the structure type y_bkpf fields?

Check if the <fs> is assigned.

IF <FS> IS ASSIGNED.

     e_struct1-bukrs = <fs>-bukrs.

ENDIF.

Thanks,

Sharath

Former Member
0 Kudos

Declare as below and try,

Field-Symbols:<fs> like line of ts_bkpf.

loop at ts_bkpf assigning <fs>.

     e_struct1-bukrs = <fs>-bukrs.

endloop.

Also check if the table ts_bkpf is not initial.

Hope this helps.

raphael_almeida
Active Contributor
0 Kudos

Anisha


That question has already received several positive response, I believe that can already be closed.

You should make a check on ts_bkpf internal table if it is empty, does not enter the loop.

The declaration of the field symbol is either declared as:

field-symbols <fs> type y_bkpf.

or

field-symbols <fs> like line of ts_bkpf.

In both situations will be handled as a line.


BR,


Raphael Pacheco.

Former Member
0 Kudos

Hi Anisha,

if ts_bkpf is initial.: then it will go in short dump.

after loop statement.

if its initial then assing some dummy value, later u can unassign that.