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

internal table with out header line

Former Member
0 Likes
1,074

guyz!!!

how cud we create an internal table without header line???

i know dat we can create like

data itab occurs 0.

but how cud we pass data into it???

like...if we have two fields...empid n empname

data: empid type i,

empname(12).

how cud we pass data into internal table ITAB using external work area....like cratin an external work area wid same structure n passing

can anybody gimme d code n make me to understand???

regards,

zizu!!!

guyz!!!

how cud we create an internal table without header line???

i know dat we can create like

data itab occurs 0.

but how cud we pass data into it???

like...if we have two fields...empid n empname

data: empid type i,

empname(12).

how cud we pass data into internal table ITAB using external work area....like cratin an external work area wid same structure n passing

can anybody gimme d code n make me to understand???

regards,

zizu!!!

10 REPLIES 10
Read only

Former Member
0 Likes
1,039

Hi,

DATA: t_mara type standard table of mara.

data: s_mara type mara.

s_mara-matnr = 'test'.

append s_mara to t_mara.

Hope this works.

Thanks,

Naren

Message was edited by: Narendran Muthukumaran

Read only

Former Member
0 Likes
1,039

Hi zinaden,

data: wa_itab like itab.

select fld1 fld2 into wa_itab

from mara.

append wa_itab to itab.

clear wa_itab.

endselect.

regards,

keerthi.

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,039

Hi. You can define your internal table without a header line in the following way.

data: it001 type table of t001.

This is just the body of the table. In order to read or write data to the internal table, you need to use a work area. Use a work area that is the same type as your internal table.



data: xt001 type t001.

* or...

data: xt001 like line of it001.

You can then access the interna table and read and write to it.

Loop at it001 into xt001.
  write:/ xt001-bukrs.
endloop.

Read table it001 into xt001 with key bukrs = '0010'.
If sy-subrc = 0.
  Write:/ xt001-bukrs.
endif.

You can append records to the internal table in this way.

clear xt001.
xt001-bukrs = 'TEST'.
xt001-butxt = 'This is a test'.
append xt001 to it001.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
1,039

guyz!! dont use MARA's structure...create ya own structure by takin 2 fields n built a prog....nwayz! thnx for d reply!!!

Read only

0 Likes
1,039

Keep it real, Bro !!!!

Read only

0 Likes
1,039

Hi Ziden,

Types:

begin of ty_employee,

emp_id type i,

name type string,

sal type p decimals 2,

end of ty_employee.

To declare internal table then

<b>data it_employee type table of ty_employee.</b>

To declare work for this table then

<b>data wa_employee type ty_employee.</b>

Thanks,

Vinay

Read only

0 Likes
1,039

Then it would be very simular. This time we want to use a TYPE.



Types: begin of ttab,
       empid type i,
       empname(12) type c,
       end of ttab.

data: itab type table of ttab.
data: wa   type ttab.



wa-empid = '123456'.
wa_empname = 'Rich Heilman'.
append wa to itab.


loop at itab into wa.
  write:/ wa-empid, wa_empname.
endloop.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
1,039

<b>TYPES: BEGIN OF TY_ITAB,

NAME(10) TYPE C,

EMPNO(5) TYPE C,

END OF TY_ITAB.

*Internal table Declaration

DATA: I_TAB TYPE STANDARD TABLE OF TY_ITAB.

*Work Area

data: wa_tab type ty_itab.

wa_tab-name = 'Pra'.

wa_tab-empno = '90129'.

append wa_tab to i_tab.

clear wa_tab.

wa_tab-name = 'Pra123'.

wa_tab-empno = '12129'.

append wa_tab to i_tab.

clear wa_tab.</b>

Read only

0 Likes
1,039

Please make sure to award points for helpful answers and mark as solved as your question has been answered.

Regards,

Rich Heilman

Read only

0 Likes
1,039

Please make sure to award points for comic answers as well.