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

SYNTEX FOR TABLE TYPE FOR A STRUCTURE

Former Member
0 Likes
1,229

Hi friends,

can anyon tell me how to create a table type through syntex in SE 38 . I have one structure . Now I need to create one table type . Can anyone help me regarding that ?

Hi friends,

can anyon tell me how to create a table type through syntex in SE 38 . I have one structure . Now I need to create one table type . Can anyone help me regarding that ?

10 REPLIES 10
Read only

Former Member
0 Likes
1,143

Let's say your structure is named "my_struct".

Try coding

TYPES: table_type TYPE STANDARD TABLE OF my_struct.

Hope it helps.

Avraham

Edited by: Avraham Kahana on Jul 29, 2008 12:51 PM

Read only

Former Member
0 Likes
1,143

DATA: BEGIN OF ITAB OCCURS 0.

INCLUDE STRUCTURE MARA.

DATA: END OF ITAB .

OR

TYPES: BEGIN OF TY_ITAB ,

MATNR LIKE MARA-MATNR,

MEINS LIKE MARA-MEINS,

END OF TY_ITAB .

DATA: ITAB TYPE STANDARD TABLE OF TY_ITAB WITH HEADER LINE .

Read only

Former Member
0 Likes
1,143

Hi,

Please go through the following link, It gives detailed procedure of creating a Table Type from ABAP coding,

[http://help.sap.com/saphelp_nw70/helpdata/en/fc/eb340d358411d1829f0000e829fbfe/content.htm]

Read only

Former Member
0 Likes
1,143

hi,

data : begin of fs_data,

matnr like mara-matnr,

end of fs_data.

data : t_data type standard table of fs_data .

Read only

Former Member
0 Likes
1,143

if your structure name is ty_itab

data it_table type standard table of ty_itab.

Read only

Former Member
0 Likes
1,143

Hi,

Table type is nothing but an internal table.

We can declare it as

types:

it_tab type standard table of spfli.

Read only

Former Member
0 Likes
1,143

Hi Gaurab,

say zstruc is ur sturcture in the program,proceed as below:

data:lt_table type standard table of zstruc,

wa_table type zstruc.

Here,

lt_table = internal table

wa_table = work area

Based on the type of table you need you can replace "STANDARD" in the above code with "SORTED" & "HASHED"

Have A Nice Day

Chaitanya.

Read only

Former Member
0 Likes
1,143

Hi,

you can define a table from type in the following way

TYPES: BEGIN OF t_mara ,

MATNR TYPE ZMARA-MATNR,

MTART TYPE ZMARA-MTART,

MATKL TYPE ZMARA-MATKL,

MEINS TYPE ZMARA-MEINS,

SPRAS TYPE ZMAKT-SPART,

MAKTX TYPE ZMAKT-MAKTX,

WERKS TYPE ZMARC2-WERKS,

CURRENCY TYPE ZMARC2-CURRENCY,

END OF t_mara.

DATA IT_TAB TYPE STANDARD TABLE OF t_mara WITH HEADER LINE .

Thanks & Regards

Ashu Singh

Read only

Former Member
0 Likes
1,143

hi

use this

types: begin of itab1.
include structure VBdpa.
types: end of itab1.

*here we have declared the table type here* 

types: itab2 type standard table of itab1.

Cheers

Snehi

Read only

Former Member
0 Likes
1,143

try this piece of code...

this is the user defined data type..

Types: begin of ty_vbak,

vbeln type vbak-vbeln,

auart type vbak-auart,

end of ty_vbak.

data: it_vbak type table of ty_vbak,

wa_vbak type ty_vbak.

select vbeln auart from vbak into table it_vbak upto 20 rows.

loop at it_vbak into wa_vbak.

write:/ wa_vbak-vbeln,

wa_vbak-auart.

endloop.