Dcsea LZ Ais Velo12f01 2022 07 29
Dcsea LZ Ais Velo12f01 2022 07 29
***INCLUDE LZ_AIS_VELO12F01 .
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Form INIT_ALL
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 None
* <-- p2 None
*----------------------------------------------------------------------*
* TA1K900110, Anbu (Infosys), 20/11/2002, VMS upgrade, Mask: VMSUPGD
*----------------------------------------------------------------------*
*-----------------------------------------------------------------------
*Change Track
* 1.0 07/04/2003 CM-1869 Additions For actions AGARWALN *
* ZIDI, ZVP8, ZVRV, ZVIP, (Mrunalini)*
* ZVT2, ZVPY, ZVHC,ZVT2
* 2.0 07/07/2003 CM-2034 Addition for action ZNAK AGARWALN *
* 3.0 09/07/2003 Ticket-1192194 Fix MARAMS *
* 4.0 17/11/2003 CM-2225 Moving ETD,ETA,STNCODE ALAPATK
* values from idoc segment
* to st_vlcvehicle
* 5.0 26/11/2003 Ticket-1486105 ZMD1 fix for GO Kerridge
* vehicle SRIVATSS *
* 6.0 09/01/2004 Ticket 1512438 New parameter added to GO FM
* SRIVATSS *
* 7.0 18/05/2004 CM-2475 Major Changes in VPC Ashish
*
* Interface (PUTHILLP)
*
* 8.0 18/06/2004 CM-2564 Creating or changing *
* for action ZAEC KALLIANM *
* 9.0 15/07/2004 Performance Tuning ANANDD *
* 10.0 15/07/2004 Additions for actions KHETERT *
* ZVHA, ZVNA, ZINS, ZINU *
* 11.0 09/12/2004 CM-2779 Changes to accomodate the DEA *
* field Title for partner type *
* ZALTNAECL1 *
* ---------------------------------------------------------------------*
* 12.0 20/03/2008 6854552 SWT Physical BHORCHIS
* Split & XI-LO
* ABAP changes for XI migration - This include has been modified to add
* all the ABAP related changes as part of migration to XI. All
* the new partner profiles and message types have been incoporated
* and all interface related select queries have been modified.
*----------------------------------------------------------------------*
* 13.0 13.03.2009 8808645 Add Partner profile VSS *
* GSAFAB_JP to the range *
* for entry in DCON table *
*----------------------------------------------------------------------*
* 14.0 16.09.2016 34670898 For Indicator ZVAS,ZVIB SWETHAR *
*----------------------------------------------------------------------*
* 15.0 08.12.2020 54479486 SG VEGA Changes GUPTRIS *
FORM init_all.
CLEAR:
st_int_edidd,
st_vlcvehiclem,
st_vlcinvoice,
st_vlcvehiclea,
st_vlcvehicleb,
st_vlcvehiclec,
st_e1cucfg,
st_e1cuins,
st_e1cuprt,
st_e1cuval,
st_errormsg,
st_vlcgoodsmvmt,
* ortegav 1/16/02
st_adrmasendcu,
idoc_status_no,
flag_po_exist,
flag_action_performed,
flag_zshm_action,
error_records,
v_action,
wf_date,
wf_time,
v_msgfn,
v_credit_note,
st_vlcsmod,
vlch_ord1_ls,
vlch_iniv_ls,
vlch_smod_ls,
wf_mtart,
wf_zfodmbch,
vlcbapicu_ls,
bapicucfg_temp,
vlcactdata_cs, " VMSUPGD
st_vlcvehicle, " VMSUPGD
vlcactdata_item_lt, " VMSUPGD
vlcadddata_cs, "PERIASAS for CM-1929
vlcadddata_gt, "RAMAKUMM 02-May-2004
*** Begin of Insertion by Ashish(PUTHILLP) on 18/05/2004 for CM-2475.
lv_vpcstatus,
*** End of Insertion by Ashish(PUTHILLP) on 18/05/2004 for CM-2475.
* Begin of changes by PPRAGYA for MBIL for CM 0051514725
st_vlcbilling,
* End of changes by PPRAGYA for MBIL for CM 0051514725
**Begin of insertion by DIROHAN for CM-0042697099 on 31.05.2018
gv_tstmp,
gv_vguid,
gv_matkl,
gv_vehicle,
wa_scc,
wa_incentivepts,
wa_pricecond,
wa_pgty.
**End of insertion by DIROHAN for CM-0042697099 on 31.05.2018
REFRESH:
tb_vlc_vehicle,
tb_vhcl_config,
tb_vhcl_cuins,
tb_vhcl_cuprt,
tb_vhcl_cuval,
tb_vhcl_cublb,
tb_curr_cuval,
tb_err_msg,
tb_errtab,
vlcsmod_vhcl_s_temp,
vlciniv_item_s_temp,
tb_vlch_actdata_lt,
ekbe_temp,
tb_vlcbapicu_lt,
* Following line inserted by PULLABHS for CM-10442289 on 20.05.2010
tb_extn,
bapicuval_temp,
bapicuins_temp,
vlcactdata_item_lt, "VMSUPGD
vlcadddata_gt, "RAMAKUMM 02-May-2004
**Begin of insertion by DIROHAN for CM-0042697099 on 31.05.2018
tb_scc,
tb_incentivepts,
tb_exten,
tb_pricecond.
**End of insertion by DIROHAN for CM-0042697099 on 31.05.2018
*&---------------------------------------------------------------------*
*& Form INTERPRET_IDOC_VEHMAS
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 None
* <-- p2 None
*----------------------------------------------------------------------*
FORM interpret_idoc_vehmas.
*--- Begin of changes by AJABOSE for CM 39989827 on 21/11/2017
DATA lo_xclass TYPE REF TO /dcsea/zais_xclass.
*--- End of changes by AJABOSE for CM 39989827 on 21/11/2017
* Begin of insert by MAAMARN for CM-0043084167(MBTH DIP Phase II) on 26.10.2018
DATA: lv_date TYPE sy-datum.
* End of insert by MAAMARN for CM-0043084167(MBTH DIP Phase II) on 26.10.2018
LOOP AT idoc_data
WHERE docnum = idoc_contrl-docnum.
CASE idoc_data-segnam.
* Invoice Segment
*Following 1 line modified by GUPTAGA for CM-20147110 on 26.03.2013
* when co_vhcl_inv_segmt.
WHEN co_vhcl_inv_segmt OR co_vhcl_inv_segmt1.
MOVE idoc_data-sdata TO st_vlcinvoice.
PERFORM append_data_zvlcinovice.
* Configuration data
WHEN co_vhcl_cfg_segmt.
MOVE idoc_data-sdata TO st_e1cucfg.
PERFORM append_data_e1cucfg.
* ortegav 1/16/02
* Goods Movement Segment
WHEN co_adrm_encu_segmt.
MOVE idoc_data-sdata TO st_adrmasendcu.
WHEN co_cust_data_segmt.
MOVE idoc_data-sdata TO st_but000a3.
*end of insert by KALLIANM for CM-2564 on 18.06.2004
WHEN co_pricecond_segmt.
MOVE idoc_data-sdata TO wa_pricecond.
APPEND wa_pricecond TO tb_pricecond.
**End of insertion by DIROHAN for CM-0042697099 on 31.05.2018
WHEN co_vhcl_adddata_segmt.
MOVE idoc_data-sdata TO st_vlcadddata.
PERFORM append_fill_adddata.
* Local Options (for Invoice Segment)
* WHEN CO_VHCL_LOPT_SEGMT.
* MOVE IDOC_DATA-SDATA TO ST_LOCALOPTIONS.
* PERFORM APPEND_DATA_ZLOCALOPTIONS.
ENDLOOP.
IF sy-subrc EQ 0.
* Append structure to table
MODIFY tb_vlc_vehicle FROM st_vlcvehicle INDEX sy-tabix.
ELSE.
* Append structure to table
APPEND st_vlcvehicle TO tb_vlc_vehicle.
ENDIF.
*End of insertion by THELAKAK for CM-3130 on 14-07-2005.
DATA(lv_0056783726) = abap_false.
CALL FUNCTION '/DCSEA/Z_AIS_CHECK_ACTIVE_CM'
EXPORTING
cm_number = '0056783726'
werks = lv_werks
IMPORTING
active_flag = lv_0056783726.
IF ( NOT lv_0056783726 IS INITIAL AND ( wf_aktion = co_zmif OR wf_aktion =
co_zmip ) )
AND idoc_contrl-rcvprn = co_lsovp_au AND idoc_contrl-mestyp =
co_mestyp_zovp.
READ TABLE vlcadddata_gt TRANSPORTING NO FIELDS
WITH KEY fieldname = 'ZZ_DAMAGE_STS'
fieldvalue = 'SV2'.
IF sy-subrc EQ 0.
SELECT vlchistory~action
UP TO 1 ROWS
INTO @DATA(lv_action)
FROM vlchistory
JOIN vlcvehicle
ON vlchistory~vguid = vlcvehicle~vguid
WHERE vlcvehicle~zz_commnos = @tb_vlc_vehicle-zz_commnos
AND vlchistory~action = @co_zmip.
ENDSELECT.
IF sy-subrc <> 0.
PERFORM write_error USING co_msg_590 "ZMIP 1st stage not executed
co_zais_msg1.
ENDIF.
ENDIF.
ENDIF.
*End of insert KAMIRES for CM-0056783726 on 05/04/2021
wa_scc-dealer_name = st_vlcvehiclec-/dcsea/zz_dealer_name.
READ TABLE tb_exten INTO wa_exten WITH KEY tabname = co_tabname
fieldname = 'Fleet_IND'.
IF sy-subrc IS INITIAL.
wa_scc-fleet_ind = wa_exten-fieldval.
ENDIF.
READ TABLE tb_pgty INTO wa_pgty WITH KEY plant = tb_vlc_vehicle-
werks sales_type = tb_vlc_vehicle-zz_flty.
IF sy-subrc IS INITIAL.
IF wa_scc-fleet_ind = 'Y'.
wa_scc-sales_ind = wa_pgty-program_type.
wa_scc-fleet_type = tb_vlc_vehicle-zz_flty.
wa_scc-subfleet_type = tb_vlc_vehicle-zz_subflty.
ELSE.
wa_scc-sales_ind = wa_pgty-program_type.
ENDIF.
ENDIF.
wa_scc-sales_card_date = idoc_contrl-upddat.
READ TABLE tb_exten INTO wa_exten WITH KEY tabname = co_tabname
fieldname = 'DEALER_SHOWROOM'.
IF sy-subrc IS INITIAL.
wa_scc-dlr_shwroom_code = wa_exten-fieldval.
ENDIF.
* Begin of insert by UDAKUMA for CM-59373041 on 12.11.2021
CONSTANTS: co_0059373041 TYPE /dcsea/z_cm_number
VALUE '0059373041'.
CONSTANTS: co_vlcvehicle(10) TYPE c VALUE 'VLCVEHICLE',
co_zz_flty(7) TYPE c VALUE 'ZZ_FLTY',
co_zz_subflty(10) TYPE c VALUE 'ZZ_SUBFLTY' ,
co_sales_ind(9) TYPE c VALUE 'SALES_IND',
co_month_ind(9) TYPE c VALUE 'MONTH_IND',
co_y TYPE c VALUE 'Y'.
TYPES: BEGIN OF ty_fieldval,
fieldval(50) TYPE c,
END OF ty_fieldval.
DATA: wf_0059373041 TYPE c,
tb_fieldval TYPE STANDARD TABLE OF ty_fieldval.
CALL FUNCTION '/DCSEA/Z_AIS_CHECK_ACTIVE_CM'
EXPORTING
cm_number = co_0059373041
werks = st_vlcvehiclem-werks
IMPORTING
active_flag = wf_0059373041.
* End of insert by UDAKUMA for CM-59373041 on 12.11.2021
READ TABLE tb_exten INTO wa_exten WITH KEY tabname = co_tabname
fieldname = 'SALESMAN_CODE'.
IF sy-subrc IS INITIAL.
wa_scc-salesman_code = wa_exten-fieldval.
* Begin of insert by UDAKUMA for CM-59373041 on 12.11.2021
IF wf_0059373041 IS NOT INITIAL.
LOOP AT tb_exten ASSIGNING FIELD-SYMBOL(<fs_exten>)
WHERE tabname = co_tabname AND fieldname = co_sales_ind.
APPEND INITIAL LINE TO tb_fieldval ASSIGNING
FIELD-SYMBOL(<fs_fieldval>).
<fs_fieldval>-fieldval = <fs_exten>-fieldval.
ENDLOOP.
READ TABLE tb_exten INTO wa_exten WITH KEY tabname =
co_vlcvehicle
fieldname =
co_zz_flty.
IF sy-subrc IS INITIAL.
wa_scc-fleet_type = wa_exten-fieldval.
ENDIF.
READ TABLE tb_exten INTO wa_exten WITH KEY
tabname = co_vlcvehicle fieldname = co_zz_subflty.
IF sy-subrc IS INITIAL.
wa_scc-subfleet_type = wa_exten-fieldval.
ENDIF.
READ TABLE tb_exten INTO wa_exten WITH KEY
tabname = co_tabname fieldname = co_month_ind.
IF sy-subrc IS INITIAL.
wa_scc-month_ind = wa_exten-fieldval.
ENDIF.
ENDIF.
* End of insert by UDAKUMA for CM-59373041 on 12.11.2021
ENDIF.
wa_scc-product_type = '01'.
wa_scc-company_name = st_adrmasendcu-name_co.
wa_scc-action = wf_aktion.
wa_scc-action_exe_date = gv_tstmp.
wa_scc-mmctr = tb_vlc_vehicle-mmctr.
wa_scc-sdctr = tb_vlc_vehicle-sdctr.
* Begin of Modification by MAAMARN for CM-0046672944 on 13.03.2019
REPLACE ALL OCCURRENCES OF '-' IN tb_vlc_vehicle-zz_bbatx21 WITH
space.
CONDENSE tb_vlc_vehicle-zz_bbatx21.
* wa_scc-fleet_acct_num = st_but000a2-zfleet_no. "Changed the
IDOC mapping field for fleet_acct_num
wa_scc-fleet_acct_num = tb_vlc_vehicle-zz_bbatx21.
* End of Modification by MAAMARN for CM-0046672944 on 13.03.2019
wa_scc-fleet_count = tb_vlc_vehicle-pcount_u.
wa_scc-vendor = tb_vlc_vehicle-lifnr.
wa_scc-demo_regis_date = tb_vlc_vehicle-zz_retaildate.
wa_scc-invoice_account = tb_vlc_vehicle-zz_bbatx11.
wa_scc-registration_dt = tb_vlc_vehicle-immatdate.
wa_scc-endcustomer_name = tb_vlc_vehicle-cu_name1.
wa_scc-dms_user_name = tb_vlc_vehicle-zz_dms_user.
wa_scc-invoice_date = tb_vlc_vehicle-zz_retaildate.
wa_scc-owner_type = st_but000a3-jobgr.
wa_scc-customer_type = st_but000a1-type.
* *Populate Tenure.
READ TABLE tb_exten INTO wa_exten WITH KEY tabname = co_tabname
fieldname = 'TENURE'.
IF sy-subrc IS INITIAL.
wa_scc-tenure = wa_exten-fieldval.
ENDIF.
CLEAR : wa_fleet_target.
IF wa_scc-vhcle IS NOT INITIAL.
"Get model number using Vehicle number
SELECT matnr
FROM vlcvehicle
INTO @DATA(lv_matnr) UP TO 1 ROWS
WHERE vhcle EQ @wa_scc-vhcle.
ENDSELECT.
IF lv_matnr IS NOT INITIAL.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
**End of insertion by DIROHAN for CM-0042697099 on 31.05.2018
* Begin of insert by MAAMARN for CM-0043084167(MBTH DIP Phase II) on 26.10.2018
CLEAR: gv_0043084167.
CALL FUNCTION '/DCSEA/Z_AIS_CHECK_ACTIVE_CM'
EXPORTING
cm_number = '0043084167'
werks = st_vlcvehiclem-werks
IMPORTING
active_flag = gv_0043084167.
IF gv_0043084167 IS NOT INITIAL.
IF idoc_contrl-rcvprn = co_rcvprn_th.
IF idoc_contrl-mestyp = co_mestyp_zgen.
IF wf_aktion = co_zecu.
* PERFORM get_dip_data.
PERFORM get_dip_data_th.
READ TABLE tb_vlc_vehicle INDEX 1.
CLEAR: wa_exten.
READ TABLE tb_exten INTO wa_exten WITH KEY tabname = co_slty
fieldname = 'ZSALETYPE_CODE'.
IF sy-subrc IS INITIAL.
wa_scc-zsaletype_code = wa_exten-fieldval.
ENDIF.
CLEAR: wa_exten.
READ TABLE tb_exten INTO wa_exten WITH KEY tabname = co_slty
fieldname = 'ZVEHICLE_TYPE'.
IF sy-subrc IS INITIAL.
wa_scc-zvehicle_type = wa_exten-fieldval.
ENDIF.
CLEAR: wa_exten.
READ TABLE tb_exten INTO wa_exten WITH KEY tabname = co_fanm
fieldname = 'ZFAN_NO'.
IF sy-subrc IS INITIAL.
wa_scc-fleet_acct_num = wa_exten-fieldval.
ENDIF.
IF wa_scc-fleet_acct_num IS NOT INITIAL.
SELECT * UP TO 1 ROWS FROM /dcsea/th_v_fanm
INTO @DATA(ls_fanm)
WHERE zfan_no = @wa_scc-fleet_acct_num.
ENDSELECT.
IF sy-subrc = 0.
wa_scc-zfleet_class = ls_fanm-zfleet_class.
wa_scc-zfleet_class_cat = ls_fanm-zfleet_class_cat.
ENDIF.
ENDIF.
wa_scc-plant = tb_vlc_vehicle-werks.
wa_scc-vhcle = wa_vlcvehicle-vhcle.
wa_scc-zcommnos = tb_vlc_vehicle-zz_commnos.
wa_scc-dealer_code = tb_vlc_vehicle-kunnr.
wa_scc-sales_card_date = idoc_contrl-upddat.
wa_scc-product_type = '01'.
wa_scc-action = wf_aktion.
wa_scc-action_exe_date = idoc_contrl-upddat.
wa_scc-mmctr = wa_vlcvehicle-mmctr.
wa_scc-sdctr = wa_vlcvehicle-sdctr.
wa_scc-vendor = wa_vlcvehicle-lifnr.
wa_scc-demo_regis_date = tb_vlc_vehicle-zz_retadt.
wa_scc-invoice_account = tb_vlc_vehicle-zz_bbatx11.
wa_scc-registration_dt = tb_vlc_vehicle-immatdate.
wa_scc-endcustomer_name = tb_vlc_vehicle-cu_name1.
wa_scc-dms_user_name = tb_vlc_vehicle-zz_dms_user.
IF tb_vlc_vehicle-zz_retadt IS NOT INITIAL.
CLEAR: lv_date.
CALL FUNCTION 'VELO03_CONVERT_FROM_TIMESTAMP'
EXPORTING
timestamp_iv = tb_vlc_vehicle-zz_retadt
IMPORTING
datlo_ev = lv_date.
wa_scc-invoice_date = lv_date.
ENDIF.
wa_scc-idoc_no = idoc_contrl-docnum.
wa_scc-idoc_date = idoc_contrl-upddat.
wa_scc-idoc_msg_type = idoc_contrl-mestyp.
wa_scc-zclaim_gen_y_n = 'N'.
REPLACE ALL OCCURRENCES OF '-' IN tb_vlc_vehicle-zz_bbatx21 WITH
space.
CONDENSE tb_vlc_vehicle-zz_bbatx21.
wa_scc-company_reg_no = tb_vlc_vehicle-zz_rego_number.
REPLACE ALL OCCURRENCES OF '-' IN tb_vlc_vehicle-zz_bbatx12 WITH
space.
CONDENSE tb_vlc_vehicle-zz_bbatx12.
wa_scc-vat_reg_no = tb_vlc_vehicle-zz_bbatx12.
IF idoc_contrl-mestyp = co_mestyp_zgen.
wa_scc-transaction_type = 'GEN'.
ENDIF.
*& Fleet Vehicles Count Update
IF ls_fanm IS NOT INITIAL
AND ls_fanm-zfleet_class = 'VF'
AND ls_fanm-zfleet_class_cat = 'INFA'.
SELECT * FROM /dcsea/th_v_pnnf
INTO TABLE @DATA(lt_pnnf)
WHERE zplant = @wa_scc-plant.
CLEAR: wa_tnnf.
SELECT * UP TO 1 ROWS FROM /dcsea/th_v_tnnf
INTO wa_tnnf
WHERE zplant = wa_scc-plant
AND zdealer = wa_scc-dealer_code
AND zfan_no = wa_scc-fleet_acct_num.
ENDSELECT.
IF wa_tnnf IS NOT INITIAL.
wa_tnnf-zvehicle_sold = wa_tnnf-zvehicle_sold + 1.
READ TABLE lt_pnnf ASSIGNING FIELD-SYMBOL(<lfs_pnnf>) WITH KEY
zplant = wa_tnnf-zplant
zsign = 'BT'.
IF sy-subrc IS INITIAL AND <lfs_pnnf> IS ASSIGNED.
IF wa_tnnf-zvehicle_sold BETWEEN <lfs_pnnf>-veh_units_from
AND <lfs_pnnf>-veh_units_to.
wa_tnnf-zcustomer_margin = <lfs_pnnf>-zcustomer_margin.
wa_tnnf-zdealer_margin = <lfs_pnnf>-zdealer_margin.
ELSE.
READ TABLE lt_pnnf ASSIGNING <lfs_pnnf> WITH KEY zplant =
wa_tnnf-zplant
zsign =
'GE'.
IF sy-subrc IS INITIAL AND <lfs_pnnf> IS ASSIGNED.
IF wa_tnnf-zvehicle_sold GE <lfs_pnnf>-veh_units_from.
wa_tnnf-zcustomer_margin = <lfs_pnnf>-zcustomer_margin.
wa_tnnf-zdealer_margin = <lfs_pnnf>-zdealer_margin.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ELSE.
wa_tnnf-zplant = wa_scc-plant.
wa_tnnf-zdealer = wa_scc-dealer_code.
wa_tnnf-zfan_no = wa_scc-fleet_acct_num.
wa_tnnf-zvehicle_sold = 1.
wa_tnnf-zvehicle_cumm = wa_tnnf-zvehicle_sold + wa_tnnf-
zvehicle_cumm.
ENDIF.
ENDIF.
*& Update the Dealer Sale Vehicle Count for Bonus - TPM Scenario
SELECT * UP TO 1 ROWS FROM /dcsea/th_v_spb
INTO @DATA(ls_spb)
WHERE plant_code = @wa_scc-plant
AND matnr = @wa_vlcvehicle-matnr
ORDER BY PRIMARY KEY.
ENDSELECT.
IF sy-subrc IS INITIAL.
SELECT * UP TO 1 ROWS FROM /dcsea/th_v_dtrg
INTO wa_dtrg
WHERE plant_code = wa_scc-plant
AND dealer_code = wa_scc-dealer_code
AND target_month = sy-datlo+4(2)
AND target_year = sy-datlo+0(4)
AND spb = ls_spb-spb
ORDER BY PRIMARY KEY.
ENDSELECT.
IF sy-subrc IS INITIAL.
wa_dtrg-target_acheived = wa_dtrg-target_acheived + 1.
ENDIF.
*&---------------------------------------------------------------------*
*& Form APPEND_DATA_ZVLCVEHICLEM
*&---------------------------------------------------------------------*
* Adds vehicle master data to the vehicle internal table
*----------------------------------------------------------------------*
* --> p1 None
* <-- p2 None
*----------------------------------------------------------------------*
FORM append_data_zvlcvehiclem.
CLEAR : wf_flag_49520014,
wa_vlcvehicle_my.
SELECT shiptoparty
FROM /dcsea/id_m_stp
INTO lv_ship
WHERE werks = st_vlcvehicle-werks
AND customercode = st_vlcvehicle-kunnr
ORDER BY PRIMARY KEY.
ENDSELECT.
IF sy-subrc = 0.
MOVE lv_ship TO st_vlcvehicle-kunnr.
*Start of insertion by MALAKAS for CM-0045722136 on 02.14.2019
ELSE.
tb_errtab-msgid = co_msgid.
tb_errtab-msgty = co_msgty.
tb_errtab-msgnr = co_msgno.
tb_errtab-msgv1 = st_vlcvehicle-kunnr.
APPEND tb_errtab.
ENDIF.
*End of insertion by MALAKAS for CM-0045722136 on 02.14.2019
ENDIF.
*End of insertion by MALAKAS for CM-0045722136 on 1.02.2019
*&---------------------------------------------------------------------*
*& Form APPEND_DATA_ZVLCINOVICE
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 None
* <-- p2 None
*----------------------------------------------------------------------*
FORM append_data_zvlcinovice.
*&---------------------------------------------------------------------*
*& Form APPEND_DATA_ZVLCVEHICLEA
*&---------------------------------------------------------------------*
* Adds additional vehicle data to the vehicle internal table
*----------------------------------------------------------------------*
* --> None
* <-- None
*----------------------------------------------------------------------*
FORM append_data_zvlcvehiclea.
* ortegav 1/10/2002
* Move Kerridge DMS User ID to ZZ_Uname to be later saved in VLCHistory
* for ZCHA action (Logical Interface Name ?TKERDMSL4?
MOVE st_vlcvehiclea-/dcsea/zz_dms_user TO st_vlcvehicle-zz_dms_user.
* Begin of insert by Anil on 01/09/2004 for bug fixing
MOVE st_vlcvehiclea-carrier TO st_vlcvehicle-zz_carrier.
* End of insert by Anil on 01/09/2004 for bug fixing
*&---------------------------------------------------------------------*
*& Form APPEND_DATA_ZVLCVEHICLEB
*&---------------------------------------------------------------------*
* Add global template vehicle data to vehicle internal table
*----------------------------------------------------------------------*
* --> p1 None
* <-- p2 None
*----------------------------------------------------------------------*
FORM append_data_zvlcvehicleb.
MOVE st_vlcvehicleb-/dcsea/zz_commnos
TO st_vlcvehicle-zz_commnos.
IF sy-subrc EQ 0.
*===Added validation for Pajero commnos lmp 8/30/01
* commented-out by rpc 06/05/02
* IF ST_VLCVEHICLEB-/DCSEA/ZZ_COMMNOS+0(2) EQ CO_COMMNOS_BS.
* clear st_vlcvehicle-zz_commnos.
ENDIF.
ELSE.
MOVE st_vlcvehicleb-/dcsea/zz_commnos TO st_vlcvehicle-zz_commnos.
ENDIF.
*===
MOVE st_vlcvehicleb-/dcsea/zz_engine_number
TO st_vlcvehicle-zz_engine_number.
MOVE st_vlcvehicleb-/dcsea/zz_transm_number
TO st_vlcvehicle-zz_transm_number.
MOVE st_vlcvehicleb-/dcsea/zz_tyre
TO st_vlcvehicle-zz_tyre.
MOVE st_vlcvehicleb-/dcsea/zz_lights_produc
TO st_vlcvehicle-zz_lights_produc.
MOVE st_vlcvehicleb-/dcsea/zz_lock_number
TO st_vlcvehicle-zz_lock_number.
MOVE st_vlcvehicleb-/dcsea/zz_windscr_wiper
TO st_vlcvehicle-zz_windscr_wiper.
MOVE st_vlcvehicleb-/dcsea/zz_radio_code
TO st_vlcvehicle-zz_radio_code.
MOVE st_vlcvehicleb-/dcsea/zz_fin_miss_stamp
TO st_vlcvehicle-zz_fin_miss_stam.
MOVE st_vlcvehicleb-/dcsea/zz_rear_axle
TO st_vlcvehicle-zz_rear_axle.
* Following zz_rear_axle_3 added by BONDEP CM-1731 15/11/2002
MOVE st_vlcvehicleb-/dcsea/zz_rear_axle_3
TO st_vlcvehicle-zz_rear_axle_3.
MOVE st_vlcvehicleb-/dcsea/zz_front_axle
TO st_vlcvehicle-zz_front_axle.
MOVE st_vlcvehicleb-/dcsea/zz_steer_whl_typ
TO st_vlcvehicle-zz_steer_whl_typ.
MOVE st_vlcvehicleb-/dcsea/zz_fuel_tank
TO st_vlcvehicle-zz_fuel_tank.
MOVE st_vlcvehicleb-/dcsea/zz_elect_lock_no
TO st_vlcvehicle-zz_elect_lock_no.
MOVE st_vlcvehicleb-/dcsea/zz_trans_case_4wd
TO st_vlcvehicle-zz_tran_case_4wd.
MOVE st_vlcvehicleb-/dcsea/zz_eng_ctrl_unit
TO st_vlcvehicle-zz_eng_ctrl_unit.
MOVE st_vlcvehicleb-/dcsea/zz_coc_number
TO st_vlcvehicle-zz_coc_number.
MOVE st_vlcvehicleb-/dcsea/zz_type_key
TO st_vlcvehicle-zz_type_key.
MOVE st_vlcvehicleb-/dcsea/zz_airbag_sensor
TO st_vlcvehicle-zz_airbag_sensor.
MOVE st_vlcvehicleb-/dcsea/zz_airbag_driver
TO st_vlcvehicle-zz_airbag_driver.
MOVE st_vlcvehicleb-/dcsea/zz_airbag_beifah
TO st_vlcvehicle-zz_airbag_beifah.
MOVE st_vlcvehicleb-/dcsea/zz_sidebag
TO st_vlcvehicle-zz_sidebag.
MOVE st_vlcvehicleb-/dcsea/zz_sidebag_doors
TO st_vlcvehicle-zz_sidebag_doors.
MOVE st_vlcvehicleb-/dcsea/zz_egs_serie
TO st_vlcvehicle-zz_egs_serie.
MOVE st_vlcvehicleb-/dcsea/zz_egs_kennung
TO st_vlcvehicle-zz_egs_kennung.
MOVE st_vlcvehicleb-/dcsea/zz_egs_codierung
TO st_vlcvehicle-zz_egs_codierung.
MOVE st_vlcvehicleb-/dcsea/zz_vtweg
TO st_vlcvehicle-zz_vtweg.
MOVE st_vlcvehicleb-/dcsea/zz_vessel_name
TO st_vlcvehicle-zz_vessel_name.
MOVE st_vlcvehicleb-/dcsea/zz_voyage_number
TO st_vlcvehicle-zz_voyage_number.
MOVE st_vlcvehicleb-/dcsea/zz_bill_of_lad
TO st_vlcvehicle-zz_bill_of_lad.
MOVE st_vlcvehicleb-/dcsea/zz_etd
TO st_vlcvehicle-zz_etd.
MOVE st_vlcvehicleb-/dcsea/zz_eta
TO st_vlcvehicle-zz_eta.
* MOVE ST_VLCVEHICLEB-/DCSEA/ZZ_PRD_FLAG
* TO ST_VLCVEHICLE-ZZ_PRD_FLAG.
MOVE st_vlcvehicleb-/dcsea/zz_req_prod_dec
TO st_vlcvehicle-zz_req_prod_dec.
MOVE st_vlcvehicleb-/dcsea/zz_bill_of_lad
TO st_vlcvehicle-zz_bill_of_lad.
MOVE st_vlcvehicleb-/dcsea/zz_port_of_dest
TO st_vlcvehicle-zz_port_of_dest.
MOVE st_vlcvehicleb-/dcsea/zz_chrysler_year
TO st_vlcvehicle-zz_chrysler_year.
* MOVE ST_VLCVEHICLEB-/DCSEA/ZZ_CHASSIS
* TO ST_VLCVEHICLE-ZZ_CHASSIS.
MOVE st_vlcvehicleb-/dcsea/zz_fin_prod_dec
TO st_vlcvehicle-zz_fin_prod_dec.
MOVE st_vlcvehicleb-/dcsea/zz_prod_number
TO st_vlcvehicle-zz_prod_number.
MOVE st_vlcvehicleb-/dcsea/zz_low_arm
TO st_vlcvehicle-zz_low_arm.
MOVE st_vlcvehicleb-/dcsea/zz_upp_arm
TO st_vlcvehicle-zz_upp_arm.
MOVE st_vlcvehicleb-/dcsea/zz_amplifier_num
TO st_vlcvehicle-zz_amplifier_no.
PERFORM convert_into_timestamp
USING wf_date
wf_time
CHANGING st_vlcvehicle-zz_final_inspect.
PERFORM convert_into_timestamp
USING wf_date
wf_time
CHANGING st_vlcvehicle-zz_fpromdt.
MOVE st_vlcvehicleb-/dcsea/zz_rego_number
TO st_vlcvehicle-zz_rego_number.
* Station Code
MOVE st_vlcvehicleb-/dcsea/zz_station_code
TO st_vlcvehicle-zz_chry_stncode.
* Mode of Transport
MOVE st_vlcvehicleb-/dcsea/zz_mode_transp
TO st_vlcvehicle-zz_mode_transp.
MOVE st_vlcvehicleb-/dcsea/zz_cust_decl_no
TO st_vlcvehicle-zz_cust_decl_no.
PERFORM convert_into_timestamp
USING wf_date
wf_time
CHANGING st_vlcvehicle-zz_cust_decl_dt.
* if sy-subrc eq 0.
call method /dcsea/in_cl_global=>check_build_type
exporting
i_matnr = gv_matnr_in
importing
e_is_cbu = /dcsea/in_cl_global=>gc_cbu_flag
e_is_ckd = /dcsea/in_cl_global=>gc_ckd_flag
exceptions
no_classification = 1
invalid_class_type = 2
others = 3.
if /dcsea/in_cl_global=>gc_ckd_flag is not initial.
data(gv_ckd_in) = /dcsea/in_cl_global=>gc_ckd_flag.
FREE MEMORY ID 'GV_CKD_IN'.
export gv_ckd_in to memory id 'GV_CKD_IN'.
endif.
endif.
endif.
endif.
* Begin of changes by PPRAGYA for MBIL CM:0051514725
ENDFORM. " APPEND_DATA_ZVLCVEHICLEB
*&---------------------------------------------------------------------*
*& Form APPEND_DATA_ZVLCVEHICLEG
*&---------------------------------------------------------------------*
* Add global template vehicle data to vehicle internal table
*----------------------------------------------------------------------*
* --> None
* <-- None
*----------------------------------------------------------------------*
* RJV - 2000/11/07 - Replaced by Z1VLCVEHICLEB
* FORM APPEND_DATA_ZVLCVEHICLEG.
*&---------------------------------------------------------------------*
*& Form APPEND_DATA_E1CUCFG
*&---------------------------------------------------------------------*
* Adds the configuration data to the config internal table
*----------------------------------------------------------------------*
* --> None
* <-- None
*----------------------------------------------------------------------*
FORM append_data_e1cucfg.
CLEAR xnum_posex.
MOVE-CORRESPONDING st_e1cucfg TO tb_vhcl_config.
MOVE tb_vhcl_config-posex TO xnum_posex.
MOVE xnum_posex TO tb_vhcl_config-posex.
APPEND tb_vhcl_config.
*&---------------------------------------------------------------------*
*& Form APPEND_DATA_E1CUINS
*&---------------------------------------------------------------------*
* Adds the instance data to the instance internal table
*----------------------------------------------------------------------*
* --> None
* <-- None
*----------------------------------------------------------------------*
FORM append_data_e1cuins.
*&---------------------------------------------------------------------*
*& Form APPEND_DATA_E1CUPRT
*&---------------------------------------------------------------------*
* Adds the part of instance data to the internal table
*----------------------------------------------------------------------*
* --> None
* <-- None
*----------------------------------------------------------------------*
FORM append_data_e1cuprt.
*&---------------------------------------------------------------------*
*& Form APPEND_DATA_E1CUVAL
*&---------------------------------------------------------------------*
* Adds characteristics valuation data to the internal table
*----------------------------------------------------------------------*
* --> None
* <-- None
*----------------------------------------------------------------------*
FORM append_data_e1cuval.
*&---------------------------------------------------------------------*
*& Form WRITE_ERROR
*&---------------------------------------------------------------------*
* Write error messages in the internal table ERRTAB
*----------------------------------------------------------------------*
* -->pf_msgty Message Type
* -->pf_msgno Message Number
* -->pf_msgid Message ID
*----------------------------------------------------------------------*
FORM write_error USING pf_msgno
pf_msgid.
CLEAR tb_errtab.
IF sy-subrc EQ 0.
* Move message data to errtab fields
tb_errtab-msgty = co_msgtyp_e.
tb_errtab-msgid = t100-arbgb.
tb_errtab-msgnr = t100-msgnr.
* There's no need to fill in the TEXT field of TB_ERRTAB
* MESSAGE ID T100-ARBGB TYPE CO_MSGTYP_E NUMBER T100-MSGNR
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4 INTO TB_ERRTAB-TEXT.
* MOVE T100-TEXT TO TB_ERRTAB-TEXT.
* CONDENSE TB_ERRTAB-TEXT.
tb_errtab-msgv1 = sy-msgv1.
tb_errtab-msgv2 = sy-msgv2.
tb_errtab-msgv3 = sy-msgv3.
tb_errtab-msgv4 = sy-msgv4.
APPEND tb_errtab.
ENDIF. "sy-subrc eq 0
ENDFORM. " WRITE_ERROR
*&---------------------------------------------------------------------*
*& Form FILL_ORD2_DATA
*&---------------------------------------------------------------------*
* Fill VLCH_ORD2 structure
*----------------------------------------------------------------------*
* --> p1 None
* <-- p2 None
*----------------------------------------------------------------------*
FORM fill_ord1_data.
* begin of delete for VMS Upgrade. VMSUPGD
** Following line is commented by Anbu 20.11.2002
** data v_eindt type vlcord1-eindt.
*
** Following line is added by Anbu 20.11.2002
* data v_eindt type ZVLCH_vlcord1-eindt.
*
* clear vlch_ord1_ls.
* move co_ord1 to vlch_ord1_ls-aktion.
* move tb_vlc_vehicle-vhcle to vlch_ord1_ls-vhcle.
* move 'NB' to vlch_ord1_ls-bsart.
** SELECT SINGLE * FROM T001W WHERE WERKS EQ TB_VLC_VEHICLE-WERKS.
** IF SY-SUBRC EQ 0.
** MOVE T001W-EKORG TO VLCH_ORD1_LS-EKORG.
** ENDIF.
** { Assign CB01 to EKORD, For testing purpose only }
** MOVE 'CB01' TO VLCH_ORD1_LS-EKORG.
** Get Purchasing Organization - SantosG 02/15/2001
* select single infnr into (eina-infnr) from eina
* where matnr eq tb_vlc_vehicle-matnr and
* lifnr eq tb_vlc_vehicle-lifnr.
* if sy-subrc eq 0.
* select single ekorg into (eine-ekorg) from eine
* where infnr eq eina-infnr and
* werks eq tb_vlc_vehicle-werks and
* esokz eq co_zero.
* if sy-subrc eq 0.
* move eine-ekorg to vlch_ord1_ls-ekorg.
* endif.
* endif.
*
** Get Purchasing Group - SantosG 02/15/2001
* select single * from marc
* where ( matnr eq tb_vlc_vehicle-matnr ) and
* ( werks eq tb_vlc_vehicle-werks ).
* if sy-subrc eq 0.
* move marc-ekgrp to vlch_ord1_ls-ekgrp.
* endif.
** { Value is assigned for testing purpose only }
** For testing since there are no values for EKGRP in MARC
** IF ( VLCH_ORD1_LS-EKGRP EQ ' ' ).
** MOVE '005' TO VLCH_ORD1_LS-EKGRP.
** ENDIF.
*
* call function 'VELO03_CONVERT_FROM_TIMESTAMP'
* exporting
* timestamp_iv = tb_vlc_vehicle-pstsp
* tzone_iv = sy-zonlo
* importing
* datlo_ev = v_eindt
** TIMLO_EV =
* .
* if sy-subrc eq 0.
* move v_eindt to vlch_ord1_ls-eindt.
* endif.
** { Value is assigned for testing purpose only }
** For testing since PSTSP has no value
** IF VLCH_ORD1_LS-EINDT IS INITIAL.
** MOVE '20001127' TO VLCH_ORD1_LS-EINDT.
** ENDIF.
*
** Move value LIFNR - required by function ME_CREATE_PO_ITEM
* move tb_vlc_vehicle-lifnr to vlch_ord1_ls-lifnr.
* move vlch_ord1_ls to vlch_actdata_ls-vlch_ord1.
*
* append vlch_actdata_ls to tb_vlch_actdata_lt.
* end of delete. VMSUPGD
* clear vlch_ord1_ls.
* move co_ord1 to vlch_ord1_ls-aktion.
MOVE tb_vlc_vehicle-vhcle TO vlcactdata_item_lt-vhcle.
MOVE 'NB' TO vlcactdata_cs-bsart.
* SELECT SINGLE * FROM T001W WHERE WERKS EQ TB_VLC_VEHICLE-WERKS.
* IF SY-SUBRC EQ 0.
* MOVE T001W-EKORG TO VLCH_ORD1_LS-EKORG.
* ENDIF.
* { Assign CB01 to EKORD, For testing purpose only }
* MOVE 'CB01' TO VLCH_ORD1_LS-EKORG.
* Get Purchasing Organization - SantosG 02/15/2001
"HANA Code Remediation:Select Single not unique
" select single infnr into (eina-infnr) from eina
" where matnr eq tb_vlc_vehicle-matnr and
" lifnr eq tb_vlc_vehicle-lifnr.
SELECT infnr INTO (eina-infnr) UP TO 1 ROWS FROM eina
WHERE matnr EQ tb_vlc_vehicle-matnr AND
lifnr EQ tb_vlc_vehicle-lifnr ORDER BY PRIMARY KEY. ENDSELECT.
IF sy-subrc EQ 0.
"HANA Code Remediation:Select Single not unique
" select single ekorg into (eine-ekorg) from eine
" where infnr eq eina-infnr and
" werks eq tb_vlc_vehicle-werks and
" esokz eq co_zero.
SELECT ekorg INTO (eine-ekorg) UP TO 1 ROWS FROM eine
WHERE infnr EQ eina-infnr AND
werks EQ tb_vlc_vehicle-werks AND
esokz EQ co_zero ORDER BY PRIMARY KEY. ENDSELECT.
IF sy-subrc EQ 0.
MOVE eine-ekorg TO vlcactdata_cs-ekorg.
ENDIF.
ENDIF.
*&---------------------------------------------------------------------*
*& Form FILL_INIV_DATA
*&---------------------------------------------------------------------*
* Fill VLCH_INIV structure
*----------------------------------------------------------------------*
* --> p1 None
* <-- p2 None
*----------------------------------------------------------------------*
FORM fill_iniv_data.
************************************************************************
* Fill VLCINIV-INIV_ITEM table - BEGIN
************************************************************************
* begin of delete for VMSUPGD
* clear vlciniv_item_s_temp.
*
* vlciniv_item_s_temp-vguid = tb_vlc_vehicle-vguid.
* vlciniv_item_s_temp-vhcle = tb_vlc_vehicle-vhcle.
** VLCINIV_ITEM_S_TEMP-REF_DOC = ST_VLCINVOICE-XBLNR.
** VLCINIV_ITEM_S_TEMP-ITEM_AMOUNT = ST_VLCINVOICE-RMWWR.
*
** Base Amount and Currency
* vlciniv_item_s_temp-zenp_amount = st_vlcinvoice-zenp_amount.
* vlciniv_item_s_temp-zenp_currency = st_vlcinvoice-zenp_currency.
*
** Local Standard Amount and Currency
* vlciniv_item_s_temp-zmxs_amount = st_vlcinvoice-zmxs_amount.
* vlciniv_item_s_temp-zmxs_currency = st_vlcinvoice-zmxs_currency.
*
** Customer Option Amount and Currency
* vlciniv_item_s_temp-zmxo_amount = st_vlcinvoice-zmxo_amount.
* vlciniv_item_s_temp-zmxo_currency = st_vlcinvoice-zmxo_currency.
*
** Inward Freight Amount and Currency
* vlciniv_item_s_temp-zvfi_amount = st_vlcinvoice-zvfi_amount.
* vlciniv_item_s_temp-zvfi_currency = st_vlcinvoice-zvfi_currency.
*
** Insurance Amount and Currency
* vlciniv_item_s_temp-zvin_amount = st_vlcinvoice-zvin_amount.
* vlciniv_item_s_temp-zvin_currency = st_vlcinvoice-zvin_currency.
*
* vlciniv_item_s_temp-po_number = vlcporder-ebeln.
* vlciniv_item_s_temp-po_item = vlcporder-ebelp.
*
* append vlciniv_item_s_temp.
*
** Loop at TB_VHCL_LOPT table
** LOOP AT TB_VHCL_LOPT.
*
** CLEAR VLCINIV_ITEM_S_TEMP.
*
** VLCINIV_ITEM_S_TEMP-VGUID = TB_VLC_VEHICLE-VGUID.
** VLCINIV_ITEM_S_TEMP-VHCLE = TB_VLC_VEHICLE-VHCLE.
** VLCINIV_ITEM_S_TEMP-REF_DOC = ST_VLCINVOICE-XBLNR.
** VLCINIV_ITEM_S_TEMP-ITEM_AMOUNT = ST_VLCINVOICE-RMWWR.
*
** VLCINIV_ITEM_S_TEMP-PO_NUMBER = VLCPORDER-EBELN.
** VLCINIV_ITEM_S_TEMP-PO_ITEM = VLCPORDER-EBELP.
*
** Data from local options segment
** VLCINIV_ITEM_S_TEMP-ZSTUNR = TB_VHCL_LOPT-STUNR.
** VLCINIV_ITEM_S_TEMP-ZZAEHK = TB_VHCL_LOPT-ZAEHK.
** VLCINIV_ITEM_S_TEMP-ZCOND_AMOUNT = TB_VHCL_LOPT-COND_AMOUNT.
** VLCINIV_ITEM_S_TEMP-ZCOND_CURR = TB_VHCL_LOPT-COND_CURR.
*
** APPEND VLCINIV_ITEM_S_TEMP.
*
** ENDLOOP.
*
************************************************************************
*
** Fill VLCINIV-INIV_ITEM table - END
************************************************************************
*
*
** Following line is commented by Anbu 20.11.2002
** move vlciniv_item_s_temp[] to vlch_iniv_ls-iniv_item[].
*
** Following line is added by Anbu 20.11.2002
* move vlciniv_item_s_temp[] to vlch_iniv_ls-ZVLCH_iniv_item[].
* end of delete. VMSUPGD
ENDIF.
IF NOT wf_amount_zefr IS INITIAL.
vlcactdata_item_lt-zefr_amount = wf_amount_zefr.
vlcactdata_item_lt-zefr_currency = st_vlcinvoice-zvfi_currency.
vlcactdata_cs-zefr_amount = wf_amount_zefr.
vlcactdata_cs-zvfi_currency = st_vlcinvoice-zvfi_currency.
vlcactdata_cs-zefr_amount_ch = wf_amount_zefr.
ENDIF.
*End of insert by RNEELAM for CM 0041034978 on date 29.10.2020
* Begin of insert by MAAMARN for CM-0039003675 on 19.10.2017
DATA: lv_flag_0039003675 TYPE c.
CLEAR: lv_flag_0039003675.
CALL FUNCTION '/DCSEA/Z_AIS_CHECK_ACTIVE_CM'
EXPORTING
cm_number = /dcsea/mbid_constants=>gc_0039003675
werks = tb_vlc_vehicle-werks
IMPORTING
active_flag = lv_flag_0039003675.
IF lv_flag_0039003675 IS NOT INITIAL.
IF gv_lux_tax IS NOT INITIAL.
vlcactdata_item_lt-zlut_amount = gv_lux_tax.
vlcactdata_cs-zlut_amount = gv_lux_tax.
vlcactdata_cs-zarticle22_amount = gv_article22.
vlcactdata_cs-tax_amount = gv_tax_amount.
vlcactdata_cs-tax_code = 'P1'.
ENDIF.
ENDIF.
*Begin of insert by SAEARLA for CM-0052128757 on 21.02.2020
DATA: lv_flag_0052128757 TYPE c.
CONSTANTS : C_0052128757(10) TYPE c VALUE '0052128757'.
CLEAR: lv_flag_0052128757.
CALL FUNCTION '/DCSEA/Z_AIS_CHECK_ACTIVE_CM'
EXPORTING
cm_number = c_0052128757
werks = tb_vlc_vehicle-werks
IMPORTING
active_flag = lv_flag_0052128757.
IF lv_flag_0052128757 IS NOT INITIAL.
IF gv_lux_tax IS INITIAL.
vlcactdata_cs-zarticle22_amount = gv_article22.
vlcactdata_cs-tax_amount = gv_tax_amount.
vlcactdata_cs-tax_code = 'P1'.
ELSE.
CLEAR : vlcactdata_item_lt-zlut_amount,vlcactdata_cs-zlut_amount,
vlcactdata_cs-zarticle22_amount,vlcactdata_cs-tax_amount,
vlcactdata_cs-tax_code.
ENDIF.
ENDIF.
* End of of insert by SAEARLA for CM-0052128757 on 21.02.2020
ENDIF.
*&---------------------------------------------------------------------*
*& Form STATUSRECORDS
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_TB_ERRTAB Internal table for storing errors in idoc data
* -->P_IDOC_STATUS_NO Idoc status '51' or '53'
*----------------------------------------------------------------------*
FORM statusrecords TABLES tb_errtab
STRUCTURE tb_errtab
USING pf_idoc_status_no
p_v_action.
idoc_status-docnum = idoc_contrl-docnum.
idoc_status-status = co_posted.
idoc_status-msgty = 'I'.
idoc_status-msgid = co_velo.
idoc_status-msgno = '035'.
idoc_status-msgv1 = p_v_action.
* idoc_status-msgv2 = ?????????????????
* idoc_status-msgv3 = ?????????????????
* idoc_status-msgv4 = ?????????????????
* idoc_status-segnum = ?????????????????
* idoc_status-segfld = ?????????????????
* idoc_status-uname = ?????????????????
idoc_status-repid = 'SAPLZAIS'.
* idoc_status-routid = ?????????????????
APPEND idoc_status.
LOOP AT tb_errtab.
idoc_status-docnum = idoc_contrl-docnum.
* idoc_status-status = co_error. " Comented by Anil on 04/10/2004
idoc_status-status = pf_idoc_status_no. "Added by Anil-04/10/2004
idoc_status-msgty = tb_errtab-msgty.
idoc_status-msgid = tb_errtab-msgid.
idoc_status-msgno = tb_errtab-msgnr.
idoc_status-msgv1 = tb_errtab-msgv1.
idoc_status-msgv2 = tb_errtab-msgv2.
idoc_status-msgv3 = tb_errtab-msgv3.
idoc_status-msgv4 = tb_errtab-msgv4.
* idoc_status-segnum = ?????????????????
* idoc_status-segfld = ?????????????????
* idoc_status-uname = ?????????????????
idoc_status-repid = 'SAPLZAIS'.
* idoc_status-routid = ?????????????????
APPEND idoc_status.
ENDLOOP.
ENDIF.
*&---------------------------------------------------------------------*
*& Form CHECK_IF_CREDIT_NOTE
*&---------------------------------------------------------------------*
* Check if received data is credit note
* If credit note, write error in errtab
*----------------------------------------------------------------------*
* --> p1 None
* <-- p2 None
*----------------------------------------------------------------------*
FORM check_if_credit_note.
*&---------------------------------------------------------------------*
*& Form WRITE_ZAIS_FACTORY_INV_DATA
*&---------------------------------------------------------------------*
* Write data in ZAIS_FACTORY_INV table
*----------------------------------------------------------------------*
* --> p1 None
* <-- p2 None
*----------------------------------------------------------------------*
FORM write_zais_factory_inv_data.
/dcsea/zais_finv-mandt = sy-mandt.
/dcsea/zais_finv-vhcle = tb_vlc_vehicle-vhcle.
* /DCSEA/ZAIS_FINV-DOCNUM =
/dcsea/zais_finv-xblnr = st_vlcinvoice-xblnr.
/dcsea/zais_finv-docdate = st_vlcinvoice-budat.
/dcsea/zais_finv-wrbtr = st_vlcinvoice-rmwwr.
/dcsea/zais_finv-waers = st_vlcinvoice-waers.
/dcsea/zais_finv-vgabe = ekbe-vgabe.
* MOVE-CORRESPONDING TB_VLC_VEHICLE TO /DCSEA/ZAIS_FINV.
* INSERT /DCSEA/ZAIS_FINV FROM TABLE TB_VLC_VEHICLE.
* Begin of vforge fix by MSREENA on 27/11/2019
* INSERT INTO /dcsea/zais_finv CLIENT SPECIFIED VALUES /dcsea/zais_finv.
INSERT INTO /dcsea/zais_finv VALUES /dcsea/zais_finv.
* end of Vforge fix by MSREENA on 27/11/2019
ENDFORM. " WRITE_ZAIS_FACTORY_INV_DATA
*&---------------------------------------------------------------------*
*& Form GET_ERROR_DATA
*&---------------------------------------------------------------------*
* Check if error occured
*----------------------------------------------------------------------*
* --> p1 None
* <-- p2 None
*----------------------------------------------------------------------*
FORM get_error_data.
*&---------------------------------------------------------------------*
*& Form CHECK_IN_VLCVEHICLE
*&---------------------------------------------------------------------*
* Check if vehicle exists in VLCVEHICLE
*----------------------------------------------------------------------*
* --> p1 None
* <-- p2 None
*----------------------------------------------------------------------*
FORM check_in_vlcvehicle.
IF sy-subrc NE 0.
PERFORM write_zais_factory_inv_data.
p_flag_po_exist = 'X'.
* Begin of change by KHAGRAW for CM:0057190950 on 27/05/2021
CALL FUNCTION '/DCSEA/Z_AIS_CHECK_ACTIVE_CM'
EXPORTING
cm_number = co_0041034978
werks = vlcvehicle-werks
IMPORTING
active_flag = lv_0041034978.
wa_pocondx-condition_no = wa_pocond-condition_no.
wa_pocondx-cond_st_no = wa_pocond-cond_st_no.
wa_pocondx-cond_value = co_x.
APPEND wa_pocondx TO tb_pocondx.
CLEAR : wa_pocond ,
wa_pocondx.
ENDIF.
wa_pocondx-condition_no = wa_pocond-condition_no.
wa_pocondx-cond_st_no = wa_pocond-cond_st_no.
wa_pocondx-cond_value = co_x.
APPEND wa_pocondx TO tb_pocondx.
CLEAR : wa_pocond ,
wa_pocondx.
ENDIF.
wa_pocondx-condition_no = wa_pocond-condition_no.
wa_pocondx-cond_st_no = wa_pocond-cond_st_no.
wa_pocondx-cond_value = co_x.
APPEND wa_pocondx TO tb_pocondx.
CLEAR : wa_pocond ,
wa_pocondx.
ENDIF.
wa_pocondx-condition_no = wa_pocond-condition_no.
wa_pocondx-cond_st_no = wa_pocond-cond_st_no.
wa_pocondx-cond_value = co_x.
APPEND wa_pocondx TO tb_pocondx.
CLEAR : wa_pocond ,
wa_pocondx.
ENDIF.
*-----Updae the condition values in PO
CALL FUNCTION 'BAPI_PO_CHANGE'
EXPORTING
purchaseorder = wf_ponum
TABLES
return = tb_return
pocond = tb_pocond
pocondx = tb_pocondx.
* If invoice has been reversed (field STBLG is not initial), do not post
* the error that invoice already exists, otherwise, post the error.
CLEAR rbkp.
SELECT SINGLE * FROM rbkp
WHERE belnr EQ ekbe-belnr
AND gjahr EQ ekbe-gjahr.
IF sy-subrc EQ 0 AND
rbkp-stblg IS INITIAL.
PERFORM write_zais_factory_inv_data.
* Write error in errtab, invoice already exists
PERFORM write_error USING co_msg_041
co_zais_msg.
IF st_vlcvehicle-zz_go_ord_ver IS INITIAL OR
st_vlcvehicle-zz_go_ord_ver < tb_vlc_vehicle-zz_go_ord_ver.
idoc_status_no = co_archive. "Status of Idoc made '73'
idoc_status-msgno = '835'.
p_flag_action_performed = ' '.
** Write error in errtab since it is an error message records
PERFORM write_error USING '835'
co_zais_msg..
RETURN.
ENDIF.
ENDIF.
*End of insert KAMIRES for CM-0056948324 on 15/04/2021
* IF ERROR_RECORDS EQ 0.
if /dcsea/in_cl_global=>check_cm_active( im_cm_no =
/dcsea/in_cl_global=>co_cm_0050026313
im_werks = tb_vlc_vehicle-werks )
is not initial and lv_mmsta ne
'LS51'
and /dcsea/in_cl_global=>gc_cbu_flag is
not initial
and idoc_contrl-mestyp = 'ZINV'.
* For MBIL if primary status is not LF07 skip the action
* and idoc should be in error state
perform write_error using /dcsea/in_cl_global=>gc_009
/dcsea/in_cl_global=>gc_msgid.
else.
* perform action for all other markets along with MBIL
* END of insert by KJITHEN for MBIL CM: 0050026313
CALL FUNCTION 'VELO09_SET_ACTION'
EXPORTING
incoming_action_iv = p_action
commit_iv = 'S' "Ticket 1537132 AGARWALN
* DIALOGUE_ALLOWED_IV =
TABLES
vlcdiavehi_ct = tb_vlc_vehicle
vlch_mssg_et = tb_vehimsg
vlcbapicu_it = tb_vlcbapicu_lt
CHANGING
vlcactdata_cs = vlcactdata_cs
EXCEPTIONS
action_not_defined = 1
no_authority = 2
interlinked_action_error = 3
crea_prepare_failed = 4
action_not_performed = 5
action_not_compl_performed = 6
OTHERS = 7.
* end of insert. VMSUPGD
*Step 3: Error Handling after action execution
IF sy-subrc NE 0.
* Begin of insert. VMSUPGD
READ TABLE tb_vehimsg WITH KEY msgty = 'E'.
MOVE: tb_vehimsg-msgid TO sy-msgid,
tb_vehimsg-msgty TO sy-msgty,
tb_vehimsg-msgno TO sy-msgno,
tb_vehimsg-msgv1 TO sy-msgv1,
tb_vehimsg-msgv2 TO sy-msgv2,
tb_vehimsg-msgv3 TO sy-msgv3,
tb_vehimsg-msgv4 TO sy-msgv4.
* End of insert. VMSUPGD
PERFORM write_error USING sy-msgno
sy-msgid.
p_flag_action_performed = ' '.
* Step 3.1: Unlock the vlchistory manually in case of rollback
* PERFORM UNLOCK_VLCHISTORY.
ELSE.
p_flag_action_performed = 'X'.
* Begin of insert by HALDERT for CM-3726 on 18.10.2006
IF NOT tb_acnf[] IS INITIAL.
LOOP AT tb_acnf.
tb_acnf-werks = tb_vlc_vehicle-werks.
tb_acnf-mtart = hd_mara-mtart.
tb_acnf-matnr = tb_vlc_vehicle-matnr.
tb_acnf-vhcle = tb_vlc_vehicle-vhcle.
tb_acnf-docnum = idoc_contrl-docnum.
tb_acnf-credat = sy-datlo.
tb_acnf-cretim = sy-timlo.
MODIFY tb_acnf.
ENDLOOP.
MODIFY /dcsea/zais_acnf FROM TABLE tb_acnf.
CLEAR tb_acnf.
REFRESH tb_acnf.
ENDIF.
* End of insert by HALDERT for CM-3726 on 18.10.2006
ENDIF.
endif. " Added by KJITHEN for MBIL CM:0050026313
* ENDIF.
* Get Vehicle
*Begin of comment by anandd for Performance Tuning on 15/07/2004
* select single * from vlcvehicle
* where zz_commnos eq tb_vlc_vehicle-zz_commnos.
*End of comment by anandd for Performance Tuning on 15/07/2004
*Begin of insertion by TRIPATHIL for CM-10003589 v5.6T on 28/10/2009
*for BBDC
CLEAR wf_flag_cnb1.
CALL FUNCTION '/DCSEA/Z_AIS_CHECK_ACTIVE_CM'
EXPORTING
cm_number = co_10003589
werks = tb_vlc_vehicle-werks
IMPORTING
active_flag = wf_flag_cnb1.
IF sy-subrc EQ 0.
*&---------------------------------------------------------------------*
*& Form get_idoc_data
*&---------------------------------------------------------------------*
* Update the corresponding fields that are required to be updated from
* ZVEHMAS02 Idoc during the execution of action being triggered.
*----------------------------------------------------------------------*
* --> p1 None
* <-- p2 None
*----------------------------------------------------------------------*
FORM get_idoc_data.
*** Begin of insert by UALAKUN CM-44882665 ON 09.01.2019
RANGES:lr_vehusg FOR vlcvehicle-zz_vehusg.
DATA:lt_para TYPE STANDARD TABLE OF /dcsea/zais_para,
ls_para TYPE /dcsea/zais_para,
ls_vehusg LIKE LINE OF lr_vehusg.
CONSTANTS:lc_mfus TYPE /dcsea/domval2 VALUE 'MFUS',
lc_zvrb TYPE /dcsea/parameter VALUE 'ZVRB',
lc_vhusg TYPE /dcsea/fieldname VALUE 'VHUSG'.
***End of insert by UALAKUN CM-44882665 ON 09.01.2019
*** Begin of Insert by REDDAMV for CM-0044882665 on 02.01.2019
DATA: lv_flag_44882665(1) TYPE c,
ls_vlcvehicle TYPE vlcvehicle,
lv_kvgr TYPE kvgr5. "Customer group
*** End of Insert by REDDAMV for CM-0044882665 on 02.01.2019
READ TABLE tb_vlc_vehicle INDEX 1.
IF sy-subrc EQ 0.
MOVE-CORRESPONDING tb_vlc_vehicle TO vlcactdata_item_lt.
MOVE-CORRESPONDING tb_vlc_vehicle TO vlcactdata_cs.
***Start of insertion for CM-2034 by AGARWALN on 07/07/2003***
IF wf_aktion EQ co_znak.
MOVE wf_zz_cert_num1 TO vlcactdata_cs-zz_cert_num.
ENDIF.
***End of insertion for CM-2034 by AGARWALN on 07/07/2003***
* Begin of Insert by NBHAWSA for CM-0044882665 on 24.09.2018
CLEAR: lv_flag_44882665, ls_vlcvehicle, lv_kvgr.
CALL FUNCTION '/DCSEA/Z_AIS_CHECK_ACTIVE_CM'
EXPORTING
cm_number = /dcsea/zfuso_if_constants=>gc_44882665
werks = tb_vlc_vehicle-werks
IMPORTING
active_flag = lv_flag_44882665.
IF lv_flag_44882665 IS NOT INITIAL AND
( wf_aktion EQ /dcsea/zfuso_if_constants=>gc_zvrb OR
wf_aktion EQ co_zdld ).
SELECT * FROM vlcvehicle INTO ls_vlcvehicle UP TO 1 ROWS
WHERE zz_commnos = tb_vlc_vehicle-zz_commnos
ORDER BY PRIMARY KEY.
ENDSELECT.
SELECT kvgr5 UP TO 1 ROWS FROM knvv
INTO lv_kvgr
WHERE kunnr EQ ls_vlcvehicle-kunnr
ORDER BY PRIMARY KEY.
ENDSELECT.
*** Begin of insert by UALAKUN CM-44882665 ON 09.01.2019
REFRESH lt_para.
SELECT * FROM /dcsea/zais_para
INTO TABLE lt_para
WHERE domval1 = ls_vlcvehicle-werks
AND domval2 = lc_mfus
AND param = lc_zvrb
AND fieldname = lc_vhusg ORDER BY PRIMARY KEY .
IF sy-subrc IS INITIAL.
LOOP AT lt_para INTO ls_para.
ls_vehusg-sign = 'I'.
ls_vehusg-option = 'EQ'.
ls_vehusg-low = ls_para-fieldval.
APPEND ls_vehusg TO lr_vehusg.
CLEAR ls_vehusg.
ENDLOOP.
ENDIF.
* IF lv_kvgr EQ '05' OR ls_vlcvehicle-zz_vehusg EQ 'FD'. " Begin of insert by
UALAKUN
"CM-0044882665 on 28.12.2018
*Following line replaced by NBHAWSA for CM-44882665 on 27.02.2019
* IF lv_kvgr EQ '05' OR ls_vlcvehicle-zz_vehusg IN lr_vehusg.
IF lv_kvgr EQ '05' OR ( ls_vlcvehicle-zz_vehusg IN lr_vehusg
AND lr_vehusg[] IS NOT INITIAL ).
* *** End of insert by UALAKUN CM-44882665 ON 09.01.2019
wf_aktion = /dcsea/zfuso_if_constants=>gc_zvrb.
MOVE lv_kvgr TO vlcactdata_cs-zz_cust_flag.
ELSE.
wf_aktion = co_zdld.
MOVE lv_kvgr TO vlcactdata_cs-zz_cust_flag.
ENDIF.
ENDIF.
* End of Insert by NBHAWSA for CM-0044882665 on 24.09.2018
ENDIF. "SY-SUBRC EQ 0
ENDFORM. " GET_IDOC_DATA
*&---------------------------------------------------------------------*
*& Form GET_VLCVEHICLE_DATA
*&---------------------------------------------------------------------*
* Get data from VLCVEHICLE table
*----------------------------------------------------------------------*
* --> p1 None
* <-- p2 None
*----------------------------------------------------------------------*
FORM get_vlcvehicle_data.
ELSEIF tb_vlc_vehicle-zz_quote NE 0.
IF sy-subrc EQ 0.
* Get MTART and MATKL using VLCVEHICLE lmp
SELECT SINGLE * INTO hd_mara "lmp
FROM mara "lmp
WHERE matnr EQ hd_vlcvehicle-matnr. "lmp
IF sy-subrc EQ 0. "lmp
* Get Production Code from /DCSEA/ZAIS_PCOD using MARA lmp
"HANA Code Remediation:Select Single not unique
" select single prod_code
"lmp
" into wf_prod_code
"lmp
" from /dcsea/zais_pcod
"lmp
" where mtart eq hd_mara-mtart and
"lmp
" matkl eq hd_mara-matkl.
"lmp
SELECT prod_code "lmp
INTO wf_prod_code "lmp
UP TO 1 ROWS FROM /dcsea/zais_pcod
"lmp
WHERE mtart EQ hd_mara-mtart AND "lmp
matkl EQ hd_mara-matkl ORDER BY PRIMARY KEY. ENDSELECT.
"lmp
* IF SY-SUBRC EQ 0. "lmp
* Copy VLCVEHICLE to internal table
*&---------------------------------------------------------------------*
*& Form FILL_SMOD_DATA
*&---------------------------------------------------------------------*
* Fill SMOD data
*----------------------------------------------------------------------*
* --> p1 None
* <-- p2 None
*----------------------------------------------------------------------*
FORM fill_smod_data.
*&---------------------------------------------------------------------*
*& Form convert_into_timestamp
*&---------------------------------------------------------------------*
* Convert data into timestamp
*----------------------------------------------------------------------*
* -->P_DATE Date to be converted
* <--P_TIMESTAMP Converted timestamp
*----------------------------------------------------------------------*
FORM convert_into_timestamp USING p_date
p_time
CHANGING p_timestamp.
*&---------------------------------------------------------------------*
*& Form FILL_VLCSMOD_DATA
*&---------------------------------------------------------------------*
* Fill in other fields in VLCSMOD structure
*----------------------------------------------------------------------*
* --> p1 None
* <-- p2 None
*----------------------------------------------------------------------*
FORM fill_vlcsmod_data.
* begin of delete for VMS Upgrade . "VMSUPGD
* st_vlcsmod-vguid = tb_vlc_vehicle-vguid.
* st_vlcsmod-vhcle = tb_vlc_vehicle-vhcle.
* st_vlcsmod-pddatu = tb_vlc_vehicle-pddatu.
* st_vlcsmod-pcount_u = tb_vlc_vehicle-pcount_u.
* st_vlcsmod-immatdate = tb_vlc_vehicle-immatdate.
*
** CM-1650; pascuar 07/15/2002
** If ZFOC/ZFSC and MBCV or ZRSQ and Colt or ZFVP and Pajero/Lancer
* if not st_vlcvehiclem-pddatu is initial.
* if wf_aktion eq co_zfoc OR
* wf_aktion eq co_zfsc OR
* wf_aktion eq co_zrsq OR
* wf_aktion eq co_zfvp OR
** CM-1646; pascuar 08/26/2002
* wf_aktion eq co_zvdu.
*
* move st_vlcvehiclem-pddatu to st_vlcsmod-pddatu.
* move st_vlcvehiclem-pdtime to wf_time.
*
* endif.
* endif.
*
** ortegav 1/29/02 - passED address number
* if wf_aktion eq co_zecu.
*
* st_vlcsmod-zz_dfendcu = wf_address_number.
*
* endif.
*
** For FDOK Interfacem, do not pass original value of PCOUNT, instead
** take value from the IDoc
* if wf_aktion ne co_zvdu.
*
* st_vlcsmod-pcount = tb_vlc_vehicle-pcount.
*
** Following line is commented by Anbu 20.11.2002
** st_vlcsmod-cstryear = tb_vlc_vehicle-cstryear.
*
** Following line is added by Anbu 20.11.2002
* st_vlcsmod-zcstryear = tb_vlc_vehicle-cstryear.
*
** Following line is commented by Anbu 20.11.2002
** st_vlcsmod-cstrmonth = tb_vlc_vehicle-cstrmonth.
*
** Following line is added by Anbu 20.11.2002
* st_vlcsmod-zcstrmonth = tb_vlc_vehicle-cstrmonth.
*
*
* endif.
*
** For AFAB Factory Confirmation Interface. If Factory Order not
*confirm
** action is triggered, update the ZZ_AMMEND_FLAG
* if wf_aktion eq co_zfon.
* st_vlcsmod-zz_ammend_flag = co_true.
* endif. " IF WF_AKTION EQ CO_ZFON
*
** For Colt Factory Confirmation Interface. If Factory Freeze action is
** triggered, copy the planned finishing date to promised date
* if wf_aktion eq co_zfsc.
* st_vlcsmod-zz_fpromdt = tb_vlc_vehicle-zz_plan_fin_date.
* endif. " IF WF_AKTION EQ
*CO_ZFON
*
** Santosg 4/17/02
** CM-1573 Local Date and Time for Interfaces
* if idoc_contrl-rcvlad eq co_zacarriel2 or
* idoc_contrl-rcvlad eq co_zacarriel3 or
* idoc_contrl-rcvlad eq co_zacarriel4.
*
** Use IMS TimeStamp date to pass the Local Date and Time from the
** Control Record Field Serial
* clear: wf_date,
* wf_time.
*
** comment-out and replaced by pascuar 04/28/2002
** WF_DATE = IDOC_CONTRL-SERIAL+0(8).
** WF_TIME = IDOC_CONTRL-SERIAL+8(6).
*
** Note that Serial Field format is YYMMDDHHMMSS, where the millenium
** and century digits of the date are missing
* wf_date = idoc_contrl-serial+0(6).
* wf_time = idoc_contrl-serial+6(6).
*
** Step 1 : Add current millenium and century digits to Serial Date
* concatenate sy-datum+0(2) wf_date into wf_date.
** Step 2 : Get the timezone assigned to the plant
** Step 2.1: Get the address number of the plant
* select single * from t001w
* where werks eq hd_vlcvehicle-werks.
*
* if sy-subrc eq 0.
** Step 2.2: Get the timezone based on the address number of the plant
* select single * from adrc
* where addrnumber eq t001w-adrnr.
* endif. " IF SY-SUBRC EQ 0. (T001W)
*
* call function 'VELO03_CONVERT_INTO_TIMESTAMP'
* exporting
* datlo_iv = wf_date
* timlo_iv = wf_time
** TZONE_IV = SY-ZONLO
* tzone_iv = adrc-time_zone
* importing
* timestamp_ev = st_vlcsmod-zz_ims_trans.
*
* st_vlcsmod-zz_online = co_true.
*
* endif. " IF IDOC_CONTRL-RCVLAD EQ CO_ZACARRIEL1 OR
vlcactdata_cs-pcount = tb_vlc_vehicle-pcount.
* Santosg 4/17/02
* CM-1573 Local Date and Time for Interfaces
* Begin of Modification MARAMS CM-1755 09/12/02
* if idoc_contrl-rcvlad eq co_zacarriel2 or
* idoc_contrl-rcvlad eq co_zacarriel3 or
* idoc_contrl-rcvlad eq co_zacarriel4.
IF wf_carrier_iface_ind = co_true. "Added
* End of Modification MARAMS CM-1755 09/12/02
* Use IMS TimeStamp date to pass the Local Date and Time from the
* Control Record Field Serial
CLEAR: wf_date,
wf_time.
IF sy-subrc EQ 0.
* Step 2.2: Get the timezone based on the address number of the plant
"HANA Code Remediation:Select Single not unique
" select single * from adrc
" where addrnumber eq t001w-adrnr.
SELECT * UP TO 1 ROWS FROM adrc
WHERE addrnumber EQ t001w-adrnr ORDER BY PRIMARY KEY.
ENDSELECT.
ENDIF. " IF SY-SUBRC EQ 0. (T001W)
vlcactdata_item_lt-zz_online = co_true.
vlcactdata_cs-zz_online = co_true.
ENDIF. " IF IDOC_CONTRL-RCVLAD EQ CO_ZACARRIEL1 OR
* Use IMS TimeStamp date to pass the Local Date and Time from the
* Control Record Field Serial
CLEAR: wf_date,
wf_time.
wf_date = idoc_contrl-serial+0(8).
wf_time = idoc_contrl-serial+8(4).
IF sy-subrc EQ 0.
* Step 1.2: Get the timezone based on the address number of the plant
"HANA Code Remediation:Select Single not unique
" select single * from adrc
" where addrnumber eq t001w-adrnr.
SELECT * UP TO 1 ROWS FROM adrc
WHERE addrnumber EQ t001w-adrnr ORDER BY PRIMARY KEY.
ENDSELECT.
IF sy-subrc EQ 0.
* Step 2: Change to Timestamp
CALL FUNCTION 'VELO03_CONVERT_INTO_TIMESTAMP'
EXPORTING
datlo_iv = wf_date
timlo_iv = wf_time
* TZONE_IV = SY-ZONLO
tzone_iv = adrc-time_zone
IMPORTING
timestamp_ev = vlcactdata_cs-zz_ims_trans.
ENDIF. " IF SY-SUBRC EQ 0. (adrc)
* append vlcactdata_item_lt.
* move vlcactdata_item_lt[] to vlcactdata_cs-actdata_item[].
IF wf_aktion EQ co_zaec.
vlcactdata_cs-endcu = gv_partner.
vlcactdata_cs-kunnr = st_vlcvehiclem-kunnr.
vlcactdata_cs-zz_vehusg = st_vlcvehiclec-/dcsea/zz_vehusg.
vlcactdata_cs-bstnk = st_vlcvehiclec-/dcsea/zz_bstnk.
* ship-to-party and sold-to-party should be the same as kunnr
* only in the case of this partner type
IF idoc_contrl-rcvprn+0(10) = co_zaltnaecl1
*Begin of Insert by BHORCHIS for CM-6854552 on 24.03.2008
* Another check for the new partner system and message type
* corresponding to 'ZALTNAECL1 ' is required as a result of
* migration to XI.
OR ( idoc_contrl-rcvprn+0(10) = co_lsccars_za "LSCCARS_ZA
AND idoc_contrl-mestyp = co_mestyp_znaec ). "ZNAEC
*End of Insert by BHORCHIS for CM-6854552 on 24.03.2008.
vlcactdata_cs-kunwe = st_vlcvehiclem-kunnr.
vlcactdata_cs-zz_kuwev = st_vlcvehiclem-kunnr.
ENDIF.
ENDIF.
*&---------------------------------------------------------------------*
*& Form GET_GLOBAL_TEMPLATE_DATA_SHIP
*&---------------------------------------------------------------------*
* This subroutine is specific to the shipping interface.
* It checks if the global template data for vehicle exists.
* If global data exists, move data to ST_VLCSMOD structure.
* Else write error in errtab.
*----------------------------------------------------------------------*
* --> p1 None
* <-- p2 None
*----------------------------------------------------------------------*
FORM get_global_template_data_ship.
* Burglar Alarm
MOVE st_vlcvehiclec-/dcsea/zz_burglar_alm
TO st_vlcvehicle-zz_burglar_alm.
* Battery
MOVE st_vlcvehiclec-/dcsea/zz_battery
TO st_vlcvehicle-zz_battery.
* Type Plate Data
MOVE st_vlcvehiclec-/dcsea/zz_typ_plt_data
TO st_vlcvehicle-zz_typ_plt_data.
* Salesperson
MOVE st_vlcvehiclec-/dcsea/zz_sales
TO st_vlcvehicle-zz_sales.
* Vehicle Usage
MOVE st_vlcvehiclec-/dcsea/zz_vehusg
TO st_vlcvehicle-zz_vehusg.
* Ship-to-party
MOVE st_vlcvehiclec-/dcsea/zz_kuwev
TO st_vlcvehicle-zz_kuwev.
* Quote Number
MOVE st_vlcvehiclec-/dcsea/zz_quote
TO st_vlcvehicle-zz_quote.
* License District
MOVE st_vlcvehiclec-/dcsea/zz_lcndist
TO st_vlcvehicle-zz_lcndist.
* Model Type
MOVE st_vlcvehiclec-/dcsea/zz_cv_model_type
TO st_vlcvehicle-zz_cv_model_type.
* Axle Weight 1
MOVE st_vlcvehiclec-/dcsea/zz_cv_axle_wt_1
TO st_vlcvehicle-zz_cv_axle_wt_1.
* Axle Weight 2
MOVE st_vlcvehiclec-/dcsea/zz_cv_axle_wt_2
TO st_vlcvehicle-zz_cv_axle_wt_2.
* Axle Weight 3
MOVE st_vlcvehiclec-/dcsea/zz_cv_axle_wt_3
TO st_vlcvehicle-zz_cv_axle_wt_3.
*&---------------------------------------------------------------------*
*& Form append_data_zvlcvehicled
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM append_data_zvlcvehicled.
* Port of departure
MOVE st_vlcvehicled-/dcsea/zz_portdep TO st_vlcvehicle-zz_portdep.
MOVE st_vlcvehicled-/dcsea/zz_cert_num1
TO wf_zz_cert_num1.
**End of insertion By AGARWALN for CM-2034 on 07-Jul-2003***
* Begin of Insertion by SRIVATSS for CM1948-ver 1.5 on 04/09/2003
MOVE st_vlcvehicled-/dcsea/zz_factory_num TO
st_vlcvehicle-zz_factory_num.
MOVE st_vlcvehicled-/dcsea/zz_req_del_dt_to TO
st_vlcvehicle-zz_req_del_dt_to.
MOVE st_vlcvehicled-/dcsea/zz_req_del_dt_fr TO
st_vlcvehicle-zz_req_del_dt_fr.
MOVE st_vlcvehicled-/dcsea/zz_req_prd_dt_to TO
st_vlcvehicle-zz_req_prd_dt_to.
MOVE st_vlcvehicled-/dcsea/zz_req_prd_dt_fr TO
st_vlcvehicle-zz_req_prd_dt_fr.
* CLEAR:wf_date,wf_time.
MOVE st_vlcvehicled-/dcsea/zz_prod_no_date TO wf_date.
PERFORM convert_into_timestamp
USING wf_date
wf_time
CHANGING st_vlcvehicle-zz_prod_no_dat.
MOVE st_vlcvehicled-/dcsea/zz_ord_clsfcn TO
st_vlcvehicle-zz_ord_clsfcn.
* End of Insertion by SRIVATSS for CM1948-ver 1.5 on 04/09/2003
MOVE st_vlcvehicled-/dcsea/zz_int_ref_no TO
st_vlcvehicle-zz_int_ref_no.
MOVE st_vlcvehicled-/dcsea/zz_bond_ref_no TO
st_vlcvehicle-zz_bond_ref_no.
PERFORM convert_into_timestamp
USING wf_date
wf_time
CHANGING st_vlcvehicle-zz_bond_ref_dt.
MOVE st_vlcvehicled-/dcsea/zz_cust_line_no TO
st_vlcvehicle-zz_cust_line_no.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form APPEND_DATA_ZLOCALOPTIONS
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM append_data_zlocaloptions.
* CLEAR TB_VHCL_LOPT.
* Step number
* TB_VHCL_LOPT-STUNR = ST_LOCALOPTIONS-STUNR.
* Condition counter
* TB_VHCL_LOPT-ZAEHK = ST_LOCALOPTIONS-ZAEHK.
* Condition amount
* TB_VHCL_LOPT-COND_AMOUNT = ST_LOCALOPTIONS-COND_AMOUNT.
* Condition currency
* TB_VHCL_LOPT-COND_CURR = ST_LOCALOPTIONS-COND_CURR.
* APPEND TB_VHCL_LOPT.
* get instance
PERFORM get_instance.
*&---------------------------------------------------------------------*
*& Form get_config_header
*&---------------------------------------------------------------------*
* Get Configuration Header for the vehicle
*----------------------------------------------------------------------*
* --> None
* <-- None
*----------------------------------------------------------------------*
FORM get_config_header.
TABLES: scekb.
CLEAR wf_ctr_date.
* begin of delete for VMSUPGD
* concatenate tb_vlc_vehicle-cstryear
* tb_vlc_vehicle-cstrmonth
* tb_vlc_vehicle-zcstrday
* into wf_ctr_date.
* end of delete for VMSUPGD
* Step 2: Get all versions from SCEKB table that are less than or equal
* to the construction date
SELECT * FROM scekb
INTO TABLE tb_scekb
WHERE kbobjname EQ tb_vlc_vehicle-matnr
AND fromdate LE wf_ctr_date.
IF sy-subrc EQ 0.
ENDIF.
IF sy-subrc EQ 0.
LOOP AT tb_curr_cuval.
ENDIF.
ENDLOOP.
ELSE.
RAISE error_message_received.
ENDIF.
*&---------------------------------------------------------------------*
*& Form GET_VEHICLE_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM get_vehicle_data.
READ TABLE tb_vlc_vehicle INDEX 1.
IF sy-subrc EQ 0.
* move tb_vlc_vehicle-vhvin to st_vlcsmod-vhvin."VMSUPGD
* move tb_vlc_vehicle-zz_engine_number to"VMSUPGD
* st_vlcsmod-zz_engine_number."VMSUPGD
MOVE tb_vlc_vehicle-vhvin TO vlcactdata_cs-vhvin."VMSUPGD
MOVE tb_vlc_vehicle-zz_engine_number TO "VMSUPGD
vlcactdata_cs-zz_engine_number."VMSUPGD
ENDIF.
ENDFORM. " GET_VEHICLE_DATA
*&---------------------------------------------------------------------*
*& Form FILL_SMOD_DATA_VEHI
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM fill_smod_data_vehi.
* begin of delete for VMS UPgrade. VMSUPGD
* clear vlch_smod_ls.
*
** Fill VCLSMOD structure
* vlch_smod_ls-aktion = co_smod.
*
** Fill VLCSMOD_VHCL_S structure
* move-corresponding st_vlcsmod to vlcsmod_vhcl_s_temp.
* vlcsmod_vhcl_s_temp-vhcle = tb_vlc_vehicle-vhcle.
* append vlcsmod_vhcl_s_temp.
*
** Move VLCSMOD_VHCL_S structure to VLCSMOD
* move vlcsmod_vhcl_s_temp[] to vlch_smod_ls-vlcsmod_vhcl[].
*
** Move VLCSMOD to VLCH_ACTDATA_LS-VLCH_SMOD
* move vlch_smod_ls to vlch_actdata_ls-vlch_smod.
* end of delete for VMS Upgrade. VMSUPGD
* begin of insert for VMS Upgrade. VMSUPGD
* clear vlch_smod_ls.
*&---------------------------------------------------------------------*
*& Form append_data_errormsg
*&---------------------------------------------------------------------*
* Adds Error Message data to the internal table
*----------------------------------------------------------------------*
* --> None
* <-- None
*----------------------------------------------------------------------*
FORM append_data_errormsg.
*&---------------------------------------------------------------------*
*& Form add_diffchar
*&---------------------------------------------------------------------*
* Adds data to the characteristics difference table
*----------------------------------------------------------------------*
* -->PF_FLAG Type of record to be stored in the IDR table
*----------------------------------------------------------------------*
FORM add_diffchar USING pf_flag.
* Clear structure
CLEAR st_zais_diffconfig.
IF st_vlcvehicle-zz_go_ord_ver IS INITIAL OR
st_vlcvehicle-zz_go_ord_ver < tb_vlc_vehicle-zz_go_ord_ver.
RETURN.
ENDIF.
ENDIF.
*End of insert KAMIRES for CM-0057183202 on 04/05/2021
*&---------------------------------------------------------------------*
*& Form GET_GLOBAL_TEMPLATE_DATA_ZFOC
*&---------------------------------------------------------------------*
* This form is specific for factory order confirmation of the AFAB
* interface. It moves all customer specific fields from the IDoc
* to the SMOD structure which will be later passed to the function
* VELO09_SET_ACTION
*----------------------------------------------------------------------*
* --> None
* <-- None
*----------------------------------------------------------------------*
FORM get_global_template_data_foc.
IF sy-subrc EQ 0.
CASE wf_aktion.
WHEN co_zrsq.
* For ZRSQ action, check if planned finishing date is not empty
IF ( tb_vlc_vehicle-zz_plan_fin_date EQ 0 ).
* If fields is initial, write error in errtab
PERFORM write_error USING co_msg_142
co_zais_msg.
ENDIF. " IF ( TB_VLC_VEHICLE-ZZ_PLAN_FIN_DATE EQ 0 ).
WHEN co_zpl5 OR
co_zpl6.
* For ZPL5 and ZPL6 actions, check if actual arrival date is not empty
ELSE.
* Write error in errtab, no data transmitted
PERFORM write_error USING co_msg_052
co_velo.
ENDIF.
*&---------------------------------------------------------------------*
*& Form CHECK_GOODS_MVMT_DATA
*&---------------------------------------------------------------------*
* Check if mandatory fields for goods movement have values
*----------------------------------------------------------------------*
* --> None
* <-- None
*----------------------------------------------------------------------*
FORM check_goods_mvmt_data.
IF (
( st_vlcgoodsmvmt-mm_budat IS INITIAL ) OR
( st_vlcgoodsmvmt-mm_bldat IS INITIAL ) OR
( st_vlcgoodsmvmt-lgort IS INITIAL ) ).
ENDIF.
*&---------------------------------------------------------------------*
*& Form FILL_GORE_DATA
*&---------------------------------------------------------------------*
* Prepares a table containing goods movement data to be
* passed to the VELO09_SET_ACTION function module
*----------------------------------------------------------------------*
* --> None
* <-- None
*----------------------------------------------------------------------*
FORM fill_gore_data.
* begin of delete for VMS Upgrade. "VMSUPGD
* clear vlch_gore_ls.
* clear vlch_actdata_ls.
* refresh tb_vlch_actdata_lt.
*
** Fill structure
* vlch_gore_ls-aktion = co_gore.
* vlch_gore_ls-bwart = co_mvmt_101.
* vlch_gore_ls-lgort = st_vlcgoodsmvmt-lgort.
* vlch_gore_ls-budat = st_vlcgoodsmvmt-mm_budat.
* vlch_gore_ls-bldat = st_vlcgoodsmvmt-mm_bldat.
* vlch_gore_ls-lfsnr = st_vlcgoodsmvmt-lfsnr.
** IF Bill of Lading is not passed, get it from VLCVehicle
* if not ( st_vlcgoodsmvmt-frbnr is initial ).
* vlch_gore_ls-frbnr = st_vlcgoodsmvmt-frbnr.
* else.
* vlch_gore_ls-frbnr = hd_vlcvehicle-zz_bill_of_lad.
* endif.
*
** Santosg 4/17/02
** CM-1573 Local Date and Time for Interfaces
** Use IMS TimeStamp date to pass the Local Date and Time from the
** Control Record Field Serial
* if idoc_contrl-rcvlad eq co_zacarriel1.
* clear: wf_date,
* wf_time.
*
**-lmp 4/26/2002 Plant-based timezone-----\
** Note that Serial Field format is YYMMDDHHMMSS, where the millenium
** and century digits of the date are missing
* wf_date = idoc_contrl-serial+0(6).
* wf_time = idoc_contrl-serial+6(6).
*
** Step 1 : Add current millenium and century digits to Serial Date
* concatenate sy-datum+0(2) wf_date into wf_date.
** Step 2 : Get the timezone assigned to the plant
** Step 2.1: Get the address number of the plant
* select single * from t001w
* where werks eq hd_vlcvehicle-werks.
* if sy-subrc eq 0.
** Step 2.2: Get the timezone based on the address number of the plant
* select single * from adrc
* where addrnumber eq t001w-adrnr.
* endif. " IF SY-SUBRC EQ 0. (T001W)
**-lmp 4/26/2002 Plant-based timezone-----/
*
* call function 'VELO03_CONVERT_INTO_TIMESTAMP'
* exporting
* datlo_iv = wf_date
* timlo_iv = wf_time
** TZONE_IV = SY-ZONLO "lmp 4/26/2002
* tzone_iv = adrc-time_zone "lmp 4/26/2002
* importing
* timestamp_ev = vlch_gore_ls-zz_local_tstmp.
*
* endif. "IF IDOC_CONTRL-RCVLAD EQ CO_ZACARRIEL1
** End of CM-1573 Santosg 4/17/02
*
** Fill structure of structures
* move vlch_gore_ls to vlch_actdata_ls-vlch_gore.
*
** Fill table of structures
* append vlch_actdata_ls to tb_vlch_actdata_lt.
* end of delete ."VMSUPGD
* begin of insert ."VMSUPGD
REFRESH vlcactdata_item_lt.
CLEAR vlcactdata_item_lt.
CLEAR vlcactdata_cs.
* Fill structure
* vlch_gore_ls-aktion = co_gore.
vlcactdata_cs-lgort = st_vlcgoodsmvmt-lgort.
vlcactdata_cs-budat = st_vlcgoodsmvmt-mm_budat.
vlcactdata_cs-bldat = st_vlcgoodsmvmt-mm_bldat.
vlcactdata_cs-lfsnr = st_vlcgoodsmvmt-lfsnr.
* IF Bill of Lading is not passed, get it from VLCVehicle
IF NOT ( st_vlcgoodsmvmt-frbnr IS INITIAL ).
vlcactdata_cs-frbnr = st_vlcgoodsmvmt-frbnr.
ELSE.
vlcactdata_cs-frbnr = hd_vlcvehicle-zz_bill_of_lad.
ENDIF.
* Santosg 4/17/02
* CM-1573 Local Date and Time for Interfaces
* Use IMS TimeStamp date to pass the Local Date and Time from the
* Control Record Field Serial
IF idoc_contrl-rcvlad EQ co_zacarriel1
*Begin of Insertion by BHORCHIS for CM-6854552 on 24.03.2008
*Another check for the new partner system and message type
*corresponding to 'ZACARRIEL1' is required.
*This check is needed as a result of migration to XI.
OR ( idoc_contrl-rcvlad EQ co_lscaryr_za
AND idoc_contrl-mestyp EQ co_mestyp_zgr ).
*End of Insertion by BHORCHIS for CM-6854552 on 24.03.2008
CLEAR: wf_date,
wf_time.
IF sy-subrc EQ 0.
ELSE.
* Write error in errtab, no data transmitted
PERFORM write_error USING co_msg_052
co_velo.
ENDIF. "SY-SUBRC EQ 0
APPEND tb_addr1_data.
* Store to TB_ADDR1_LINE
MOVE tb_addr1_data TO tb_addr1_line-data.
APPEND tb_addr1_line.
wf_counter = 1.
DO 2 TIMES.
CLEAR tb_adtel_data.
CASE wf_counter.
WHEN 1.
MOVE st_adrmasendcu-tel_number TO tb_adtel_data-tel_number.
WHEN 2.
MOVE st_adrmasendcu-tel_number_2 TO tb_adtel_data-tel_number.
ENDCASE.
APPEND tb_adtel_data.
* Store to TB_ADTEL_LINE
MOVE tb_adtel_data TO tb_adtel_line-adtel.
APPEND tb_adtel_line.
wf_counter = wf_counter + 1.
ENDDO.
CLEAR tb_adfax_data.
MOVE: '001' TO tb_adfax_data-consnumber,
st_adrmasendcu-fax_number TO tb_adfax_data-fax_number.
APPEND tb_adfax_data.
* Store to TB_ADFAX_LINE
MOVE tb_adfax_data TO tb_adfax_line-adfax.
APPEND tb_adfax_line.
CLEAR tb_adsmtp_data.
MOVE: '001' TO tb_adsmtp_data-consnumber,
st_adrmasendcu-email TO tb_adsmtp_data-smtp_addr.
APPEND tb_adsmtp_data.
* Store to TB_ADSMTP_LINE
MOVE tb_adsmtp_data TO tb_adsmtp_line-adsmtp.
APPEND tb_adsmtp_line.
* IF TB_VLC_VEHICLE-ENDCU IS INITIAL.
st_addrref-appl_table = 'VLCVEHICLE'.
st_addrref-appl_field = 'ENDCU'.
st_addrref-addr_group = co_addr_group_vehi_gc.
st_addrref-owner = co_true.
CONCATENATE sy-mandt p_vguid INTO st_addrref-appl_key.
IF sy-subrc NE 0.
PERFORM write_error USING co_msg_193
co_zais_msg.
EXIT.
ENDIF.
* ELSE.
* WF_ADDRESS_NUMBER = TB_VLC_VEHICLE-ENDCU.
IF sy-subrc NE 0.
ENDIF.
*&---------------------------------------------------------------------*
*& Form GET_NEW_CONFIG
*&---------------------------------------------------------------------*
* Get and save new configuration for the vehicle
*----------------------------------------------------------------------*
* --> None
* <-- None
*----------------------------------------------------------------------*
FORM get_new_config.
* get configuration header
PERFORM get_config_header.
* get instance
PERFORM get_instance.
*&---------------------------------------------------------------------*
*& Form get_new_char
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM get_new_char.
LOOP AT tb_vhcl_cuval.
CLEAR serialization_info.
REFRESH serialization_info.
CLEAR tb_errtab.
tb_errtab-msgid = co_idoc_msg.
tb_errtab-msgty = co_msgtyp_e.
tb_errtab-msgnr = co_msg_028.
tb_errtab-msgv1 = sy-msgv1.
tb_errtab-msgv2 = sy-msgv2.
tb_errtab-msgv3 = sy-msgv3.
tb_errtab-msgv4 = sy-msgv4.
APPEND tb_errtab.
ENDIF.
ENDLOOP.
ELSEIF tb_vlc_vehicle-zz_quote NE 0.
CLEAR: gv_bupa,
ls_centraldata,
ls_centraldataperson,
ls_addressdata,
lt_addressnotes[],
ls_addressnotes,
lt_telefondata[],
ls_telefondata,
lt_e_maildata[],
ls_e_maildata,
lt_return[],
ls_partner,
lt_vlcdeaend[].
CLEAR: lt_addr1[],
ls_addr1,
lt_adtel[],
ls_adtel,
lt_adfax[],
ls_adfax,
lt_adsmtp[],
ls_adsmtp.
MOVE: st_adrmasendcu-title TO ls_centraldata-title_key,
st_adrmasendcu-name1 TO ls_centraldataperson-lastname,
st_adrmasendcu-name2 TO ls_centraldataperson-firstname,
st_adrmasendcu-street TO ls_addressdata-street,
st_adrmasendcu-str_suppl1 TO ls_addressdata-str_suppl1,
st_adrmasendcu-str_suppl2 TO ls_addressdata-str_suppl2,
st_adrmasendcu-str_suppl3 TO ls_addressdata-str_suppl3,
st_adrmasendcu-post_code1 TO ls_addressdata-postl_cod1.
ls_addressdata-pobox_ctry = st_adrmasendcu-country(3).
ls_addressdata-country = st_adrmasendcu-country(3).
ls_addressdata-city = st_adrmasendcu-city1.
ls_addressdata-po_box = st_adrmasendcu-po_box.
ls_addressdata-comm_type = 'TEL'.
ls_telefondata-std_no = 'X'.
ls_telefondata-telephone = st_adrmasendcu-tel_number.
APPEND ls_telefondata TO lt_telefondata.
ls_addressdata-comm_type = 'TEL'.
ls_telefondata-std_no = 'X'.
ls_telefondata-telephone = st_adrmasendcu-tel_number_2.
APPEND ls_telefondata TO lt_telefondata.
* For Fax Number
IF NOT st_adrmasendcu-fax_number IS INITIAL.
ls_faxdata-fax = st_adrmasendcu-fax_number.
APPEND ls_faxdata TO lt_faxdata.
ENDIF.
* email ID
ls_e_maildata-std_no = 'X'.
ls_e_maildata-e_mail = st_adrmasendcu-email.
APPEND ls_e_maildata TO lt_e_maildata.
* Begin of insert to verify that certain fields are at least filled in
* before we create the business partner. Only for South Africa
CLEAR ls_return.
CALL FUNCTION '/DCSEA/ZAIS_BP_MANDATORY_CHECK'
EXPORTING
partnercategory = '1'
centraldata = ls_centraldata
centraldataperson = ls_centraldataperson
addressdata = ls_addressdata
zcust_id = lv_cust_id
werks = tb_vlc_vehicle-werks
IMPORTING
return = ls_return.
IF ls_return-type = 'E'.
PERFORM write_error USING ls_return-id ls_return-number.
EXIT.
ENDIF.
* end of insert for mandatory checks for South Africa
ENDIF.
*End of Insertion by VIDYASD for CM-0042474461 (DFE SG) on 06.07.2018
*&---------------------------------------------------------------------*
*& Form check_pod
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
*Start of insertion By JoshiM for CM-1869 Ver 1.4 on 23-04-2003
FORM check_pod.
* If there is a difference between vehicle port of destination
* and VPC? location
* trigger ZTPS action
IF ( tb_vlc_vehicle-zz_port_of_dest EQ co_dest_port1 AND
st_vlcvehiclem-loctn EQ co_loctn1 ) OR
( tb_vlc_vehicle-zz_port_of_dest EQ co_dest_port2 AND
st_vlcvehiclem-loctn EQ co_loctn2 ) .
wf_aktion = co_ztps.
* Prepare data for ZTPS action
PERFORM fill_gore_data.
ENDIF.
*&---------------------------------------------------------------------*
*& Form move_add_data
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM move_add_data USING p_action
p_werks. " by Kuchibv 04.02.04
REFRESH lt_vguid.
CLEAR: lv_flag_54479486.
CALL FUNCTION '/DCSEA/Z_AIS_CHECK_ACTIVE_CM'
EXPORTING
cm_number = /dcsea/zais_vega_implementatio=>gc_54479486
werks = p_werks
IMPORTING
active_flag = lv_flag_54479486.
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
REFRESH: tb_imeiserl.
LOOP AT tb_vlc_vehicle.
lt_vguid-vguid = tb_vlc_vehicle-vguid.
APPEND lt_vguid.
ENDLOOP.
*Begin of insertion for T-3497001 by KUMARA on 22/08/05.
*Since CM-2898 is for Partner profile -TWVPCINBL1,checking for this
*partner profile for the below logic
IF ( idoc_contrl-rcvprn = co_twvpcinbl1
*Begin of Insert by BHORCHIS for CM-6854552 on 20.03.2008
* Another check for the new partner system and message type
* corresponding to 'TWVPCINBL1' is required.
* This check is as a result of migration to XI.
OR idoc_contrl-rcvprn = co_lsvpc_tw "LSVPC_TW
AND idoc_contrl-mestyp = co_mestyp_zvpc ). "ZVPC
*End of Insert by BHORCHIS for CM-6854552 on 20.03.2008
MODIFY vlcadddata_gt.
ENDLOOP.
*End of Insertion by Vijay Sai(SANTHOSR) for CM-2898 on 18.03.2005
*Following line inserted for T-3497001 by KUMARA on 22/08/05.
ENDIF. " if idoc_contrl-rcvprn = CO_TWVPCINBL1.
* Begin of change by STEEVEA for CM-6943780 on 24/4/2008
IF idoc_contrl-rcvprn = co_thvpcinbl1
*Begin of insertion by RAYCHOUDS for CM-6854552 on 09.09.2008
*New Partner profile & msg type for interface thvpcinbl1
OR ( idoc_contrl-rcvprn = co_lsvpc_th "LSVPC_TH
AND idoc_contrl-mestyp = co_mestyp_zvpc ) . "ZVPC
* to add/update record in table VLCADDDATA
LOOP AT vlcadddata_gt.
CONCATENATE vlcadddata_gt-fieldvalue
co_hyp
vlcactdata_cs-zz_vpcstatus
co_hyp
idoc_contrl-docnum
co_hyp
sy-datlo
sy-timlo
INTO vlcadddata_gt-fieldvalue.
MODIFY vlcadddata_gt.
ENDLOOP.
ENDIF.
* End of change by STEEVEA for CM-6943780 on 24/4/2008
CALL FUNCTION '/DCSEA/Z_AIS_PREPARE_ADDDATA'
EXPORTING
action = p_action
plant = p_werks
* vlcadddata = vlcadddata_cs "by Kuchibv 04.02.04
TABLES
vguid = lt_vguid
adddata = vlcadddata_gt
CHANGING
vlcactdata_cs = vlcactdata_cs
EXCEPTIONS
invalid_field = 1
no_data_found = 2
OTHERS = 3.
IF idoc_contrl-rcvprn+0(8) = 'AUOVPINB'
*Begin of Insert by BHORCHIS for CM-6854552 on 20.03.2008
* Another check for the new partner system and message type
* corresponding to 'AUOVPINB' is required.This check is needed as a
* result of migration to XI.
OR ( idoc_contrl-rcvprn+0(6) = co_lsovp "LSOVP_
AND idoc_contrl-mestyp = co_mestyp_zovp ) "ZOVP
*End of Insert by BHORCHIS for CM-6854552 on 20.03.2008.
*Begin of insert for CM-39989827 by AJABOSE on 15.10.2017
OR ( idoc_contrl-rcvprn = /dcsea/zais_xclass=>co_lsauc_au "LSAUC_AU
AND idoc_contrl-mestyp = /dcsea/zais_xclass=>co_mestyp_zovp )."ZOVP
*End of insert for CM-39989827 by AJABOSE on 15.10.2017
SELECT * FROM /dcsea/zais_para
INTO TABLE lt_zais_para
WHERE ( domval1 = idoc_contrl-rcvprn
*Begin of Insert by BHORCHIS for CM-6854552 on 20.03.2008.
* As part of migration to XI , partner number and message type
* will be concatenated into domval1 and hence the same need to be
* included in the select query as well
OR domval1 = wf_partner_mestyp )
*End of Insert by BHORCHIS for CM-6854552 on 20.03.2008
AND domval2 = p_action
AND param = 'INTERFACEQUALIFIER'.
* Listener Data
wf_string(50) = vlc_listener.
* VLC TCPIP Date
wf_string+50(112) = vlc_tcpip_stub.
* Dispatcher header data
wf_string+162(130) = dispatch_head.
* BUAP0 string
wf_string+292(33) = message_control.
* BUAP1 string
* Below line changed by shiwali(VTHIRUV) for CM 18325656 on 3.10.2012
*line modified to accomodate BUAP1 with new BUAP20
* wf_string1+325(825) = basic_vehi_data.
wf_string+325(1325) = basic_vehi_data.
* BUAP3 string
* Below line changed by VTHIRUV for CM 18325656 on 3.11.2012
* wf_string+1150(32) = export_markets.
wf_string+1650(32) = export_markets.
* Store the contents on the CONP table
CLEAR st_conp.
st_conp-werks = tb_vlc_vehicle-werks.
CALL FUNCTION 'VELO03_CONVERT_INTO_TIMESTAMP'
EXPORTING
datlo_iv = sy-datlo
timlo_iv = sy-timlo
tzone_iv = sy-zonlo
IMPORTING
timestamp_ev = lv_tstmp.
st_conp-tstmp = lv_tstmp + '0.9999999'.
st_conp-z_origin = 'I'.
st_conp-z_commnos = tb_vlc_vehicle-zz_commnos.
st_conp-direct = '2'.
st_conp-dtint2 = strlen( wf_string ).
st_conp-z_go_data = wf_string.
APPEND st_conp.
* the data to be stored on table /dcsea/zais_conp is updated
* using a FM
UPDATE vlcvehicle
SET mmsta = tb_vlc_vehicle-mmsta
WHERE vguid = tb_vlc_vehicle-vguid.
* Release the Lock
CALL FUNCTION 'DEQUEUE_E_VLCVEHICLE'
EXPORTING
mode_vlcvehicle = 'E'
mandt = sy-mandt
vguid = tb_vlc_vehicle-vguid.
ENDIF.
ENDFORM. " save_conp
* End of insert by SRIVATSS for CM1486 on 22/09/03
* begin of insert by harishr for cm-2261 on 25/02/2004
*&---------------------------------------------------------------------*
*& Form check_iface_ovp
*&---------------------------------------------------------------------*
* INBSTSFORVEHUSAGE parameter specifies the logistics status for
* inbound* actions. The requirement is there are many paths in action
* matrix based on vehicle usage. Trigger inbound actions looking into
* the combination of logistics status and vehicle usage for this
* interface in table /DCSEA?ZAIS_PARA.
* e.g. .
* For DOMVAL1 = AUOVPINBL1 and DOMVAL2 = ZIDI for FIELDNAME = LS11 and
* FIELDVAL will contain Vehicle Usage.
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM check_iface_ovp.
DATA : wa_vlcvehicle LIKE vlcvehicle,
tb_para_ovp LIKE /dcsea/zais_para
OCCURS 0 WITH HEADER LINE. "CM-2261 fix
CLEAR : /dcsea/zais_para.
CHECK sy-subrc EQ 0.
SELECT *
FROM /dcsea/zais_para
INTO CORRESPONDING FIELDS OF TABLE tb_para_ovp
WHERE ( domval1 = idoc_contrl-rcvprn
*Begin of Insert by BHORCHIS for CM-6854552 on 20.03.2008
* As part of migration to XI , partner number and message type
* will be concatenated into domval1 and hence the same need to be
* included in the select query as well
OR domval1 = wf_partner_mestyp )
*End of Insert by BHORCHIS for CM-6854552 on 20.03.2008.
AND domval2 = wf_aktion
AND param = co_inbstsforvehusage.
IF sy-subrc EQ 0.
* Write error in errtab, combination of mmsta and vhusg not found
READ TABLE tb_para_ovp
WITH KEY fieldname = tb_vlc_vehicle-mmsta
fieldval = tb_vlc_vehicle-vhusg.
IF sy-subrc NE 0.
PERFORM write_error USING co_msg_553
co_zais_msg.
ENDIF.
ENDIF.
* End of insertion - santosg 16/06/2004 - fix on CM-2261
*&---------------------------------------------------------------------*
*& Form check_lgort_pod
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM check_lgort_pod.
* If no match found
IF sy-subrc <> 0.
wf_aktion = co_ztps.
* Fill VLCGORE data
PERFORM fill_gore_data.
ELSE.
* Check if werks = 'TOYO' and first four chars of port of dest
* description is 'TOYO'.
IF st_vlcvehiclem-loctn = co_toyo.
wf_aktion = co_ztps.
* Fill VLCGORE data
PERFORM fill_gore_data.
ENDIF.
ENDIF.
ENDIF.
*&---------------------------------------------------------------------*
*& Form append_data_extn
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM append_data_extn.
IF st_extn-tabname EQ co_vlcvehicle.
ASSIGN st_extn-fieldname TO <fs_fieldname>.
* Begin of Changes by AGORAMS(Sriram) 20Sep2005 TKT-3588327
* assign component <fs_fieldname> of structure tb_vlc_vehicle to
* <fs_fieldval>.
ASSIGN COMPONENT <fs_fieldname> OF STRUCTURE st_vlcvehicle TO
<fs_fieldval>.
* End of Changes by AGORAMS(Sriram) 20Sep2005 TKT-3588327
SELECT SINGLE *
FROM /dcsea/zais_par2
WHERE fieldname EQ <fs_fieldname>.
ENDIF.
IF st_extn-fieldname EQ 'ZEFR'.
wf_amount_zefr = st_extn-fieldval.
ENDIF.
*End of insert by RNEELAM for CM 0041034978 on date 29.10.2020
ENDFORM. " append_data_extn
FORM get_customer_data.
PERFORM fill_central_data.
"HANA Code Remediation:Select Single not unique
" select single partner from but000 into gv_partner
" where bu_sort1 = st_adrmasendcub-bu_sort1.
SELECT partner UP TO 1 ROWS FROM but000 INTO gv_partner
WHERE bu_sort1 = st_adrmasendcub-bu_sort1 ORDER BY PRIMARY KEY.
ENDSELECT.
IF sy-subrc EQ 0.
CALL FUNCTION 'BUPA_CENTRAL_CHANGE'
EXPORTING
iv_partner = gv_partner
is_data = wa_central_data
is_data_person = wa_central_data_person
is_data_person_x = wa_central_data_person_x
is_data_x = wa_central_data_x
TABLES
et_return = tb_return.
IF tb_return[] IS INITIAL.
PERFORM update_customer_data.
ELSE.
PERFORM fill_error_table.
ENDIF.
ELSE.
PERFORM create_customer_data.
ENDIF.
*&---------------------------------------------------------------------
*& Form update_customer_data
*&---------------------------------------------------------------------
* this form is used to update the address of the customer.
*----------------------------------------------------------------------
FORM update_customer_data.
PERFORM get_address_data.
CLEAR tb_return.
REFRESH tb_return.
*&---------------------------------------------------------------------
*& Form create_customer_data
*&---------------------------------------------------------------------
* this form is used to create a new customer if the employee no is
* not found in table BUT000
*----------------------------------------------------------------------
FORM create_customer_data.
PERFORM get_address_data.
CLEAR tb_return.
REFRESH tb_return.
APPEND tb_return.
PERFORM fill_error_table.
ENDIF.
ENDIF.
ENDIF.
*&---------------------------------------------------------------------
*& Form get_address_data
*&---------------------------------------------------------------------
* this form is used to fill the address data into the structure
*----------------------------------------------------------------------
FORM get_address_data.
DATA : lv_partner LIKE but020-partner.
REFRESH: tb_bapiadtel,
tb_bapiad_rem,
tb_bapiadtel_x,
tb_bapiad_rem_x.
wa_addressdata-street = st_adrmasendcu-street.
wa_addressdata-str_suppl1 = st_adrmasendcu-str_suppl1.
wa_addressdata-str_suppl2 = st_adrmasendcu-str_suppl2.
wa_addressdata-city = st_adrmasendcu-city1.
wa_addressdata-postl_cod1 = st_adrmasendcu-post_code1.
wa_addressdata-country = st_adrmasendcu-country.
wa_addressdata_x-street = 'X'.
wa_addressdata_x-str_suppl1 = 'X'.
wa_addressdata_x-str_suppl2 = 'X'.
wa_addressdata_x-city = 'X'.
wa_addressdata_x-postl_cod1 = 'X'.
wa_addressdata_x-country = 'X'.
*&---------------------------------------------------------------------*
*& Form fill_central_data
*&---------------------------------------------------------------------*
* this form fills the central data needed to be passed to the BAPI.
* the central data contains the sort1 and sort2 fields from the IDOC.
*----------------------------------------------------------------------*
FORM fill_central_data.
wa_central_data-searchterm1 = st_adrmasendcub-bu_sort1.
wa_central_data-searchterm2 = st_adrmasendcub-bu_sort2.
wa_central_data_x-searchterm1 = 'X'.
wa_central_data_x-searchterm2 = 'X'.
wa_central_data_person-firstname = st_but000a3-name_first.
wa_central_data_person-lastname = st_but000a3-name_last.
wa_central_data_person_x-firstname = 'X'.
wa_central_data_person_x-lastname = 'X'.
*&---------------------------------------------------------------------*
*& Form fill_error_table
*&---------------------------------------------------------------------*
* this form is used to fill the error table with the errors obtained
* from the BAPI return table
*----------------------------------------------------------------------*
FORM fill_error_table.
CLEAR tb_errtab.
IF ( idoc_contrl-rcvprn+0(10) = co_zamlninsl1
* Begin of Insert by BHORCHIS for CM-6854552 on 24.03.2008
* Another check for the new partner system and message type
* corresponding to 'ZAMLNINSL1' is required.This check is needed
* as a result of migration to XI.
OR ( idoc_contrl-rcvprn+0(10) = co_lsmerln_za "LSMERLN_ZA
AND idoc_contrl-mestyp = co_mestyp_zmer ) ) "ZMER
* End of Insert by BHORCHIS for CM-6854552 on 24.03.2008
AND ( wf_aktion = co_zvha OR
wf_aktion = co_zvna OR
wf_aktion = co_zins OR
wf_aktion = co_zinu ).
tb_errtab-msgty = co_error_messagetype.
tb_errtab-msgid = co_message_id.
tb_errtab-msgnr = co_mesg_no.
tb_errtab-msgv1 = wf_aktion.
APPEND tb_errtab.
ELSE.
* End of insertion by KHETERT for T# 1924179 / CM-2531 on 15/07/2004
IF sy-subrc EQ 0.
* if there has been error in the BAPIs
* Move message data to errtab fields
tb_errtab-msgty = tb_return-type.
tb_errtab-msgid = t100-arbgb.
tb_errtab-msgnr = t100-msgnr.
tb_errtab-msgv1 = tb_return-message_v1.
tb_errtab-msgv2 = tb_return-message_v2.
tb_errtab-msgv3 = tb_return-message_v3.
tb_errtab-msgv4 = tb_return-message_v4.
APPEND tb_errtab.
ENDIF. "sy-subrc eq 0
*&---------------------------------------------------------------------*
*& Form update_custid
*&---------------------------------------------------------------------*
* this form is used to update the table BUT000 with the cust ID.
*----------------------------------------------------------------------*
FORM update_custid.
CLEAR gv_fm_err.
*&---------------------------------------------------------------------*
*& Form check_aktion_lctn
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM check_aktion_lctn.
IF st_vlcvehiclem-loctn IS INITIAL.
* Write error in errtab, The field LOCTN is mandatory
PERFORM write_error USING co_msg_828
co_zais_msg.
* Begin of inserion by THELAKAK for T#3586698 on 20.09.2005.
ELSE.
* Else populate vlcactdata_cs.
MOVE st_vlcvehiclem-loctn TO vlcactdata_cs-loctn.
* End of inserion by THELAKAK for T#3586698 on 20.09.2005.
ENDIF.
*&---------------------------------------------------------------------*
*& Form check_aktion_zscc
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM check_aktion_zscc.
IF ( st_vlcvehiclem-werks IS INITIAL ) OR
( st_vlcgoodsmvmt-lgort IS INITIAL ) OR
( st_vlcgoodsmvmt-mm_bldat IS INITIAL ) OR
( st_vlcgoodsmvmt-mm_budat IS INITIAL ) .
*Write error in errtab, The fields WERKS.LGORT,MM_BUDAT and MM_BLDAT are
*mandatory for action ZSCC
PERFORM write_error USING co_msg_830
co_zais_msg.
* Begin of inserion by THELAKAK for T#3586698 on 20.09.2005.
ELSE.
* Else populate vlcactdata_cs.
MOVE st_vlcvehiclem-werks TO vlcactdata_cs-werks.
MOVE st_vlcgoodsmvmt-lgort TO vlcactdata_cs-lgort.
MOVE st_vlcgoodsmvmt-mm_bldat TO vlcactdata_cs-bldat.
MOVE st_vlcgoodsmvmt-mm_budat TO vlcactdata_cs-budat.
ENDIF.
ENDFORM. " check_aktion_zscc
* End of insertion by THELAKAK for CM-3130 on 14/07/2005
IF sy-subrc = 0.
* Get Purchasing Organization.
"HANA Code Remediation:Select Single not unique
" select single infnr into wf_infnr from eina
" where matnr eq tb_vlc_vehicle-matnr and
"*Begin of change by TALESRAH for CM-6516912 on 14/01/2008.
"* lifnr eq tb_vlc_vehicle-lifnr.
" lifnr eq st_vlcvehiclem-lifnr.
SELECT infnr INTO wf_infnr UP TO 1 ROWS FROM eina
WHERE matnr EQ tb_vlc_vehicle-matnr AND
*Begin of change by TALESRAH for CM-6516912 on 14/01/2008.
* lifnr eq tb_vlc_vehicle-lifnr.
lifnr EQ st_vlcvehiclem-lifnr ORDER BY PRIMARY KEY. ENDSELECT.
*End of change by TALESRAH for CM-6516912 on 14/01/2008.
IF sy-subrc = 0.
*Fetch the no: of days to deliver and put it into a variable
SELECT SINGLE aplfz INTO wf_deldays FROM eine
WHERE infnr EQ wf_infnr AND
werks EQ tb_vlc_vehicle-werks AND
*Purchasing info record category as subcontracting.
esokz EQ co_three AND
ekorg EQ st_ekko-ekorg.
ENDIF.
ENDIF.
*&---------------------------------------------------------------------*
*& Form append_ekko_data
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM append_ekko_data.
* Populate the values from extension segment to the internal table as
* the IDOC has two segments with an individual field at a time i,e,
* purchasing organisation or purchasing group.
IF st_extn-tabname EQ co_ekko.
IF st_extn-fieldname EQ co_ekorg.
MOVE st_extn-fieldval TO st_ekko-ekorg.
ELSEIF st_extn-fieldname EQ co_ekgrp.
MOVE st_extn-fieldval TO st_ekko-ekgrp.
ENDIF.
ENDIF.
*Start of code by Sravan Guduru on 4th March 2020 for MBIL rollout:CM_0050289212
PERFORM append_values TABLES ra_rcvprn_new "for 'GSAFAB_IN'
USING /dcsea/in_cl_global=>gc_afab_in.
*End of code by Sravan Guduru on 4th March 2020 for MBIL rollout:CM_0050289212
CLEAR wf_compare_idoc.
IF sy-subrc NE 0
AND ( lv_sndprn NS 'GTCHRFO'
*Begin of Insert by BHORCHIS for CM-6854552 on 20.03.2008
* Another check for the new partner system and message type
* corresponding to 'GTCHRFO*' is required.This check is needed as a
* result of migration to XI.
OR ( lv_sndprn(8) NE co_gshpims "GSHPIMS_
OR ( lv_mestyp NE co_mestyp_zfactory_con "ZFACTORY_CON
AND lv_mestyp NE co_mestyp_zfactver_up ) ) ).
"ZFACTORY_VER_UPD
*End of Insert by BHORCHIS for CM-6854552 on 20.03.2008
EXIT. "Continue normal processing
ENDIF.
ra_idoc-sign = 'I'.
ra_idoc-option = 'EQ'.
ra_idoc-low = adddata_idoc.
APPEND ra_idoc.
ra_idoc-sign = 'I'.
ra_idoc-option = 'EQ'.
ra_idoc-low = idoc_contrl-docnum.
APPEND ra_idoc.
"HANA Code Remediation: ORDER BY PRIMARY KEY Added to Select Statement below
SELECT *
FROM edid4
INTO TABLE lt_idocdata
WHERE docnum IN ra_idoc ORDER BY PRIMARY KEY.
LOOP AT lt_idocdata.
READ TABLE lt_temp INDEX sy-tabix.
* If there is no Idoc data in the other table
* or the segments don't match in both Idoc's
IF sy-subrc NE 0
OR lt_idocdata-segnam NE lt_temp-segnam.
lv_exit_processing = 'X'.
EXIT. "Exit this loop & Continue normal processing
ELSE. "sy-subrc eq 0 and segnam are same.
IF lt_idocdata-sdata NE lt_temp-sdata.
lv_exit_processing = 'X'.
EXIT. "Exit this loop & Continue normal processing
ENDIF.
ENDIF.
ENDLOOP.
IF ( idoc_contrl-rcvprn CS 'GTCHRFO'
*Begin of Insert by BHORCHIS for CM-6854552 on 20.03.2008.
* Another check for the new message type corresponding to 'GTCHRFO*' is
* required as a result of migration to XI.
OR ( idoc_contrl-rcvprn(8) EQ co_gshpims "GSHPIMS_
AND ( idoc_contrl-mestyp EQ co_mestyp_zfactory_con
"FACTORY_CON
OR idoc_contrl-mestyp EQ co_mestyp_zfactver_up ) ) ).
"ZFACTORY_VER_UPD
*End of Insert by BHORCHIS for CM-6854552 on 20.03.2008.
idoc_status-msgno = '867'.
ENDIF.
flag_exit_vehi = 'X'.
ENDIF.
IF sy-subrc NE 0.
p_wf_auto_flag = 'X'.
EXIT.
ENDIF.
CLEAR p_wf_auto_flag.
* step 1
READ TABLE lt_nidr WITH KEY werks = lt_vehicle-werks
sparte = wf_prod_code
matkl = lt_mara-matkl
matnr = lt_vehicle-matnr
charc = 'PDDATU'.
IF sy-subrc EQ 0.
IF lt_nidr-idr_autoupdate = 'Y'.
* The flag p_wf_flag is not set indicating nothing doing with now
* update the value in the autoconfig internal table
PERFORM prepare_autoupdate_char TABLES lt_nidr
USING lt_nidr
lt_vehicle-pddatu
st_vehicle-pddatu
CHANGING p_wf_auto_flag.
IF NOT p_wf_auto_flag IS INITIAL
AND lt_nidr-idr_compare EQ 'N'.
CLEAR p_wf_auto_flag.
ENDIF.
EXIT.
ELSE.
IF lt_nidr-idr_compare = 'Y'.
p_wf_auto_flag = 'X'.
ENDIF.
EXIT.
ENDIF. "For check on autopdate
ELSE.
CLEAR p_wf_auto_flag.
* step 2 : Without material type
READ TABLE lt_nidr WITH KEY werks = lt_vehicle-werks
sparte = wf_prod_code
matkl = lt_mara-matkl
matnr = space
charc = 'PDDATU'.
IF sy-subrc EQ 0.
IF lt_nidr-idr_autoupdate = 'Y'.
* The flag p_wf_flag is not set indicating nothing doing with now
* update the value in the autoconfig internal table
PERFORM prepare_autoupdate_char TABLES lt_nidr
USING lt_nidr
lt_vehicle-pddatu
st_vehicle-pddatu
CHANGING p_wf_auto_flag.
IF NOT p_wf_auto_flag IS INITIAL
AND lt_nidr-idr_compare EQ 'N'.
CLEAR p_wf_auto_flag.
ENDIF.
EXIT.
ELSE. "Now check IDR_COMPARE flag
IF lt_nidr-idr_compare = 'Y'.
p_wf_auto_flag = 'X'.
ENDIF.
EXIT.
ENDIF.
ELSE.
CLEAR p_wf_auto_flag.
* step 3 : without material type and group
READ TABLE lt_nidr WITH KEY werks = lt_vehicle-werks
sparte = wf_prod_code
matkl = space
matnr = space
charc = 'PDDATU'.
IF sy-subrc EQ 0.
IF lt_nidr-idr_autoupdate = 'Y'.
* The flag p_wf_flag is not set indicating nothing doing with now
* update the value in the autoconfig internal table
PERFORM prepare_autoupdate_char TABLES lt_nidr
USING lt_nidr
lt_vehicle-pddatu
st_vehicle-pddatu
CHANGING p_wf_auto_flag.
IF NOT p_wf_auto_flag IS INITIAL
AND lt_nidr-idr_compare EQ 'N'.
CLEAR p_wf_auto_flag.
ENDIF.
EXIT.
ELSE. "Now check IDR_COMPARE flag
IF lt_nidr-idr_compare = 'Y'.
p_wf_auto_flag = 'X'.
ENDIF.
EXIT.
ENDIF.
ELSE.
p_wf_auto_flag = 'X'.
ENDIF. "End third
ENDIF. "End second
ENDIF.
ENDFORM. " check_autoupdate
*&---------------------------------------------------------------------*
*& Form prepare_autoupdate_char
*&---------------------------------------------------------------------*
* Check for Autoupdation
*----------------------------------------------------------------------*
FORM prepare_autoupdate_char TABLES lt_nidr STRUCTURE /dcsea/zais_nidr
USING wf_nidr STRUCTURE /dcsea/zais_nidr
wf_factory
wf_current
CHANGING p_wf_auto_flag.
DATA : lv_diff TYPE i,
lv_acceptable TYPE i,
lv_currdat TYPE d,
lv_factdat TYPE d.
CLEAR : lv_diff ,
lv_acceptable ,
lv_currdat ,
lv_factdat .
* If PDDATU Lies in the same month then exit
IF wf_factory+0(6) = wf_current+0(6).
CLEAR p_wf_auto_flag.
EXIT.
ENDIF.
* Check for no of days mentioned in NIDR table
IF NOT wf_nidr-date_diff IS INITIAL.
MOVE : wf_current TO lv_currdat,
wf_factory TO lv_factdat,
wf_nidr-date_diff TO lv_acceptable.
lv_diff = lv_currdat - lv_factdat.
lv_diff = abs( lv_diff ).
IF lv_diff LE lv_acceptable.
CLEAR p_wf_auto_flag.
CLEAR tb_acnf.
tb_acnf-difference = 'PDDATU'.
tb_acnf-value = wf_current.
APPEND tb_acnf.
ELSE.
p_wf_auto_flag = 'X'.
ENDIF.
ELSE.
p_wf_auto_flag = 'X'.
ENDIF.
APPEND p_rcvprn_range.
CLEAR p_rcvprn_range.
*&---------------------------------------------------------------------*
*& Form append_vlcadddata
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM append_vlcadddata.
* Populate the values from extension segment to the internal table as
* the IDOC may contain two segments with an individual field
IF st_extn-tabname EQ co_vlcadddata AND st_extn-fieldname EQ co_vhfin.
APPEND st_extn TO tb_extn.
ENDIF.
ENDFORM. " append_vlcadddata
*END of insertion by TRIPATHIL for CM-10003589 v5.7T on 11/12/2009
*Start of insertion by AGRAWALS for CM-10256503 V1.0 on 10.12.2009
*&---------------------------------------------------------------------*
*& Form get_vlcvehicle_data_zvsp
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM get_vlcvehicle_data_zvsp.
CLEAR tb_vlc_vehicle.
READ TABLE tb_vlc_vehicle INDEX 1.
IF sy-subrc = 0.
* If Commission number is not blank in IDOC, fetch data from VLCVEHICLE
IF NOT tb_vlc_vehicle-zz_commnos IS INITIAL.
"HANA Code Remediation:Select Single not unique
" select single *
" into hd_vlcvehicle
" from vlcvehicle
" where vhcex eq tb_vlc_vehicle-zz_commnos.
SELECT *
INTO hd_vlcvehicle
UP TO 1 ROWS FROM vlcvehicle
WHERE vhcex EQ tb_vlc_vehicle-zz_commnos ORDER BY PRIMARY KEY.
ENDSELECT.
* If no data found, throw error message
IF sy-subrc <> 0.
PERFORM write_error USING co_msg_089 " no vehicles selected
co_velo.
ELSE.
* Move VLCVEHICLE data into structure tb_vlc_vehicle
MOVE-CORRESPONDING hd_vlcvehicle TO tb_vlc_vehicle.
MODIFY tb_vlc_vehicle INDEX 1.
ENDIF.
ELSE.
* If Commission number is blank in IDOC, throw error message
PERFORM write_error USING co_msg_027 " No Commission no.
co_zais_msg.
ENDIF.
ELSE.
* If no data found in IDOC, throw error message
PERFORM write_error USING co_msg_249 " No IDOC data found
co_zais_msg.
ENDIF.
ENDFORM. " get_vlcvehicle_data_zvsp
*End of insertion by AGRAWALS for CM-10256503 V1.0 on 10.12.2009
CLEAR : ra_matnr.
REFRESH : ra_matnr.
* Fill range with Part of Material no. which was received in IDoc. This
* will be used to get the actual Material No.
ra_matnr-sign = co_i.
ra_matnr-option = co_cp.
CONCATENATE st_vlcvehicle-matnr '*' INTO ra_matnr-low.
APPEND ra_matnr.
* Fetch Material No, Material Type and Material Group from table MARA
* based on part of Material No. received in IDoc
"HANA Code Remediation:Select Single not unique
" select single matnr mtart matkl
" from mara
" into (wf_matnr , wf_mtart , wf_matkl )
" where matnr in ra_matnr
" and lvorm = ' '.
SELECT matnr mtart matkl
UP TO 1 ROWS FROM mara
INTO (wf_matnr , wf_mtart , wf_matkl )
WHERE matnr IN ra_matnr
AND lvorm = ' ' ORDER BY PRIMARY KEY. ENDSELECT.
IF sy-subrc <> 0.
* Write error : Material doesn't exist
PERFORM write_error USING co_msg_021 co_zais_msg1.
ENDIF.
*&---------------------------------------------------------------------*
*& Form fill_zcre_data
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM fill_zcre_data.
*&---------------------------------------------------------------------*
*& Form fill_config_zcre
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM fill_config_zcre.
*&---------------------------------------------------------------------*
*& Form fill_config_header
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM fill_config_header.
CLEAR : tb_cuins,
wa_cucfg,
wa_cuins.
REFRESH : tb_cuins.
* Get the config version
PERFORM get_version.
IF sy-subrc EQ 0.
* Fill constant values in the structure
MOVE : '000001' TO wa_cuins-config_id,
'00000001' TO wa_cuins-inst_id,
'T' TO wa_cuins-complete,
'T' TO wa_cuins-consistent,
* Fill Material No., Class Type and table name
wf_matnr TO wa_cuins-obj_key,
inob-klart TO wa_cuins-class_type,
inob-obtab TO wa_cuins-obj_type.
* Append work-area wa_cuins data to internal table
APPEND wa_cuins TO tb_cuins.
ENDIF.
ENDFORM. " fill_config_header
*&---------------------------------------------------------------------*
*& Form fill_config
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM fill_config.
*&---------------------------------------------------------------------*
*& Form get_version
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM get_version.
*&---------------------------------------------------------------------*
*& Form execute_action_zcre
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM execute_action_zcre.
IF sy-subrc <> 0.
* Write Error messages
CASE sy-subrc.
WHEN 1.
PERFORM write_error USING co_msg_067
co_zais_msg.
WHEN 2.
PERFORM write_error USING co_msg_068
co_zais_msg.
WHEN 3.
PERFORM write_error USING co_msg_069
co_zais_msg.
WHEN 4.
PERFORM write_error USING co_msg_070
co_zais_msg.
WHEN 5.
PERFORM write_error USING co_msg_071
co_zais_msg.
WHEN 6.
PERFORM write_error USING co_msg_072
co_zais_msg.
WHEN 7.
PERFORM write_error USING co_msg_066
co_zais_msg.
ENDCASE.
ENDIF.
IF sy-subrc EQ 0.
ENDIF.
IF sy-subrc EQ 0.
MOVE-CORRESPONDING hd_vlcvehicle TO tb_vlc_vehicle.
MODIFY tb_vlc_vehicle INDEX 1.
ENDIF.
ELSE.
IF tb_vlc_vehicle-vhvin IS INITIAL AND
tb_vlc_vehicle-zz_commnos IS INITIAL.
* Move message data to errtab fields
tb_errtab-msgty = co_msgtyp_e.
tb_errtab-msgid = co_zais_msg1.
tb_errtab-msgnr = co_msg_999.
tb_errtab-msgv1 = co_err_msg.
APPEND tb_errtab.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDFORM. " UPADTE_MEMO_PLNDINSDATE
*End of change by NANDANR for CM-0032252956 on 21/04/2016
****Begin of Insert***KACHAND****MBID****CM:0041379963****CKD Kit CHassis restrict
for ZVDU****
*&---------------------------------------------------------------------*
*& Form DETERMINE_CKD_CBU
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM determine_ckd_cbu .
lv_object = gv_matnr.
CALL FUNCTION 'CLAF_CLASSIFICATION_OF_OBJECTS'
EXPORTING
class = 'BASIC_MODEL_PARMS'
classtext = 'X'
classtype = '001'
object = lv_object
TABLES
t_class = lt_class
t_objectdata = lt_objdata
EXCEPTIONS
no_classification = 1
no_classtypes = 2
invalid_class_type = 3
OTHERS = 4.
IF sy-subrc IS INITIAL.
READ TABLE lt_objdata ASSIGNING <lfs_objdata>
WITH KEY atnam = 'BMP_BUILD_TYPE'.
IF <lfs_objdata> IS ASSIGNED.
IF <lfs_objdata>-ausp1 = /dcsea/mbid_constants=>gc_ckd.
gv_ckd = 'X'.
ENDIF.
ENDIF.
ENDIF.
CLEAR wf_amount.
SELECT SINGLE
vguid,vhcle, matnr,werks
FROM vlcvehicle
INTO @DATA(gw_vhcle)
WHERE vhcex = @st_vlcvehicleb-/dcsea/zz_commnos.
IF sy-subrc EQ 0.
SELECT *
FROM /dcsea/zais_para
INTO TABLE @DATA(tb_para)
WHERE domval1 = @/dcsea/in_cl_global=>gc_bukrs_1414
AND domval2 = @/dcsea/in_cl_global=>co_ckd
** Begin of changes by Vishnuvardhan Reddy(VCHITTI) for CM 0056870814 on 07/10/2021
* AND param = @/dcsea/in_cl_global=>gc_zinv
AND param = 'VARIANCE'
** End of changes by Vishnuvardhan Reddy(VCHITTI) for CM 0056870814 on 07/10/2021
AND paradesc = @/dcsea/in_cl_global=>gc_hkont.
* Header Data
* Get company code from T001W/T001K
SELECT SINGLE * INTO t001w
FROM t001w
WHERE ( werks EQ gw_vhcle-werks ).
IF sy-subrc EQ 0.
SELECT SINGLE * INTO t001k
FROM t001k
WHERE ( bwkey EQ t001w-bwkey ).
IF sy-subrc EQ 0.
tb_header-comp_code = t001k-bukrs.
ENDIF.
ENDIF.
tb_header-invoice_ind = abap_true.
tb_header-doc_type = 'YE'.
tb_header-doc_date = st_vlcbilling-audat .
tb_header-pstng_date = st_vlcbilling-budat_bill.
tb_header-currency = st_vlcbilling-waers.
tb_header-currency_iso = st_vlcbilling-waers.
tb_header-exch_rate = 1.
tb_header-pmnttrms = 'AP00'.
tb_header-bline_date = st_vlcbilling-audat.
tb_header-business_place = '1000'.
** Begin of changes by Vishnuvardhan Reddy(VCHITTI) for CM 0056870814 on 29/04/2021
DATA: lv_cmflag TYPE /dcsea/z_active_flag,
lv_werks TYPE werks_d,
lv_bupla TYPE j_1bbranc_,
lv_cm_werks TYPE werks_d.
CONSTANTS :lc_0056870814 TYPE /dcsea/z_cm_number VALUE '0056870814'.
CLEAR: lv_cmflag,lv_werks,lv_bupla,lv_cm_werks.
lv_cm_werks = t001k-bukrs.
CALL FUNCTION '/DCSEA/Z_AIS_CHECK_ACTIVE_CM'
EXPORTING
cm_number = lc_0056870814
werks = lv_cm_werks
IMPORTING
active_flag = lv_cmflag.
IF lv_cmflag IS NOT INITIAL.
SELECT SINGLE bwkey FROM mbew INTO lv_werks WHERE matnr EQ gw_vhcle-matnr AND
bwtar EQ gw_vhcle-vhcle AND
lbkum GT 0.
IF sy-subrc IS INITIAL.
SELECT SINGLE j_1bbranch FROM t001w INTO lv_bupla WHERE werks EQ lv_werks.
IF sy-subrc IS NOT INITIAL.
CLEAR lv_bupla.
ENDIF.
ELSE.
SELECT SINGLE j_1bbranch FROM t001w INTO lv_bupla WHERE werks EQ gw_vhcle-werks.
IF sy-subrc IS NOT INITIAL.
CLEAR lv_bupla.
ENDIF.
ENDIF.
tb_header-business_place = lv_bupla.
ELSE.
** End of changes by Vishnuvardhan Reddy(VCHITTI) for CM 0056870814 on 29/04/2021
tb_header-business_place = '1000'.
** Following line inserted by Vishnuvardhan Reddy(VCHITTI) for CM 0056870814 on
29/04/2021
ENDIF.
tb_header-header_txt = st_vlcvehicleb-/dcsea/zz_commnos.
* Item Data
gw_item-invoice_doc_item = gw_item-invoice_doc_item + 1.
gw_item-po_number = gw_ekpo-ebeln.
** Begin of changes by Vishnuvardhan Reddy(VCHITTI) for CM 0056870814 on 12/10/2021
* READ TABLE tb_receipts INTO DATA(gv_receipts) INDEX 1.
* IF gv_receipts IS NOT INITIAL.
* gw_item-ref_doc = gv_receipts-mblnr.
* ENDIF.
READ TABLE lt_mseg INTO DATA(ls_mseg) INDEX 1.
IF ls_mseg IS NOT INITIAL.
gw_item-ref_doc = ls_mseg-mblnr.
ENDIF.
** End of changes by Vishnuvardhan Reddy(VCHITTI) for CM 0056870814 on 12/10/2021
gw_item-po_item = '00010'.
gw_item-ref_doc_year = st_vlcbilling-audat+0(4).
gw_item-ref_doc_it = 1.
gw_item-tax_code = 'V0'.
gw_item-quantity = 1.
gw_item-po_unit = gw_ekpo-meins.
gw_item-po_unit_iso = gw_ekpo-meins.
gw_item-po_pr_uom = gw_ekpo-meins.
gw_item-po_pr_uom_iso = gw_ekpo-meins.
APPEND gw_item TO tb_item.
* gl account data
gw_gl_acc-invoice_doc_item = gw_item-invoice_doc_item.
* gw_gl_acc-item_amount = st_vlcbilling-total_amount.
READ TABLE tb_para INTO DATA(ls_para) WITH KEY domval1 =
/dcsea/in_cl_global=>gc_bukrs_1414
domval2 =
/dcsea/in_cl_global=>co_ckd
** Begin of changes by Vishnuvardhan Reddy(VCHITTI) for CM 0056870814 on 07/10/2021
* param =
/dcsea/in_cl_global=>gc_zinv
param = 'VARIANCE'
** Begin of changes by Vishnuvardhan Reddy(VCHITTI) for CM 0056870814 on 07/10/2021
paradesc =
/dcsea/in_cl_global=>gc_hkont.
IF sy-subrc EQ 0.
CONCATENATE '0000' ls_para-fieldname INTO ls_para-fieldname .
gw_gl_acc-gl_account = ls_para-fieldname.
ENDIF.
gw_gl_acc-comp_code = t001k-bukrs.
gw_gl_acc-tax_code = 'V0'.
* tax data
gw_tax-tax_code = 'V0'.
APPEND gw_tax TO tb_tax.
* material data
gw_material-invoice_doc_item = gw_item-invoice_doc_item .
gw_material-material = gw_vhcle-matnr.
** Begin of changes by Vishnuvardhan Reddy(VCHITTI) for CM 0056870814 on 29/04/2021
IF lv_cmflag IS NOT INITIAL AND lv_werks IS NOT INITIAL.
gw_material-val_area = lv_werks.
ELSE.
** End of changes by Vishnuvardhan Reddy(VCHITTI) for CM 0056870814 on 29/04/2021
gw_material-val_area = gw_vhcle-werks.
** Following line inserted by Vishnuvardhan Reddy(VCHITTI) for CM 0056870814 on
29/04/2021
ENDIF.
gw_material-valuation_type = gw_vhcle-vhcle.
gw_material-quantity = 1.
gw_material-item_amount = wf_amount.
gw_material-tax_code = 'V0'.
gw_material-base_uom = gw_ekpo-meins.
idoc_status-docnum = idoc_contrl-docnum.
idoc_status-status = co_error.
idoc_status-msgty = wa_return-type.
idoc_status-msgid = wa_return-id.
idoc_status-msgno = wa_return-number.
idoc_status-msgv1 = wa_return-message_v1.
idoc_status-msgv2 = wa_return-message_v2.
idoc_status-msgv3 = wa_return-message_v3.
idoc_status-msgv4 = wa_return-message_v4.
idoc_status-docnum = idoc_contrl-docnum.
idoc_status-status = co_posted.
idoc_status-msgty = 'S'.
idoc_status-msgid = 'M8'.
idoc_status-msgno = '392'.
idoc_status-msgv1 = lv_inv_num.
idoc_status-uname = sy-uname.
idoc_status-repid = sy-repid.
ENDIF.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form APPEND_BILLING_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form append_billing_data .
move idoc_data-sdata to st_vlcbilling.
endform.
* End of changes by PPRAGYA for MBIL CM 0051514725
*** Begin of Insert by CBHARIS for CM:0059136446 on 20-oct-2021 ***
FORM execute_action_zddp USING p_action.