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

decode please

Former Member
0 Likes
532

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.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
492

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

4 REPLIES 4
Read only

Former Member
0 Likes
493

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

Read only

Former Member
0 Likes
492

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

Read only

Former Member
0 Likes
492

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

Read only

Former Member
0 Likes
492

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.