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

query

HI Friends,

Please help how to write this query

in tech spec they given like this

Loop internal table Customer master Partner Functions (I_KNVP).

Read internal table Customer master Partner Functions (I_KNVP) using Partner Type (PARVW) =

‘RG’ and Sales Organization (VKORG).

in this they have loop the same table and read the same table again

could u please help how to do this

regards

harshavi

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Posted on Sep 22, 2006 at 12:38 PM

    try this..

    loop at i_knvp.
    ...
    read table i_knvp with key PARVW = 'RG'
                               VKORG = ....
    endloop.
    

    ~Suresh

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 22, 2006 at 12:40 PM

    there may be some other code after this , what did they ask to do after this

    Loop at I_KNVP.
     read table I_KNVP with key PARVW = 'RG'  VKORG = ''.
    endloop.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      hi,

      loop at i_knvp.
       ---
       read table i_knvp with key PARVW = 'RG'
                                  VKORG = ---
        if sy-subrc = 0.
         ---
        endif.
      endloop.

      when you loop at an internal table each record gets into the structure(which can be headerline or the external structure. So you need not read the interanl table again. However, if you are using at new/at end statments then you need to read it explicitly)

      you can directly write the where condition while looping .

      loop at i_knvp where key PARVW = 'RG'

      VKORG = ---

      --

      endloop.

      if will only take the records that satifies this where condition.

      Regards,

      Richa.

      Message was edited by: Richa Singh

  • author's profile photo Former Member
    Former Member
    Posted on Sep 22, 2006 at 12:46 PM

    I think it is a bit strange to do it that way but if you can specify the specs in details as to what is the final requirement, the forum might be able to suggest a better version.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 22, 2006 at 12:52 PM

    Hi Harshavi,

    It makes no sence to loop at an internal table and then have a Read on the same internal table within that loop.

    You can achieve your purpose by the following code -

    LOOP AT i_knvp INTO wa_knvp WHERE wa_knvp-parvw = 'RU'

    AND wa_knvp-vkorg = 'xyz'.

    • process the record

    ENDLOOP.

    Hope this helps!

    Regards,

    Saurabh

    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.