Skip to Content
author's profile photo Former Member
Former Member

Query on internal tables

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

I already did

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.

Add a comment
10|10000 characters needed characters exceeded

Related questions

7 Answers

  • Posted on Sep 26, 2005 at 12:29 PM

    Look at the following :

    *_ Selection of Data
    Select * from mkpf into corresponding fields of table itab.
    
    * Declaration
    data : dtab like itab occurs 0 with header line.
    
    *_ Filtering data
    loop at itab where matnr in material and werks in plant.
    move-corresponding itab to dtab.
    append dtab.
    endloop.
    
    
    * Here is the output Section !
    LOOP AT dbtab.
      WRITE : / dbtab.
    ENDLOOP.

    Message was edited by: Guillaume Garcia

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 26, 2005 at 12:39 PM

    Hi Mave,

    If u use read table command then it will read only once so u have to keep that command in a loop .If u want to do in other way u can do by using select statment.

    Can you please tell me how you have defined the internal table.

    Message was edited by: Narasimha

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 26, 2005 at 12:41 PM

    can you provide the part of the code which you wrote for this logic?

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 26, 2005 at 12:42 PM

    Hi,

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

    move-corresponding itab to dtab.

    append dtab.

    endloop.

    I think 'and condition in loop fails'.Just try to change it as

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

    move-corresponding itab to dtab.

    append dtab.

    endloop.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 26, 2005 at 12:44 PM

    Hi

    what do you exactly want to do?

    How do you want to add other rows?

    While you're looping the table you could insert other rows, but we can't now the logic you want to use:

    Do you want to add other 5 rows after 10?

    data: idx_append type i,

    idx_time type i value 1.

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

    do idx_time times.

    move-corresponding itab to dtab.

    append dtab.

    enddo.

    idx_append = idex_append + 1.

    if idx_append = 10.

    idex_time = 5.

    idex_append = 0.

    else.

    idex_time = 1.

    endif.

    endloop.

    But you should give us more details

    Max

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 26, 2005 at 01:11 PM

    Hi Mave,

    See select-option form itself an internal table.

    Hence, now you have two tables ...You can compare both with the key of material.

    Reg,

    Arpit

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 26, 2005 at 09:15 PM

    Hi Mave,

    Firstly, why don't you use the select-options on the SELECT statement? I'm not sure why you would need any other data.

    ie)

    Select * from mkpf

    . into corresponding fields of table itab

    . where field1 in so_field1.

    If you don't have all of the data yet, then you have 3 ways to do what I think you want.

    If you need to preserve the data in the itab, then you will loop it, and only process entries that have valid data ie)

    loop at itab.

    . check matnr in material.

    . check werks in plant.

    . do your processing to display the data.

    endloop.

    If you don't need to preserve the data, you can delete it up front:

    delete itab where not matnr in material.

    delete itab where not werks in plant.

    And the third way would be the way you mentioned at the bottom of your question.

    HTH,

    John

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.