Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Select query

Former Member
0 Likes
558

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
517

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 .

4 REPLIES 4
Read only

Former Member
0 Likes
517

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.

Read only

Former Member
0 Likes
518

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 .

Read only

former_member585060
Active Contributor
0 Likes
517

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

Read only

Former Member
0 Likes
517

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.