Improve performence in Declaration part.

Hi,
Performence in declaration.
Data Types:
  TYPES : BEGIN OF itab,
           bukrs TYPE t001-bukrs,
           ktopl TYPE t001-ktopl,
          END OF itab.
Work Ares:
DATA:  wa_itab         TYPE itab,
Int Table:
it_itab         TYPE STANDARD TABLE OF itab,
CONSTANTS: lc_n           TYPE char1 
this is my declaration ..so to improve the declaration wise is any other way to improve performence.
By,
Kmr.

Hi ,
There is no such concept that performance is dependent of declaration of types , workarea and internal tables.
In internal tables case, type of internal table used can help to improve performance.
Only, you can follow client standards in declaration of these.
In you case , you can change code as below
TYPES : BEGIN OF itab,
bukrs TYPE bukrs, "Use Data element rather than field
ktopl TYPE ktopl, "Use Data element rather than field
END OF itab.
Hope this helps you.

Similar Messages

  • Exception in declare part..?

    hi,
    how we can catch exception in declare part..
    declare
    num1 number(2):=303;
    begin
    dbms_output.putline('num1 value-'||num1);
    exception
    when others then
    dbms_output.putline('error occured');
    end;
    rgds,
    pc
    Edited by: PC on Sep 9, 2010 2:20 AM

    BluShadow wrote:
    Or just wrap such things up in another execution block...
    SQL> ed
    Wrote file afiedt.buf
    1  begin
    2    declare
    3      num1 number(2):=303;
    4    begin
    5      dbms_output.put_line('num1 value-'||num1);
    6    end;
    7  exception
    8    when others then
    9      dbms_output.put_line('error occured');
    10      raise;
    11* end;
    SQL> /
    error occured
    begin
    ERROR at line 1:
    ORA-06502: PL/SQL: numeric or value error: number precision too large
    ORA-06512: at line 10
    Fair enough, but the error message says the error occurs at line 10 while the problem is at line 3. Not that the right line number occurs in the error message all the time anyway ...

  • Hi how to improve performence of this program

    Hi all,
    How to improve the performence of this program.....................
    REPORT z03_gil010 NO STANDARD PAGE HEADING LINE-SIZE 130.
                                 INCLUDE                                 *
    INCLUDE: z00_bci010.                   " Gestion des anomalies.
                          Déclaration des données                        *
                       Tables de la bases de données                     *
    TABLES:
            ekpo,        " Poste document d'achat.
            lfa1,        " Base fournisseurs (généralités).
            marc,        " Données division de l'article.
            z03_bw_cmp1,
            eord,        "Répertoire des sources appro. Achats
            eina,        "Fiche infos-achats - données générales
            t024,        "Groupes d'acheteurs
            tvarv.                                              "FAE17345+
                       Déclaration des données internes                  *
    Déclaration de la table interne qui permet de recuperer les mois.
    DATA: BEGIN OF itb_months OCCURS 12.
            INCLUDE STRUCTURE t247.
    DATA: END OF itb_months.
    Table pour récupération d'infos sur les divisions
    DATA: BEGIN OF itb_t001w OCCURS 0,
            werks LIKE t001w-werks,
            fabkl LIKE t001w-fabkl," Clé du calendrier d'entreprise
          END OF itb_t001w.
    Déclaration de la table interne contenant les infos sur l'adresse du
    fournisseur.
    DATA: BEGIN OF itb_adresse OCCURS 0,
            lifnr LIKE lfa1-lifnr,           " Numéro de compte fournisseur.
            name1 LIKE lfa1-name1,                              " Nom 1.
            name2 LIKE lfa1-name2,                              " Nom 2.
            name3 LIKE lfa1-name3,                              " Nom 3.
            name4 LIKE lfa1-name4,                              " Nom 4.
            stras LIKE lfa1-stras,           " N° de rue et nom de la rue.
            pstlz LIKE lfa1-pstlz,           " Code postal.
            ort01 LIKE lfa1-ort01,           " Localité.
            pfach LIKE lfa1-pfach,           " Boîte postale.
            pstl2 LIKE lfa1-pstl2,           " Code de la boîte postale.
            land1 LIKE lfa1-land1,           " Clé de pays.
            landx LIKE t005t-landx,          " Pays.
            spras LIKE lfa1-spras,           " Code langue
    END OF itb_adresse.
    Déclaration d'une table interne pour les informations sur les
    prévisions de commande.
    DATA: BEGIN OF itb_prev_cde OCCURS 0,
            werks LIKE marc-werks,            " Division
            idnlf LIKE eina-idnlf,            " ADDsde ref article frn
            lifnr LIKE eord-lifnr,            " N° fournisseur.
            ekgrp LIKE marc-ekgrp,            " Groupe d'acheteurs
            dispo LIKE marc-dispo,            " Code gestionnaire MRP
            matnr LIKE eord-matnr,            " Article.
            maktx LIKE makt-maktx,            " Désignation article.
            bstmi LIKE marc-bstmi,            " Quantité de commande.
            men00 LIKE plaf-gsmng,            " Quantité du mois en cours M.
            men01 LIKE plaf-gsmng,            " Quantité pour le mois M+1.
            men02 LIKE plaf-gsmng,            " Quantité pour le mois M+2.
            men03 LIKE plaf-gsmng,            " Quantité pour le mois M+3.
            men04 LIKE plaf-gsmng,            " Quantité pour le mois M+4.
            men05 LIKE plaf-gsmng,            " Quantité pour le mois M+5.
            men06 LIKE plaf-gsmng.            " Quantité pour le mois M+6.
    DATA: END OF itb_prev_cde.
    Structure de travail pour les commandes convernant les PFC
    DATA str_pca_pfc  LIKE itb_prev_cde.
    *add sde
    DATA str_eord_pfc  LIKE itb_prev_cde.
    Structure de travail pour les prévisons PFC
    DATA str_prev_pfc LIKE itb_prev_cde.
    Déclaration d'une table interne pour les informations sur le
    portefeuille des commandes d'achat.
    DATA: BEGIN OF itb_pca OCCURS 0,
            werks LIKE ekpo-werks,    " Division
            idnlf LIKE eina-idnlf,     " ADDsde ref article frn
            lifnr LIKE eord-lifnr,    " N° fournisseur.
            ekgrp LIKE marc-ekgrp,    " Groupe d'acheteurs
            dispo LIKE marc-dispo,    " Code gestionnaire MRP
            matnr LIKE eord-matnr,    " Article.
            maktx LIKE makt-maktx,    " Désignation article.
            ebeln LIKE ekes-ebeln,    " Numéro du document d'achat.
            ebelp LIKE ekes-ebelp,    " Numéro de poste du document d'achat.
            slfdt LIKE eket-slfdt,    " Date de livraison statistique
            eindt LIKE ekes-eindt,    " Date de livraison indiquée dans la
                                      " confirmation de la cde.
            menge LIKE ekes-menge,    " Quantité indiquée dans la confirma-
                                      " tion de la commande.
            attdu LIKE eket-wemng,    " Portefeuille fournisseur.
            netpr LIKE ekpo-brtwr,    " Prix net du document d'achat dans
                                      " la devise du document.
            rtard TYPE i,             " Retard en jours ouvres.
            wemng LIKE eket-wemng,    " Quantité de l'entrée de marchandise.
            bldat LIKE mkpf-bldat,    " Date inscrite sur la pièce/sur le
                                      " document.
            qtran LIKE ekes-menge,    " Quantité en transit.
            dtran LIKE ekes-eindt.    " Date du dernier avis de transit.
    DATA: END OF itb_pca.
    DATA: w_i TYPE i,                "Compteur
          w_i_char(1) TYPE c,        "Texte pour récupérer compteur
          w_nm_zone(20) TYPE c,      "Nom zone pour assign au field-symbols
          w_nb_j TYPE i,             "Nb de jours ouvrés jusqu'à fin mois
          w_nb_j_tot TYPE i.         "Nb de jours ouvrés du mois
    FIELD-SYMBOLS:       TYPE ANY.
    Déclaration d'une table contenant les fiches info achat.
    DATA: BEGIN OF itb_eina OCCURS 0,
            matnr LIKE eina-matnr,
            lifnr LIKE eina-lifnr,
            idfnl LIKE eina-idnlf.
    DATA: END OF itb_eina.
    Déclaration d'une table contenant les infos groupe acheteur.
    *DATA: BEGIN OF itb_t024 OCCURS 0,
           ekgrp LIKE t024-ekgrp,
           eknam LIKE t024-eknam,
           ektel LIKE t024-ektel,
           telfx LIKE t024-telfx.
    *DATA: END OF itb_t024.
    Déclaration d'une table pour le transfert du fichier.
    DATA: BEGIN OF itb_transfert OCCURS 0,
            col00(8),                 "division
            col00bis(20),             "Reference article
            col01(18),                "No article
            col02(45),                "libelle article
            col021(17),               "Groupe acheteur
            col022(13),               "gestionnaire
            col03(17),                "qte commandée ou No de commande
            col04(13),                "Mois 1 ou No poste cde
            col05(20),                "Mois 2 ou délai initial
            col06(33),                "Mois 3 ou délai négocié
            col07(13),                "Mois 4 ou qté cdée
            col08(13),                "Mois 5 ou qté attendue
            col09(13),                "Mois 6 ou Montant attendu
            col10(13),                "Mois 7 ou retard
            col11(13),                "qte partielle livree
            col12(13),                "date livraison partielle
            col13(13),                "qté en transit
            col14(13).                "date
    DATA: END OF itb_transfert.
    Déclaration d'une table contenant la liste des fournisseurs.
    DATA: BEGIN OF itb_lifnr OCCURS 0,
            werks LIKE marc-werks,
            idfnl LIKE eina-idnlf,
            lifnr LIKE eord-lifnr,
            ekgrp LIKE marc-ekgrp,
            spras LIKE lfa1-spras,
            eknam LIKE t024-eknam,
            ektel LIKE t024-ektel,
            telfx LIKE t024-telfx.
    DATA: END OF itb_lifnr.
    Déclaration d'une structure pour la selection dans la table MSEG.
    DATA : BEGIN OF itb_mseg OCCURS 0,
             mblnr LIKE mseg-mblnr,
             mjahr LIKE mseg-mjahr,
             ebeln LIKE mseg-ebeln,
             ebelp LIKE mseg-ebelp,
           END OF itb_mseg.
    déclaration d'une structure pour la selection dans EKPO.
    DATA : BEGIN OF itb_ekpo OCCURS 0,
             lifnr LIKE ekko-lifnr,
             ebeln LIKE ekpo-ebeln,
             ebelp LIKE ekpo-ebelp,
             menge LIKE ekpo-menge,
             bpumz LIKE ekpo-bpumz,
             bpumn LIKE ekpo-bpumn,
             matnr LIKE ekpo-matnr,
             werks LIKE ekpo-werks,
             netpr LIKE ekpo-netpr,
             peinh LIKE ekpo-peinh,  "Base de prix FAE17345+
             ekgrp LIKE ekko-ekgrp,   "AFT++
             dispo LIKE marc-dispo,   "AFT++
           END OF itb_ekpo.
    déclaration d'une structure pour la selection dans EKPO.
    DATA : BEGIN OF itb_ekko OCCURS 0,
             ebeln LIKE ekko-ebeln,
             lifnr LIKE ekko-lifnr,
             spras LIKE ekko-spras,
           END OF itb_ekko.
    déclaration d'une structure pour la selection dans EKES.
    DATA : BEGIN OF itb_ekes OCCURS 0,
             ebeln LIKE eket-ebeln,
             ebelp LIKE eket-ebelp,
             ebtyp LIKE ekes-ebtyp,
             eindt LIKE ekes-eindt,
             menge LIKE ekes-menge,
             dabmg LIKE ekes-dabmg,
             etens LIKE ekes-etens,
           END OF itb_ekes.
    déclaration d'une structure pour la selection dans EKET
    DATA : BEGIN OF itb_eket OCCURS 0,
             ebeln LIKE eket-ebeln,
             ebelp LIKE eket-ebelp,
             menge LIKE eket-menge,
             wemng LIKE eket-wemng,
             eindt LIKE eket-eindt,
             slfdt LIKE eket-slfdt,
           END OF itb_eket.
    déclaration d'une structure pour la selection dans MKPF.
    DATA : BEGIN OF itb_mkpf OCCURS 0,
             mblnr LIKE mkpf-mblnr,
             mjahr LIKE mkpf-mjahr,
             bldat LIKE mkpf-bldat,
           END OF itb_mkpf.
    Déclaration d'une structure pour la sélection dans EORD.
    DATA : BEGIN OF itb_eord OCCURS 0,
             matnr LIKE eord-matnr,
             werks LIKE eord-werks,
             lifnr LIKE eord-lifnr,
             ekgrp LIKE marc-ekgrp,
             dispo LIKE marc-dispo,                             "DE3K924352
             disls LIKE marc-disls,
             bstfe LIKE marc-bstfe,
             bstrf LIKE marc-bstrf,
             bstmi LIKE marc-bstmi,
             bstma LIKE marc-bstma,
           END OF itb_eord.
    DATA : BEGIN OF itb_eordw OCCURS 0.
            INCLUDE STRUCTURE itb_eord.
    DATA : END OF itb_eordw.
    Déclaration d'une structure pour la sélection dans MAKT.
    DATA : BEGIN OF itb_makt OCCURS 0,
             matnr LIKE makt-matnr,
             spras LIKE makt-spras,
             maktx LIKE makt-maktx,
           END OF itb_makt.
    Déclaration d'une structure pour la sélection dans EBAN.
    DATA : BEGIN OF itb_eban OCCURS 0,
             matnr LIKE eban-matnr,
             werks LIKE eban-werks,
             flief LIKE eban-flief,
             lfdat LIKE eban-lfdat,
             menge LIKE eban-menge,
             bsmng LIKE eban-bsmng,
             webaz LIKE eban-webaz,
             ekgrp LIKE eban-ekgrp,
             ebeln LIKE eban-ebeln,
             banfn LIKE eban-banfn,
             bnfpo LIKE eban-bnfpo, "DB3K900702+
           END OF itb_eban.
    Déclaration d'une structure pour la sélection dans PLAF.
    DATA : BEGIN OF itb_plaf OCCURS 0,
             plnum LIKE plaf-plnum, "DB3K900702+
             matnr LIKE plaf-matnr,
             plwrk LIKE plaf-plwrk,
             flief LIKE plaf-flief,
             pedtr LIKE plaf-pedtr,
             gsmng LIKE plaf-gsmng,
             webaz LIKE plaf-webaz,
           END OF itb_plaf.
    Déclaration d'une structure pour la sélection dans MARC.
    DATA : BEGIN OF itb_marc OCCURS 0,
             matnr LIKE marc-matnr,
             werks LIKE marc-werks,
             disls LIKE marc-disls,
             bstrf LIKE marc-bstrf,
             bstmi LIKE marc-bstmi,
             bstma LIKE marc-bstma,
             bstfe LIKE marc-bstfe,
             ekgrp LIKE marc-ekgrp,
             dispo LIKE marc-dispo,
           END OF itb_marc.
    DATA : BEGIN OF itb_marc_eord OCCURS 0,
              matnr LIKE marc-matnr,
              werks LIKE marc-werks,
              strgr LIKE marc-strgr,   "groupe de stratégie planif
           END OF itb_marc_eord.
    DATA : BEGIN OF itb_z03_bw_cmp1 OCCURS 0,
             matnr LIKE z03_bw_cmp1-matnr,
             werks LIKE z03_bw_cmp1-werks,
             pdatu LIKE z03_bw_cmp1-pdatu,
             plnmg LIKE z03_bw_cmp1-plnmg,
           END OF itb_z03_bw_cmp1.
    Begin change BNI <DE3K937051>
    DATA : BEGIN OF itb_z03_bw_cmp2 OCCURS 0,
             matnr LIKE z03_bw_cmp2-matnr,
             werks LIKE z03_bw_cmp2-werks,
             pdatu LIKE z03_bw_cmp2-pdatu,
             plnmg LIKE z03_bw_cmp2-plnmg,
           END OF itb_z03_bw_cmp2.
    *End change BNI
    DATA : BEGIN OF str_index1,
             matnr LIKE eord-matnr,
             werks LIKE eord-werks,
          END OF str_index1.
    DATA : BEGIN OF str_index2,
             matnr LIKE eord-matnr,
             werks LIKE eord-werks,
          END OF str_index2.
    DATA : BEGIN OF str_index3_eord,
             matnr LIKE eord-matnr,
             werks LIKE eord-werks,
          END OF str_index3_eord.
    DATA : BEGIN OF str_index4,
             matnr LIKE eord-matnr,
             werks LIKE eord-werks,
          END OF str_index4.
    DATA : BEGIN OF str_index5,
             matnr LIKE eord-matnr,
             werks LIKE eord-werks,
    END OF str_index5.
    DATA : BEGIN OF str_index6,
             matnr LIKE eord-matnr,
             werks LIKE eord-werks,
    END OF str_index6.
    DATA : BEGIN OF str_index7,
             matnr LIKE eord-matnr,
             werks LIKE eord-werks,
    END OF str_index7.
    Déclaration des variables de debut et de fin de mois.
    DATA: w_debut_mois    LIKE sy-datum,
          w_debut_periode LIKE sy-datum,
          w_fin_mois      LIKE sy-datum,
          w_fin_periode   LIKE sy-datum.
    Déclaration des variables pour les dates.
    DATA: w_date0 LIKE sy-datum,
          w_date1 LIKE sy-datum,
          w_date2 LIKE sy-datum,
          w_date3 LIKE sy-datum,
          w_date4 LIKE sy-datum,
          w_date5 LIKE sy-datum,
          w_date6 LIKE sy-datum,
          w_datejour LIKE sy-datum,                             "FAE15269
          w_dat_da LIKE eban-lfdat,
          w_dat_op LIKE plaf-pedtr,
          w_mois0 LIKE t247-ltx,
          w_mois1 LIKE t247-ltx,
          w_mois2 LIKE t247-ltx,
          w_mois3 LIKE t247-ltx,
          w_mois4 LIKE t247-ltx,
          w_mois5 LIKE t247-ltx,
          w_mois6 LIKE t247-ltx,
          w_lendemain LIKE sy-datum.                            "FAE17345+
    Temoin d'un AR dans la commande d'achat.
    DATA: w_temoin_ar.
    Numéro de la confirmation de la commande
    DATA : w_etens LIKE ekes-etens.
    Déclaration des variables pour le nom des fichiers.
    DATA: w_nom_fichier LIKE rlgrap-filename,
          w_fichier LIKE rlgrap-filename,
          w_racine LIKE rlgrap-filename,
          w_file LIKE rlgrap-filename.
    Déclaration d'une table interne pour le transfert.
    DATA: BEGIN OF itb_trans OCCURS 0,
            w_ligne(320).
    DATA: END OF itb_trans.
    Déclaration d'une variable pour rechercher les enregistrements vides.
    DATA: w_compteur     TYPE i,
          w_compteur1    TYPE i,
          w_compteur2    TYPE i,
          w_retard       TYPE i,          " Retard en jours ouvres.
          w_trouve_pfc   TYPE c, "addsde
          w_trouve_pfs   TYPE c, "+DE3K937051
          w_trouve       TYPE c.
    *Index pour les LOOP
    DATA : w_index_ekpo LIKE sy-tabix,
           w_index_ekes LIKE sy-tabix,
           w_index_eket LIKE sy-tabix,
           w_index_mseg LIKE sy-tabix,
           w_index_eban LIKE sy-tabix,
           w_index_plaf LIKE sy-tabix,
           w_index_pca  LIKE sy-tabix,
           w_index_z03_bw_cmp1 LIKE sy-tabix,
           w_index_z03_bw_cmp2 LIKE sy-tabix."+DE3K937051
    RANGES : r_type_pfs   FOR marc-strgr.
    *fichier sur serveur +EDR231003
    DATA : w_chemin LIKE filename-fileintern,  "nom du fichier
           w_date_fichier(12) TYPE c,          "Date format DD_MM_AA
           w_csv(307) TYPE c.                  "ligne du fichier format CSV
    CONSTANTS: k_imputation_m LIKE eban-knttp VALUE 'M'.        "FAE19001+
                     Description de l écran de sélection                 *
                         Paramètres "UTILISATION"                        *
    Ouverture d'un block de sélection pour le(s) fournisseur(s).
    SELECTION-SCREEN BEGIN OF BLOCK block1 WITH FRAME TITLE text-bl1.
    Sélection division(s)
    SELECT-OPTIONS: s_werks FOR ekpo-werks.
    Sélection fournisseur(s).
    SELECT-OPTIONS: s_lifnr FOR lfa1-lifnr OBLIGATORY.
    Sélection du Groupe d'acheteur
    *SELECT-OPTIONS: s_ekgrp FOR marc-ekgrp.   "-FAE26446
    *SELECT-OPTIONS: s_dispo FOR marc-dispo.   "-FAE26446
    SELECTION-SCREEN END OF BLOCK block1.
    FAE 26446 : ajout
    SELECTION-SCREEN BEGIN OF BLOCK block3 WITH FRAME TITLE text-bl3.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETER p_ekgrp RADIOBUTTON GROUP g3.
    SELECTION-SCREEN COMMENT 5(24) text-001 FOR FIELD p_ekgrp.
    SELECT-OPTIONS: s_ekgrp FOR marc-ekgrp.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETER p_dispo RADIOBUTTON GROUP g3.
    SELECTION-SCREEN COMMENT 5(24) text-002 FOR FIELD p_dispo.
    SELECT-OPTIONS: s_dispo FOR marc-dispo.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN END OF BLOCK block3.
    FAE 26446 : fin ajout
                           Paramètres "SYSTEME"                          *
    Saut de 2 lignes.
    SELECTION-SCREEN: SKIP 2.
    Ouverture d'un block de sélection pour l'adresse physique du fichier.
    SELECTION-SCREEN BEGIN OF BLOCK block2 WITH FRAME TITLE text-bl2.
    PARAMETERS: p_pc       RADIOBUTTON GROUP rad1 DEFAULT 'X',  "+EDR231003
                p_fic_pc LIKE rlgrap-filename.                  "+EDR231003
    SELECTION-SCREEN SKIP.                                      "+EDR231003
    PARAMETERS     : p_serve   RADIOBUTTON GROUP rad1,          "+EDR231003
                     p_fic_se LIKE filename-fileintern          "+EDR231003
                              DEFAULT 'Z03_PREV_COMMANDES'.     "+EDR231003
    SELECTION-SCREEN END OF BLOCK block2.
                           Logique de traitement                         *
                              INITIALIZATION                             *
    INITIALIZATION.
    Date du jour
      MOVE sy-datum TO w_datejour.                              "FAE15269
    Gestion des anomalies.
      MOVE text-lb1 TO w_lb_traitement.
      PERFORM f930_init USING sy-cprog '30'.
    Fin de la gestions des anomalies.
    Récuperation des mois dans la table interne 'ITB_MONTHS'.
      CALL FUNCTION 'MONTH_NAMES_GET'
           EXPORTING
                language              = sy-langu
           TABLES
                month_names           = itb_months
           EXCEPTIONS
                month_names_not_found = 1
                OTHERS                = 2.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    Récupération des differentes periodes.
      PERFORM f100_recuperation_date TABLES itb_months.
    Récupération du debut du mois.
      CONCATENATE sy-datlo(6) '01' INTO w_debut_mois.
      MOVE: w_debut_mois TO w_debut_periode.
    Récupération du dernier jour du mois.
      CALL FUNCTION 'LAST_DAY_OF_MONTHS'
           EXPORTING
                day_in            = sy-datlo
           IMPORTING
                last_day_of_month = w_fin_mois
           EXCEPTIONS
                day_in_no_date    = 1
                OTHERS            = 2.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
                              TOP-OF-PAGE                                *
    TOP-OF-PAGE.
      CALL FUNCTION 'Z_00_BC_TOP_OF_PAGE'
           EXPORTING
                p_linsz   = k_ligne
                p_pagno   = sy-pagno
                p_prog    = sy-cprog
                p_projet  = k_projet
                p_societe = k_societe
                p_sujet   = sy-title.
                              END-OF-PAGE                                *
    END-OF-PAGE.
                            AT SELECTION-SCREEN                          *
    FAE 26446 : ajout
    AT SELECTION-SCREEN ON BLOCK block3.
      IF NOT ( s_ekgrp IS INITIAL )
      AND  NOT ( s_dispo IS INITIAL ).
        MESSAGE e394(z03_mm).
      ENDIF.
      IF p_ekgrp = 'X'.
        IF s_ekgrp IS INITIAL.
          MESSAGE e395(z03_mm).
        ENDIF.
      ELSE.
        IF s_dispo IS INITIAL.
          MESSAGE e396(z03_mm).
        ENDIF.
      ENDIF.
    fae26446 fin ajout
    AT SELECTION-SCREEN ON BLOCK block2.
      IF p_pc = 'X'.
        IF p_fic_pc IS INITIAL.
    *Attention, il n'y a aucune adresse de sauvegarde pour le(s) fichier(s)
          MESSAGE e021(z03_mm).
        ENDIF.
      ELSE.
        IF p_fic_se IS INITIAL.
    *Attention, il n'y a aucune adresse de sauvegarde pour le(s) fichier(s)
          MESSAGE e021(z03_mm).
        ENDIF.
      ENDIF.
    Création du matchcode pour la selection du fichier local.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_fic_pc.
      CALL FUNCTION 'WS_FILENAME_GET'
           EXPORTING
                def_filename     = p_fic_pc
                def_path         = 'C:'
                mask             = text-ma1
                mode             = 'S'
                title            = text-sel
           IMPORTING
                filename         = p_fic_pc
           EXCEPTIONS
                inv_winsys       = 1
                no_batch         = 2
                selection_cancel = 3
                selection_error  = 4
                OTHERS           = 5.
      IF sy-subrc NE 0 AND sy-subrc NE 3.
        MESSAGE e032(z03_mm).
      ENDIF.
                            START-OF-SELECTION                           *
    START-OF-SELECTION.
      PERFORM select_donnees.
    =================================================
    Liste des ARTICLES impactés pour les prévisions *
    =================================================
    ===================================
    PORTEFEUILLE DE COMMANDES D'ACHAT *
    ===================================
    Construction itb_pca à partir de EKKO/EKPO.
      w_index_ekpo  = 1.
      w_index_ekes  = 1.
      w_index_eket  = 1.
      w_index_mseg  = 1.
    SORT itb_ekko BY ebeln.           "-FAE26446
      SORT itb_ekpo BY ebeln ebelp.
      SORT itb_makt BY matnr spras.
      SORT itb_eket BY ebeln ebelp.
      SORT itb_ekes BY ebeln ebelp.
      SORT itb_mseg BY ebeln ebelp.
      SORT itb_mkpf BY mblnr mjahr.
      SORT itb_marc BY matnr werks.                             "+FAE26446
    FAE 26446 remplacement
    LOOP AT itb_ekko.
       LOOP AT itb_ekpo.
               FROM w_index_ekpo.
         IF itb_ekko-ebeln = itb_ekpo-ebeln.
      LOOP AT itb_ekpo.
        READ TABLE itb_marc WITH KEY
           matnr = itb_ekpo-matnr
           werks = itb_ekpo-werks BINARY SEARCH.
        CHECK sy-subrc = 0.
    FAE 26446 fin remplacement
        itb_pca-ebeln = itb_ekpo-ebeln.
        itb_pca-ebelp = itb_ekpo-ebelp.
      itb_pca-lifnr = itb_ekko-lifnr.   "-FAE26446
        itb_pca-lifnr = itb_ekpo-lifnr.                         "+FAE26446
        itb_pca-ekgrp = itb_ekpo-ekgrp.                         "+FAE26446
        itb_pca-dispo = itb_ekpo-dispo.                         "+FAE26446
        itb_pca-matnr = itb_ekpo-matnr.
        itb_pca-werks = itb_ekpo-werks.
      Recherche du libellé article
        READ TABLE itb_makt
                   WITH KEY matnr = itb_ekpo-matnr
                            spras = text-fra
                   BINARY SEARCH.
        IF sy-subrc = 0.
          itb_pca-maktx = itb_makt-maktx.
        ELSE.
          READ TABLE itb_makt
                    WITH KEY matnr = itb_ekpo-matnr
                             spras = text-ang
                    BINARY SEARCH.
          IF sy-subrc = 0.
            itb_pca-maktx = itb_makt-maktx.
          ENDIF.
        ENDIF.
        IF NOT itb_ekpo-bpumn IS INITIAL.
          itb_pca-menge = itb_ekpo-menge * itb_ekpo-bpumz /
                                           itb_ekpo-bpumn.
        ENDIF.
      Sélect° ds la table EKES des dates de livraisons et des qtés
      en transit
        CLEAR w_temoin_ar.
        CLEAR w_etens.
        LOOP AT itb_ekes
                FROM w_index_ekes.
          IF  itb_ekes-ebeln = itb_ekpo-ebeln
          AND itb_ekes-ebelp = itb_ekpo-ebelp.
            IF itb_ekes-ebtyp = text-arn.
              itb_pca-eindt = itb_ekes-eindt.
              w_temoin_ar = 'X'.
            ELSE.
            Si c'est une qté en transit alors on recupere
            la quantité et la date.
              IF itb_ekes-dabmg < itb_ekes-menge.
                itb_pca-qtran = itb_pca-qtran + itb_ekes-menge -
                                itb_ekes-dabmg.
              ENDIF.
              IF itb_ekes-etens > w_etens.
                w_etens = itb_ekes-etens.
                itb_pca-dtran = itb_ekes-eindt.
              ENDIF.
            ENDIF.
          ELSEIF itb_ekes-ebeln > itb_ekpo-ebeln
          OR ( itb_ekes-ebeln = itb_ekpo-ebeln
          AND itb_ekes-ebelp > itb_ekpo-ebelp ).
            w_index_ekes = sy-tabix.
            EXIT.
          ENDIF.
        ENDLOOP.
      S'il n'y a pas d'AR alors récupérat° de la date livraison dans EKET.
        LOOP AT itb_eket
                FROM w_index_eket.
          IF  itb_eket-ebeln = itb_ekpo-ebeln
          AND itb_eket-ebelp = itb_ekpo-ebelp.
            IF w_temoin_ar IS INITIAL.
              itb_pca-eindt = itb_eket-eindt.
            ENDIF.
            itb_pca-slfdt = itb_eket-slfdt.
          Calcul du portefeuille fournisseur à partir de la
          qté commandée et la qté reçue
            itb_pca-attdu = itb_pca-attdu + itb_eket-menge -
                            itb_eket-wemng.
          Calcul du montant du poste
            itb_pca-netpr = itb_ekpo-netpr * itb_pca-attdu.
            IF itb_ekpo-peinh NE 0.
              itb_pca-netpr = itb_pca-netpr / itb_ekpo-peinh.
            ENDIF.
          Calcul quantité réceptionnée.
            itb_pca-wemng = itb_pca-wemng + itb_eket-wemng.
          Calcul du retard en nombre de jours calendaires
          Le calcul du retard  ne doit pas prendre en compte
          le jour de livraison
            ADD 1 TO itb_eket-eindt.
            IF NOT itb_pca-attdu  IS INITIAL
            AND    itb_eket-eindt LT sy-datum.
            Calcul du retard en nombre de jours ouvrés
              CLEAR w_retard.
              CALL FUNCTION 'Z_00_BC_WORKDAYS_PER_PERIOD'
                   EXPORTING
                        date_deb = itb_eket-eindt
                        date_fin = sy-datum
                   IMPORTING
                        jours    = w_retard.
              itb_pca-rtard = itb_pca-rtard + w_retard .
            ENDIF.
          ELSEIF itb_eket-ebeln > itb_ekpo-ebeln
          OR (   itb_eket-ebeln = itb_ekpo-ebeln
          AND    itb_eket-ebelp > itb_ekpo-ebelp ).
            w_index_eket = sy-tabix.
            EXIT.
          ENDIF.
        ENDLOOP.
      Recherche de la derniere date de livraison.
        LOOP AT itb_mseg
                FROM w_index_mseg.
          IF  itb_mseg-ebeln = itb_ekpo-ebeln
          AND itb_mseg-ebelp = itb_ekpo-ebelp.
            READ TABLE itb_mkpf
                       WITH KEY mblnr = itb_mseg-mblnr
                                mjahr = itb_mseg-mjahr
                       BINARY SEARCH.
            IF sy-subrc = 0.
              IF itb_mkpf-bldat > itb_pca-bldat.
                itb_pca-bldat = itb_mkpf-bldat.
              ENDIF.
            ENDIF.
          ELSEIF itb_mseg-ebeln > itb_ekpo-ebeln
          OR (   itb_mseg-ebeln = itb_ekpo-ebeln
          AND    itb_mseg-ebelp > itb_ekpo-ebelp ).
            w_index_mseg = sy-tabix.
            EXIT.
          ENDIF.
        ENDLOOP.
        APPEND itb_pca.
        CLEAR itb_pca.
    FAE26446 suppression parag. suivant
         ELSEIF itb_ekpo-ebeln > itb_ekko-ebeln.
           w_index_ekpo = sy-tabix.
           EXIT.
         ENDIF.
       ENDLOOP.
    Fin FAE26446
      ENDLOOP.
    =========================
    PREVISIONS DE COMMANDES *
    =========================
      SORT itb_eord        BY matnr werks lifnr ekgrp.
      SORT itb_eban        BY matnr werks flief ekgrp.
      SORT itb_plaf        BY matnr plwrk flief.
      SORT itb_z03_bw_cmp1 BY matnr werks.
      SORT itb_z03_bw_cmp2 BY matnr werks."+DE3K937051
      SORT itb_pca         BY matnr werks lifnr.
      w_index_eban = 1.
      w_index_plaf = 1.
      w_index_z03_bw_cmp1 = 1.
      w_index_pca = 1.
      w_index_z03_bw_cmp2 = 1."+DE3K937051
    Remplissage de la table des prévisions de commande.
      LOOP AT itb_eord.
        CLEAR: str_prev_pfc,
               w_trouve.
        MOVE-CORRESPONDING itb_eord TO str_index1.
        MOVE-CORRESPONDING itb_eord TO str_index3_eord.
        MOVE-CORRESPONDING itb_eord TO itb_prev_cde.
      Recherche dans table division/article (MARC) afin de déterminer si
      article PFS (prod fabriqué à stock) ou PFC (Prod fabriqué sur cde)
        AT NEW werks.
          READ TABLE itb_marc_eord
                     WITH KEY matnr = itb_eord-matnr
                              werks = itb_eord-werks
                     BINARY SEARCH.
          IF sy-subrc NE 0.
            CLEAR itb_marc_eord.
          ENDIF.
        ENDAT.
    a - Prévisions pour les PFS : DA + OP *
    *Calcul des quantités de commande.
        IF itb_eord-disls = text-tl1.
          itb_prev_cde-bstmi =  itb_eord-bstfe.
        ELSEIF itb_eord-disls = text-tl2
        OR     itb_eord-disls = text-tl3.
          IF  itb_eord-bstrf NE 0
          AND itb_eord-bstmi = 0
          AND itb_eord-bstma = 0.
            itb_prev_cde-bstmi = itb_eord-bstrf.
          ELSEIF itb_eord-bstrf NE 0
          AND    itb_eord-bstmi NE 0.
            itb_prev_cde-bstmi = itb_eord-bstmi.
          ELSEIF itb_eord-bstrf = itb_eord-bstma
          AND    itb_eord-bstrf NE 0
          AND    itb_eord-bstmi = 0.
            itb_prev_cde-bstmi = itb_eord-bstma.
          ENDIF.
        ENDIF.
      si article PFS (Prod fabriqué à stock) recherche des
      demandes d'achat ou ordres planfiés
        IF itb_marc_eord-strgr IN r_type_pfs.
      Récupérat° calendrier de la division pour calcul correct lors de
      l'ajout de eban-webaz ou plaf-webaz jours ouvrés
          CLEAR w_trouve_pfs ."+DE3K937051
          READ TABLE itb_t001w
                     WITH KEY werks = itb_eord-werks
                     BINARY SEARCH.
          IF sy-subrc = 0.
            LOOP AT itb_eban
                    FROM w_index_eban.
              MOVE-CORRESPONDING itb_eban TO str_index2.
              IF str_index1 = str_index2.
                w_trouve_pfs = 'X'."+DE3K937051
              si qte commandées pour la DA  < quantité de la DA
                IF itb_eban-bsmng < itb_eban-menge.
                ajout de quantité de la DA - qte  commandée pour la DA
                  PERFORM affect_da.
                ENDIF.
              ELSEIF str_index2 > str_index1.
                w_index_eban = sy-tabix.
                EXIT.
              ENDIF.
            ENDLOOP.
          ENDIF.
        ajout des quantité des OP (ordres planifiés)
          LOOP AT itb_plaf
                  FROM w_index_plaf.
            MOVE-CORRESPONDING itb_plaf TO str_index4.
            str_index4-werks = itb_plaf-plwrk.
          str_index4-lifnr = itb_plaf-flief.
            IF str_index4 = str_index3_eord.
            Ajout de webaz jours ouvrés à pedtr
              CALL FUNCTION 'Z_03_MM_ADD_TO_FACTORYDATE'
                   EXPORTING
                        i_date        = itb_plaf-pedtr
                        i_calendar_id = itb_t001w-fabkl
                        i_nb_days     = itb_plaf-webaz
                   IMPORTING
                        o_date        = w_dat_op
                   EXCEPTIONS
                        conv_error    = 1
                        OTHERS        = 2.
              IF sy-subrc
       If forecasts found in Z03_BW_CMP2 for the article
       IF w_trouve_pfs = 'X'."-DE3K937602
    Recalculation prev month M in fct of Nb of wrought days of the month
        IF NOT itb_prev_cde-men00 IS INITIAL.
       one does not hold any more account of the day in progress
          w_lendemain = w_date0 + 1.
          CLEAR:w_nb_j,w_nb_j_tot.         "DE3K938206+
          CALL FUNCTION 'Z_00_BC_WORKDAYS_PER_PERIOD'
               EXPORTING
                    date_deb = w_lendemain
                    date_fin = w_fin_mois
               IMPORTING
                    jours    = w_nb_j.
          CALL FUNCTION 'Z_00_BC_WORKDAYS_PER_MONTH'
               EXPORTING
                    date  = w_lendemain
               IMPORTING
                    jours = w_nb_j_tot.
          itb_prev_cde-men00  = itb_prev_cde-men00 * w_nb_j / w_nb_j_tot
    *CLA DE3K925301 FAE27197
    *to round has the higher entirety
        itb_prev_cde-men00  = ceil( itb_prev_cde-men00 ). "DE3K938206-
        ENDIF.
       ENDIF."-DE3K937602
    *End change BNI
    b - Prévisions pour les PFC (Z03_BW_CMP1 puis rééquilibrage) *
      Recherche des previsions dans Z03_BW_CMP1
      si article PFC (Prod fabriqué sur cde) recherche des prévisions
        IF  NOT itb_marc_eord-strgr IN r_type_pfs.
          CLEAR str_prev_pfc.
          MOVE-CORRESPONDING itb_eord TO str_prev_pfc.
          CLEAR w_trouve_pfc .
          LOOP AT itb_z03_bw_cmp1
                  FROM w_index_z03_bw_cmp1.
            MOVE-CORRESPONDING itb_z03_bw_cmp1 TO str_index7.
            MOVE-CORRESPONDING itb_eord TO str_index6.
            IF str_index6 = str_index7.
          si on trouve des prévisions dans z03_bw_cmp1 pour la source
          d'appro eord alors c'est un article  PFC
              w_trouve_pfc = 'X'.
              CASE itb_z03_bw_cmp1-pdatu+0(6).
                WHEN w_date0+0(6).
                  str_prev_pfc-men00 = itb_z03_bw_cmp1-plnmg.
                WHEN w_date1+0(6).
                  str_prev_pfc-men01 = itb_z03_bw_cmp1-plnmg.
                WHEN w_date2+0(6).
                  str_prev_pfc-men02 = itb_z03_bw_cmp1-plnmg.
                WHEN w_date3+0(6).
                  str_prev_pfc-men03 = itb_z03_bw_cmp1-plnmg.
                WHEN w_date4+0(6).
                  str_prev_pfc-men04 = itb_z03_bw_cmp1-plnmg.
                WHEN w_date5+0(6).
                  str_prev_pfc-men05 = itb_z03_bw_cmp1-plnmg.
                WHEN w_date6+0(6).
                  str_prev_pfc-men06 = itb_z03_bw_cmp1-plnmg.
                WHEN OTHERS.
              ENDCASE.
            ELSEIF str_index7 > str_index6.
              w_index_z03_bw_cmp1 = sy-tabix.
              EXIT.
            ENDIF.
          ENDLOOP.
    *Begin change BNI
        Si des prévisions trouvées dans Z03_BW_CMP1 pour l'article
          IF w_trouve_pfc = 'X'.
          Recalcul prev mois M en fct du nb de jours ouvrés du mois
            IF NOT str_prev_pfc-men00 IS INITIAL.
            on ne tient plus compte du jour en cours
              w_lendemain = w_date0 + 1.
              CLEAR:w_nb_j,w_nb_j_tot.               "DE3K938206+
              CALL FUNCTION 'Z_00_BC_WORKDAYS_PER_PERIOD'
                   EXPORTING
                        date_deb = w_lendemain
                        date_fin = w_fin_mois
                   IMPORTING
                        jours    = w_nb_j.
              CALL FUNCTION 'Z_00_BC_WORKDAYS_PER_MONTH'
                   EXPORTING
                        date  = w_lendemain
                   IMPORTING
                        jours = w_nb_j_tot.
              str_prev_pfc-men00 = str_prev_pfc-men00 * w_nb_j / w_nb_j_tot.
    *CLA DE3K925301 FAE27197
    *arrondir a l'entier supèrieur
              str_prev_pfc-men00 = ceil( str_prev_pfc-men00 ).
            ENDIF.
          Equilibrage PFC : commande/prévision du mois
          Recherche COMMANDES cumulées pour M à M+6
            CLEAR str_pca_pfc.
            LOOP AT itb_pca
                    FROM w_index_pca.
              MOVE-CORRESPONDING itb_pca TO str_index5.
              IF str_index5 = str_index3_eord.
                IF NOT itb_pca-menge IS INITIAL.
                  CASE itb_pca-eindt+0(6).
                    WHEN w_date0+0(6).
                      IF itb_pca-eindt >= w_date0.
                      str_pca_pfc-men00 = str_pca_pfc-men00 + itb_pca-menge.
                      ENDIF.
                    WHEN w_date1+0(6).
                      str_pca_pfc-men01 = str_pca_pfc-men01 + itb_pca-menge.
                    WHEN w_date2+0(6).
                      str_pca_pfc-men02 = str_pca_pfc-men02 + itb_pca-menge.
                    WHEN w_date3+0(6).
                      str_pca_pfc-men03 = str_pca_pfc-men03 + itb_pca-menge.
                    WHEN w_date4+0(6).
                      str_pca_pfc-men04 = str_pca_pfc-men04 + itb_pca-menge.
                    WHEN w_date5+0(6).
                      str_pca_pfc-men05 = str_pca_pfc-men05 + itb_pca-menge.
                    WHEN w_date6+0(6).
                      str_pca_pfc-men06 = str_pca_pfc-men06 + itb_pca-menge.
                  ENDCASE.
                ENDIF."NOT itb_pca-menge IS INITIAL
              ELSEIF str_index5 > str_index3_eord.
                w_index_pca = sy-tabix.
                EXIT.
              ENDIF.
            ENDLOOP."itb_pca
    *. Equilibrer commande / prévision des mois : diminuer la quantité de
    prévision de chaque mois par le portefeuille de commande client du
    mois*. Si ce solde est négatif alors lui donner la valeur 0.
            w_i = 0.
          Ajustement commandes/prévisions pour les mois M à M+6
            WHILE w_i .
            Pour un mois, SI Prévisions > Commandes en cours
              IF .
              Prévisions = Prévisions - Commandes en cours
                 = 0.
              ENDIF.
            On passe au mois suivant
              w_i = w_i + 1.
            ENDWHILE.
            MOVE str_prev_pfc-men00 TO itb_prev_cde-men00.
            MOVE str_prev_pfc-men01 TO itb_prev_cde-men01.
            MOVE str_prev_pfc-men02 TO itb_prev_cde-men02.
            MOVE str_prev_pfc-men03 TO itb_prev_cde-men03.
            MOVE str_prev_pfc-men04 TO itb_prev_cde-men04.
            MOVE str_prev_pfc-men05 TO itb_prev_cde-men05.
            MOVE str_prev_pfc-men06 TO itb_prev_cde-men06.
          ENDIF.  "w_trouve_pfc = 'X'.
        ENDIF.
    *recherche du libellé article

    Hi,
    see this link, useful tips, links and transactions for best performance, by Anji.
    https://forums.sdn.sap.com/click.jspa?searchID=5967263&messageID=4260111
    Regards

  • Selection in other way to improve performence

    Any body can suggest me how i can write the first selection in another way with the same logic.
    it_date TYPE STANDARD TABLE OF rsdsselopt,
    SELECT bukrs belnr gjahr cpudt cputm aedat awkey
    FROM bkpf INTO TABLE it_bkpf
    WHERE cpudt IN it_date.
    help me to write same select in another form which can suggest for performence.
    Tks.

    Hi,
    I have played with your select trying to improve it. Using bukrs like '%' suggested by Diego did not improved performance in my case. But using standard index with fields bukrs, cpudt, bstat is good idea. If you do not want to create a new secondary index and you can not limit your selection for a concrete BUKRS, the best approach I have found is doing the select this way:
    data: it_date TYPE STANDARD TABLE OF rsdsselopt,
             it_t001 TYPE STANDARD TABLE OF t001,
             wa_t001 TYPE t001.
    SELECT * FROM t001 INTO TABLE it_t001.
    LOOP AT it_t001 INTO wa_t001.
    SELECT bukrs belnr gjahr cpudt cputm aedat awkey
    FROM bkpf APPENDING TABLE it_bkpf
    WHERE bukrs EQ wa_t001-bukrs
          AND cpudt IN it_date.
    ENDLOOP.
    For it_date use only such values which can be transformed to EQ, IN and BETWEEN if possible, so do not use excluding select-options, instead of operand < try to put some lower boundary and use BETWEEN instead.
    Disadvantage of this approach is that select is performed more than once. I was trying to eliminate this disadvantage doiing it this way:
    data: it_date TYPE STANDARD TABLE OF rsdsselopt,
             it_t001 TYPE STANDARD TABLE OF t001.
    SELECT * FROM t001 INTO TABLE it_t001.
    LOOP AT it_t001 INTO wa_t001.
    SELECT bukrs belnr gjahr cpudt cputm aedat awkey
    FROM bkpf INTO TABLE it_bkpf
    FOR ALL ENTRIES IN it_t001
    WHERE bukrs EQ it_t001-bukrs
          AND cpudt IN it_date.
    ENDLOOP.
    But when I looked at a execution plan for this select, although FOR ALL ENTRIES was translated using IN operator, no index was used by selection. So, this one did not bring any improvement. But it can be individual and it depends on system, because FOR ALL ENTRIES can be implemented in different way depends on database system, version and system parameters. Maybe you can try to take also this FOR ALL ENTRIES approach and improve it by changing parameters rsdb/prefer_join, rsdb/prefer_union_all, rsdb/prefer_in_itab_opt via hints.
    But I would recommend to use the first approach I have used if it is sufficient improvement.
    You should become more familiar with transaction ST05 and using SQL trace to anlayse database operations.
    Hope it helps.
    Regards,
    Adrian

  • Can we improve performence using usage tracking

    hi all
    wat is the use of usage tracking in obiee
    by using this can we improve report performance
    Thanks
    Sreedhar

    Hi,
    We can use it to track the performance but not to improve the performance...
    Check this....http://sranka.wordpress.com/2010/06/22/the-myth-usage-tracking-measures-for-tracking-the-performance-of-report-retrieval-time/
    In order to improve performance...http://obieetalk.com/obiee-performance-tuning
    http://www.rittmanmead.com/2008/11/28/thoughts-on-obiee-performance-optimization-diagnostics/
    Regards,
    Srikanth

  • How to improve performence of CRM_ORDER_MAINTAIN?

    Hi Experts,
    I am doing lead upload from flat file using CRM_ORDER_MAINTAIN.
    If the file contains records upto 50 ,it is taking aorund 6 to 10 min.
    If file contains records upto 100,it is taking 30 to 40 min.
    For around 250 records ,it has taken around 4 hours.
    Please advice on improving the performance.
    Thanks,
    Adi.

    Adi,
    I would look at using CRMXIF_ORDER_SAVE instead to upload your leads.  You also need to look at your "block size", which is basically how many records do you upload before performing a commit work in CRM? 
    Also check to see if you are properly refreshing the buffers during each upload of a block of transactions.
    Take care,
    Stephen

  • How to improve performence of the procedure using regular expressions

    Hi all,
    I have used substr, instr functions in this procedure .
    Kindly tell me how use regular_expressions in this procedure .
    /* Formatted on 2011/07/20 17:18 (Formatter Plus v4.8.8) */
    PROCEDURE pr_insrt_prcdr_rvne_edit ( --ver 4.4
    p_pa_rqst_sid IN NUMBER,
    p_err_code OUT NUMBER,
    p_err_msg OUT VARCHAR2
    IS
    v_count NUMBER;
    CURSOR error_dtls
    IS
    SELECT parent_target_table_sid, inbnd_target_table_cid,
    target_table_sid
    FROM inbnd_278_error
    WHERE parent_target_table_sid = p_pa_rqst_sid
    AND SUBSTR (error_data_value, INSTR (error_data_value, ':') + 1) IN
    ('5056', '5031');
    CURSOR error_values (
    p_target_table_sid inbnd_278_error.target_table_sid%TYPE
    IS
    SELECT MAX (DECODE (SUBSTR (error_data_value,
    INSTR (error_data_value, ':', 1) + 1
    '5056', SUBSTR (error_data_value,
    1,
    INSTR (error_data_value, ':', 1) - 1
    ) AS e5056,
    MAX (DECODE (SUBSTR (error_data_value,
    INSTR (error_data_value, ':', 1) + 1
    '5031', SUBSTR (error_data_value,
    1,
    INSTR (error_data_value, ':', 1) - 1
    ) AS e5031
    FROM inbnd_278_error
    WHERE target_table_sid = p_target_table_sid
    AND SUBSTR (error_data_value, INSTR (error_data_value, ':', 1) + 1) IN
    ('5056', '5031');
    v_error_values error_values%ROWTYPE;
    BEGIN
    p_err_code := 0;
    p_err_msg := 'Success';
    FOR curr_error_dtls_rec IN error_dtls
    LOOP
    OPEN error_values (curr_error_dtls_rec.target_table_sid);
    FETCH error_values
    INTO v_error_values;
    IF (v_error_values.e5056 IS NOT NULL
    AND v_error_values.e5031 IS NOT NULL
    THEN
    DELETE FROM inbnd_278_error
    WHERE SUBSTR (error_data_value,
    INSTR (error_data_value, ':') + 1
    ) IN ('5056', '5031')
    AND target_table_sid = curr_error_dtls_rec.target_table_sid
    AND inbnd_target_table_cid = 109;
    INSERT INTO inbnd_278_error
    (inbnd_278_error_sid,
    parent_target_table_sid, inbnd_target_table_cid,
    target_table_sid, meta_data_cid,
    error_data_value,
    created_by, created_date
    VALUES (inbnd_278_error_seq.NEXTVAL,
    curr_error_dtls_rec.parent_target_table_sid, 109,
    curr_error_dtls_rec.target_table_sid, 161,
    v_error_values.e5056
    || ','
    || v_error_values.e5031
    || ':'
    || '5059',
    1, SYSDATE
    END IF;
    CLOSE error_values;
    END LOOP;
    EXCEPTION
    WHEN OTHERS
    THEN
    p_err_code := SQLCODE;
    p_err_msg :=
    'Error occured in pr_insrt_prcdr_rvne_edit procedure '
    || SUBSTR (SQLERRM, 1, 100);
    END pr_insrt_prcdr_rvne_edit;
    Thanks,
    P Prakash
    Edited by: prakash on Jul 20, 2011 4:48 AM

    Yes as explained in the forum FAQ which you should read
    http://forums.oracle.com/forums/ann.jspa?annID=1535
    *2. How do I ask a question on the forums?*
    SQL and PL/SQL FAQ
    And the section beginning.
    *9) Formatting with {noformat}{noformat} Tags*                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How can i improve a performence of query

    How can i improve performence of query which not having the where clause for a table

    whenever the query have the where clause then only it can use the indexes
    otherwise how it can use the index eventhough we create the index of that table columns.

  • What for? (2nd part global declaration in transformation)

    Hi Experts,
    does anybody know, what for is the 2nd part global declaration in a routine of a transformation?
    Myself I'm a developer, so I can differ between global and local declaration in a class-definition. But the second possibility to declare variables is outside of class-definition and class-implementation.
    I checked start routine, end routine and character/ keyfigure routine. I can see both of the declaration. Does it makes any sence to use this declaration?
    $$ begin of global - insert your declaration only below this line  -
        ... "insert your code here
    $$ end of global - insert your declaration only before this line   -
    $$ begin of 2nd part global - insert your code only below this line  *
    ... "insert your code here
    $$ end of 2nd part global - insert your code only before this line   *
    Thanks in advance.
    Greets Nico

    Hi Lijo,
    first, thank you for you answer.
    I'm not sure if I got it.
    If you want to use a global variable for all packages that will be processed, I have to declare a CLASS-DATA. That means the instance of the class won't be deleted the whole data package.
    If I want to use a global variable that will be used in character/ keyfigure routine it's sufficient to declare DATA in 1st or 2nd part of declaration.
    I understand it in a way, that the second declaration part is redundant. Is it right?
    Thanks in advance.
    Greets Nico

  • How to improve function & procedure performence

    Hi,
    How to improve performence of function and procedure .
    When i have to use parallel_enable,deterministic features .
    thank you
    Edited by: 808542 on Dec 22, 2010 2:25 AM
    Edited by: 808542 on Dec 22, 2010 2:26 AM

    How to improve performence of function and procedure .Start with tracing the session that executes the functions/procedures and tkprof the trc. file (with wait events).
    The tkprof output will give you pointers where you could make some improvement.
    You can find many examples on http://asktom.oracle.com, do a search on 'tuning'
    For example:
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:6904032233295
    If you have no clue what all this means then ask your DBA to help you.
    See also the Performance Tuning Guide @ http://download.oracle.com/docs/cd/B19306_01/server.102/b14211/toc.htm

  • Improve performance by less server calls

    Hi,
    I have a problem with an application that are to slow. One of the
    problems is that the client calls the server alot of times. What I would
    like to do (what I should have done from the start) is minimize the calls
    to the server. But the calls are scattered around the client code so I
    can�t see an easy way of doing this.
    (Every server call go through a class called ServerInteractor.)
    I think this might be a very common newbie mistake, so I hope there is
    someone out there who knows a way to solve this.
    Thanks!

    Thanks for your replies!
    My experience is that if your app is taking too longto load, it's likely the amount of data you are
    retrieving, not the number of times you call the
    server
    Do you think this might vary if you have a slow or
    fast network-connection?We had this problem on a local network. A slow network would just be worse. Actually, we had to support slow connections (56K) so we ended up compressing the messages.
    Most likely caching the screen after the first timeyou get the information about it and reusing that
    cached version will yield better performance
    I have implemented a client cache that caches
    information about the
    windows. This was the solution we came up with for the 'big spit-ball' message pattern. We cached as much information as possible. On shutdown of the app, we serialized the cache to disk. We implemented a small message that would report when parts of the cache items were no longer valid. By making the cache block the client, we were able to do this seamlessly.
    This improves performence alot! The second
    time you open
    a window it takes 4 seconds instead of 25.
    But now I am facing another problem. After runing the
    app for a while I
    get an outOfMemoryError. Before the client cache I
    never got this error,
    but now it always comes after I run the app for a
    while. So this makes
    me think that the cache "is to be blamed". Is this a
    sign for a bug in my
    caching code? I have read that you can increase the
    memory when you
    start the app, but is that a guarantee for this never
    to happen?From your description, it sounds like increasing the max heap size will merely delay the error.
    You've got two options at this point: 1. Start looking through the code for the cache and make sure you are not holding onto expired information. 2. Get a profiling tool and use it to figure out where the leak is.
    I would attempt 1. since you just wrote the cache but I find that guis are the worst for sneaky leaks. Watch out for inner classes (not static nested classes) because they contain a hidden reference to the outer instance.

  • How to declare a string parameter

    Hi all,
    I declared a parameter of type string in parameters declaration part. System giving me a error as 'deep data type "string" is not allowed'.
    My requirement is to declare a parameter of type string for file name in GUI_DOWNLOAD FM. If I declare any other type its goin for a short dump. How to do it. Please give relevant code for it if possible.

    Hi,
    Please check, For file download,, and declaring file as parameters, all scenarios are covered,
    Please go through code.Hope it work well for your requirement.
    Reward all helpful answers.
    Thanks.
    REPORT Zxyx NO STANDARD PAGE HEADING MESSAGE-ID zf.
    *Table Declarations
    SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
    PARAMETERS     : cb_box1  TYPE c AS CHECKBOX.
    PARAMETERS     : p_wsfile LIKE rlgrap-filename.
    PARAMETERS     : cb_box2  TYPE c AS CHECKBOX.
    PARAMETERS     : p_lpfile LIKE rlgrap-filename DEFAULT c_lpat.
    SELECTION-SCREEN END OF BLOCK b2.
                      INITIALIZATION
    INITIALIZATION.
                      AT SELECTION-SCREEN
    AT SELECTION-SCREEN OUTPUT.
    Change to Display Mode for Logical Path
      PERFORM lpdisplay.
    AT SELECTION-SCREEN.
    Validate Input At Selection Screen
      PERFORM screen_validation.
    Authority Check
      PERFORM authority_check.
    Assist file Path for Download
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_wsfile.
      PERFORM get_path.
                      START-OF-SELECTION.
    START-OF-SELECTION.
    Get all Accounting Document Details
      PERFORM get_bkpf.
                      END-OF-SELECTION.
    END-OF-SELECTION.
      IF i_bkpf IS INITIAL.
        MESSAGE s001(zf) WITH 'No Records Found for the Selection'(003).
      ELSE.
    Prepare Download Table
        PERFORM fill_download.
    Submit to gui_download.
        IF NOT cb_box1 IS INITIAL.
          PERFORM download_csv USING p_wsfile.
        ENDIF.
    Download to Logical Path.
        IF NOT cb_box2 IS INITIAL.
          PERFORM logicalpath_download.
        ENDIF.
      ENDIF.
    *&                      Form  screen_validation
                  At Selection Screen Validation for Inputs.
    FORM screen_validation.
    *Validation for company code
      IF NOT p_bukrs IS INITIAL.
        SELECT COUNT(*) FROM t001 WHERE bukrs = p_bukrs.
        IF sy-subrc NE 0.
          MESSAGE e001(zf) WITH 'Company Code(s) not found'(004).
        ENDIF.
      ENDIF.
    ENDFORM.                    " screen_validation
    *&                    Form  authority_check
                          Authority Check
    FORM authority_check.
    ENDFORM.                    " authority_check
    *&                        Form  get_bkpf
                          Get Document Details
    FORM get_bkpf.
      SELECT
                bukrs     "Company Code
        IF sy-subrc = 0.
          SORT i_kna1 BY kunnr.
        ENDIF.
      ENDIF.
    ENDFORM.                    " get_bkpf
    *&                    Form  fill_download
                       Prepare Download Table
    FORM fill_download.
      DATA : v_flag TYPE c.
      v_taxsum = 0.
      SORT i_bseg BY belnr buzei.
    ENDFORM.                    " summary_build
    *&                      Form  download_csv
                      Download To Pipe CSV File
    FORM download_csv USING v_p_wsfile LIKE rlgrap-filename.
      DATA : v_time LIKE sy-uzeit,
             v_date LIKE sy-datum,
             v_fname TYPE string.
      v_time = sy-uzeit.
      v_date = sy-datum.
      IF p_bukrs = '2000'.
        CONCATENATE v_p_wsfile c_csg v_date v_time c_2000
                                   '.TXT' INTO v_p_wsfile.
        v_fname = v_p_wsfile.
      ELSEIF p_bukrs = '3110'.
        CONCATENATE v_p_wsfile c_ams v_date v_time c_2000
                                   '.TXT' INTO v_p_wsfile.
        v_fname = v_p_wsfile.
      ENDIF.
      CALL FUNCTION 'GUI_DOWNLOAD'
           EXPORTING
                filename                = v_fname
                filetype                = 'ASC'
           TABLES
                data_tab                = i_csv[]
           EXCEPTIONS
                file_write_error        = 1
                no_batch                = 2
                gui_refuse_filetransfer = 3
                invalid_type            = 4
                no_authority            = 5
                unknown_error           = 6
                header_not_allowed      = 7
                separator_not_allowed   = 8
                filesize_not_allowed    = 9
                header_too_long         = 10
                dp_error_create         = 11
                dp_error_send           = 12
                dp_error_write          = 13
                unknown_dp_error        = 14
                access_denied           = 15
                dp_out_of_memory        = 16
                disk_full               = 17
                dp_timeout              = 18
                file_not_found          = 19
                dataprovider_exception  = 20
                control_flush_error     = 21
                OTHERS                  = 22.
      IF sy-subrc <> 0.
        MESSAGE e001(zf) WITH v_fname
                         'Sorry, File download Unsucessful'(008).
      ELSE.
        MESSAGE s001(zf) WITH v_fname 'Download Sucessful'(009).
      ENDIF.
    ENDFORM.                    " download_csv
    *&                      Form  get_path
                   Get The File Path for Download.
    FORM get_path.
    Provide F4 Help for Download Path Selection
      CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
           EXPORTING
                program_name  = 'ZFIPDRDGCSV'
                dynpro_number = sy-dynnr
                field_name    = p_wsfile
           CHANGING
                file_name     = p_wsfile
           EXCEPTIONS
                mask_too_long = 1
                OTHERS        = 2.
      IF sy-subrc <> 0.
        MESSAGE s001(zf) WITH 'Given Path Unsucessful'(010).
      ENDIF.
    ENDFORM.                    " get_path
    *&                      Form  lpdisplay
                Diaply the Logical path In NON EDIT MOde
    FORM lpdisplay.
      LOOP AT SCREEN.
        IF screen-name = 'P_LPFILE'.
          screen-input = 0.
          MODIFY SCREEN.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    " lpdisplay

  • BUG?: unexpected token in connection pane for cursor declaration

    If I declare a cursor with an order clause in the declaration part of a procedure in a package I will get the unexpected token. The code compiles without errors.
    SQL Developer 15.57.
    Windows XP SP2
    Oracle 10g
    example:
    declare procedure test( param in integer ) as
    cursor cur( nVal in integer ) is
    select * from tab where col1 = nVal
    order by col2;
    begin
    NULL;
    end test;
    If I comment out the order by line and proper end the line before all is OK in connection pane.

    There are a few issues logged for these unexpected tokens. We will be reviewing this section for 1.1.
    Regards
    Sue Harper

  • Declaration of WA for Table Type

    Hi,
    I am trying to append a structure data to a table type.
    For example:
    I have a Table Type called ZTABLE_TYPE of Line Type ZSTRUCTURE.
    In my program, my declaration is as below:
    DATA itab TYPE STANDARD TABLE OF ZTABLE_TYPE.
    DATA work_area TYPE ZSTRUCTURE.
    work_area-field1 = 'abc'
    work_area-field2 = '123'
    APPEND work_area TO itab.
    However, when I try to activate, I received a syntax error: 
    "WORK_AREA" cannot be converted to the line type of "ITAB".
    Can I get some help on whether I have declared wrongly, or is there a more appropriate way to append data into a table type.
    Thanks!

    Hi,
    Declare like this:
    DATA itab TYPE ZTABLE_TYPE.
    DATA work_area TYPE ZSTRUCTURE.
    work_area-field1 = 'abc'
    work_area-field2 = '123'
    APPEND work_area TO itab.
    This is because ZTABLE_TYPE is already a table type. So you need not mention "type table of" in your declaration part.
    Thanks and Regards,
    Santosh Kumar Mukka.

  • Have some confusion with declaration

    hello,
    i have got some seriouse doubt .i use a HashMap in my jsp but i put it in the declaration part
    ie
    <%! HashMap hm=new HashMap(); %>
    now here i have some doubt with the data i enter to or get from the hashmap .is there any need for Synchronizing the entery made to the hashMap made using put.
    and
    otherday i wanted to override the init() methord i did it like the below code
    <%! public void jspInit()
    %>
    but it gave me some error can anybody tell me where i have gone wrong
    waiting for some dam good solution
    thanking you

    For the first, yes the HashMap will be shared by all requests to the JSP page.
    If you take a look at the generated Servlet .java file you will see something like this
    public class generatedServletForMyPage_jsp implements HttpJspPage
    // your declarations from the <%! %> tags
    HashMap hm = new HashMap();
    public void jspInit()
    public void _jspService(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{
      // Code that is run in your JSP
      // eg...
      hm.put("myValue" = request.getParameter("param1");
    }Note that hm is declared as a class variable, rather than a local variable to the _jspService method.
    Because of this, it is shared by all requests. Every time you call this JSP it will be using the same variable (and will still have the same value)
    My suggestion would be to declare it in <% %> tags, or with a <jsp:useBean> tag.
    The jspInit() method looks ok to me - what error message was it giving?
    Cheers,
    evnafets

Maybe you are looking for

  • HT4009 "Sorry, your device doesn't support the payment". Trying to make in app purchase.

    Hi, i am trying to make an in app purchase in the game Iron Force, but keep getting a screen pop up that says "Sorry, your device doesn't support the payment". I have already tried to trouble shoot this, I went into settings and made sure in app purc

  • Embedding a report designer query into a template - errors out

    In a template i want to include the report designer query, with the web item type - report, when i drag the report item into the template and try to edit it, it takes me to the report designer, there I'm able to open my report designer query - then w

  • 5700 Express Music, Need Help!! Bluetooth is not ...

    Hi everyone..... Im writing first time like this.... I bought new 5700 Express Music on 23rd of august... First 2 days it was fine.... yesterday,I was transfering some songs to my friends mobile via bluetooth.... suddenly i got a message in the displ

  • Depreciation Error in AFAB : asset posting not completed

    Hi All Depreciation run was not finished for past 3 years before that one of the Scrapping Asset was posted without execute the depreciation run.  For that reason we are unable close the period in asset depreciation run by using transaction code AFAB

  • IPhoto file Corruption from HP Digi. Cam

    Long story short, I finally convinced my parents to get a Mac. So i picked up a Mac Mini for them today, and when we got it set up i hooked up my mom's digital camera to it. It's a HP Photosmart M415. The pictures are in jpg format. So here's the iss