2008 Apr 03 10:08 PM
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>.
2008 Apr 03 11:20 PM
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,
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>.
2008 Apr 03 10:11 PM
2008 Apr 03 10:11 PM
2008 Apr 03 11:08 PM
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
2008 Apr 03 11:20 PM
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,
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |