ZXLTOU01

<< Click to Display Table of Contents >>

Navigation:  All About ABAP Technique > English > ABAP Tutorial > ABAP Workbench Tools > Enhancement > Customer Exits > Customer Exits Examples > Project ZWMWS001 > Funtions Exits  > EXIT_SAPLL03T_001 >

ZXLTOU01

*&---------------------------------------------------------------------*
*&  Include           ZXLTOU01                                         *
*&---------------------------------------------------------------------*
*break sol_budi.
*break abap07.
 
TABLES: zta_w_trtoto.
 
DATA: lv_ltbp LIKE ltbp occurs 1 with header line,
     ch_manual(1).
 
data: begin of ch_total occurs 1,
         lgnum   like ltak-lgnum,
         tbnum   like ltbp-tbnum,
         tbpos   like ltbp-tbpos,
         menge   like RL03T-EINML,
    end of ch_total.
 
*---> check TR masih ada open quantity
SELECT * INTO corresponding fields of table lv_ltbp
      FROM ltbp
      WHERE lgnum = i_ltak_vb-lgnum
        AND tbnum = i_ltak_vb-tbnum
        and ELIKZ eq space.
check sy-subrc = 0.
 
*---> import original target TR
import ch_total from memory id 'ZWM_TARGET_TR'.
free memory id 'ZWM_TARGET_TR'.
 
clear ch_manual.
loop at ch_total.
if ch_total-menge gt 0.
  loop at lv_ltbp where lgnum = ch_total-lgnum and
                               tbnum = ch_total-tbnum and
                               tbpos = ch_total-tbpos.
 
     lv_ltbp-menge = lv_ltbp-menge - lv_ltbp-tamen.
 
    if ch_total-menge ne lv_ltbp-menge.
       ch_manual = 'X'.
      exit.
    endif.
 
  endloop.
 
  if not ch_manual is initial.
    exit.
  endif.
 
endif.
endloop.
 
check ch_manual is initial.
 
*---> check entry di temp table
select single * from  zta_w_trtoto
              where lgnum = i_ltak_vb-lgnum
              and   tbnum = i_ltak_vb-tbnum.
 
if sy-subrc ne 0.
 
CLEAR zta_w_trtoto.
 zta_w_trtoto-lgnum  = i_ltak_vb-lgnum.
 zta_w_trtoto-tbnum  = i_ltak_vb-tbnum.
 zta_w_trtoto-uname  = sy-uname.
 zta_w_trtoto-udate  = sy-datum.
 zta_w_trtoto-menge =  lv_ltbp-menge.
 zta_w_trtoto-meins =  lv_ltbp-meins.
 
INSERT zta_w_trtoto FROM zta_w_trtoto.
check sy-subrc = 0.
 
else.
 
check not zta_w_trtoto-menge is initial.
 
endif.
 
*---> raise event to call program ZJB_WM003_TR_TO_TO
CALL FUNCTION 'BP_EVENT_RAISE'
EXPORTING
   eventid                = 'ZTR_TO_TO'
EXCEPTIONS
   bad_eventid            = 1
   eventid_does_not_exist = 2
   eventid_missing        = 3
   raise_failed           = 4
  OTHERS                 = 5.