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

For All Entries Problem

Hi Experts,

I have one query. I had selected one sales order. Now I wanted to select all the partner function for that sales order.

But while using for all entries it will select only one partner function whereas that sales order having multiple partner function.

The sample code is

SELECT VBELN PARVW FROM VBPA INTO TABLE JTAB FOR ALL ENTRIES IN ITAB WHERE VBELN = ITAB-VBELN.

Please suggest.

Regards,

Poonam

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

8 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Dec 05, 2008 at 12:53 PM

    This message was moderated.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 05, 2008 at 12:54 PM

    Hi,

    Usually for all entires will give you unique entries although you hit the table with duplicate entries..

    I understand that in your case, there are duplicate VBELN and each of them have a partner assigned..

    Hence try to use some more key fields in the wherre conditons..Like item no or some field which can be used to fetch the partner...

    SELECT VBELN PARVW FROM VBPA INTO TABLE JTAB FOR ALL ENTRIES IN ITAB WHERE VBELN = ITAB-VBELN

    < > = ITAB-< >.

    Regards

    Shiva

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 05, 2008 at 01:06 PM

    Just this

    SELECT VBELN POSNR PARVW FROM VBPA INTO TABLE JTAB FOR ALL ENTRIES IN ITAB WHERE VBELN = ITAB-VBELN.

    When you use for all entries, you should select the full key. As it internally delete the duplicate values.

    Thanks

    Subhankar

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 05, 2008 at 01:35 PM

    Hi ,

    Two things...

    1) you have used the select ...for all entries syntax so after the first select query have you mentioned the conditions...

    if itab[] is not initial.

    sort itab.

    delete duplicates (if necessary in ur case).

    2) now while selecting the order from the table you have the line item details also i guess...if yes then while writing the second select query iee...

    SELECT VBELN PARVW FROM VBPA INTO TABLE JTAB FOR ALL ENTRIES IN ITAB WHERE VBELN = ITAB-VBELN.

    mention in where that line item detail also as

    SELECT VBELN PARVW FROM VBPA INTO TABLE JTAB FOR ALL ENTRIES IN ITAB WHERE VBELN = ITAB-VBELN and posnr = itab-posnr.

    Hope this will help.

    if still have any problem then do reply me.

    Regards,

    Rohan.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 05, 2008 at 01:46 PM

    HI Poonam,

    While using this for all entries you should be carefull

    either u need to select the full key or in where clause you should have the full key.

    i mean in select clause or in where clause you should give the complete key

    Regards,

    Sunil Kumar Mutyala

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 05, 2008 at 02:08 PM

    Hi Poonam,

    Partner function is item level data, so consider POSNR too while extracting partner function.

    select PONSR too into internal table ITAB before this query.

    Dont forget to check the ITAB for entries before using FOR ALL ENTRIES option.

    if ITAB[] IS NOT INITIAL.

    SELECT VBELN POSNR PARVW FROM VBPA INTO TABLE JTAB FOR ALL ENTRIES IN ITAB WHERE VBELN = ITAB-VBELN AND

    POSNR = ITAB-POSNR .

    ENDIF.

    This will solve your issue

    -Sujatha

    Edited by: Sujatha Reddy on Dec 5, 2008 3:08 PM

    Edited by: Sujatha Reddy on Dec 5, 2008 3:10 PM

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 05, 2008 at 02:54 PM

    hi poonam,

    One of the solution to your problem is to create a range table and copy all values from ITAB into it.

    Ranges: it_range for VBPA-VBELN.

    loop at itab.

    it_range-sign = 'I'.

    it_range-option = 'EQ'.

    it_range-low = itab-vbeln.

    append it_range.

    endloop.

    SELECT VBELN PARVW FROM VBPA INTO TABLE JTAB WHERE VBELN IN IT_RANGE-VBELN.

    Hope this helps!

    Mona

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 19, 2008 at 03:56 AM

    thanks

    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.