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 statment

Former Member
0 Likes
668

Giving below is my select statement. Plz check it and tel;l is itr right or do i need to add anything else into this.

data: wa_bkpf like bkpf.

select single * from bkpf into wa_bkpf where belnr = p_belnr.

select * from bseg into corresponding fields of table itab

where belnr = wa_bkpf-belnr.

loop at itab where belnr = wa_bkpf-belnr.

endloop.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
634

Hi,

If you have company code & year then you can give it in the BKPF select..

Thanks,

Naren

5 REPLIES 5
Read only

Former Member
0 Likes
635

Hi,

If you have company code & year then you can give it in the BKPF select..

Thanks,

Naren

Read only

Former Member
0 Likes
634

Hi AbhaySingh,

May i know what's your problem?

From,

KK

Read only

Former Member
0 Likes
634

Hi,

All your staetment are correct.

But for the 'for loop' , no need to write the condition 'belnr = wa_bkpf-belnr'.

For the table itab you will get the records which will satisfy the condition

belnr = wa_bkpf-belnr only.

Regards,

Balakrishna.N

Read only

Former Member
0 Likes
634

hi,

chk this way.

tables : bkpf,bseg.

data: wa_bkpf like bkpf,
      p_belnr like bseg-belnr.

data : Begin of itab occurs 0.
         include structure bseg.
data : end of itab.
*avoid INTO CORRESPONDING

select * from bseg into table itab where belnr = p_belnr.

if itab[] is not initial.

loop at itab.
endloop. 

endif.

Regards

Reshma

Read only

Former Member
0 Likes
634

HI,

In the BKPF select you have to pass Company code and fiscal year, since you are using select single (full key has to give).

Same will pass in the BSEG also.

No need to use the Where condition in the loop.

Regards

Sabu