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
1,189

Hi,

I am very new to abap. can anyone help me with this program.

data: begin of it_lfa1 occurs 10,

lifnr like lfa1-lifnr,

land1 like lfa1-lifnr,

end of it_lfa1.

data: begin of it_lfb1 occurs 10,

lifnr like lfb1-lifnr,

bukrs like lfb1-bukrs,

end of it_lfb1.

data: wa_lfa1 like line of it_lfa1,

wa_lfb1 like line of it_lfb1.

wa_lfa1-lifnr = '1000'.

wa_lfa1-land1 = 'india'.

append wa_lfa1 to it_lfa1.

write:/ sy-tabix.

loop at it_lfa1 into wa_lfa1.

write:/ it_lfa1-lifnr,

it_lfa1-land1.

endloop.

when i am executing this code the value of it_lfa1-lifnr and it_lfa1-land1 is not displayed.

please help me in resolving this issue.

regards

vivek

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,153

change to this

loop at it_lfa1 into wa_lfa1.

write:/ <b>wa_lfa1-lifnr,

wa_lfa1-land1.</b>endloop.

14 REPLIES 14
Read only

Former Member
0 Likes
1,154

change to this

loop at it_lfa1 into wa_lfa1.

write:/ <b>wa_lfa1-lifnr,

wa_lfa1-land1.</b>endloop.

Read only

0 Likes
1,153

Hi,

thank you very much for resolving this issue. can you please explain me this concept of loop, what we have used in this internal table. and why loop is required.

thanks and regards

vivek

Read only

0 Likes
1,153

When there are multiple records u need to loop at the it_lfa1 and pass each record to workarea and then write

loop at it_lfa1 into wa_lfa1.     "<--- Each record is passed to workarea
write:/ wa_lfa1-lifnr,               "< details of each record is stored in wa_lfa1
wa_lfa1-land1.
endloop.

Read only

0 Likes
1,153

hi,

thank you chandershekhar and everyone who helped me.

regards vivek

Read only

Former Member
0 Likes
1,153

Hi,

data: begin of it_lfa1 occurs 10,

lifnr like lfa1-lifnr,

land1 like lfa1-land1,

bukrs like lfb1-bukrs,

end of it_lfa1.

data: wa_lfa1 like line of it_lfa1.

wa_lfa1-lifnr = '1000'.

wa_lfa1-bukrs = '2000'.

wa_lfa1-land1 = 'india'.

append wa_lfa1 to it_lfa1.

loop at it_lfa1 into wa_lfa1.

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

endloop.

reward points if useful

regards,

Anji

Message was edited by:

Anji Reddy Vangala

Read only

Former Member
0 Likes
1,153

Hi..,

change this loop..

loop at it_lfa1 into wa_lfa1.

write:/ wa_lfa1-lifnr,

wa_lfa1-land1.

endloop.

regards,

sai ramesh

Read only

Former Member
0 Likes
1,153

or u can even change to this (remove the into <b>wa_lfa1</b>)

loop at it_lfa1.

write:/ it_lfa1-lifnr,

it_lfa1-land1.

endloop

Read only

Former Member
0 Likes
1,153

HI

use the following

<b>loop at it_lfa1 into wa_lfa1.

write:/ wa_lfa1-lifnr,

wa_lfa1-land1.

endloop.</b>

HOPE THIS WILL DEFINITELY WORK FOR U

<b>u have to use loop because ur table contains multiple records. u have to put one record from table into work area which contains single record and write that record.</b>

regards

ravish

<b>plz dont forget to reward points if helpful</b>

Message was edited by:

ravish goyal

Read only

Former Member
0 Likes
1,153

Hi

Try using work area name instead of table name in loop. I tried the same and it worked.

<b>please reward if useful</b>

Read only

former_member673464
Active Contributor
0 Likes
1,153

hi,

You are not reading the values into header line but into work area .You are trying to write those values.

regards,

veeresh

Read only

0 Likes
1,153

Hi veereshbabu,

thank you very much for resolving my problem. can u please explain me how the concept of work area works. is it always necessary to use work area to display the output of an internal table.

thanks and regards

vivek

Read only

Former Member
0 Likes
1,153

take into wa_lfa1 u`ll get it..

Read only

Former Member
0 Likes
1,153

As you are taking data from an itab to work area, the contents will be populated in work area. so use the work area to display the contents.

loop at it_lfa1 into wa_lfa1.

write:/ wa_lfa1-lifnr,

wa_lfa1-land1.

endloop.

Thanks

Sandeep

Reward if helpful

Read only

Former Member
0 Likes
1,153

Hi,

Is it possible to run two transactions in session method?and is it possible to set timing in calltransaction method(i.e i want that report in bet 10pm to something)

thax in advance