Skip to Content
0
Former Member
Nov 24, 2005 at 11:34 AM

Need help in select statement

44 Views

hi all

i am stuck at one point i am selecting values from vbrk ainto one internal table and then putting loop on Internal table. and then i have to match the vbeln from bseg table with internal table value. but it taking long time more then 10 min. plz help i am attaching the code also..

SELECT vkorg kunag fkart vbeln erdat netwr FROM vbrk INTO TABLE t_itab

WHERE vkorg IN s_vkorg

AND kunag IN s_kunag

AND fkart IN s_fkart

AND erdat IN s_erdat.

CHECK sy-subrc EQ 0.

LOOP AT t_itab.

SELECT vbeln FROM bseg INTO table t_bseg

WHERE vbeln eq t_itab-vbeln

AND bschl EQ '01'

AND augbl EQ ''.

CHECK sy-subrc EQ 0.

loop at t_bseg.

MOVE: t_itab-kunag TO t_final-kunag,

t_itab-fkart TO t_final-fkart,

bseg-vbeln TO t_final-vbeln,

t_itab-erdat TO t_final-erdat,

t_itab-netwr TO t_final-netwr.

APPEND t_final.

*check sy-subrc eq 0.

SELECT SINGLE name1 FROM kna1 INTO t_final-name1

WHERE kunnr = t_final-kunag.

APPEND t_final.

i hope i am clear what i have to do...

i have to get data from vbrk and then i have to match vbrk-vbeln by bseg vbeln for exsisting document no.

plz help me

its urgent

thanks in advance