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 symbol

Former Member
0 Kudos

Dear experts,

Actually in the badi Import parameter T_ACCCR is of standard table type.

I debugged and checked , T_ACCCR has the structure ty_itab.

i want to move the data from T_ACCCR into another another internal table , to do some operations.

so i have declared the Field-symbol <dyn_table> to copy the dat from T_ACCCR.

From the <dyn_table> , i wan to move it to nomal itab , i 'm getting strucked with this.

types : begin of ty_itab,

awtyp(5) type c,

awref(10) type c,

aworg(10) type c,

posnr(10) type n,

curtp(2) type c,

waers(5) type c,

istat(1) type c,

wrbtr(7) type p decimals 2,

kursf(5) type p decimals 5,

fwbas(5) type p decimals 2,

skfbt(7) type p decimals 2,

wskto(7) type p decimals 2,

end of ty_itab.

data : itab type table of ty_itab.

field-symbols: <dyn_table> type standard table,

<dyn_wa> type any .

assign T_ACCCR[] to <dyn_table>.

-


i'm getting strucked with this part----


loop at <dyn_table> assigning <dyn_wa>.

.

insert <dyn_wa> into table itab. *----


> this is not working

endloop.

your help would be appreciated.

Regards,

sabari

Edited by: sabari on Mar 6, 2009 7:39 AM

3 REPLIES 3

Former Member
0 Kudos

use APPEND

0 Kudos

It is Giving runtime error - cannot be converted

MarcinPciak
Active Contributor
0 Kudos

Hi Sabari,

Table itab has the same structure as table T_ACCCR, so you can easily copy the content with:


itab[] = t_acccr[].

But if you would like to do this via field-symbols this can be used:


TYPES: tty_itab TYPE TABLE OF ty_itab.   "table type for T_ACCCR and ITAB

DATA : itab TYPE tty_itab.

FIELD-SYMBOLS: <dyn_table> TYPE tty_itab,  "field symbols fully typed
               <dyn_wa> TYPE ty_itab.

ASSIGN t_acccr[] TO <dyn_table>.

LOOP AT <dyn_table> ASSIGNING <dyn_wa>.
  APPEND <dyn_wa> TO itab.
ENDLOOP.

As long as T_ACCCR is fully typed it is easy to copy the content, the problem would begin when table is of generic type (TYPE ANY TABLE).

Regards

Marcin