Performance Issue in ABAP part as suggested by SE30 for the below coding

Dear Abapers,
The below coding was done by my seniors and having performance issue i.e in SE30 the abap part is consuming 98% of time.
Pl. help us to solve this situation.
With best regards,
S. Arunachalam.
the code is:
REPORT ZOBJLIST LINE-SIZE 320 NO STANDARD PAGE HEADING. "280 to 320
TABLES: MARA, MAKT, A916, KONP, MVKE, ZSAI_PARAM.
Input parameters *****************************************************
DATA IT_MARA LIKE MARA OCCURS 0 WITH HEADER LINE.
DATA T_CLASS LIKE SCLASS OCCURS 0 WITH HEADER LINE.
DATA T_CLOBJDAT LIKE CLOBJDAT OCCURS 0 WITH HEADER LINE.
DATA FLG_COLOR TYPE C.
DATA WRK_CLASS LIKE KLAH-CLASS.
DATA WRK_PERCENT TYPE I. " Progress percentage
DATA WRK_LINES LIKE SY-TABIX. " To store the no. of lines in int.table
DATA WRK_PROGRESSTEXT(72) . " Progress indicator text
DATA : BEGIN OF IT_MATNR OCCURS 0,
MATNR LIKE MARA-MATNR,
MAKTX LIKE MAKT-MAKTX,
BISMT LIKE MARA-BISMT, "Thanikai-17.05.2002
END OF IT_MATNR.
DATA : BEGIN OF IT_HEADER OCCURS 0,
MATNR LIKE MARA-MATNR,
MAKTX LIKE MAKT-MAKTX,
CLART LIKE SCLASS-KLART,
CLASS LIKE SCLASS-CLASS,
BISMT LIKE MARA-BISMT, "Thanikai-17.05.2002
SCMNG(4) TYPE I, "Thanikai-03.10.2002
END OF IT_HEADER.
DATA : BEGIN OF IT_DETAILS OCCURS 0,
MATNR LIKE MARA-MATNR,
ZAEHL LIKE CLOBJDAT-ZAEHL,
ATNAM LIKE CLOBJDAT-ATNAM,
AUSP1 LIKE CLOBJDAT-AUSP1,
END OF IT_DETAILS.
DATA : BEGIN OF IT_DETAILS1 OCCURS 0,
MATNR LIKE MARA-MATNR,
ATNAM LIKE CLOBJDAT-ATNAM,
ZAEHL LIKE CLOBJDAT-ZAEHL,
END OF IT_DETAILS1.
DATA: IT_DETAILS2 LIKE IT_DETAILS1 OCCURS 0 WITH HEADER LINE.
DATA TMP_MATNR LIKE AUSP-OBJEK.
DATA WRK_FIELD(25).
DATA WRK_TABNAME(40). " Name of the int.table from wrk_fldname
DATA WRK_FIELDNAME(40). " Name of the fld name from wrk_fldname
DATA WRK_FLDNAME(40).
DATA T_CLOBJDAT_LINES LIKE SY-TABIX.
DATA WRK_LINES1 LIKE SY-TABIX.
DATA WRK_FIRST_TIME.
DATA TMP_STR.
DATA WRK_AUSP1 LIKE CLOBJDAT-AUSP1.
DATA: WRK_KBETR LIKE KONP-KBETR. "Thanikai-03.10.2002
SELECTION-SCREEN BEGIN OF BLOCK B3 WITH FRAME TITLE TEXT-003.
*PARAMETERS:
SELECT-OPTIONS:
P_MATKL FOR MARA-MATKL DEFAULT 'DIAL' OBLIGATORY NO INTERVALS.
SELECT-OPTIONS : S_MATNR FOR MARA-MATNR MATCHCODE OBJECT MAT1.
SELECTION-SCREEN END OF BLOCK B3.
SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-002.
PARAMETERS: P_CLASS LIKE KLAH-CLASS,
P_KLART LIKE KLAH-KLART DEFAULT '001' OBLIGATORY.
SELECTION-SCREEN END OF BLOCK B2.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
PARAMETERS : REQ RADIOBUTTON GROUP RGRP ,
NREQ RADIOBUTTON GROUP RGRP .
SELECTION-SCREEN END OF BLOCK B1.
AT SELECTION-SCREEN.
IF NOT P_CLASS IS INITIAL.
WRK_CLASS = P_CLASS.
ELSE.
WRK_CLASS = SPACE.
ENDIF.
TOP-OF-PAGE.
IF SY-BATCH NE 'X'.
PERFORM PRINT_TOP.
ENDIF.
START-OF-SELECTION.
SET PF-STATUS '9000'.
SELECT * INTO TABLE IT_MARA
FROM MARA CLIENT SPECIFIED
WHERE MANDT = SY-MANDT
AND MATKL IN P_MATKL
AND MATNR IN S_MATNR.
DESCRIBE TABLE IT_MARA LINES WRK_LINES.
MOVE 'Selecting Material Description' TO WRK_PROGRESSTEXT.
PERFORM SAPGUI USING WRK_PERCENT WRK_PROGRESSTEXT.
LOOP AT IT_MARA.
SELECT SINGLE * FROM MAKT CLIENT SPECIFIED
WHERE MANDT = SY-MANDT
AND MATNR = IT_MARA-MATNR
AND SPRAS = 'E'.
IF SY-SUBRC = 0.
IT_MATNR-MATNR = IT_MARA-MATNR.
IT_MATNR-MAKTX = MAKT-MAKTX.
IT_MATNR-BISMT = IT_MARA-BISMT. "Thanikai-17.05.2002
ENDIF.
APPEND IT_MATNR.
CLEAR IT_MATNR.
ENDLOOP.
CLEAR WRK_LINES.
DESCRIBE TABLE IT_MATNR LINES WRK_LINES.
MOVE 'Selecting Class / characteristics for the Material'
TO WRK_PROGRESSTEXT.
PERFORM SAPGUI USING WRK_PERCENT WRK_PROGRESSTEXT.
LOOP AT IT_MATNR.
CLEAR: TMP_MATNR, T_CLASS, T_CLOBJDAT. "Thanikai-26.08.2002
REFRESH: T_CLASS, T_CLOBJDAT. "Thanikai-26.08.2002
TMP_MATNR = IT_MATNR-MATNR.
CALL FUNCTION 'CLAF_CLASSIFICATION_OF_OBJECTS'
EXPORTING
CLASS = WRK_CLASS
CLASSTEXT = 'X'
CLASSTYPE = '001'
CLINT = ' '
FEATURES = 'X'
LANGUAGE = SY-LANGU
OBJECT = TMP_MATNR
OBJECTTABLE = 'MARA'
KEY_DATE = SY-DATUM
INITIAL_CHARACT = 'X'
NO_VALUE_DESCRIPT = 'X'
CHANGE_SERVICE_CLF = 'X'
INHERITED_CHAR = ' '
TABLES
T_CLASS = T_CLASS
T_OBJECTDATA = T_CLOBJDAT
EXCEPTIONS
NO_CLASSIFICATION = 1
NO_CLASSTYPES = 2
INVALID_CLASS_TYPE = 3
OTHERS = 4.
IF SY-SUBRC = 0.
READ TABLE T_CLASS INDEX 1.
IT_HEADER-MATNR = IT_MATNR-MATNR.
IT_HEADER-MAKTX = IT_MATNR-MAKTX.
IT_HEADER-BISMT = IT_MATNR-BISMT."Thanikai-17.05.2002
IT_HEADER-CLART = T_CLASS-KLART.
IT_HEADER-CLASS = T_CLASS-CLASS.
PERFORM PKG_DLVY_UNIT.
APPEND IT_HEADER.
CLEAR: IT_HEADER.
Code Start by Thanikai on 16.08.2002
LOOP AT T_CLOBJDAT.
IT_DETAILS-MATNR = IT_MATNR-MATNR.
IT_DETAILS-ZAEHL = T_CLOBJDAT-ZAEHL.
IT_DETAILS-ATNAM = T_CLOBJDAT-ATNAM.
IT_DETAILS-AUSP1 = T_CLOBJDAT-AUSP1.
APPEND IT_DETAILS.
ENDLOOP.
CLEAR: IT_DETAILS.
LOOP AT T_CLOBJDAT.
IT_DETAILS1-MATNR = IT_MATNR-MATNR.
IT_DETAILS1-ATNAM = T_CLOBJDAT-ATNAM.
IT_DETAILS1-ZAEHL = T_CLOBJDAT-ZAEHL.
APPEND IT_DETAILS1.
ENDLOOP.
CLEAR: IT_DETAILS1.
DESCRIBE TABLE IT_DETAILS1 LINES T_CLOBJDAT_LINES.
IF WRK_FIRST_TIME NE 'X'.
WRK_LINES1 = T_CLOBJDAT_LINES.
WRK_FIRST_TIME = 'X'.
IT_DETAILS2[] = IT_DETAILS1[].
ELSE.
IF T_CLOBJDAT_LINES GT WRK_LINES1.
WRK_LINES1 = T_CLOBJDAT_LINES.
IT_DETAILS2[] = IT_DETAILS1[].
ENDIF.
ENDIF.
CLEAR: T_CLOBJDAT_LINES.
CLEAR: IT_DETAILS1. REFRESH: IT_DETAILS1.
ENDIF.
Code end by Thanikai on 16.08.2002
ENDLOOP.
CLEAR: WRK_LINES1, WRK_FIRST_TIME.
Print Details *********************************
PERFORM PRINT_DETAILS.
AT USER-COMMAND.
GET CURSOR FIELD WRK_FIELD.
SPLIT WRK_FIELD AT '-' INTO WRK_TABNAME WRK_FLDNAME.
IF NOT WRK_FLDNAME IS INITIAL.
CASE SY-UCOMM.
WHEN 'SORA'.
IF SY-LSIND > 0.
SY-LSIND = SY-LSIND - 1. "To print in the same window
ENDIF.
PERFORM PRINT_REPORT_ASCENDING.
WHEN 'SORD'.
IF SY-LSIND > 0.
SY-LSIND = SY-LSIND - 1. "To print in the same window
ENDIF.
PERFORM PRINT_REPORT_DESCENDING.
ENDCASE.
ELSE.
MESSAGE S000(38) WITH 'Selete Material Number / Description'.
ENDIF.
*& Form SAPGUI
text
-->P_WRK_PERCENT text *
-->P_WRK_PROGRESSTEXT text *
FORM SAPGUI USING P_WRK_PERCENT
P_WRK_PROGRESSTEXT.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
PERCENTAGE = WRK_PERCENT
TEXT = WRK_PROGRESSTEXT
EXCEPTIONS
OTHERS = 1.
ENDFORM. " SAPGUI
*& Form PRINT_REPORT_ASCENDING
text
--> p1 text
<-- p2 text
FORM PRINT_REPORT_ASCENDING.
IF WRK_TABNAME = 'IT_HEADER'.
SORT IT_HEADER BY (WRK_FLDNAME).
PERFORM PRINT_TOP.
PERFORM PRINT_DETAILS.
ENDIF.
ENDFORM. " PRINT_REPORT_ASCENDING
*& Form PRINT_DETAILS
text
--> p1 text
<-- p2 text
WRK_AUSP1 width chged below from (7)to(9) by Nagaraj/MKRK 24.11.05
FORM PRINT_DETAILS.
SORT IT_HEADER BY MATNR.
IF SY-BATCH EQ 'X'.
PERFORM PRINT_TOP.
ENDIF.
IF REQ = 'X'.
LOOP AT IT_HEADER.
IF FLG_COLOR = 'X'.
FORMAT COLOR COL_NORMAL INTENSIFIED ON.
CLEAR FLG_COLOR.
ELSE.
FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
FLG_COLOR = 'X'.
ENDIF.
WRITE :/ SY-VLINE NO-GAP,
(18) IT_HEADER-MATNR COLOR COL_KEY NO-GAP,
SY-VLINE NO-GAP,
(40) IT_HEADER-MAKTX NO-GAP,
SY-VLINE NO-GAP,
(18) IT_HEADER-BISMT NO-GAP, "Thanikai-17.05.2002
SY-VLINE NO-GAP.
Code started by Thanikai on 16.08.2002
LOOP AT IT_DETAILS2.
CLEAR: TMP_STR, WRK_AUSP1.
IF IT_DETAILS2-ATNAM EQ 'CALIBRE'.
LOOP AT IT_DETAILS WHERE MATNR = IT_HEADER-MATNR
AND ATNAM = IT_DETAILS2-ATNAM
AND ZAEHL = IT_DETAILS2-ZAEHL.
TMP_STR = 'X'.
WRK_AUSP1 = IT_DETAILS-AUSP1.
EXIT.
ENDLOOP.
IF TMP_STR EQ 'X'.
WRITE : (9)WRK_AUSP1 NO-GAP, SY-VLINE NO-GAP.
ELSE.
WRITE : ' ', SY-VLINE NO-GAP.
ENDIF.
ELSE.
LOOP AT IT_DETAILS WHERE MATNR = IT_HEADER-MATNR
AND ATNAM = IT_DETAILS2-ATNAM.
TMP_STR = 'X'.
WRK_AUSP1 = IT_DETAILS-AUSP1.
EXIT.
ENDLOOP.
IF TMP_STR EQ 'X'.
WRITE : (9)WRK_AUSP1 NO-GAP, SY-VLINE NO-GAP.
ELSE.
WRITE : ' ', SY-VLINE NO-GAP.
ENDIF.
ENDIF.
ENDLOOP.
WRITE : (8) IT_HEADER-SCMNG NO-GAP, SY-VLINE NO-GAP.
IF SY-LINNO > 25.
IF SY-BATCH EQ 'X'.
NEW-PAGE.
PERFORM PRINT_TOP.
ENDIF.
ENDIF.
Code end by Thanikai on 16.08.2002..
ENDLOOP.
ELSEIF NREQ = 'X'.
LOOP AT IT_HEADER.
IF FLG_COLOR = 'X'.
FORMAT COLOR COL_NORMAL INTENSIFIED ON.
CLEAR FLG_COLOR.
ELSE.
FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
FLG_COLOR = 'X'.
ENDIF.
WRITE :/ SY-VLINE NO-GAP,
(18) IT_HEADER-MATNR COLOR COL_KEY NO-GAP,
SY-VLINE NO-GAP,
(18) IT_HEADER-BISMT NO-GAP, "Thanikai-17.05.2002
SY-VLINE NO-GAP.
Code started by Thanikai on 16.08.2002
LOOP AT IT_DETAILS2.
CLEAR: TMP_STR, WRK_AUSP1.
IF IT_DETAILS2-ATNAM EQ 'CALIBRE'.
LOOP AT IT_DETAILS WHERE MATNR = IT_HEADER-MATNR
AND ATNAM = IT_DETAILS2-ATNAM
AND ZAEHL = IT_DETAILS2-ZAEHL.
TMP_STR = 'X'.
WRK_AUSP1 = IT_DETAILS-AUSP1.
EXIT.
ENDLOOP.
IF TMP_STR EQ 'X'.
WRITE : (9)WRK_AUSP1 NO-GAP, SY-VLINE NO-GAP.
ELSE.
WRITE : ' ', SY-VLINE NO-GAP.
ENDIF.
ELSE.
LOOP AT IT_DETAILS WHERE MATNR = IT_HEADER-MATNR
AND ATNAM = IT_DETAILS2-ATNAM.
TMP_STR = 'X'.
WRK_AUSP1 = IT_DETAILS-AUSP1.
EXIT.
ENDLOOP.
IF TMP_STR EQ 'X'.
WRITE : (9)WRK_AUSP1 NO-GAP, SY-VLINE NO-GAP.
ELSE.
WRITE : ' ', SY-VLINE NO-GAP.
ENDIF.
ENDIF.
ENDLOOP.
WRITE : (8) IT_HEADER-SCMNG NO-GAP, SY-VLINE NO-GAP.
IF SY-LINNO > 25.
IF SY-BATCH EQ 'X'.
NEW-PAGE.
PERFORM PRINT_TOP.
ENDIF.
ENDIF.
Code end by Thanikai on 16.08.2002
ENDLOOP.
ENDIF.
ULINE.
ENDFORM. " PRINT_DETAILS
*& Form PRINT_REPORT_DESCENDING
text
--> p1 text
<-- p2 text
FORM PRINT_REPORT_DESCENDING.
IF WRK_TABNAME = 'IT_HEADER'.
SORT IT_HEADER BY (WRK_FLDNAME) DESCENDING.
PERFORM PRINT_TOP.
PERFORM PRINT_DETAILS.
ENDIF.
ENDFORM. " PRINT_REPORT_DESCENDING
*& Form PRINT_TOP
text
--> p1 text
<-- p2 text
IT_DETAILS2-ATNAM width chged below from 7 to 9. Nagaraj/MKRK 24.11.05
FORM PRINT_TOP.
FORMAT COLOR COL_HEADING INTENSIFIED OFF.
ULINE.
IF REQ = 'X'.
READ TABLE IT_HEADER INDEX 1.
WRITE :/ SY-VLINE NO-GAP,(17) 'Material No' ,SY-VLINE NO-GAP.
SET LEFT SCROLL-BOUNDARY.
WRITE :(39) ' Material Description', SY-VLINE NO-GAP,
(17) ' Old Matl. Number', SY-VLINE NO-GAP. "Thanikai-17.05.2002
Comments made by Thanikai on 16.08.2002
LOOP AT IT_DETAILS WHERE MATNR = IT_HEADER-MATNR.
LOOP AT IT_DETAILS2.
WRITE : (9) IT_DETAILS1-ATNAM NO-GAP,SY-VLINE NO-GAP.
WRITE : (9) IT_DETAILS2-ATNAM NO-GAP,SY-VLINE NO-GAP.
ENDLOOP.
WRITE : (8) 'Pkg.Unit' NO-GAP, SY-VLINE NO-GAP.
ELSEIF NREQ = 'X'.
READ TABLE IT_HEADER INDEX 1.
WRITE :/ SY-VLINE NO-GAP, (17) 'Material No' ,SY-VLINE NO-GAP,
(17) ' Old Matl. Number', SY-VLINE NO-GAP. "Thanikai-17.05.2002
Comments made by Thanikai on 16.08.2002
LOOP AT IT_DETAILS WHERE MATNR = IT_HEADER-MATNR.
LOOP AT IT_DETAILS2.
WRITE : (9) IT_DETAILS-ATNAM NO-GAP,SY-VLINE NO-GAP.
WRITE : (9) IT_DETAILS2-ATNAM NO-GAP,SY-VLINE NO-GAP.
ENDLOOP.
WRITE : (8) 'Pkg.Unit' NO-GAP, SY-VLINE NO-GAP.
ENDIF.
ULINE.
FORMAT RESET.
ENDFORM. " PRINT_TOP
*& Form PKG_DLVY_UNIT
text
--> p1 text
<-- p2 text
FORM PKG_DLVY_UNIT.
SELECT SINGLE KONP~KBETR INTO WRK_KBETR
FROM ( A916 INNER JOIN KONP
ON KONP~MANDT = SY-MANDT
AND KONPKNUMH = A916KNUMH
AND KONP~KOPOS = '01' ) CLIENT SPECIFIED
WHERE A916~MANDT = SY-MANDT
AND A916~KAPPL = 'V'
AND A916~KSCHL = 'PR00'
AND A916~VKORG = 'WTCH'
AND A916~VTWEG = '01'
AND A916~SPART = '01'
AND A916~MATNR = IT_MATNR-MATNR
AND A916~DATBI >= SY-DATUM
AND A916~DATAB <= SY-DATUM.
IF SY-SUBRC EQ 0.
SELECT SINGLE * FROM ZSAI_PARAM CLIENT SPECIFIED
WHERE MANDT = SY-MANDT
AND PMFID = 'ZPKG_PRICE'
AND PMVL1 = '01'.
IF SY-SUBRC EQ 0.
IF WRK_KBETR BETWEEN 1 AND ZSAI_PARAM-PMVL2.
SELECT SINGLE * FROM MVKE CLIENT SPECIFIED
WHERE MANDT = SY-MANDT
AND MATNR = IT_MATNR-MATNR
AND VKORG = 'WTCH'
AND VTWEG = '01'.
IF SY-SUBRC EQ 0.
IF MVKE-SCMNG GE 1.
IT_HEADER-SCMNG = MVKE-SCMNG.
ELSE.
In the absence of delivery unit for a material,
delivery unit is considered as one.
IT_HEADER-SCMNG = 1.
ENDIF.
ELSE.
IT_HEADER-SCMNG = 1.
ENDIF.
ELSE.
If the price for a material is either below 1 or above 2499, then
the delivery unit is considered as one.
IT_HEADER-SCMNG = 1.
ENDIF.
ELSE.
IT_HEADER-SCMNG = 1.
ENDIF.
ELSE.
In the absence of price for a material, delivery unit is
considered as one.
IT_HEADER-SCMNG = 1.
ENDIF.
CLEAR: WRK_KBETR.
ENDFORM. " PKG_DLVY_UNIT

