Skip to Content
-4
Jun 21, 2018 at 09:20 AM

Passing the inputs of Vbrp in standard table ( VBFA : Sales Document Flow ) giving dump

1237 Views Last edit Jun 25, 2018 at 08:45 AM 2 rev

vbfa-1.jpgvbfa-3.jpgvbfa-4.jpg

Dear All ,

Actually I have a ZReport related to the Sales .

In that particular report I am doing some optimizations so that the report can be executed for a period of 1 Year .

Before optimization the report is giving dump if executed for a period of 1 year ( 01.04.2014 to 31.03.2015) for all plants , all distribution channels and all divisions .

so with above inputs the report is giving dump .

Now I have done some optimizations in this zreport so that the run time can be improved .

What I have done is that I have replaced the select single queries within the loop with the for all entries select outside the loop.

So all queries are working fine except the select query on VBFA .It is talking a lot of time in execution then finally resulting in a dump .

Below are my select queries :-

SELECT VBELN
FKART
WAERK
VKORG
VTWEG
KNUMV
FKDAT
NETWR
KUNAG
VTWEG
XBLNR FROM VBRK INTO TABLE IT_VBRK WHERE

VBELN IN S_VBELN “ invoice no.

AND FKART IN S_FKART " Invoice type

AND FKART NOT IN ('ZG2','ZL2','ZF5','ZRE','F8')

AND VKORG = P_VKORG " sales organisation

AND VTWEG IN P_VTWEG " distribution channel

AND FKDAT IN S_DATE " date of invoice

AND KUNAG IN S_KUNAG AND

KUNRG IN S_KUNRG "Ship To Party

AND SFAKN EQ SPACE " cancelled invoices have refrence doc no. here
AND FKSTO NE 'X' " to exclude cancelled invoices

AND REGIO IN S_BLAND AND MRNKZ NE 'X'.


IF SY-SUBRC NE 0.

MESSAGE 'No Data Found' TYPE 'I'.LEAVE LIST-PROCESSING.

ENDIF.


SELECT VBELN
POSNR
FKIMG
VRKME
VGBEL
AUBEL
MATNR
ARKTX
CHARG
WERKS
KONDM
VKAUS FROM VBRP INTO TABLE IT_VBRP FOR ALL ENTRIES IN IT_VBRK WHERE VBELN = IT_VBRK-VBELN AND MATNR IN S_MAT AND SPART IN P_SPART AND CHARG IN S_CHARG AND WERKS IN P_WERKS AND KONDM IN S_MATNR .

IF SY-SUBRC NE 0.

MESSAGE 'No Data Found' TYPE 'I'.LEAVE LIST-PROCESSING.

ENDIF.

SELECT

VBELN

PARVW

KUNNR

ADRNR

FROM VBPA INTO TABLE IT_VBPA FOR ALL ENTRIES IN IT_VBRK WHERE

VBELN = IT_VBRK-VBELN AND PARVW IN ('WE','RE','RG').


SELECT

KUNNR

NAME1

NAME2

STCD3

REGIO

FROM KNA1 INTO TABLE IT_KNA1_TEMP FOR ALL ENTRIES IN IT_VBPA WHERE

KUNNR = IT_VBPA-KUNNR.



SELECT

ADDRNUMBER

STR_SUPPL1

STR_SUPPL2

STREET

CITY1

CITY2 FROM ADRC INTO TABLE IT_ADRC FOR ALL ENTRIES IN IT_VBPA WHERE ADDRNUMBER = IT_VBPA-ADRNR.

IF IT_VBRP[] IS NOT INITIAL .

Select

MATNR

WERKS

STEUC

from MARC into table IT_MARC for all entries in IT_VBRP WHERE MATNR = IT_VBRP-MATNR AND WERKS = IT_VBRP-WERKS .

select

RDOC

EXPIND

STATUS

from J_1IEXCHDR into table IT_J_1IEXCHDR FOR ALL ENTRIES IN IT_VBRP WHERE RDOC = IT_VBRP-VBELN and STATUS = 'C'.

SELECT

VBELV

VBELN

POSNN

VBTYP_N

VBTYP_V

FROM VBFA INTO TABLE IT_VBFA FOR ALL ENTRIES IN IT_VBRP WHERE VBELN = IT_VBRP-AUBEL AND
POSNN = IT_VBRP-POSNR AND

VBTYP_N = 'C' .


delete IT_VBFA where VBTYP_V <> 'G'.

ENDIF.

So I have replaced all the select single queries with for all entries in .

My issue is that only this query which is highlighted in bold is taking a lot of time and hence resulting in a dump . Time limit exceeded .

Please guide me how to fix this issue .

Secondly , If I manually check why the select query to VBFA is giving dump by entering the values which is obtained in the internal table IT_VBRP TO Standard table VBFA in the SE11 VBFA table .

Then also the standard table is also giving dump .

So I am unable to find what exactly the problem is .

vbfa-1.jpgvbfa-3.jpg

The standard table is giving the dump . I have attached the dump logs . I am unable to understand that why the standard table : VBFA is giving the dump .

Regardszsales-report-1.jpgzsales-report-2.jpg

Deep

Attachments

vbfa-1.jpg (97.6 kB)
vbfa-3.jpg (81.3 kB)
vbfa-4.jpg (88.1 kB)
zsales-report-2.jpg (111.7 kB)