Skip to Content
0
Former Member
Feb 24, 2010 at 06:33 AM

Issue in Select Statement

51 Views

Dear gurus

Refer to the below code. my query takes too much time to execute can it work more faster.

SELECT *
  FROM bseg
  INTO bseg
  WHERE belnr = doc_no
  AND buzei EQ '002'
  AND gjahr EQ gjahr.
  ENDSELECT.

  SELECT * FROM payr
    INTO payr
    WHERE vblnr EQ doc_no
    AND gjahr EQ gjahr .
  ENDSELECT.

  SELECT * FROM reguh
  INTO reguh
  WHERE vblnr EQ doc_no
     AND laufd EQ payr-laufd.
  ENDSELECT.

  SELECT SINGLE adrnr INTO adrnr
  FROM lfa1
  WHERE lifnr = reguh-lifnr.

  SELECT SINGLE street INTO zcheque_struct-stras
    FROM adrc
    WHERE addrnumber = adrnr.

SELECT SINGLE landx INTO zcheque_struct-land1
  FROM t005t
  WHERE
  land1 = reguh-land1
  AND spras = 'EN'.

  SELECT SINGLE budat INTO post_date FROM bkpf
   WHERE belnr = doc_no AND gjahr EQ gjahr.

  SELECT wrbtr qbshb rebzg belnr shkzg gjahr   "Problem Comes Here it take more then 3 min's to get details"
    INTO TABLE document_tab
    FROM bseg
    WHERE augbl = payr-vblnr
    AND  belnr NE payr-vblnr AND
     augdt EQ post_date.