The first point would be to change the following:
LOOP AT IT_MARA.
SELECT SINGLE * FROM MAKT CLIENT SPECIFIED
WHERE MANDT = SY-MANDT
AND MATNR = IT_MARA-MATNR
AND SPRAS = 'E'.
IF SY-SUBRC = 0.
IT_MATNR-MATNR = IT_MARA-MATNR.
IT_MATNR-MAKTX = MAKT-MAKTX.
IT_MATNR-BISMT = IT_MARA-BISMT. "Thanikai-17.05.2002
ENDIF.
APPEND IT_MATNR.
CLEAR IT_MATNR.
ENDLOOP.
I would sort IT_MARA by matnr then select for all entries into new table IT_matnr and only read when you are actuallygoing to use it for your final table.
This however will not make much difference to your problem. I suggest you put more of the code into subroutines and look at the se30 output as tyo which subroutines are actually taking most of the time. Please post the results and the subroutines which take the longest.

Similar Messages

  • ABAP Routine code for the below logic

    Hello BW Experts ,
    I need to write a complex ABAP routine in BW .
    Following is the detail explaination .
    Can anyone tell me the ABAP code for the below logic?
    It would be a greate help as I am unable to do this
    since last two days.
    WBS Elements are maintained at  IOS and  Warranty levels in R/3 side.
    The IOS WBS is a top level of WBS element and below that the Warranty WBS level.
    The IOS and Warranty WBS elements can be differentiated by means of priority field.
    When priority = i   , WBS Element is known as  IOS Level WBS Element and
    When  priority = Y the WBS element is known as Warranty WBS element.
    The Equipment Number is maintained compulsorily at IOS Level WBS elements only.
    It is not maintained at  Warranty WBS Element.
    But the Cost is maintained at Warranty WBS Elements.
    In BW I need all Warranty WBS ( priority = Y) along with their cost figures and Equipment Numbers.
    But as the Equipment Number is not maintained compulsorily at Warranty WBS level we have asked to
    Copy it from  IOS WBS ( priority = i ) and assign it to Warranty WBS level ( priority = Y ).
    So I have included the Equipment Number in the ODS and in update rules I need to write the routine for it as
    per the above logic.
    The Equipment Number is coming from Master data of  WBS Element.
    The WBS element master data we are loading in BW .
    Also the same WBS Element transaction data is coming from the transaction data data source in BW.
    Following fields / infoobjects and the table names in BW :
    1. Equipment Number : /BIC/ZEQUIPMNT  and table name /BIC/MZWBS_ELEM.
    2. WBS Element       : ZWBS_ELEM  is coming from transaction data data source as well as master data.
                                     In ODS update rules it is coming from  transaction data data source Comm_structure-ZWBS_ELEM.
                                     Also we are loading separetly the master data for ZWBS_ELEM.
                                     The  ZEQUIPMNT is an attribute of ZWBS_ELEM.
    3. Priority                :  PRIORITY     and table name /BIC/MZWBS_ELEM.
                                      The info object name for Priority is 0Priority but in master data table /BIC/MZWBS_ELEM
                                      the field name is    PRIORITY.
                                     When PRIORITY = ' i ' then    ZWBS_ELEM is at IOS Level
                                     When PRIORITY = ' y ' then  ZWBS_ELEM is at Warranty Level.
    4. ODS name :  /BIC/AZCOST00 and same is table name active data table .
    So please tell me the routine Code .
    Best Regards ,
    Amol.

    Hi Dinaker,
    Did you find any solution for this issue. I too have a similar requirement of pulling all the service orders for a specific Purchase Order in the BW report.
    Thanks,
    SAPBWI

  • Performance for the below code

    Can any one help me in improving the performance for the below code.
    FORM RETRIEVE_DATA .
    CLEAR WA_TERRINFO.
    CLEAR WA_KNA1.
    CLEAR WA_ADRC.
    CLEAR SORT2.
    *To retrieve the territory information from ZPSDSALREP
    SELECT ZZTERRMG
           ZZSALESREP
           NAME1
           ZREP_PROFILE
           ZTEAM
         INTO TABLE GT_TERRINFO
         FROM ZPSDSALREP.
    *Preparing Corporate ID from KNA1 & ADRC and storing it in SORT2 field
    LOOP AT GT_TERRINFO INTO WA_TERRINFO.
      SELECT SINGLE * FROM KNA1 INTO WA_KNA1
                      WHERE KUNNR = WA_TERRINFO-SALESREP.
      SELECT SINGLE * FROM ADRC INTO WA_ADRC
                      WHERE ADDRNUMBER = WA_KNA1-ADRNR.
      IF NOT WA_ADRC-SORT2 IS INITIAL.
      CONCATENATE 'U' WA_ADRC-SORT2 INTO SORT2.
      MOVE SORT2 TO WA_TERRINFO-SORT2.
    MODIFY GT_TERRINFO1 FROM WA_TERRINFO.
      APPEND WA_TERRINFO TO GT_TERRINFO1.
      CLEAR WA_TERRINFO.
      ENDIF.
      CLEAR WA_KNA1.
      CLEAR WA_ADRC.
    ENDLOOP.
    ENDFORM.                    " RETRIEVE_DATA

    Hi
    The code is easy so I don't think you can do nothing, only u can try to limit the reading of KNA1:
    FORM RETRIEVE_DATA .
      CLEAR WA_TERRINFO.
      CLEAR WA_KNA1.
      CLEAR WA_ADRC.
      CLEAR SORT2.
    *To retrieve the territory information from ZPSDSALREP
      SELECT ZZTERRMG
      ZZSALESREP
      NAME1
      ZREP_PROFILE
      ZTEAM
      INTO TABLE GT_TERRINFO
      FROM ZPSDSALREP.
      SORT GT_TERRINFO BY SALESREP.
    *Preparing Corporate ID from KNA1 & ADRC and storing it in SORT2 field
      LOOP AT GT_TERRINFO INTO WA_TERRINFO.
        IF KNA1-KUNNR <> WA_KNA1-KUNNR.
          SELECT SINGLE * FROM KNA1 INTO WA_KNA1
               WHERE KUNNR = WA_TERRINFO-SALESREP.
          IF SY-SUBRC <> 0.
            CLEAR: WA_KNA1, WA_ADRC.
          ELSE.
            SELECT SINGLE * FROM ADRC INTO WA_ADRC
                                     WHERE ADDRNUMBER = WA_KNA1-ADRNR.
            IF SY-SUBRC <> 0. WA_ADRC. ENDIF.
          ENDIF.
        ENDIF.
        IF NOT WA_ADRC-SORT2 IS INITIAL.
          CONCATENATE 'U' WA_ADRC-SORT2 INTO SORT2.
          MOVE SORT2 TO WA_TERRINFO-SORT2.
    * MODIFY GT_TERRINFO1 FROM WA_TERRINFO.
          APPEND WA_TERRINFO TO GT_TERRINFO1.
          CLEAR WA_TERRINFO.
        ENDIF.
      ENDLOOP.
    ENDFORM. " RETRIEVE_DATA
    If program takes many times to upload the data from ZPSDSALREP, you can try to split in sevaral packages:
    SELECT ZZTERRMG ZZSALESREP NAME1 ZREP_PROFILE ZTEAM
      INTO TABLE GT_TERRINFO PACKAGE SIZE <...>
      FROM ZPSDSALREP.
      SORT GT_TERRINFO BY SALESREP.
    *Preparing Corporate ID from KNA1 & ADRC and storing it in SORT2 field
      LOOP AT GT_TERRINFO INTO WA_TERRINFO.
        IF KNA1-KUNNR <> WA_KNA1-KUNNR.
          SELECT SINGLE * FROM KNA1 INTO WA_KNA1
               WHERE KUNNR = WA_TERRINFO-SALESREP.
          IF SY-SUBRC <> 0.
            CLEAR: WA_KNA1, WA_ADRC.
          ELSE.
            SELECT SINGLE * FROM ADRC INTO WA_ADRC
                                     WHERE ADDRNUMBER = WA_KNA1-ADRNR.
            IF SY-SUBRC <> 0. WA_ADRC. ENDIF.
          ENDIF.
        ENDIF.
        IF NOT WA_ADRC-SORT2 IS INITIAL.
          CONCATENATE 'U' WA_ADRC-SORT2 INTO SORT2.
          MOVE SORT2 TO WA_TERRINFO-SORT2.
    * MODIFY GT_TERRINFO1 FROM WA_TERRINFO.
          APPEND WA_TERRINFO TO GT_TERRINFO1.
          CLEAR WA_TERRINFO.
        ENDIF.
      ENDLOOP.
    ENDSELECT.
    Max

  • Performance issue in abap program

    hi,
    how can we improve the performance of  abap program

    hi,
    read the follwing links
    ABAP provides few tools to analyse the perfomance of the objects, which was developed by us.
    Run time analysis transaction SE30
    This transaction gives all the analysis of an ABAP program with respect to the database and the non-database processing.
    SQL Trace transaction ST05
    by using this tool we can analyse the perfomance issues related to DATABASE calls.
    Perfomance Techniques for improve the perfomance of the object.
    1) ABAP/4 programs can take a very long time to execute, and can make other processes have to wait before executing. Here are some tips to speed up your programs and reduce the load your programs put on the system:
    2) Use the GET RUN TIME command to help evaluate performance. It's hard to know whether that optimization technique REALLY helps unless you test it out.
    3) Using this tool can help you know what is effective, under what kinds of conditions. The GET RUN TIME has problems under multiple CPUs, so you should use it to test small pieces of your program, rather than the whole program.
    4) Generally, try to reduce I/O first, then memory, then CPU activity. I/O operations that read/write to hard disk are always the most expensive operations. Memory, if not controlled, may have to be written to swap space on the hard disk, which therefore increases your I/O read/writes to disk. CPU activity can be reduced by careful program design, and by using commands such as SUM (SQL) and COLLECT (ABAP/4).
    5) Avoid 'SELECT *', especially in tables that have a lot of fields. Use SELECT A B C INTO instead, so that fields are only read if they are used. This can make a very big difference.
    6) Field-groups can be useful for multi-level sorting and displaying. However, they write their data to the system's paging space, rather than to memory (internal tables use memory). For this reason, field-groups are only appropriate for processing large lists (e.g. over 50,000 records). If you have large lists, you should work with the systems administrator to decide the maximum amount of RAM your program should use, and from that, calculate how much space your lists will use. Then you can decide whether to write the data to memory or swap space.
    Use as many table keys as possible in the WHERE part of your select statements.
    7)Whenever possible, design the program to access a relatively constant number of records (for instance, if you only access the transactions for one month, then there probably will be a reasonable range, like 1200-1800, for the number of transactions inputted within that month). Then use a SELECT A B C INTO TABLE ITAB statement.
    8) Get a good idea of how many records you will be accessing. Log into your productive system, and use SE80 -> Dictionary Objects (press Edit), enter the table name you want to see, and press Display. Go To Utilities -> Table Contents to query the table contents and see the number of records. This is extremely useful in optimizing a program's memory allocation.
    9) Try to make the user interface such that the program gradually unfolds more information to the user, rather than giving a huge list of information all at once to the user.
    10) Declare your internal tables using OCCURS NUM_RECS, where NUM_RECS is the number of records you expect to be accessing. If the number of records exceeds NUM_RECS, the data will be kept in swap space (not memory).
    11) Use SELECT A B C INTO TABLE ITAB whenever possible. This will read all of the records into the itab in one operation, rather than repeated operations that result from a SELECT A B C INTO ITAB... ENDSELECT statement. Make sure that ITAB is declared with OCCURS NUM_RECS, where NUM_RECS is the number of records you expect to access.
    12) If the number of records you are reading is constantly growing, you may be able to break it into chunks of relatively constant size. For instance, if you have to read all records from 1991 to present, you can break it into quarters, and read all records one quarter at a time. This will reduce I/O operations. Test extensively with GET RUN TIME when using this method.
    13) Know how to use the 'collect' command. It can be very efficient.
    14) Use the SELECT SINGLE command whenever possible.
    15) Many tables contain totals fields (such as monthly expense totals). Use these avoid wasting resources by calculating a total that has already been calculated and stored.
    Some tips:
    1) Use joins where possible as redundant data is not fetched.
    2) Use select single where ever possible.
    3) Calling methods of a global class is faster than calling function modules.
    4) Use constants instead of literals
    5) Use WHILE instead of a DO-EXIT-ENDDO.
    6) Unnecessary MOVEs should be avoided by using the explicit work area operations
    see the follwing links for a brief insifght into performance tuning,
    http://www.thespot4sap.com/Articles/SAPABAPPerformanceTuning_Introduction.asp
    http://help.sap.com/saphelp_nw2004s/helpdata/en/d1/801f7c454211d189710000e8322d00/frameset.htm
    regards
    Rohan

  • Performance Issue in ABAP coding

    Hi Experts,
                    I am facing performance issue when fetch the data from view IAOM_CRM_AUFK.My perspective to fetch the internal order from that table by passing the OBJECT_ID which is not the primary key..Also the field IHREZ is not the primary key of table VBKD..
    My code is under....
         select EXT_OBJECT_ID
                  AUFNR
                  OBJECT_ID
                  into table IT_EXAT
                  from IAOM_CRM_AUFK
                  client specified
                  for all entries in IT_VBKD
                  where OBJECT_ID = IT_VBKD-IHREZ.
    Please give the wayout by which I can fetch lot of data without performance issue..

    Hi,
        I have maintain IHREZ of table VBKD this way.
    IHREZ type IAOM_CRM_AUFK-OBJECT_ID,
    I know that OBJECT_ID is no good access to view IAOM_CRM_AUFK..But I have no way..Because I have got IHREZ from VBKD table which only match with the field OBJECT_ID of view IAOM_CRM_AUFK...
    I have to fetch internal order no. on the basis of Sales order no..Forr this reason First I have put Sales order no in VBKD table and get IHREZ and then put IHREZ in the field OBJECT_ID of view  IAOM_CRM_AUFK..then I have got AUFNR which is internal order..
    Please give me the way which will enhance my coding execution speed..

  • Need ABAP code for the below Services requirement

    Hi,
    We have a requirement to show all the services for a particular Purchase order number.For this I built a view on 2 tables ESLL and EKPO.Now based on the below logic I need to bring the services for the Purchase order..
    1.Enter PO number,item no. and Doc category in EKPO and find the Pack no.
    2.Now take the Pack no. of EKPO and give in ESLL and find the Sub pack no.
    3.Now take this Subpack no. and Give this sub pack as Pack no. in ESLL
    4.This will be the Service entry record for that PO number.
    Can any one Please suggest me to how to write the ABAP code for the above logic.
    Thanks & Regards,
    Dinakar

    Hi Dinaker,
    Did you find any solution for this issue. I too have a similar requirement of pulling all the service orders for a specific Purchase Order in the BW report.
    Thanks,
    SAPBWI

  • Event ID 2003 The configuration information of the performance library "perf-MSSQLSERVER-sqlctr11.1.3000.0.dll" for the "MSSQLSERVER" service does not match the trusted performance library information stored in the registry.

    I keep getting the above error on all my SQL 2012 deployments (standard and enterprise) on all Windows Server 2012 Standard machines. I have already tried the following commands in administrator mode to resolve without success:
    lodctr /T:perf-MSSQLSERVER-sqlctr11.1.3000.0.dll
    lodctr /T:MSSQLSERVERlodctr /R:perf-MSSQLSERVER-sqlctr11.1.3000.0.dll
    lodctr /R
    Any other suggestions?
    Diane

    Hi,
    Add the service accounts to the local server’s “Performance Monitor Users” group.
    Configure Windows Service Accounts and Permissions
    http://msdn.microsoft.com/en-IN/library/ms143504.aspx#VA_Desc

  • I have an IMac and would like to scan and edit scans can anyone suggest a scanner for the Mac

    Help.  I have an IMac and I want to scan and be able to edit my scans and I have received so many different opinions on how to do this.  Buy a separate scanner or buy an all in one that scans but you have to get software to edit. It is really confusing so before I purchase a scanner I need to know if anyone else is doing this and what machine should I buy. Thanks for the help.

    SaugusGirl wrote:
    Hi and thanks for replying. I have a management company and I would like to scan a document and then be able to go in and make changes if necessary.  Some people told me to purchase a Fujitsu 1500 scanner for the Mac which costs about 500.00 but didn't think I needed something that sophisticated and then another opinion was to get an all in one but I need software to edit and no one seems to know what software to purchase. Thanks again for your input.
    Get the Fujitsu (Get the M1500, the S1500 is for Windows), it comes with ABBy Fine Reader OCR software that is probably less good than Vuescan but for printed text works just fine, handwriting is a different matter. It is about $500 (look around, under $400 is sometimes possible) don't buy the S version, none of the software will work on a Mac. I've used this scanner fairly often, it's better than the price would suggest.

  • How do I suggest an accessory for the 2nd gen nano?

    I'm trying to make a suggestion to Apple to make a belt clip for the 2nd gen nano like the older 40gb iPods had. How do I make one, because I can't find any sort of suggestion box(for lack of better term)

    You may be able to use the apple iPod feedback form
    to make that type of suggestion. You might also want
    to check other sites that make iPod accessories to
    see if they have one that you may like.
    http://www.apple.com/feedback/ipodnano.html
    Thank you!=)

  • How to give if condition in XSLT for the below issue

    I have a customer order in .Txt which is picked by my FTP process & in mediator mapping will be done. Here i have an issue where the Txt file is in delimiter file it is having Customer Order number(CON) in each line of a single record,now i have to ignore the CON and to pic all the other details of the same Order. Here in the below i'm placing the sample file. where each order no. is repeated along with remaining details of same order. My problem is when i deployed each CON of line is taking as a single order., after reading CON details once it should jump to new CON. In this Stock code & Quantity are changing, so it should pic this excluding CON in each line.
    Customer order number;Order Date;Stock code;Quantity;Leverans adress namn;Leverans adress rad 1;Leverans adress rad 2;Leverans adress rad 3;Postnummer;Stad;ButiksID
    "61068344";"31-01-11";"02716Z0";"1";"Telenor Sverige AB";"Inköp Verkstan";"Industrigatan 33B";"";"212 28";"Malmö";"302"
    "61068344";"31-01-11";"99H10048-00";"1";"Telenor Sverige AB";"Inköp Verkstan";"Industrigatan 33B";"";"212 28";"Malmö";"302"
    "61068344";"31-01-11";"99H10046-00";"1";"Telenor Sverige AB";"Inköp Verkstan";"Industrigatan 33B";"";"212 28";"Malmö";"302"
    "61068344";"31-01-11";"100-99150000-60";"4";"Telenor Sverige AB";"Inköp Verkstan";"Industrigatan 33B";"";"212 28";"Malmö";"302"
    "61068344";"31-01-11";"0278812";"2";"Telenor Sverige AB";"Inköp Verkstan";"Industrigatan 33B";"";"212 28";"Malmö";"302"
    "61068344";"31-01-11";"534970";"1";"Telenor Sverige AB";"Inköp Verkstan";"Industrigatan 33B";"";"212 28";"Malmö";"302"
    "61068373";"31-01-11";"1234-0433";"1";"Strålfors Svenska AB";"Web Consumer";"Logistik Telenor";"Långgatan 8";"341 38";"Ljungby";"269"
    "61068373";"31-01-11";"100-92080000-60";"30";"Strålfors Svenska AB";"Web Consumer";"Logistik Telenor";"Långgatan 8";"341 38";"Ljungby";"269"
    "61068373";"31-01-11";"0138";"40";"Strålfors Svenska AB";"Web Consumer";"Logistik Telenor";"Långgatan 8";"341 38";"Ljungby";"269"
    "61068373";"31-01-11";"CM011674";"40";"Strålfors Svenska AB";"Web Consumer";"Logistik Telenor";"Långgatan 8";"341 38";"Ljungby";"269"
    "61068373";"31-01-11";"CM012044";"10";"Strålfors Svenska AB";"Web Consumer";"Logistik Telenor";"Långgatan 8";"341 38";"Ljungby";"269"
    "61068373";"31-01-11";"IC416";"30";"Strålfors Svenska AB";"Web Consumer";"Logistik Telenor";"Långgatan 8";"341 38";"Ljungby";"269"
    "61068373";"31-01-11";"1230-1847";"10";"Strålfors Svenska AB";"Web Consumer";"Logistik Telenor";"Långgatan 8";"341 38";"Ljungby";"269"
    "61068373";"31-01-11";"99H10046-00";"2";"Strålfors Svenska AB";"Web Consumer";"Logistik Telenor";"Långgatan 8";"341 38";"Ljungby";"269"
    "61068373";"31-01-11";"CPW012602";"30";"Strålfors Svenska AB";"Web Consumer";"Logistik Telenor";"Långgatan 8";"341 38";"Ljungby";"269"

    Here i missed one thing to say, After reading all the fields from first record of CON the Stock_Code & Quantity to be picked and added in the same record from next line of CON untill the CON is changed. For this can we do with NXSD file? using which option can we use this? & how can we complete this in XSLT?

  • Santa suggestions: portable speakers for the Zen Sle

    With Christmas coming up shortly, I'd like to treat myself to (or be treated to ) a decent portable speaker system for my Zen Sleek.
    I've looked at the Creative TravelSound series (ok) and the Logic3 I-Station (only for ipods).
    Any suggestions folks?

    Th iM4 is a very nice looking speaker set.... I am more interested in somehting like the Bose or the JBL music station that is made specifically for the iPod. With the docking capability of the Sleek, this would make for some NICE competition here. My mother has the JBL for her iPod and it sounds AMAZING! Plus, it fully controls the iPods volume and tracks. The Bose is very similar.

  • Content Query Web Part (CQWP) displaying ASCII code for the colon portion of a time

    I'm having an issue with a CQWP displaying &#58; for the colon portion of a time.  For example, instead of 6:30, the CQWP shows 6&#58;30. 
    I checked our encoding which is set to UTF-8.  We also have a custom style on the CQWP and I've made sure that our custom itemstyle.xsl file has the disable-output-escaping property set to yes. 
    When I look at the list I'm querying from, the ascii code is not showing in there; it's displaying properly as 6:30.  I tried to flip this by replacing the colon with the ascii symbol in the list but it still showed the ascii code on the CQWP.
    Any ideas?

    Hi Cameron,  thanks for your reply.  The solution in the blog would work for an area that is only for date or time.  Unfortunately, this particular section of my CQWP is more than just a time; it's the summary of a news article--
    which may or may not contain a time depending on what the news article is about. 
    In further testing I have also noticed, when viewing the source code, that the colon is represented as
    &amp;#58; which tells me that the ampersand of the ascii code for the colon is also being convertied to ascii (in a sort-of double
    conversion situation.)  This isn't something I've ever seen before.

  • Performance issue in ABAP

    Hi,
    This issue is becoming very big challenge for us.
       "select adrnr
               tplnr
        appending table i_iloa
        package size 50000
        from iloa
        where tplnr in s_mprn2
        and owner eq '2'.
      endselect.
    like this i have some other select statements based on i_iloa. 
    I am getting 4 milian records based on above selection.
    Based on i_iloa i have to get some other line items
      "select zztplnr
              herst
              serge
              typbz
              baujj
              zzicharge
              matnr
        appending table i_equi_i
        package size 50000
        from equi
       for all entries in i_iloa
       where zztplnr eq i_iloa-tplnr.
    endselect."
    I think an average this will get more than 10millians records.So system is going for dump.
    ERROR
    "Operating system can not provide enough space to process the data"
    Error analysis is
    "The internal table could not be enlarged futher.You are attempted to create block of table of length for internal table"
    Is there any way to fine tune this coding.
    Thanks in advance
    Murali

    Hi murali,
    1. This is a serious error.
       There are a couple of things
       which need to be taken care of.
    2. I am getting 4 milian records based on above selection.
       Getting 4 milions records of
       this selection is not worth for
       any information purpose.
       Apply MORE RESTRICTIONS on the sql.
       (ie, MORE FILTER CONDITIONS  in the where clause)
    3.
    Operating system can not provide enough space to process the data"
    Such error means some
    more BASIS / OPERATING SYSTEM LEVEL
    configurations / parameter changes
    are required.
    For that, also contact the BASIS Team.
    regards,
    amit m.

  • Performance Issue with Webi report uses SAP BI Query as the data source

    Hello.
    I have created a Webi ad-hoc report which connects to a SAP BI query through BO OLAP universe.
    The layout of Webi is the exactly the same as the BI query.  There are filters in the Webi to restrict the number of data extraction, but even with data result of 5000 rows, it took about 30 seconds.
    If I execute the BI query with the same filter restriction, it tooks less than 10 seconds.
    It seems that large percentage of time is consumed at the MDX part.
    Is there any tuning method that could speed up the process time of MDX?
    Thank you.
    Justine
    Edited by: Justine Liu on Mar 18, 2009 6:59 AM

    Hi,
    please take a look here:
    [https://service.sap.com/sap/support/notes/1142664] (Look under related notes)
    It includes references to various performance improvements of the MDX interface. From what I saw there it is advisable to upgrade your SAP BI (7.0)  up to at least Support Package 21 (you are currently on SP 15).
    This may also be interesting for you: There is a new Fix Pack 1.4 coming out for BOBJ XI 3.1. Combined with the related SAP Enh.Pack (not sure about the version of this one) should also improve WebI performance. This fix pack is not yet officially released though but it should not take look.
    I recommend that you try the upgrade to Support Package 21 first.
    BTW it is also advisable to take a look in the results of your MDX query (e.g using the MDXTEST transaction). You should make sure that your query is indeed restricted as expected. Sometimes the results you see in SAP native reporting tools (e.g. BEx Analyzer) differ from those returned from the MDX component, depending on the way variables/restrictions where defined in the query designer. It is all about making sure that there is no apples/oranges comparison here.
    Regards,
    Stratos

  • Insane performance issue. GPU not being used at all for cropping.

    I regularly record my screen and later open the resulting file in Pr and export only a square on it. I import the video, maybe cut away some fluff, and export, choosing to crop it.
    The result is a painful ordeal that cripples my computer for hours every single day, where Premiere Pro CC uses almost 100% CPU constantly, but 0% of the GPU. It's really extremely slow. Other export tasks seem to be as quick as you expect them to be. But not this particular job, which I rely on every day. Very annoying.
    There is simply no way that this is intended. The GPU seems to be made for things like this. Why isn't Pr using it?
    I have 20 GB RAM, a very powerful quad core Xeon, a new Nvidia GPU, solid state disk, etc. Windows 8.1 Update 1. My computer is never slow for other tasks. This is really a very annoying issue as it makes using the computer nearly impossible for hours a day. For no good reason. It needs to use the graphics card to crop!

    It just really annoys me that this kind of thing is ever turned off, hidden away and just... ambiguous.
    Its hardly hidden away.  Its in the NEW PROJECT Settings page and first setting drop down option.
    There are reasons why its an option... buts its ON by default on any new project I start.

Maybe you are looking for