Hi how to avoid nested loops in this program to improve the performence

Hi all
How to avoide the nested loops in this programing what is the replacement for the nested loops in this program coding......
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.
Thanks in advance for all.....

Hi
these are the performance tips
Instead of using nested Select loops it is often better to use subqueries.
SELECT * FROM SPFLI
  INTO TABLE T_SPFLI
  WHERE CITYFROM = 'FRANKFURT'
    AND CITYTO = 'NEW YORK'.
SELECT * FROM SFLIGHT AS F
    INTO SFLIGHT_WA
    FOR ALL ENTRIES IN T_SPFLI
    WHERE SEATSOCC < F~SEATSMAX
      AND CARRID = T_SPFLI-CARRID
      AND CONNID = T_SPFLI-CONNID
      AND FLDATE BETWEEN '19990101' AND '19990331'.
ENDSELECT.
The above mentioned code can be even more optimized by using subqueries instead of for all entries.
SELECT * FROM SFLIGHT AS F INTO SFLIGHT_WA
    WHERE SEATSOCC < F~SEATSMAX
      AND EXISTS ( SELECT * FROM SPFLI
                     WHERE CARRID = F~CARRID
                       AND CONNID = F~CONNID
                       AND CITYFROM = 'FRANKFURT'
                       AND CITYTO = 'NEW YORK' )
      AND FLDATE BETWEEN '19990101' AND '19990331'.
ENDSELECT.
<b>Internal Tables</b>
1.     Table operations should be done using explicit work areas rather than via header lines.
2.     Always try to use binary search instead of linear search. But don’t forget to sort your internal table before that.
3.     A dynamic key access is slower than a static one, since the key specification must be evaluated at runtime.
4.     A binary search using secondary index takes considerably less time.
5.     LOOP ... WHERE is faster than LOOP/CHECK because LOOP ... WHERE evaluates the specified condition internally.
6.     Modifying selected components using “ MODIFY itab …TRANSPORTING f1 f2.. “ accelerates the task of updating  a line of an internal table.
Point # 2
READ TABLE ITAB INTO WA WITH KEY K = 'X‘ BINARY SEARCH.
IS MUCH FASTER THAN USING
READ TABLE ITAB INTO WA WITH KEY K = 'X'.
If TAB has n entries, linear search runs in O( n ) time, whereas binary search takes only O( log2( n ) ).
Point # 3
READ TABLE ITAB INTO WA WITH KEY K = 'X'. IS FASTER THAN USING
READ TABLE ITAB INTO WA WITH KEY (NAME) = 'X'.
Point # 5
LOOP AT ITAB INTO WA WHERE K = 'X'.
ENDLOOP.
The above code is much faster than using
LOOP AT ITAB INTO WA.
  CHECK WA-K = 'X'.
ENDLOOP.
Point # 6
WA-DATE = SY-DATUM.
MODIFY ITAB FROM WA INDEX 1 TRANSPORTING DATE.
The above code is more optimized as compared to
WA-DATE = SY-DATUM.
MODIFY ITAB FROM WA INDEX 1.
7.     Accessing the table entries directly in a "LOOP ... ASSIGNING ..." accelerates the task of updating a set of lines of an internal table considerably
8.    If collect semantics is required, it is always better to use to COLLECT rather than READ BINARY and then ADD.
9.    "APPEND LINES OF itab1 TO itab2" accelerates the task of appending a table to another table considerably as compared to “ LOOP-APPEND-ENDLOOP.”
10.   “DELETE ADJACENT DUPLICATES“ accelerates the task of deleting duplicate entries considerably as compared to “ READ-LOOP-DELETE-ENDLOOP”.
11.   "DELETE itab FROM ... TO ..." accelerates the task of deleting a sequence of lines considerably as compared to “  DO -DELETE-ENDDO”.
Point # 7
Modifying selected components only makes the program faster as compared to Modifying all lines completely.
e.g,
LOOP AT ITAB ASSIGNING <WA>.
  I = SY-TABIX MOD 2.
  IF I = 0.
    <WA>-FLAG = 'X'.
  ENDIF.
ENDLOOP.
The above code works faster as compared to
LOOP AT ITAB INTO WA.
  I = SY-TABIX MOD 2.
  IF I = 0.
    WA-FLAG = 'X'.
    MODIFY ITAB FROM WA.
  ENDIF.
