Hi.
here is the selection criteria that i am using and the table use vrkpa i only used to map the table kna1 and vbrk.vbrk and kna1 doesnot have the direct primary key relationship.
please check and let me know wht this vrkpa is taking time and how can i improve the performance as from kna1,i am fetching data very easily while fetching nothing from vrkpa and fetching fkdat from vbrk.
the idea behind using these tables is just for one kunnr (from kna1)getting the relevant entries based on the fkdat(selection screen input field),please suggest.
SELECT kunnr
name1
land1
regio
ktokd
FROM kna1
INTO TABLE it_kna1
FOR ALL ENTRIES IN it_knb1
WHERE kunnr = it_knb1-kunnr
AND ktokd = '0003'.
IF sy-subrc = 0.
SORT it_kna1 BY kunnr.
DELETE ADJACENT DUPLICATES FROM it_kna1 COMPARING kunnr.
ENDIF.
ENDIF.
IF NOT it_kna1[] IS INITIAL.
SELECT kunnr
vbeln
FROM vrkpa
INTO TABLE it_vrkpa
FOR ALL ENTRIES IN it_kna1
WHERE kunnr = it_kna1-kunnr.
IF sy-subrc = 0.
SORT it_vrkpa BY kunnr vbeln.
ENDIF.
ENDIF.
IF NOT it_vrkpa[] IS INITIAL.
SELECT vbeln
kunrg
fkdat
kkber
bukrs
FROM vbrk
INTO TABLE it_vbrk
FOR ALL ENTRIES IN it_vrkpa
WHERE vbeln = it_vrkpa-vbeln.
IF sy-subrc = 0.
DELETE it_vbrk WHERE fkdat NOT IN s_indate.
DELETE it_vbrk WHERE fkdat NOT IN s_chdate.
DELETE it_vbrk WHERE bukrs NOT IN s_ccode.
SORT it_vbrk DESCENDING BY vbeln fkdat.
ENDIF.
ENDIF.