|
<< Click to Display Table of Contents >> Navigation: All About ABAP Technique > Indonesia > ABAP Tutorial > ABAP Workbench Tools > Enhancement > Customer Exits > Contoh Customer Exits > Project ZSDWS001 > Funtions Exits > EXIT_SAPLV56U_004 > ZXV56U11 |
*&---------------------------------------------------------------------*
*& Include ZXV56U11 *
*&---------------------------------------------------------------------*
*"----------------------------------------------------------------------
*"*"Lokale Schnittstelle:
*" TABLES
*" I_XVTTK STRUCTURE VTTKVB
*" I_YVTTK STRUCTURE VTTKVB
*" I_XVTTP STRUCTURE VTTPVB
*" I_YVTTP STRUCTURE VTTPVB
*" I_VTRLK STRUCTURE VTRLK
*" I_VTRLP STRUCTURE VTRLP
*" I_XVTTS STRUCTURE VTTSVB
*" I_YVTTS STRUCTURE VTTSVB
*" I_XVTSP STRUCTURE VTSPVB
*" I_YVTSP STRUCTURE VTSPVB
*" I_XVBPA STRUCTURE VBPAVB
*" I_YVBPA STRUCTURE VBPAVB
*" I_XSADR STRUCTURE SADRVB
*" I_YSADR STRUCTURE SADRVB
*" I_XVTFA STRUCTURE VTFAVB
*" I_YVTFA STRUCTURE VTFAVB
*"----------------------------------------------------------------------
* Enhanced by Sy Syarien
*
* Buat ngitung-ngitungan yang bikin pussssyyyyyiiiiingggg...
************************************************************************
tables: equi,
vttk,
equz,
iloa,
fleet,
kna1,
knvp,
ihpa.
DATA: BEGIN OF invttk OCCURS 0.
INCLUDE STRUCTURE vttkvb.
DATA: END OF invttk.
data: lv_tabix like sy-tabix,
lv_rpmowa like I_XVTTK-/BEV1/RPMOWA,
ritmuat type i,
rit(2),
seqno like I_XVTTK-/BEV1/RPFLGNR.
move I_XVTTK-/BEV1/RPMOWA to lv_rpmowa.
read table I_XVTTK with key /BEV1/RPMOWA = lv_rpmowa.
if sy-subrc eq 0.
move sy-tabix to lv_tabix.
endif.
select single * from equi where EQUNR = I_XVTTK-/BEV1/RPMOWA.
IF sy-subrc = 0 .
* Jika shipment status started
if I_XVTTK-/BEV1/RPFLGNR is initial and I_XVTTK-DATBG is not initial.
* check sequence number (jumlah rit jalan)
seqno = 1.
select * from vttk where tknum ne I_XVTTK-TKNUM
and DATBG = I_XVTTK-DATBG
and /BEV1/RPMOWA = I_XVTTK-/BEV1/RPMOWA.
seqno = seqno + 1.
endselect.
* update sequence (rit jalan) number to document.
I_XVTTK-/BEV1/RPFLGNR = seqno.
modify I_XVTTK index lv_tabix.
endif.
* update rit muat ke document.
if I_XVTTK-ADD01 is initial and I_XVTTK-DALEN is not initial.
* check jumlah rit muat
clear rit.
ritmuat = 1.
select * from vttk where tknum ne I_XVTTK-TKNUM
and DALEN = I_XVTTK-DALEN
and /BEV1/RPMOWA = I_XVTTK-/BEV1/RPMOWA.
ritmuat = ritmuat + 1.
endselect.
* update sequence (rit muat) number to document.
move ritmuat to rit.
I_XVTTK-ADD01 = rit.
modify I_XVTTK index lv_tabix.
endif.
if seqno > ritmuat and ritmuat <> 0 .
ritmuat = seqno.
move ritmuat to rit.
I_XVTTK-ADD01 = rit.
modify I_XVTTK index lv_tabix.
endif.
* move internal order number to TEXT1.
IF I_XVTTK-TEXT1 is initial.
select single * from equz where equnr = I_XVTTK-/BEV1/RPMOWA.
select single * from iloa where iloan = equz-iloan.
move iloa-aufnr to I_XVTTK-TEXT1.
modify I_XVTTK index lv_tabix.
ENDIF.
* get driver code
IF I_XVTTK-/BEV1/RPMOWA ne I_YVTTK-/BEV1/RPMOWA.
select single * from ihpa where OBJNR = equi-objnr and parvw = 'Z1'
and kzloesch eq space.
if sy-subrc = 0.
* move driver from Vehicle Master to Shipment Doc.
I_XVTTK-/BEV1/RPFAR1 = IHPA-PARNR.
* move NIK to Text 2 in additional data.
select single * from knvp where kunnr = ihpa-parnr
and parvw = 'Z7'.
if sy-subrc = 0.
I_XVTTK-TEXT2 = KNVP-PERNR.
endif.
endif.
* move helper1 to text3
select single * from ihpa where OBJNR = equi-objnr and parvw = 'Z2'
and kzloesch eq space.
if sy-subrc = 0.
I_XVTTK-TEXT3 = IHPA-PARNR.
endif.
* move helper2 to text4
select single * from ihpa where OBJNR = equi-objnr and parvw = 'Z3'
and kzloesch eq space.
if sy-subrc = 0.
I_XVTTK-TEXT4 = IHPA-PARNR.
endif.
* move driver name to field External ID 2.
IF I_XVTTK-/BEV1/RPFAR1 ne space and I_XVTTK-DTABF is initial.
select single * from kna1 where kunnr = I_XVTTK-/BEV1/RPFAR1.
I_XVTTK-EXTI2 = kna1-name1.
ENDIF.
modify I_XVTTK index lv_tabix.
endif.
* move License Plate number to shipment document (External ID 1).
IF I_XVTTK-/BEV1/RPMOWA ne I_YVTTK-/BEV1/RPMOWA.
if I_XVTTK-/BEV1/RPMOWA is not initial
and I_XVTTK-DAREG is not initial.
select single * from fleet where objnr = equi-objnr.
move FLEET-LICENSE_NUM to I_XVTTK-EXTI1.
modify I_XVTTK index lv_tabix.
endif.
ENDIF.
ENDIF.