05-11-2015 10:55 AM
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.
05-11-2015 11:54 AM
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
05-11-2015 12:03 PM
Hello,
- IF ts_bkpf IS NOT INITIAL.
- LOOP AT ts_bkpf ASSIGNING <fs>.
- e_struct1-bukrs = <fs>-bukrs.
- ENDLOOP.
- ELSE.
- WRITE: 'The table TS_BKPF is empty'.
- ENDIF.
05-11-2015 12:15 PM
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
05-11-2015 12:21 PM
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.
05-12-2015 3:14 AM
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.
05-12-2015 9:55 AM
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.