‎2007 Jul 27 6:48 PM
Hi all,
As per new versions, what is the best/correct way of declaring internal tables?
can anyone tell the syntax?
thanks
Revanth.
‎2007 Jul 27 7:03 PM
TYPES: BEGIN of my_type,
field1(1),
field2(1),
END OF my_type.
DATA i_table like standard TABLE OF my_type.
DATA wa_table like my_type.
first declare type and declare internal table with out header line and work area
regards,
srinu reddy.
‎2007 Jul 27 6:57 PM
Hi,
Please try these ...
data: it_mseg type table of mseg,
it_mkpf type table of mkpf.
data: wa_mseg type mseg,
wa_mkpf type mkpf.
or
types: begin of ty_itab,
<your fields>.
end of ty_itab.
data: itab type table of ty_itab,
wa_itab type ty_itab.
Regards,
Ferry Lianto
‎2007 Jul 27 7:01 PM
hi,
Corrrect way of declaration? what do u mean by this.
ways to declare internal tables.
1) if you want to create a intenal table same as a standard table in the database then
data : itab like standard table of vbak with header line.
2) if you want to have your own structure to your internal table the.
delcare types : this is how you shold do most of the times. to be more professional
types : begin of ty_tab,
field1,
field 2,
end of ty_tab.
data : x_tab type ty_tab.
data: itab like standard table of x_Tab with header line.
or
3) data : begin of itab occurs 0,
field1,
field 2,
end of itab.
with object oriented programming type 3 declartion is ruled out and also with header line specification is not possible in this oops scenerio you have to do like this
data : itab like standard table of vbak.
x_tab like vbak.
Thanks
Mahesh
‎2007 Jul 27 7:03 PM
TYPES: BEGIN of my_type,
field1(1),
field2(1),
END OF my_type.
DATA i_table like standard TABLE OF my_type.
DATA wa_table like my_type.
first declare type and declare internal table with out header line and work area
regards,
srinu reddy.
‎2007 Jul 27 7:23 PM
TYPES : BEGIN OF ty_tab
Fields names
END OF ty_tab.
DATA: itab TYPE STANDARD TABLE OF ty_tab INITIAL SIZE 0. " internal table
DATA: wa TYPE ty_tab. " Work Area
If u want to use Field-symbols, then
FIELD-SYMBOLS : <fs> type ty_tab.
and use like
LOOP AT itab ASSIGNING <fs>.
process <fs>.
ENDLOOP.
Reward if useful
Regards
Prax
‎2007 Jul 28 2:14 AM
E.c.c version . some rules for declaring internal tables.
<b>do not used header line.</b>
compsary used work area.
data: it_db type standard table of kna1,
wa_db type kna1.
types: begin of ty_itab,
fiel1..
2
3
end of ty_itab.
data: it_db type standard table of ty_itab,
wa_db type ty_itab.