cancel
Showing results for 
Search instead for 
Did you mean: 

Extraction from ECC

Former Member
0 Kudos


Hi,

I have a problem. i add some logic in Functional location cmod. every things are wroking fine but the problem is now it is taking 4h to load data before it takes 45min, most of the time taken to fill the internal tables  please someone help me to fix this.

Thanks

   TYPES: BEGIN of S_VIQMEL,
         QMNUM type  QMNUM,       "Notification No.
         ERDAT type ERDAT,         "Date on Which Record Was Created.
         STRMN type STRMN,         "Required start date.
         LTRMN type LTRMN,          "Required End Date.
         QMDAB type QMDAB,          "Date for Notification Completion.
         QMART type QMART,          "Notification Type.
         QMGRP type QMGRP,          "Code Group - Coding.
         BEZDT TYPE BEZDT,           "Notification Reference Date.
         TPLNR type TPLNR,           "Functional Location.
      END of S_VIQMEL.

DATA: I_VIQMEL1 TYPE STANDARD TABLE OF S_VIQMEL.
DATA: WA_VIQMEL1 TYPE S_VIQMEL.

TYPES: BEGIN OF S_OPEN,
       QMNUM type  QMNUM,       "Notification No.
       ERDAT type ERDAT,         "Date on Which Record Was Created.
       STRMN type STRMN,         "Required start date.
       LTRMN type LTRMN,          "Required End Date.
       QMDAB type QMDAB,          "Date for Notification Completion.
       QMART type QMART,          "Notification Type.
       QMGRP type QMGRP,          "Code Group - Coding.
       BEZDT TYPE BEZDT,          "Notification Reference Date.
       TPLNR type TPLNR,          "Functional Location.
END OF S_OPEN.

DATA: I_OPEN TYPE STANDARD TABLE OF S_OPEN,
      WA_OPEN TYPE S_OPEN.

TYPES: BEGIN OF S_Close,
       QMNUM type  QMNUM,       "Notification No.
       ERDAT type ERDAT,         "Date on Which Record Was Created.
       STRMN type STRMN,         "Required start date.
       LTRMN type LTRMN,          "Required End Date.
       QMDAB type QMDAB,          "Date for Notification Completion.
       QMART type QMART,          "Notification Type.
       QMGRP type QMGRP,          "Code Group - Coding.
       BEZDT TYPE BEZDT,          "Notification Reference Date.
       TPLNR type TPLNR,          "Functional Location.

END OF S_Close.

DATA: I_Close TYPE STANDARD TABLE OF S_Close,
      WA_Close TYPE S_Close.


TYPES: BEGIN OF S_QMIH,
  QMNUM TYPE QMNUM,          "Notification No.
  ILOAN TYPE ILOAN,
  TPLNR TYPE TPLNR,         "Location and account assignment for technical object.
END OF S_QMIH.

DATA: IT_QMIH TYPE STANDARD TABLE OF S_QMIH.
data: wa1_QMIH type S_QMIH.

TYPES: BEGIN OF S_ILOA,
  ILOAN TYPE ILOAN,                 "Location and account assignment for technical object.
  TPLNR TYPE TPLNR,                      "Functional Location.
END OF  S_ILOA.

DATA: IT_ILOA TYPE STANDARD TABLE OF S_ILOA.
data: wa1_ILOA type S_ILOA.

field-symbols: <fs_QMIH> type S_QMIH.
field-symbols: <fs_VIQMEL> type S_VIQMEL.

   * getting dates from Notification for flttyp is R and G.
  i_funct_loc1[] = i_funct_loc[].

  Refresh: IT_ILOA,
           IT_QMIH,
           I_VIQMEL1.

  Clear: IT_ILOA,
         IT_QMIH,
         I_VIQMEL1.

  DELETE i_funct_loc1[] WHERE
                        fltyp NE 'R' AND
                        fltyp NE 'G'.