ENDLOOP.
Point # 8
LOOP AT ITAB1 INTO WA1.
  READ TABLE ITAB2 INTO WA2 WITH KEY K = WA1-K BINARY SEARCH.
  IF SY-SUBRC = 0.
    ADD: WA1-VAL1 TO WA2-VAL1,
         WA1-VAL2 TO WA2-VAL2.
    MODIFY ITAB2 FROM WA2 INDEX SY-TABIX TRANSPORTING VAL1 VAL2.
  ELSE.
    INSERT WA1 INTO ITAB2 INDEX SY-TABIX.
  ENDIF.
ENDLOOP.
The above code uses BINARY SEARCH for collect semantics. READ BINARY runs in O( log2(n) ) time. The above piece of code can be more optimized by
LOOP AT ITAB1 INTO WA.
  COLLECT WA INTO ITAB2.
ENDLOOP.
SORT ITAB2 BY K.
COLLECT, however, uses a hash algorithm and is therefore independent
of the number of entries (i.e. O(1)) .
Point # 9
APPEND LINES OF ITAB1 TO ITAB2.
This is more optimized as compared to
LOOP AT ITAB1 INTO WA.
  APPEND WA TO ITAB2.
ENDLOOP.
Point # 10
DELETE ADJACENT DUPLICATES FROM ITAB COMPARING K.
This is much more optimized as compared to
READ TABLE ITAB INDEX 1 INTO PREV_LINE.
LOOP AT ITAB FROM 2 INTO WA.
  IF WA = PREV_LINE.
    DELETE ITAB.
  ELSE.
    PREV_LINE = WA.
  ENDIF.
ENDLOOP.
Point # 11
DELETE ITAB FROM 450 TO 550.
This is much more optimized as compared to
DO 101 TIMES.
  DELETE ITAB INDEX 450.
ENDDO.
12.   Copying internal tables by using “ITAB2[ ] = ITAB1[ ]” as compared to “LOOP-APPEND-ENDLOOP”.
13.   Specify the sort key as restrictively as possible to run the program faster.
Point # 12
ITAB2[] = ITAB1[].
This is much more optimized as compared to
REFRESH ITAB2.
LOOP AT ITAB1 INTO WA.
  APPEND WA TO ITAB2.
ENDLOOP.
Point # 13
“SORT ITAB BY K.” makes the program runs faster as compared to “SORT ITAB.”
Internal Tables         contd…
Hashed and Sorted tables
1.     For single read access hashed tables are more optimized as compared to sorted tables.
2.      For partial sequential access sorted tables are more optimized as compared to hashed tables
Hashed And Sorted Tables
Point # 1
Consider the following example where HTAB is a hashed table and STAB is a sorted table
DO 250 TIMES.
  N = 4 * SY-INDEX.
  READ TABLE HTAB INTO WA WITH TABLE KEY K = N.
  IF SY-SUBRC = 0.
  ENDIF.
ENDDO.
This runs faster for single read access as compared to the following same code for sorted table
DO 250 TIMES.
  N = 4 * SY-INDEX.
  READ TABLE STAB INTO WA WITH TABLE KEY K = N.
  IF SY-SUBRC = 0.
  ENDIF.
ENDDO.
Point # 2
Similarly for Partial Sequential access the STAB runs faster as compared to HTAB
LOOP AT STAB INTO WA WHERE K = SUBKEY.
ENDLOOP.
This runs faster as compared to
LOOP AT HTAB INTO WA WHERE K = SUBKEY.
ENDLOOP.
<b>Reward if usefufll</b>

