Skip to Content
0
Former Member
Jul 31, 2007 at 09:31 AM

Regarding report

10 Views

hi experts,

i have made a report using 4 tables.there is no syntatic error.but when i try to execute it..it gives a short dump after 5-10 min displaying msg that execution time exceeds..m sending you the code.please check all the select queries that i hav used..n give me the related solution..

REPORT ZFI_R_VENDOR .

TABLES:BSEG,LFA1,BKPF,VBRK.

DATA: BEGIN OF ITAB OCCURS 0,

BUKRS LIKE BSEG-BUKRS,

BELNR LIKE BKPF-BELNR,

DOC LIKE BSEG-BELNR,

LIFNR LIKE BSEG-LIFNR,

BUDAT LIKE BKPF-BUDAT,

VBELN LIKE VBRK-VBELN,

ORT01 LIKE LFA1-ORT01,

PSTLZ LIKE LFA1-PSTLZ,

STRAS LIKE LFA1-STRAS,

NAME1 LIKE LFA1-NAME1,

KOART LIKE BSEG-KOART,

SHKZG LIKE BSEG-SHKZG,

DMBTR LIKE BSEG-DMBTR,

DEBIT LIKE BSEG-DMBTR,

CREDIT LIKE BSEG-DMBTR,

AMOUNT LIKE BSEG-DMBTR,

END OF ITAB.

DATA PTAB LIKE ITAB OCCURS 0 WITH HEADER LINE.

DATA:WBUDAT LIKE BKPF-BUDAT,

WABUKRS LIKE BKPF-BUKRS,

WVBELN LIKE VBRK-VBELN,

WBUKRS LIKE VBRK-BUKRS.

DATA:WCREDIT LIKE BSEG-DMBTR VALUE '0',

WDEBIT LIKE BSEG-DMBTR VALUE '0'.

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.

PARAMETER CMP_CD LIKE VBRK-BUKRS.

SELECT-OPTIONS:VENDOR FOR LFA1-LIFNR,

P_DATE FOR BKPF-BUDAT.

SELECTION-SCREEN END OF BLOCK B1.

SELECT BUDAT BUKRS FROM BKPF INTO (WBUDAT, WABUKRS) WHERE BUDAT IN P_DATE.

SELECT BUKRS VBELN FROM VBRK INTO (WBUKRS, WVBELN) WHERE BUKRS = CMP_CD.

SELECT BUKRS BELNR LIFNR KOART SHKZG DMBTR FROM BSEG INTO (ITAB-BUKRS, ITAB-DOC, ITAB-LIFNR, ITAB-KOART, ITAB-SHKZG, ITAB-DMBTR)

WHERE BUKRS = WABUKRS

AND BUKRS = WBUKRS

AND LIFNR IN VENDOR

AND KOART = 'K'.

APPEND ITAB.

ENDSELECT.

ENDSELECT.

ENDSELECT.

LOOP AT ITAB.

SELECT SINGLE NAME1 ORT01 PSTLZ STRAS FROM LFA1 INTO (ITAB-NAME1,ITAB-ORT01,ITAB-PSTLZ,ITAB-STRAS) WHERE LIFNR = ITAB-LIFNR.

MODIFY ITAB.

ENDLOOP.

LOOP AT ITAB.

SELECT SINGLE VBELN FROM VBRK INTO ITAB-VBELN WHERE BUKRS = ITAB-BUKRS.

MODIFY ITAB.

ENDLOOP.

*

SORT ITAB BY LIFNR.

LOOP AT ITAB.

IF ITAB-SHKZG = 'H'.

WCREDIT = WCREDIT + ITAB-DMBTR.

ELSEIF ITAB-SHKZG = 'S'.

WDEBIT = WDEBIT + ITAB-DMBTR.

ENDIF.

ITAB-CREDIT = WCREDIT.

ITAB-DEBIT = WDEBIT.

ITAB-AMOUNT = ITAB-CREDIT - ITAB-DEBIT.

MOVE-CORRESPONDING ITAB TO PTAB.

AT END OF LIFNR.

APPEND PTAB.

CLEAR: WCREDIT,WDEBIT.

ENDAT.

ENDLOOP.

LOOP AT PTAB.

WRITE:/ PTAB-BELNR,PTAB-BUDAT,PTAB-CREDIT,PTAB-DEBIT,PTAB-AMOUNT.

regards,

raman.