We have added search box. Key in SAP issue keyword to search
TopBottom

Announcement: wanna exchange links? contact me at sapchatroom@gmail.com.

[sap-abap] Hashed Tables Internal Table Goes to Dump

Posted by Admin at
Share this post:
Ma.gnolia DiggIt! Del.icio.us Yahoo Furl Technorati Reddit

Posted by arif_mohd_ali (SAP)
on Dec 10 at 10:02 AM
Dear all,
Due to performance problem and time limit exceed exception as the huge data is being retrieve near 35000-4000k so I have declared hashed tables as per the suggestions but now the problem is when the data is retrieved from BSAD table, it has many clearing document for 1 document maintained in the table and it now gives exception "ITAB DUPLCATE KEYS" and program goes into dump and still the performance is not a approved.

Please, could anyone help me or suggest me in this regards, thanks in advance. I enclosed some piece of data.


Internal tables declaration.

DATA :IT_BKPF TYPE HASHED TABLE OF S_BKPF WITH UNIQUE KEY BELNR BUKRS GJAHR WITH HEADER LINE,
IT_BSID TYPE HASHED TABLE OF S_BSEG1 WITH UNIQUE KEY BELNR BUKRS GJAHR WITH HEADER LINE,
IT_BSAD TYPE HASHED TABLE OF S_BSEG1 WITH UNIQUE KEY BELNR BUKRS GJAHR WITH HEADER LINE,
IT_BSIK TYPE HASHED TABLE OF S_BSEG WITH UNIQUE KEY BELNR BUKRS GJAHR WITH HEADER LINE,
IT_BSAK TYPE HASHED TABLE OF S_BSEG WITH UNIQUE KEY BELNR BUKRS GJAHR WITH HEADER LINE,
IT_BSET TYPE HASHED TABLE OF S_BSET WITH UNIQUE KEY BELNR BUKRS GJAHR BUZEI WITH HEADER LINE.


SELECT BUKRS BELNR GJAHR BUDAT BLDAT MONAT XBLNR BKTXT FROM BKPF INTO TABLE IT_BKPF
WHERE BUKRS = P_BUKRS
AND GJAHR = P_GJAHR
AND BUDAT IN S_BUDAT.
IF SY-SUBRC = 0.
IF NOT IT_BKPF[] IS INITIAL.
IF C1 = 'X' AND C2 = 'X'.
SELECT BUKRS BELNR GJAHR BUZEI HWSTE FROM BSET INTO TABLE IT_BSET
FOR ALL ENTRIES IN IT_BKPF[]
WHERE BELNR = IT_BKPF-BELNR
AND GJAHR = P_GJAHR
AND BUKRS = P_BUKRS
AND STMDT = '00000000' "HWSTE NE '0.00'
AND ( MWSKZ = 'V7' OR MWSKZ = 'O7').
ELSEIF C1 = 'X'.
SELECT BUKRS BELNR GJAHR BUZEI HWSTE FROM BSET INTO TABLE IT_BSET
FOR ALL ENTRIES IN IT_BKPF[]
WHERE BELNR = IT_BKPF-BELNR
AND GJAHR = P_GJAHR
AND BUKRS = P_BUKRS
AND STMDT = '00000000' "HWSTE NE '0.00'
AND MWSKZ = 'O7'.
ELSEIF C2 = 'X'.
SELECT BUKRS BELNR GJAHR BUZEI HWSTE FROM BSET INTO TABLE IT_BSET
FOR ALL ENTRIES IN IT_BKPF[]
WHERE BELNR = IT_BKPF-BELNR
AND GJAHR = P_GJAHR
AND BUKRS = P_BUKRS
AND STMDT = '00000000' "HWSTE NE '0.00'
AND MWSKZ = 'V7'.
ENDIF.
ENDIF.
ENDIF.

IF NOT IT_BSET[] IS INITIAL.
SELECT BELNR GJAHR BUKRS KUNNR GSBER ZUONR BUPLA SGTXT FROM BSAD INTO TABLE IT_BSAD
FOR ALL ENTRIES IN IT_BSET[]
WHERE BELNR = IT_BSET-BELNR
AND BUKRS = IT_BSET-BUKRS
AND GJAHR = IT_BSET-GJAHR.

SELECT BELNR GJAHR BUKRS KUNNR GSBER ZUONR BUPLA SGTXT FROM BSID INTO TABLE IT_BSID
FOR ALL ENTRIES IN IT_BSET[]
WHERE BELNR = IT_BSET-BELNR
AND BUKRS = IT_BSET-BUKRS
AND GJAHR = IT_BSET-GJAHR.

SELECT BELNR GJAHR BUKRS LIFNR GSBER ZUONR BUPLA SGTXT FROM BSAK INTO TABLE IT_BSAK
FOR ALL ENTRIES IN IT_BSET[]
WHERE BELNR = IT_BSET-BELNR
AND BUKRS = IT_BSET-BUKRS
AND GJAHR = IT_BSET-GJAHR.

SELECT BELNR GJAHR BUKRS LIFNR GSBER ZUONR BUPLA SGTXT FROM BSIK INTO TABLE IT_BSIK
FOR ALL ENTRIES IN IT_BSET[]
WHERE BELNR = IT_BSET-BELNR
AND BUKRS = IT_BSET-BUKRS
AND GJAHR = IT_BSET-GJAHR.
ENDIF.

IF NOT IT_BSID[] IS INITIAL.
SELECT KUNNR NAME1 NAME2 FROM KNA1 INTO TABLE IT_KNA1
FOR ALL ENTRIES IN IT_BSID[]
WHERE KUNNR = IT_BSID-KUNNR.

ENDIF.

IF NOT IT_BSAD[] IS INITIAL.
SELECT KUNNR NAME1 NAME2 FROM KNA1 APPENDING TABLE IT_KNA1
FOR ALL ENTRIES IN IT_BSAD[]
WHERE KUNNR = IT_BSAD-KUNNR.


ENDIF.

IF NOT IT_BSIK[] IS INITIAL.
* loop at it_bsak.
* move it_bsak-lifnr to i_lfa1.
* append i_lfa1.
* endloop.

SELECT LIFNR NAME1 NAME2 FROM LFA1 INTO TABLE IT_LFA1
FOR ALL ENTRIES IN IT_BSIK[]
WHERE LIFNR = IT_BSIK-LIFNR.
ENDIF.

IF NOT IT_BSAK[] IS INITIAL.
* loop at it_bsak.
* move it_bsak-lifnr to i_lfa1.
* append i_lfa1.
* endloop.
SELECT LIFNR NAME1 NAME2 FROM LFA1 APPENDING TABLE IT_LFA1
FOR ALL ENTRIES IN IT_BSAK[]
WHERE LIFNR = IT_BSAK-LIFNR.
ENDIF.

SORT IT_KNA1 BY KUNNR.
DELETE ADJACENT DUPLICATES FROM IT_KNA1 COMPARING KUNNR.

SORT IT_LFA1 BY LIFNR.
DELETE ADJACENT DUPLICATES FROM IT_LFA1 COMPARING LIFNR.
__.____._
Copyright © 2011 Toolbox.com and message author.

Toolbox.com 4343 N. Scottsdale Road Suite 280, Scottsdale, AZ 85251
View this online
  
arif_mohd_ali
SAP ABAP Helper

Posted helpful replies on 5 threads in a group to earn a Bronze Achievement
Popular White Papers

In the Spotlight
SAP BusinessObjects: Dashboards and Analytics. Learn more about this Toobox.com Marketplace online course.

_.____.__

0 comments:

Post a Comment

T r a n s l a t e to your language