Similar Messages

  • I have Photoshop CS4,on how many computers can you install this program ?

    Hello,
    I got Photoshop CS4. On how many computers can you install this program ?
    Sonste

    The license and activation rights are for a single user on two computers that are not used simultaneously—such as your desktop machine and your laptop.

  • Creative Cloud: How many computers can I download this program to?

    I bought the 119 subscription and I have yet to use it because I am waiting on my new laptop. How many computers can I download this program to??

    OK having issues. I signed into my account on adobe on my new computer but
    after signing in I can't download the program it says download trial
        Creative Cloud: How many computers can I download this program to?
    created by John Waller <https://forums.adobe.com/people/John+Waller> in *Adobe
    Creative Cloud* - View the full discussion
    <https://forums.adobe.com/message/7264004#7264004>

  • Hi very urgent  How to improve the performence of the program

    Hi all please tell me 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.
     

    Hi
    You check in SM50 by executing the programing, You will come to know which select is taking more time and accordingly you modify that select.
    You can do SQL trace and Run time analysis and analyse and see.
    check this and use
    1) Dont use nested select statements
    2) If possible use for all entries in addition
    3) In the where addition make sure you give all the primary key
    4) Use Index for the selection criteria.
    5) You can also use inner joins
    6) You can try to put the data from the first select statement into an Itab and then in order to select the data from the second table use for all entries in.
    7) Use the runtime analysis SE30 and SQL Trace (ST05) to identify the performance and also to identify where the load is heavy, so that you can change the code accordingly
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/5d0db4c9-0e01-0010-b68f-9b1408d5f234
    ABAP performance depends upon various factors and in devicded in three parts:
    1. Database
    2. ABAP
    3. System
    Run Any program using SE30 (performance analys) to improve performance refer to tips and trics section of SE30, Always remember that ABAP perfirmance is improved when there is least load on Database.
    u can get an interactive grap in SE30 regarding this with a file.
    also if u find runtime of parts of codes then use :
    Switch on RTA Dynamically within ABAP Code
    *To turn runtim analysis on within ABAP code insert the following code
    SET RUN TIME ANALYZER ON.
    *To turn runtim analysis off within ABAP code insert the following code
    SET RUN TIME ANALYZER OFF.
    Always check the driver internal tables is not empty, while using FOR ALL ENTRIES
    Avoid for all entries in JOINS
    Try to avoid joins and use FOR ALL ENTRIES.
    Try to restrict the joins to 1 level only ie only for tables
    Avoid using Select *.
    Avoid having multiple Selects from the same table in the same object.
    Try to minimize the number of variables to save memory.
    The sequence of fields in 'where clause' must be as per primary/secondary index ( if any)
    Avoid creation of index as far as possible
    Avoid operators like <>, > , < & like % in where clause conditions
    Avoid select/select single statements in loops.
    Try to use 'binary search' in READ internal table. Ensure table is sorted before using BINARY SEARCH.
    Avoid using aggregate functions (SUM, MAX etc) in selects ( GROUP BY , HAVING,)
    Avoid using ORDER BY in selects
    Avoid Nested Selects
    Avoid Nested Loops of Internal Tables
    Try to use FIELD SYMBOLS.
    Try to avoid into Corresponding Fields of
    Avoid using Select Distinct, Use DELETE ADJACENT
    Check the following Links
    Re: performance tuning
    Re: Performance tuning of program
    http://www.sapgenie.com/abap/performance.htm
    http://www.thespot4sap.com/Articles/SAPABAPPerformanceTuning_PerformanceAnalysisTools.asp
    check the below link
    http://www.sap-img.com/abap/performance-tuning-for-data-selection-statement.htm
    See the following link if it's any help:
    http://www.thespot4sap.com/Articles/SAPABAPPerformanceTuning_PerformanceAnalysisTools.asp
    Check also http://service.sap.com/performance
    and
    books like
    http://www.sap-press.com/product.cfm?account=&product=H951
    http://www.sap-press.com/product.cfm?account=&product=H973
    http://www.sap-img.com/abap/more-than-100-abap-interview-faqs.htm
    http://www.thespot4sap.com/Articles/SAPABAPPerformanceTuning_PerformanceAnalysisTools.asp
    Performance tuning for Data Selection Statement
    http://www.sap-img.com/abap/performance-tuning-for-data-selection-statement.htm
    Debugger
    http://help.sap.com/saphelp_47x200/helpdata/en/c6/617ca9e68c11d2b2ab080009b43351/content.htm
    http://www.cba.nau.edu/haney-j/CIS497/Assignments/Debugging.doc
    http://help.sap.com/saphelp_erp2005/helpdata/en/b3/d322540c3beb4ba53795784eebb680/frameset.htm
    Run Time Analyser
    http://help.sap.com/saphelp_47x200/helpdata/en/c6/617cafe68c11d2b2ab080009b43351/content.htm
    SQL trace
    http://help.sap.com/saphelp_47x200/helpdata/en/d1/801f7c454211d189710000e8322d00/content.htm
    CATT - Computer Aided Testing Too
    http://help.sap.com/saphelp_47x200/helpdata/en/b3/410b37233f7c6fe10000009b38f936/frameset.htm
    Test Workbench
    http://help.sap.com/saphelp_47x200/helpdata/en/a8/157235d0fa8742e10000009b38f889/frameset.htm
    Coverage Analyser
    http://help.sap.com/saphelp_47x200/helpdata/en/c7/af9a79061a11d4b3d4080009b43351/content.htm
    Runtime Monitor
    http://help.sap.com/saphelp_47x200/helpdata/en/b5/fa121cc15911d5993d00508b6b8b11/content.htm
    Memory Inspector
    http://help.sap.com/saphelp_47x200/helpdata/en/a2/e5fc84cc87964cb2c29f584152d74e/content.htm
    ECATT - Extended Computer Aided testing tool.
    http://help.sap.com/saphelp_47x200/helpdata/en/20/e81c3b84e65e7be10000000a11402f/frameset.htm
    Just refer to these links...
    performance
    Performance
    Performance Guide
    performance issues...
    Performance Tuning
    Performance issues
    performance tuning
    performance tuning
    You can go to the transaction SE30 to have the runtime analysis of your program.Also try the transaction SCI , which is SAP Code Inspector.
    1 Always check the driver internal tables is not empty, while using FOR ALL ENTRIES
    2 Avoid for all entries in JOINS
    3 Try to avoid joins and use FOR ALL ENTRIES.
    4 Try to restrict the joins to 1 level only ie only for 2 tables
    5 Avoid using Select *.
    6 Avoid having multiple Selects from the same table in the same object.
    7 Try to minimize the number of variables to save memory.
    8 The sequence of fields in 'where clause' must be as per primary/secondary index ( if any)
    9 Avoid creation of index as far as possible
    10 Avoid operators like <>, > , < & like % in where clause conditions
    11 Avoid select/select single statements in loops.
    12 Try to use 'binary search' in READ internal table. Ensure table is sorted before using BINARY SEARCH.
    13 Avoid using aggregate functions (SUM, MAX etc) in selects ( GROUP BY , HAVING,)
    14 Avoid using ORDER BY in selects
    15 Avoid Nested Selects
    16 Avoid Nested Loops of Internal Tables
    17 Try to use FIELD SYMBOLS.
    18 Try to avoid into Corresponding Fields of
    19 Avoid using Select Distinct, Use DELETE ADJACENT.
    Regards
    Anji

  • Error message "This program cannot display the webpage when uploading images to Cafe Press

    I have had a Café Press shop for five years and except for sometimes being slow, no problems uploading images. Now, suddenly for 3 days I get the message "This program cannot display the webpage
    Most likely causes:
    • You are not connected to the Internet.
    • The website is encountering problems.
    • There might be a typing error in the address.
    What you can try:
    Check your Internet connection. Try visiting another website to make sure you are connected.
    Retype the address."
    I got the messsage about half way through the uploading of an image. People suggested using "firefox" instead of IE so I now get a similar error message from Firefox. I signed in, clicked on the image I wanted to upload and hit "upload" and get message as follows:
    Server not found
    Firefox can't find the server at members.cafepress.com.
    * Check the address for typing errors such as
    ww.example.com instead of
    [url=http://www.example.com]www.example.com[/url]
    * If you are unable to load any pages, check your computer's network connection.
    * If your computer or network is protected by a firewall or proxy, make sure that Firefox is permitted to access the Web.
    None of this makes sense because I WAS connected to the internet (obviously) or I wouldn't have been able to sign in, go to my media basket, browse for the image and click "upload" and watch as the progress bar showed percentage of upload such as 20%, etc. and even went to 100% at times before giving me the error message. Plus I couldn't make a typing error since I wasn't typing anything but uploading an image. Any suggestions?
    Whatever your suggestion, I need step by step instructions as I am totally computer illiterate. I don't even know what a "proxy" is and don't know if I have a "firewall" as the message suggests. I have "Comodo" security and am using Windows XP.
    I contacted CP which was no help at all. All they did was tell me to clear my cache which I do after every session. Thanks
    Nancy
    http://www.cafepress.com/calendarflr

    Sounds like your desktop application is in fact running from
    a server. CHMs were identified as a security risk by Microsoft and
    are best suited to the user's PC.
    Click
    here for more information.

  • I have Adobe premiere 12 elements I have Buy it but this program is Corrupt. the are no sound on the time line. I have sound in my computer, this is no problem, I can listen every another things but NO Elements 12 OK I make ia video take down to the time

    i have Adobe premiere 12 elements I have Buy it but this program is Corrupt. the are no sound on the time line. I have sound in my computer, this is no problem, I can listen every another things but NO Elements 12 OK I make ia video take down to the time line. Video is OK BUT NO sound I have makit in 2 veeks from monday to next vek here whit this very bad program so i go to garbags I think I buy a another program is be better and have a Sound. This is very bad I am not god to English. I Have a pro camera and I will have a god support but this is very bad. I is bad to English. But this Program I buy i think this is very Corrupt. The mast find a sound in this program. I cvan not understan if You can sell this very bad program Videoredigering and this program have nothing sound. This is crazy.

    i have Adobe premiere 12 elements I have Buy it but this program is Corrupt. the are no sound on the time line. I have sound in my computer, this is no problem, I can listen every another things but NO Elements 12 OK I make ia video take down to the time line. Video is OK BUT NO sound I have makit in 2 veeks from monday to next vek here whit this very bad program so i go to garbags I think I buy a another program is be better and have a Sound. This is very bad I am not god to English. I Have a pro camera and I will have a god support but this is very bad. I is bad to English. But this Program I buy i think this is very Corrupt. The mast find a sound in this program. I cvan not understan if You can sell this very bad program Videoredigering and this program have nothing sound. This is crazy.

  • I need a program for camera.The androide has a program IP Cam View basic that has the fohu HA 425 and I get the cameras.I downlouded the IP camera viewer in the Aple but this program doesnt have the fuho HA 425. Which apple program is compatible?

    I need a program for camera.The androide has a program IP Cam View basic that has the fohu HA 425 and I get the cameras.I downlouded the IP camera viewer in the Aple but this program doesnt have the fuho HA 425. Which apple program is compatible?

    Hi,
    As far as I know, Sony Ericsson Z520, like a lot of the other cell phones, doesn�t support bluetooth serial communication.
    See:
    http://developer.sonyericsson.com/entry.jspa?externalID=138&categoryID=5
    BUT(!) You should double check this information.
    If you ask me, we have done similar project.
    We are working on hobby project � our robot use J2ME cell phone as on-board brain.
    And there is connection between this small robot and Linux-based PC.
    Communication was done via BlueTooth (in reality we use Linux implementation of BlueTooth stack and obexftp).
    BUT (!) We use Siemens S75 for this communication.
    I�m afraid that Siemens is the only manufacture, which implemented serial communication over bluetooth, embedded camera and non-usb socket.
    Also there are some Motorola phones, which implement serial communication over bluetooth.
    But � note that all Motorola phones use USB sockets and it will not be easy for you to make connection between such a phone and the robot.
    If you need just connection between cell phone and PC, then may be USB is OK too.
    Our robot project: www.RoboHobby.com

  • What excatly this program do for the R/3 job

    Hi,
    In R/3 side there is a job and got there variant and program. I want to know what excatly this program do for the R/3 job where we can see in SM37?
    Thanks,

    Hi......
    Go to SE38 >> Give the Program name................Display.............from there check the code...........u will get the answer..........but for that u hav to know ABAP..........
    U can take help of some ABAPER.............
    Actually..........a vriant is something like a specific selections............for an example...... if you have a report instead doing the selections all the time.. you save the selection as variant............it reduces time..........errors in input...........you can schedule a background job only using variants........
    Generally..........we create a JOb in SM36.........as already said............there the job is created using the program and the variant..............while executing the job...........this program get executed.........
    Regards,
    Debjani.........

  • HT3680 where can i find this program after reading the whole story?

    where can i find this program after reading the whole story?

    could this knowledge base article be what your looking for?:
    HT3680

  • Using Lightroom 4 w/ Windows 7.  Recently started shooting w/ Sony camera .arw files.  Lightroom cannot read the files.  Loaded Adobe converter program onto the computer and this program cannot read the files either.  Any suggestions?

    Using Lightroom 4 w/ Windows 7.  Recently started shooting w/ Sony camera that shoots .arw files.  Lightroom cannot read the files.  Loaded Adobe converter program onto the computer and this program cannot read the files either.  Any suggestions?

    Thnx again for the reply.  The version of Lightroom I have is 4.0  (working w/Windows 7)  This computer and all media files are kept off-line After doing more research, I downloaded DNG Converter 7.1This loaded into a .zip folder, which I am planning to install into the off-line computer andrun.  Where does this folder go?
    And will this set up work with my version of Lightroom?
    What a pain.  Makes me wanna go back to shooting .nef files for all stills
    Thnx

  • Avoid nested loops

    I have an internal table (itab) with a field having vale in the form as shown below;
    0001-0003;0005;0007-0009 (In one row)
    This means it has values  0001 to 0003 0005 0007 to 0009
    I have to compare these values with some other table itab3 which has these values singly means 0001 0002 0003...etc (all in different rows ). so for that I have used nested loops because i need to expand all values to compare with itab3 table something like this :
    loop at itab
        split <itab-field1> at ';' into itab2.
      loop at itab2
         split itab2-field at '-' into var1 var2.
            while var1 le var2.
               append var1 to new table
              increment var1     
           endwhile
      endloop
    endloop
    By this way I get vaues in new table as :
    0001
    0002
    0003
    0005
    0007
    0008
    0009
    So plz tell me is thr some other way by which I can avoid nested loops

    But still it avoids 2 splits
    Yes Rainer, you are right but still my code improves performance.I checked it .
    data:start type i,
         end type i,
         res type i.
    data:begin of itab1 occurs 0,
         str type char255,
         end of itab1.
    data:begin of itab2 occurs 0,
         str type char255,
         end of itab2.
    data:var1 type char04,
         var2 type char04.
    get RUN TIME FIELD start.
    itab1-str = '0001-0003;0005;0007-0009'.
    append itab1.
    loop at itab1.
        split itab1-str at ';' into table itab2.
      loop at itab2.
         split itab2-str at '-' into var1 var2.
            while var1 le var2.
               var1 = var1 + 1.
           endwhile.
      endloop.
    endloop.
    get RUN TIME FIELD end.
    res = end - start.
    write :'code1-', res.
    skip 1.
    DATA:lv_str1 TYPE char255,
         lv_low(04) TYPE n,
         lv_high(04) TYPE n.
    TYPES:BEGIN OF ty_itab,
          line TYPE char255,
          END OF ty_itab.
    DATA:itab TYPE TABLE OF ty_itab,
         wa TYPE ty_itab.
    clear:start,end,res.
    get RUN TIME FIELD start.
    wa-line = '0001-0003;0005;0007-0009'.
    APPEND wa TO itab.
    LOOP AT itab INTO wa.
      DO.
        IF wa-line CA ';'.
          lv_str1 = wa-line+0(sy-fdpos).
          sy-fdpos = sy-fdpos + 1.
          wa-line+0(sy-fdpos) = ' '.
          CONDENSE wa-line.
          IF lv_str1 CA '-'.
            lv_low = lv_str1+0(sy-fdpos).
            lv_high = lv_str1+sy-fdpos(*).
            WHILE NOT lv_low GT lv_high.
               ADD 1 TO lv_low.
            ENDWHILE.
          ELSE.
          ENDIF.
        ELSE.
          IF wa-line CA '-'.
            lv_low = wa-line+0(sy-fdpos).
            lv_high = wa-line+sy-fdpos(*).
            WHILE NOT lv_low GT lv_high.
              ADD 1 TO lv_low.
            ENDWHILE.
          ELSE.
          ENDIF.
          EXIT.
        ENDIF.
      ENDDO.
    ENDLOOP.
    skip 1.
    get RUN TIME FIELD end.
    res = end - start.
    write: 'code2-',res.
    Edited by: Keshav.T on Jun 18, 2010 5:24 PM
    Edited by: Keshav.T on Jun 18, 2010 5:25 PM

  • How to disable nested loop option on a 10gR2 OLAP environment?

    is it possible to disable nested loop option on a 10gR2 OLAP environment? There are some thousands of automatically generated report queries and whenever a join is needed we want to force hash join if possible(equality) or sort merge but never nested loop. optimizer sometimes can go for NL because of broken ETL, last steps as collecting statistics can not be finished successfully before the users start to do their reporting.
    of course looking for a global parameter and do not want to hint each and every possible report query :)
    thank you.

    In general, connections that use a thin (type 4) JDBC driver will bypass the tnsnames.ora and sqlnet.ora files because they don't need those files to exist. One of the primary benefit of the type 4 JDBC drivers is that the Java code's connection string is fully specified in Java and doesn't depend on configuration files outside the JVM. So I wouldn't be surprised that any Java-based application could use the EZConnect syntax.
    It is not obvious to me, though, why EZConnect would bypass any SSL tunnel that you had established. Assuming that you've instructed your client to send all traffic on a particular port going to a particular IP address to use a tunnel, I'm not sure why (or how) EZConnect syntax would bypass that. I would tend to expect that the problem was with the SSL tunnel configuration but perhaps I'm missing something on the network side.
    Justin

  • Avoiding Nested Loops

    Hi all,
    I want to populate a internal table with Header and Item Level Details. BKPF is the Header Table and BSEG is the Item Details table. Can this be done without using nested LOOPS?
    Consider the Logic I am using.
      SELECT bukrs
             belnr
             gjahr
             budat
             xblnr
             bktxt
             FROM   bkpf
             INTO TABLE t_bkpf
             WHERE      bukrs   IN p_bukrs " = p_bukrs
                 AND    gjahr   IN p_gjahr  "= p_gjahr
                 AND    monat   IN p_monat  " = p_monat
                 AND    bstat    = space.
      IF sy-subrc IS INITIAL.
        SORT t_bkpf BY bukrs belnr gjahr.
        SELECT  bukrs
                belnr
                buzei
                gjahr
                hkont
                zlsch
                shkzg
                dmbtr
                FROM bseg
                INTO TABLE t_bseg
                FOR ALL ENTRIES IN t_bkpf
                WHERE     bukrs = t_bkpf-bukrs
                   AND    gjahr = t_bkpf-gjahr
                   AND    belnr = t_bkpf-belnr
                   AND    hkont = w_hkont .
        IF sy-subrc IS INITIAL.
          SORT t_bseg BY  bukrs belnr gjahr buzei.
        ENDIF.
      ENDIF.
    LOOP AT t_bkpf INTO wa_bkpf.
      LOOP AT t_bkpf INTO wa_bkpf WHERE bukrs = wa_bkpf-bukrs
                                  AND   belnr = wa_bkpf-belnr
                                  AND   gjahr = wa_bkpf-gjahr.
          wa_final-bukrs    =  wa_bkpf-bukrs.
          wa_final-budat    =  wa_bkpf-budat.
          wa_final-belnr    =  wa_bkpf-belnr.
          wa_final-shkzg    =  wa_bseg-shkzg.
          wa_final-dmbtr    =  wa_bseg-dmbtr.
          wa_final-xblnr    =  wa_bkpf-xblnr.
          wa_final-bktxt    =  wa_bkpf-bktxt.
          wa_final-hkont    =  wa_bseg-hkont.
          wa_final-zlsch    =  wa_bseg-zlsch.
       ENDLOOP.
    ENDLOOP.
    Thanks in advance.

    Hai Arun try with the following code
      SELECT
             bukrs
             belnr
             gjahr
             budat
             xblnr
             bktxt
             FROM   bkpf
             INTO TABLE t_bkpf
             WHERE   bukrs   IN p_bukrs " = p_bukrs
                 AND gjahr   IN p_gjahr  "= p_gjahr
                 AND monat   IN p_monat  " = p_monat
                 AND bstat    = space.
      IF sy-subrc IS INITIAL.
         SORT t_bkpf BY bukrs belnr gjahr.
      endif.
      if not t_bkpf[] is initial. 
        SELECT 
                bukrs
                belnr
                buzei
                gjahr
                hkont
                zlsch
                shkzg
                dmbtr
                FROM bseg
                INTO TABLE t_bseg
                FOR ALL ENTRIES IN t_bkpf
                WHERE     bukrs = t_bkpf-bukrs
                   AND    belnr = t_bkpf-belnr
                   AND    gjahr = t_bkpf-gjahr
                   AND    hkont = w_hkont .
        IF sy-subrc IS INITIAL.
          SORT t_bseg BY  bukrs belnr gjahr buzei.
        ENDIF.
    loop at t_bkpf.
      read table it_bseg with key   bukrs = t_bkpf-bukrs
                             AND    belnr = t_bkpf-belnr
                             AND    gjahr = t_bkpf-gjahr
                             binary search. 
      if sy-subrc = 0.
        wa_final-bukrs    =  wa_bkpf-bukrs.
        wa_final-budat    =  wa_bkpf-budat.
        wa_final-belnr    =  wa_bkpf-belnr.
        wa_final-shkzg    =  wa_bseg-shkzg.
        wa_final-dmbtr    =  wa_bseg-dmbtr.
        wa_final-xblnr    =  wa_bkpf-xblnr.
        wa_final-bktxt    =  wa_bkpf-bktxt.
        wa_final-hkont    =  wa_bseg-hkont.
        wa_final-zlsch    =  wa_bseg-zlsch.
      endif.
    endloop. 
    Thanks & regards
    Sreenivasulu P

  • How to Avoid reading Processing cube data (incomplete data from the cell )

    Hi All
    we have ssis package which we will run for every 5 minutes to get latest data , the cube also refreshed every 5 minutes .
    i will take the latest value specific to the measure . Here cube processing and SSIS schedular are asynchromous . some times the cube processing may take more time by that time the ssis package starts pulling the value . in this case the values are coming
    in correct , here my question is  when i am using Tail function specific to the measure how come i am getting incorrect value instead of NULL ot Previous LatestTimesample  value.   How to Avoid this issue .
    For latest timesample we are using this set
    WITH
     SET LastSample AS TAIL(NONEMPTY([Date].[Year - Month - Date].members *[Time].[Twelfth Of Hour].members,([Measures].[VS LicenseSCSCFConcurRegistCur],{[Source 2013].[LOCALDN].&[PMES1]&[LSM]})))
    Surendra Thota

    Hi Surendra,
    We need to consider how many data of the cube is going to grow over time. I don't think it's the best practices to process the cube every 5 minutes, as the number of cube data increases, the cube processing time increases.  
    In addition, we can implement Analysis Services scale-out querying architecture solution to increase the frequency of cube updates. Here is the article for your reference, please see:
    SQL Server Best Practices Article:
    http://technet.microsoft.com/en-us/library/cc966449.aspx
    If you have any feedback on our support, please click
    here.
    Regards,
    Elvis Long
    TechNet Community Support

  • HT3224 I am new to Mac and started transferring data from my PC to my new Macbook Pro.  Connection was lost once I started and now my Pro is stuck on the 'Transferring Information' screen.  How do I get out of this screen to attempt the connection again?

    II am new to Mac and was trying to transfer data from my PC to my new Macbook Pro.  The connection was lost however and now my Pro is stuck on the 'Transferring you nformation' screen.  How do I get out of this screen so I can attempt the connection again?  Is it safe to force shut down of my Mac and will it still prompt me through all the setup process again?

    Welcome to Apple Support Communities
    If your Mac and PC are connected by Ethernet, unplug and plug that cable again. If not, you have to turn off the MacBook by holding the Power button.
    In the next startup, try to transfer your files again. It's important not to interrupt the transfer process, because in most cases, you will stop it and you won't be able to resume it

