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

how do i correct this code ?

Former Member
0 Likes
594

Hello all,

i used this code piece,


select * from bkpf into t_bkpf where bldat in s_bldat and blart = 'KZ'.

select * from bseg into wa_bseg where belnr = t_bkpf-belnr.

append wa_bseg into t_bseg.

endselect.

endselect.

which i changed to sumthing lyke,



select * from bkpf into t_bkpf where bldat in s_bldat and blart = 'KZ'.

select * from bseg into t_bseg for all entries in t_bkpf where belnr = t_bkpf-belnr.

endselect.

endselect.

but i get nothing ... why and what is the correct code ?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
558

Select * from bkpf into table t_bkpf

where bldat in s_bldat

and blart = 'KZ'.

if sy-subrc = 0.

select * from bseg into table t_bseg

for all entries in t_bkpf

where belnr = t_bkpf-belnr.

endif.

4 REPLIES 4
Read only

Former Member
0 Likes
559

Select * from bkpf into table t_bkpf

where bldat in s_bldat

and blart = 'KZ'.

if sy-subrc = 0.

select * from bseg into table t_bseg

for all entries in t_bkpf

where belnr = t_bkpf-belnr.

endif.

Read only

Former Member
0 Likes
558

hi,

declare two work areas like wa_bkpf, wa_bseg. do like this:

select * from bkpf into wa_bkpf where bldat in s_bldat and blart = 'KZ'.

append wa_bkpf to t_bkpf.

select * from bseg into wa_bseg for all entries in t_bkpf where belnr = t_bkpf-belnr.

append wa_bseg to t_bseg.

endselect.

endselect.

Read only

Former Member
0 Likes
558

<deleted>

Message was edited by: Michael Malvey

Read only

0 Likes
558

<deleted>

Message was edited by: Michael Malvey