cancel
Showing results for 
Search instead for 
Did you mean: 

Query on internal table

Former Member
0 Kudos

Pls any body can tell i am putting data into some internal table and doing some manupulation.

Now i want to show data from that internal table based on selection screen fields.

E.g

Select * from mkpf into corresponding fields of table itab .

now i am doing manupulation i am adding lot of rows into the internal table.

if mkpf has thrown 10 rows , iam adding another 5 rows to it.

Now based on selection screen fields i want to show the data from the internal tables so how could i do that.

eg. in selection screen

select-options : material for mkpf-matnr.

select-options : plant for mkpf-werks.

now based on this selction i want to show data from the internal table.

WhatI am doing is

read table itab with key matnr = material werks = plant.

But it is not working

Thanks and Regards

Mave

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Mave,

Use

Loop at itab where matnr in material

and werks in plant .

ENDloop.

Read Table will not work with select-option.

Cheers

Former Member
0 Kudos

hello,

Sanjay how are you ?

Please stay in touch with mails.

I have given you 10 points.

Regards

Mave

Former Member
0 Kudos

hi,

I did this thing

data : dtab like itab occurs 0 with header line.

loop at itab where matnr in material and werks in plant.

move-corresponding itab to dtab.

endloop.

but when i am executing the program with realtive inputs for which the data is present into the internal table it is not showing with the selection screen.

regards

Mave

guillaume-hrc
Active Contributor
0 Kudos

I think there is a :

APPEND dtab.

missing in your code.

The whole code should be :

DATA : dtab LIKE itab occurs 0 with header line.

LOOP AT itab WHERE matnr IN material AND werks IN plant.
MOVE-CORRESPONDING itab to dtab.
APPEND dtab.
ENDLOOP.

Answers (2)

Answers (2)

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

Select * from mkpf into corresponding fields of table itab where matnr in material and werks in plant.

If your manipulations to internal table will add only the entires based on the above selected matnr and plant,then you can code as above.No read or loop is required.

If not,you can code as below.

Select * from mkpf into corresponding fields of table itab .

loop at itab into wa

where matnr in material and werks in plant.

....

endloop.

Since material and werks are select-options,you cannot use read statement.Read statement is used if you are sure that only one entry will be retrived for the conditions given in read statement.In otherwords,if matnr and werks are key fields,then you can use read statement.

Kidnly reward points by clicking the star on the left of reply,if it helps.

Former Member
0 Kudos

if i got you right

select * from mkpf into table itab

where matnr IN material AND

werks IN plant.

regards