Maybe you are looking for

  • HT1386 Windows 8 Syncing Problem with Contacts and Calendars Office 2007 and iphone 4

    I have a new Dell Inspiron 17R and just did a sync with my iphone 4.  It wiped out my contact  and calendar listing.  I have selected the contacts and calenders sync option.  It is almost like the sync process can not fine the pst file on this new Wi

  • Not able to open data model

    Hi In portal i want ot design news for that i want to use xml form builder so i clicked on content management xml form builder is opened i have created a new project when i saved  i recived an error but still i clicked yes and it is saved anyways now

  • Account type D is not defined for document type RE

    Hi can any one tell me use of the field " Account with vendor" in table LFB1? Regards

  • Failure of Key-NxtBlk Trigger in Tab Pages

    Say, I have 3 blocks, b1, b2 and b3, wherein block b1 and b3 are in a "tab-paged canvas" and block b2 is in a different canvas. When the control is in the tab-canvas (say in block b1). Upon pressing the Key_NxtBlk, CTRL goes to the third block rather

  • Why does drawing of ellipses appear inaccurate?

    Below is a very simple applet: it defines two points (px, py) and (qx, qy), finds the distance (radius) between those two points, and then plots the point (px, py), along with the circle centered at (qx, qy) with radius radius. Mathematically, the ci