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

declaring field symbools

Former Member
0 Likes
691

Hi,

Can any one explain the following declarations?

Types: begin of ty_ltap,

lgnum like ltap-lgnum,

tanum like ltap-tanum,

tapos like ltap-tapos,

end of ty_ltap.

data: lt_ltap type standard table of ty_ltap,

wa_ltap type ty_ltap.

1) field-symbols: <fs_ltap> type ty_ltap.

can i use :

loop at lt_ltap into <fs_ltap>.

---

---

endloop.

when i this it gives a short dump. what is the error?

2) what is the defference if i use :

assign wa_ltap to <fs_ltap>.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
670

Hello,

You use field-symbols when you only know the name of the variables at runtime or in commands such LOOP or READ by performance reasons.

When you use FIELD-SYMBOLS the data is not transported to a work area, in case of internal tables you work directly with the record. So, be carefull when you change the keys of a record, if you're using a sorted table you can get runtime errors.

Regards,

4 REPLIES 4
Read only

b_deterd2
Active Contributor
0 Likes
670

loop at lt_tap assigning <fs_ltap> should work !

Read only

Former Member
0 Likes
670

Try


loop at lt_ltap ASSIGNING <fs_ltap>.

Read only

Former Member
0 Likes
670

DATA: new_line TYPE REF TO data.

FIELD-SYMBOLS: <fs_inttab> TYPE STANDARD TABLE.

DATA: lv_tab_name TYPE dd02l-tabname.

CREATE DATA new_line TYPE STANDARD TABLE OF (lv_tab_name).

ASSIGN new_line->* TO <fs_inttab>.

If you write the above logic then it accepts INTO otherwise until runtime it doesn't know the structure so you need to use ASSIGN statement.

Hope it clarifies.

Thanks,

Srinivas

Read only

Former Member
0 Likes
671

Hello,

You use field-symbols when you only know the name of the variables at runtime or in commands such LOOP or READ by performance reasons.

When you use FIELD-SYMBOLS the data is not transported to a work area, in case of internal tables you work directly with the record. So, be carefull when you change the keys of a record, if you're using a sorted table you can get runtime errors.

Regards,