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

select statements and table declaration

Former Member
0 Likes
616

Hi all

If I dont use OCCURS 0 or WITH HEADER LINE how can i can get data in the table for eg

TYPES : BEGIN OF xit_mara,

matnr TYPE matnr,

brgew TYPE brgew,

volum TYPE volum,

wheel_width TYPE zwid,

wheel_diam TYPE zdiam,

END OF xit_mara.

DATA : it_mara TYPE TABLE OF xit_mara WITH HEADER LINE.

DATA : wa_it_mara TYPE xit_mara.

what do i write in select querry and how do i get that into a table.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
595

Hi,

TYPES : BEGIN OF xit_mara,

matnr TYPE matnr,

brgew TYPE brgew,

volum TYPE volum,

wheel_width TYPE zwid,

wheel_diam TYPE zdiam,

END OF xit_mara.

DATA : it_mara TYPE TABLE OF xit_mara .

DATA : wa_it_mara like line of it_mara.

select * into TABLE it_mara.

loop at it_mara into wa_it_mara.

endloop.

4 REPLIES 4
Read only

Former Member
0 Likes
595

Hi,

When you use SELECT stmt, let it be in any scenario, ven if you use OCCURS 0 or not,

the best syntax is:

SELECT <DB fields> from <DB Table> into table <Internal table>.

Hope this is helpful to you. If you need further information, revert back.

Reward all the helpful answers.

Regards

Nagaraj T

Read only

Former Member
0 Likes
595

Hi,

Your declaration is correct ,only thing you dont need is "WITH HEADER LINE" so remove that.

Then you can write the select as follows :

select * from mara

into table it_mara

where (your where clause )

once the records are selected in the internal table

you can either loop at it or read the internal table into a work area and process the records individualy.

regards,

Advait

Read only

Former Member
0 Likes
595

Hi,

Write as below:

DATA : it_mara TYPE STANDARD TABLE OF xit_mara.
DATA : wa_it_mara TYPE xit_mara.

SELECT <fields>
FROM <database table name>
INTO CORRESPONDING FIELDS OF TABLE it_mara.

Regards,

Raghu

Read only

Former Member
0 Likes
596

Hi,

TYPES : BEGIN OF xit_mara,

matnr TYPE matnr,

brgew TYPE brgew,

volum TYPE volum,

wheel_width TYPE zwid,

wheel_diam TYPE zdiam,

END OF xit_mara.

DATA : it_mara TYPE TABLE OF xit_mara .

DATA : wa_it_mara like line of it_mara.

select * into TABLE it_mara.

loop at it_mara into wa_it_mara.

endloop.