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

Select query

Hi all,

I am having a Ztable (Zacc) wih the fileds BELNR and BUKRS and we had maitained some DATA manually in the Ztable

Now i need to write an select query to fetch the DATA from BKPF tabele for all the records which are present ZTABLE

BELNR is the primary key in both the tables BKPF and Zacc

Please give me the select query

Thanks in advance

Ajay

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Oct 21, 2008 at 11:48 AM

    Hi ,

    Get the Zacc details into one internal table .Then you can use for all entries .

    ex :

    select bukrs belnr into it_bseg

    from bseg

    for all entries in zacc

    where bseg-bukrs eq zacc-bukrs .

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 21, 2008 at 11:46 AM

    treat Ztable as other standard SAP table.frst fetch data from Ztable than fire for all entries at Ztable while secting data from BKPF table.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 21, 2008 at 11:53 AM

    SELECT belnr FROM zacc INTO TABLE it_itab.

    SELECT belnr bukrs buzei FROM bseg INTO CORRESPONDING FIELDS TABLE it_bseg FOR ALL ENTRIES IN it_itab WHERE belnr = it_itab-belnr

    AND gjahr = p_gjahr.

    Regards

    Bala Krishna

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 21, 2008 at 12:12 PM

    hi

    You can use Query as....

    1.) Select BELNR BUKRS into IT_TABLE1

    FROM Ztable

    (based on Condition).

    2.) Select DATA.... into IT_TABLE2

    FROM BKPF

    FOR ALL ENTIRES in IT_TABLE1

    WHERE BELNR = IT_TABLE1-BELNR.

    Second Query will fetch all the data based on data present in ztable.

    hope this will solve your Problem.

    Regards,

    Mandeep.

    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.