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

Former Member
0 Likes
791

Hi All,

I have a query regarding internal table. i want to create an internal table having fields: lfa1-lifnr , lfa1-land1 and lfb1-bukrs using the condition lfa1-lifnr = lfb1-lifnr. and want to display the output. can anyone please explain me the procedure and role of work-area in the above example.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
755

Hi,

types: begin of ty_itab,

lifnr type lfa1-lifnr,

land1 type lfa1-land1,

bukrs type lfb1-bukrs,

end of ty_itab.

data: itab type standard table of ty_itab,

wa_itab like line of itab. "Work area

start-of-selection.

"fetch data

select alifnr aland` b~bukrs into table itab

from lfa1 as a inner join lfb1 as b on alifnr = blifnr.

"Display data

loop at itab into wa_itab.

write: / wa_itab-lifnr, wa_itab-land1, wa_itab-bukrs.

endloop.

That's all...

Check this codes...

Hope this will solve ur problem...

8 REPLIES 8
Read only

Former Member
0 Likes
755

use <b>select</b> statement with <b>inner joint</b>

see ABAP help for select statement with inner join

Read only

Former Member
0 Likes
755

Hi,

Can you please be clear with your query..

regards

nazeer

Read only

Former Member
0 Likes
755

Hi..

Define itab with 3 fields u wanted..

<b>select</b> lfa1~lifnr

lfa1~land1

lfb1~bukrs

into table itab

from ( lfa1 inner join lfb1 )

on <b>lfa1lifnr = lfb1lifnr</b>.

<b>no need of work area</b> in the selecct query..

Read only

Former Member
0 Likes
755

data : begin of itab occurs 0,
            lifnr like lfa1-lifr,
            land1 like lfa1-land1,
            bukrs like lfb1-bukrs,
         end of itab.

select A~lifnr
         A~land1
         B~bukrs
         into table itab
         from lfa1 as A inner join
                lfb1 as b on
                A~lifnr eq B~lifnr.

No need to use workarea here

Read only

Former Member
0 Likes
755

hi

join lfa1 and lfb1 to fetch the required data

select alifnr aland1 b~bukrs

into table itab

from lfa1 as a inner join lfb1 as b

on alifnr = blifnr

where <conditions>.

regards,

madhu

Read only

Former Member
0 Likes
755

use os WA(work area) depends if u want to use it.

if u declare the internal tble with hearder line tgen u dont need WA

Read only

Former Member
0 Likes
756

Hi,

types: begin of ty_itab,

lifnr type lfa1-lifnr,

land1 type lfa1-land1,

bukrs type lfb1-bukrs,

end of ty_itab.

data: itab type standard table of ty_itab,

wa_itab like line of itab. "Work area

start-of-selection.

"fetch data

select alifnr aland` b~bukrs into table itab

from lfa1 as a inner join lfb1 as b on alifnr = blifnr.

"Display data

loop at itab into wa_itab.

write: / wa_itab-lifnr, wa_itab-land1, wa_itab-bukrs.

endloop.

That's all...

Check this codes...

Hope this will solve ur problem...

Read only

Former Member
0 Likes
755

Hi

Create like this.

Data: Begin of it_lfa1 occurs 0,

lifnr like lfa1-lifnr,

land1 like lfa1-land1,

End of it_lfa1.

Data: Begin of it_lfb1 occurs 0,

lifnr like lfb1-lifnr,

bukrs like lfb1-bukrs,

End of it_lfb1.

Data: Begin of it_final occurs 0,

lifnr like lfa1-lifnr,

land1 like lfa1-land1,

bukrs like lfb1-bukrs,

End of it_final.

select lifnr

land1

from lfa1

into table it_lfa1.

sort it_lfa1 by lifnr.

if not it_lfa1[] is initial.

select lifnr

bukrs

from lfb1

into table it_lfb1

for all entries in it_lfa1

where lifnr = it_lfa1-lifnr.

endif.

loop at it_lfa1.

read table it_lfb1 with key lifnr = it_lfa1-lifnr.

it_final-lifnr = it_lfa1-lifnr.

it_final-land1 = it_lfa1-land1.

it_final-bukrs = it_lfb1-bukrs.

append it_final.

endloop.

loop at it_final.

write:/ it_final-lifnr,it_final-land1,it_final-bukrs.

endloop.

I think this will solve ur problem. Here there is no need of a workarea.

Regards

Haritha.