2006 Aug 10 6:44 PM
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!!!
2006 Aug 10 6:46 PM
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
2006 Aug 10 6:52 PM
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.
2006 Aug 10 6:55 PM
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
2006 Aug 10 6:56 PM
guyz!! dont use MARA's structure...create ya own structure by takin 2 fields n built a prog....nwayz! thnx for d reply!!!
2006 Aug 10 6:59 PM
2006 Aug 10 7:02 PM
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
2006 Aug 10 7:07 PM
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
2006 Aug 10 7:31 PM
<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>
2006 Aug 10 7:36 PM
2006 Aug 10 7:46 PM