* B will be uncomment line when the Briges start
*                        fltyp NE 'B' .

  IF i_funct_loc1 IS NOT INITIAL.
    SORT i_funct_loc1 by tplnr.
    SELECT ILOAN TPLNR
           FROM ILOA INTO TABLE IT_ILOA
           FOR ALL ENTRIES IN i_funct_loc1
           WHERE TPLNR = i_funct_loc1-tplnr.

    IF IT_ILOA IS NOT INITIAL.

      sort IT_ILOA by ILOAN.

      SELECT QMNUM ILOAN from QMIH into table IT_QMIH
         FOR ALL ENTRIES IN IT_ILOA
         WHERE ILOAN = IT_ILOA-ILOAN.

      Sort IT_QMIH by ILOAN.

      Loop at IT_QMIH  ASSIGNING <fs_QMIH>.

        read table IT_ILOA into wa1_ILOA with key ILOAN = <fs_QMIH>-ILOAN
        Binary search.
        if sy-subrc = 0.
*
          <fs_QMIH>-tplnr = wa1_iloa-tplnr.

        endif.
      endloop.
      delete IT_QMIH where TPLNR is initial.
*

      iF IT_QMIH IS NOT INITIAL.
        Sort IT_QMIH by QMNUM.


        select
                   QMNUM        "Notification No.
                   ERDAT         "Date on Which Record Was Created.
                   STRMN         "Required start date.
                   LTRMN         "Required End Date.
                   QMDAB         "Date for Notification Completion.
                   QMART          "Notification Type.
                   QMGRP          "Code Group - Coding.
                   BEZDT          "Notification Reference Date.

          from QMEL  into table I_VIQMEL1
          for all entries in IT_QMIH
            WHERE  QMNUM = IT_QMIH-QMNUM
            and
            QMART = 'TP'.
*
        delete I_VIQMEL1 where QMGRP <> 'R-INSPFE'.
        Clear: A_index.
        if I_VIQMEL1 is not initial.
*
          Loop at I_VIQMEL1 assigning <fs_VIQMEL>.

            read table IT_QMIH into wa1_qmih with key QMNUM = <fs_VIQMEL>-QMNUM
       Binary search.
            if sy-subrc = 0.
*
              <fs_VIQMEL>-tplnr = wa1_qmih-tplnr.
*
            endif.

          endloop.
          delete I_VIQMEL1 where TPLNR is initial.
          SORT I_VIQMEL1 BY TPLNR ascending ERDAT DESCENDING.

          IF I_VIQMEL1 IS NOT INITIAL.

            I_OPEN[] = I_VIQMEL1[].

            DELETE I_OPEN WHERE QMDAB IS not INITIAL.

            SORT I_OPEN BY TPLNR ascending ERDAT DESCENDING.

            I_CLOSE[] = I_VIQMEL1[].

            DELETE I_CLOSE WHERE QMDAB IS INITIAL.

            SORT I_CLOSE BY TPLNR ascending ERDAT DESCENDING.

          ENDIF.
        ENDIF.
      endif.
    ENDIF.
  ENDIF.

   * getting dates from Notification for flttyp is R and G.
      IF
                           wa_funct_loc-fltyp = 'R' OR
                           wa_funct_loc-fltyp = 'G'.
*                           wa_funct_loc-fltyp = 'B' OR.
        if I_OPEN is not initial.

          READ TABLE I_OPEN INTO WA_OPEN with key tplnr = wa_funct_loc-tplnr
          Binary search.
          IF SY-SUBRC = 0.

            wa_funct_loc-ZZNEXT_INSPFRM_T = WA_OPEN-STRMN.
            wa_funct_loc-ZZNEXT_INSPTO_T = WA_OPEN-LTRMN.
          endif.
        endif.
        CLEAR: WA_CLOSE.

        LV_COUNT1 = 0.


        if I_CLOSE is not initial.
          READ TABLE I_CLOSE INTO WA_CLOSE with key tplnr = wa_funct_loc-tplnr
          Binary search.
          IF SY-SUBRC = 0.
            wa_funct_loc-ZZLAST_INSP_T = WA_CLOSE-BEZDT.
            L_index1 = sy-tabix.

            LV_COUNT1 = L_index1 + 1.

            READ TABLE I_CLOSE INTO WA_CLOSE index LV_COUNT1.
            IF SY-SUBRC = 0.
              if WA_CLOSE-tplnr wa_funct_loc-tplnr.
                wa_funct_loc-ZZPREV_INSP_T = WA_CLOSE-BEZDT.
              endif.
            endif.
          endif.
        ENDIF.
      ENDIF.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Did you try debug your code to find the exact line with problem?

Former Member
0 Kudos

any comments please


Former Member
0 Kudos

any comments please