Advertisement
Guest User

Untitled

a guest
Aug 7th, 2018
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
ABAP 5.65 KB | None | 0 0
  1.  
  2.           ls_poitem-po_item      = ls_poste_commande-ebelp.
  3.           ls_poitemx-po_item     = ls_poste_commande-ebelp.
  4.  
  5.           "Modification du prix du poste
  6.           IF NOT  ls_poste_commande-netpr IS INITIAL.
  7.             IF ls_poste_commande-netpr LT ls_ekpo-netpr.
  8.  
  9.               " La modif n'est possible que pour les Hors Catalogue
  10.               "   -> Pour déterminer le HC, on va regarder le type d'article d'un poste qui doit etre a ZNCS
  11.               IF ls_ekpo-mtart EQ c_mtart_zncs.
  12.                 ls_poitem-net_price  = ls_poste_commande-netpr.
  13.                 ls_poitemx-net_price  = c_abap_true.
  14.  
  15.                 lw_flag_reload_wf = c_abap_true. "Flag de redéclenchement du WF.
  16.               ELSE.
  17.                 CLEAR ls_return.
  18.                 ls_return-type = 'E'.
  19.                 MESSAGE i106(zdgre) INTO ls_return-message WITH ls_poste_commande-ebelp.
  20.                 APPEND ls_return TO et_return.
  21.               ENDIF.
  22.  
  23.             ELSEIF ls_poste_commande-netpr GT ls_ekpo-netpr.
  24.               CLEAR ls_return.
  25.               ls_return-type = 'E'.
  26.               MESSAGE i101(zdgre) INTO ls_return-message WITH ls_poste_commande-ebelp.
  27.               APPEND ls_return TO et_return.
  28.             ELSE.
  29.               "même prix = rien
  30.             ENDIF.
  31.           ENDIF.
  32.  
  33.           "Modification qté du poste
  34.           IF NOT  ls_poste_commande-menge IS INITIAL.
  35.             IF ls_poste_commande-menge LT ls_ekpo-menge.
  36.  
  37.               ls_poitem-quantity  = ls_poste_commande-menge.
  38.               ls_poitemx-quantity  = c_abap_true.
  39.  
  40.               lw_flag_reload_wf = c_abap_true. "Flag de redéclenchement du WF.
  41.             ELSEIF ls_poste_commande-menge GT ls_ekpo-menge.
  42.               CLEAR ls_return.
  43.               ls_return-type = 'E'.
  44.               MESSAGE i104(zdgre) INTO ls_return-message WITH ls_poste_commande-ebelp.
  45.               APPEND ls_return TO et_return.
  46.             ELSE.
  47.               "même qté = rien
  48.             ENDIF.
  49.           ELSE.
  50. * Début modif - ALEG001 - 02/10/2014 (+)
  51.             CLEAR ls_return.
  52.             ls_return-type = 'E'.
  53.             MESSAGE i109(zdgre) INTO ls_return-message WITH ls_poste_commande-ebelp.
  54.             APPEND ls_return TO et_return.
  55. * Fin modif - ALEG001 - 02/10/2014 (+)
  56.           ENDIF.
  57.  
  58.           "Modificaiton du type d'imputation
  59.           IF NOT ls_poste_commande-knttp IS INITIAL.
  60.             IF ls_poste_commande-knttp NE ls_ekpo-knttp.
  61.               ls_poitem-acctasscat    = ls_poste_commande-knttp.
  62.               ls_poitemx-acctasscat   = c_abap_true.
  63.             ENDIF.
  64.           ENDIF.
  65.  
  66. **Modification du type d'imputation
  67.           IF ls_poste_commande-aufnr IS NOT INITIAL.
  68.  
  69.             SELECT SINGLE auart FROM  coas INTO lw_auart
  70.                    WHERE  aufnr  = ls_poste_commande-aufnr.
  71.  
  72.             READ TABLE lt_zdgre_otp_type INTO ls_zdgre_otp_type WITH KEY auart = lw_auart.
  73.             IF sy-subrc EQ 0.
  74.               ls_poaccount-po_item = ls_poste_commande-ebelp.
  75.               ls_poaccount-serial_no = '01'.
  76.               ls_poaccount-orderid = ls_poste_commande-aufnr.
  77.               APPEND ls_poaccount TO lt_poaccount.
  78.  
  79.               ls_poaccountx-po_item   = ls_poste_commande-ebelp.
  80.               ls_poaccountx-serial_no = '01'.
  81.               ls_poaccountx-orderid   = c_abap_true.
  82.               ls_poaccountx-po_itemx  = c_abap_true.
  83.               APPEND ls_poaccountx TO lt_poaccountx.
  84.             ELSE.
  85.               CLEAR ls_return.
  86.               ls_return-type = 'E'.
  87.               "Le type de la catégorie imputation n'est pas un type DGRE (zdgre_otp_type)
  88.               MESSAGE i103(zdgre) INTO ls_return-message WITH ls_poste_commande-ebelp.
  89.               APPEND ls_return TO et_return.
  90.             ENDIF.
  91.  
  92. * Début modif - GHAR002 - 11/08/2017 (+)
  93.             IF ls_poste_commande-aufnr+3(1)  = 'I'.
  94.  
  95.               CLEAR ls_zmax_main.
  96.               IF lt_zmax_main[] IS NOT INITIAL.
  97.                 READ TABLE lt_zmax_main INTO ls_zmax_main
  98.                                         WITH KEY aufnr = ls_poste_commande-aufnr
  99.                                         BINARY SEARCH.
  100.               ENDIF.
  101.  
  102.               IF ls_zmax_main IS NOT INITIAL.
  103.                 " Si l'OI est saturé
  104.                 IF ls_zmax_main-sat_oi = 'X'.
  105.  
  106.                   CLEAR ls_return.
  107.                   MOVE 'E' TO ls_return-type.
  108.                   MESSAGE e063(zdsrm) WITH ls_poste_commande-aufnr
  109.                                       INTO ls_return-message.
  110.                   APPEND ls_return TO et_return.
  111.  
  112.  
  113.                 ELSE.
  114.                   " Recherche d'un OI non-saturé du même axe analytique que
  115.                   " l'OI en entrée et ayant moins de GRR disponibles dans
  116.                   " la ZMAX
  117.                   CLEAR ls_zmax_temp.
  118.                   READ TABLE lt_zmax_temp INTO ls_zmax_temp
  119.                                           WITH KEY aufnr(10) = ls_poste_commande-aufnr(10)
  120.                                           BINARY SEARCH.
  121.  
  122.                   IF ls_zmax_temp IS NOT INITIAL
  123.                     AND ls_zmax_temp-grr_dispo LT ls_zmax_main-grr_dispo.
  124.                     CLEAR ls_return.
  125.                     MOVE 'E' TO ls_return-type.
  126.                     MESSAGE e066(zdsrm) WITH ls_zmax_temp-aufnr
  127.                                              ls_zmax_main-aufnr
  128.                                         INTO ls_return-message.
  129.                     APPEND ls_return TO et_return.
  130.                   ENDIF.
  131.                 ENDIF.
  132.               ENDIF.
  133.             ENDIF.
  134. * Fin modif - GHAR002 - 11/08/2017 (+)
  135.  
  136.           ENDIF.
  137.  
  138.           APPEND ls_poitem  TO lt_poitem.
  139.           APPEND ls_poitemx TO lt_poitemx.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement