‎2006 Jun 16 7:10 PM
Hello Frnds,
How to use itab without occurs 0 ... i need it for object oriented programming.
tables: mara, marc, makt.
*data :begin of itab occurs 0,
matnr type mara-matnr,
werks type marc-werks,
maktx type makt-maktx,
end of itab.
select-options : s_matnr for mara-matnr,
s_werks for marc-werks,
s_maktx for makt-maktx.
select amatnr bwerks c~maktx into table itab
from mara as a
inner join marc as b on amatnr = bmatnr
inner join makt as c on amatnr = cmatnr
where a~matnr in s_matnr and
b~werks in s_werks and
c~maktx in s_maktx.
if sy-subrc ne 0.
message 'not right' type 'I'.
endif.
‎2006 Jun 16 7:19 PM
Create a type or create a table of type some structure and create a work area when you are looping.
First type:
TYPES : begin of ty_mara,
matnr type mara-matnr,
werks type marc-werks,
maktx type makt-maktx,
end of ty_mara.
DATA : l_it_mara type table of ty_mara,
l_wa_mara type ty_mara.
Select the Records
loop at l_it_mara into l_wa_mara.
your logic
endloop.
Second Way
DATA : l_it_mara type table of mara,
l_wa_mara type mara.
Select the Records
loop at l_it_mara into l_wa_mara.
your logic
endloop.
The suggested way is to select global structures and create internal tables as this will allow you to use it in the FM/Methods interfaces.
hith
Sunil Achyut
‎2006 Jun 16 7:19 PM
Create a type or create a table of type some structure and create a work area when you are looping.
First type:
TYPES : begin of ty_mara,
matnr type mara-matnr,
werks type marc-werks,
maktx type makt-maktx,
end of ty_mara.
DATA : l_it_mara type table of ty_mara,
l_wa_mara type ty_mara.
Select the Records
loop at l_it_mara into l_wa_mara.
your logic
endloop.
Second Way
DATA : l_it_mara type table of mara,
l_wa_mara type mara.
Select the Records
loop at l_it_mara into l_wa_mara.
your logic
endloop.
The suggested way is to select global structures and create internal tables as this will allow you to use it in the FM/Methods interfaces.
hith
Sunil Achyut
‎2006 Jun 16 7:20 PM
Hi Reason,
Check this Link out and declare internal table as per your requirement.
http://help.sap.com/saphelp_erp2005/helpdata/en/fc/eb3660358411d1829f0000e829fbfe/frameset.htm
one way is using <b>TYPES</b>
i.e,
<b> TYPES :begin of it_itab,
matnr type mara-matnr,
werks type marc-werks,
maktx type makt-maktx,
end of itab.
DATA : itab type standard table of it_itab.</b>
Regards,
Santosh
‎2006 Jun 16 7:37 PM
Hi reson,
types :begin of itab,
matnr type mara-matnr,
werks type marc-werks,
maktx type makt-maktx,
end of itab.
data : it_tab type standard table of itab with header line.This is what ur asking reson.
Thanks
Vikranth Khimavath
‎2006 Jun 16 7:46 PM
HI RESON,
<b>types :begin of itab,
matnr type mara-matnr,
werks type marc-werks,
maktx type makt-maktx,
end of itab.
data : itab1 type standard table of itab.</b>
hope this helps,
priya.