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

Work area problem

sukhbold_altanbat
Active Participant
0 Likes
407

Hi all,

I have 2 internal tables in my ABAP program.

report ztest123.

data: itab_1 type standard table of kna1,

data: wa_1 type kna1.

data: itab_2 TYPE STANDARD TABLE OF string,

data: wa_2 type string.

*populating data for itab_1

select * from kna1 into table itab_1 up to 50 rows.

*populating data for itab_2

wa_2 = 'kunnr'. append wa_2 to itab_2.

wa_2 = 'name1'. append wa_2 to itab_2.

wa_2 = 'ort01'. append wa_2 to itab_2.

*hard coded

loop at itab_1 into wa_1.

write:/ wa_1-kunnr, wa_1-name1, wa_1-ort01.

endloop.

My question is how to display value of only those fields of itab_1 which are stored in itab_2?

Thx,

Sukhbold

1 ACCEPTED SOLUTION
Read only

andreas_mann3
Active Contributor
0 Likes
389

use assign-command:

loop at itab_2 into wa_2.

concatenate 'itab_1-' wa_2 into hfield.

assign (hfield) to <fs>.

write: <fs>.

endloop.

A.

Edited by: Andreas Mann on Jan 8, 2008 12:03 PM

2 REPLIES 2
Read only

andreas_mann3
Active Contributor
0 Likes
390

use assign-command:

loop at itab_2 into wa_2.

concatenate 'itab_1-' wa_2 into hfield.

assign (hfield) to <fs>.

write: <fs>.

endloop.

A.

Edited by: Andreas Mann on Jan 8, 2008 12:03 PM

Read only

0 Likes
389

Hi Andreas,

Thanks for solving my query.

I made below changes, now it worked....

data hfield type string.

field-symbols: <FS> type any.

loop at itab_1 into wa_1.

loop at itab_2 into wa_2.

concatenate 'wa_1-' wa_2 into hfield.

assign (hfield) to <fs>.

write: <fs>, hfield.

endloop.

write:/ .

endloop.

Thx,

Sukhbold