METHOD if_ex_le_shp_delivery_proc~change_field_attributes.
DATA: ls_field_attributes TYPE shp_screen_attributes,
ls_xvbup TYPE vbupvb.
* Example 1: The field 'Actual goods-movement date' should not be
* changed by the user
IF sy-binpt EQ ''.
ls_field_attributes-name = 'LIKP-LIFSK'.
ls_field_attributes-input = 0.
APPEND ls_field_attributes TO ct_field_attributes.
ENDIF.
ENDMETHOD.
method if_ex_le_shp_delivery_proc~delivery_final_check.
data: wa_lips like line of it_xlips,
gs_lips like line of it_xlips,
l_lips like line of it_xlips,
xlikp like line of it_xlikp,
gs_vbak type vbak.
data:
l_vendor type zsd002-lifnr,
l_plant type lips-werks,
l_bukrs type lfb1-bukrs,
l_matnr type marc-matnr,
l_salk3 type qbew-salk3,
l_ekgrp type marc-ekgrp.
data: goodsmvt_code type bapi2017_gm_code.
data: wbs type c length 24,
l_kunno type likp-kunnr, "sold-to party
l_kunni type likp-kunnr, "ship-to party.
l_lifnr type zsd002-lifnr,
l_flag.
data: gs_vbpa type vbpa.
data: ls_finchdel type finchdel.
data: gs_xvbpa like line of it_xvbpa.
data: regiogroup type adrc-regiogroup,
msgtyp.
* CHECK sy-uname = 'WALLACEZHU' OR sy-uname = 'OLIVER_LEE'.
read table it_xvbpa into gs_xvbpa with key parvw = 'WE'.
if sy-subrc eq 0.
select single regiogroup into regiogroup
from kna1 as a join adrc as b
on a~adrnr = b~addrnumber
where a~kunnr = gs_xvbpa-kunnr.
else.
exit.
endif.
check regiogroup = 'VTECH'.
if sy-ucomm eq 'WABU_T'.
msgtyp = 'E'.
elseif sy-ucomm eq 'SICH_T'.
msgtyp = 'W'.
endif.
read table it_xlikp into xlikp index 1.
read table it_xlips into gs_lips index 1.
select single * into corresponding fields of gs_vbak
from vbak
where vbeln = gs_lips-vgbel.
if gs_vbak-auart eq 'TA'.
if gs_vbak-auart eq 'ZSP'.
read table it_xvbpa into gs_xvbpa with key parvw = 'AG'.
if sy-subrc eq 0.
l_kunno = gs_xvbpa-kunnr.
endif.
read table it_xvbpa into gs_xvbpa with key parvw = 'WE'.
if sy-subrc eq 0.
l_kunni = gs_xvbpa-kunnr.
endif.
select single lifnr flag from zsd002
into (l_vendor,l_flag)
where kunno = l_kunno
and kunni = l_kunni
and vkorg = gs_vbak-vkorg.
if sy-subrc ne 0.
clear ls_finchdel.
ls_finchdel-vbeln = xlikp-vbeln.
ls_finchdel-pruefung = '99'.
ls_finchdel-msgty = msgtyp.
ls_finchdel-msgid = 'ZSD'.
ls_finchdel-msgno = '001'.
ls_finchdel-msgv1 = 'Please maintain table ZSD002 for customer'.
* Note: CT_FINCHDEL is a hashed table
insert ls_finchdel into table ct_finchdel.
endif.
select single bukrs from lfb1
into l_bukrs
where lifnr = l_vendor
and bukrs = '8000'.
if sy-subrc ne 0.
clear ls_finchdel.
ls_finchdel-vbeln = xlikp-vbeln.
ls_finchdel-pruefung = '99'.
ls_finchdel-msgty = msgtyp.
ls_finchdel-msgid = 'ZSD'.
ls_finchdel-msgno = '001'.
ls_finchdel-msgv1 = 'Please maintain vendor master'.
concatenate l_vendor ' for Company 8000' into ls_finchdel-msgv2
separated by space.
* Note: CT_FINCHDEL is a hashed table
insert ls_finchdel into table ct_finchdel.
endif.
loop at it_xlips into wa_lips where vbeln = xlikp-vbeln.
select single ekgrp from marc into l_ekgrp
where matnr = wa_lips-matnr
and werks = wa_lips-werks.
if l_ekgrp is initial.
clear ls_finchdel.
ls_finchdel-vbeln = xlikp-vbeln.
ls_finchdel-pruefung = '99'.
ls_finchdel-msgty = msgtyp.
ls_finchdel-msgid = 'ZSD'.
ls_finchdel-msgno = '001'.
ls_finchdel-msgv1 = 'Please maintain Purch. Group of material'.
concatenate wa_lips-matnr wa_lips-werks into ls_finchdel-msgv2 separated by space.
* Note: CT_FINCHDEL is a hashed table
insert ls_finchdel into table ct_finchdel.
endif.
endloop.
elseif gs_vbak-auart eq 'TA'.
read table it_xvbpa into gs_xvbpa with key parvw = 'WE'.
select single werks from zsd001
into l_plant
where kunnr = gs_xvbpa-kunnr
and vkorg = gs_vbak-vkorg.
if sy-subrc ne 0.
clear ls_finchdel.
ls_finchdel-vbeln = xlikp-vbeln.
ls_finchdel-pruefung = '99'.
ls_finchdel-msgty = msgtyp.
ls_finchdel-msgid = 'ZSD'.
ls_finchdel-msgno = '001'.
ls_finchdel-msgv1 = 'Please maintain table ZSD001 for customer'.
* Note: CT_FINCHDEL is a hashed table
insert ls_finchdel into table ct_finchdel.
endif.
loop at it_xlips into wa_lips where vbeln = xlikp-vbeln.
select single matnr from marc into l_matnr
where matnr = wa_lips-matnr
and werks = l_plant.
if sy-subrc ne 0.
clear ls_finchdel.
ls_finchdel-vbeln = xlikp-vbeln.
ls_finchdel-pruefung = '99'.
ls_finchdel-msgty = msgtyp.
ls_finchdel-msgid = 'ZSD'.
ls_finchdel-msgno = '001'.
ls_finchdel-msgv1 = 'Please maintain plant'.
concatenate l_plant 'for material' wa_lips-matnr into ls_finchdel-msgv2
separated by space.
* Note: CT_FINCHDEL is a hashed table
insert ls_finchdel into table ct_finchdel.
endif.
* LOOP AT it_xlips INTO l_lips.
* SELECT SINGLE matnr FROM mard INTO l_matnr
* WHERE matnr = wa_lips-matnr
* AND werks = l_plant
* AND lgort = l_lips-lgort.
* IF sy-subrc NE 0.
* CLEAR ls_finchdel.
* ls_finchdel-vbeln = xlikp-vbeln.
* ls_finchdel-pruefung = '99'.
* ls_finchdel-msgty = msgtyp.
* ls_finchdel-msgid = 'ZSD'.
* ls_finchdel-msgno = '001'.
* CONCATENATE 'Please maintain Loction' l_lips-lgort
* INTO ls_finchdel-msgv1.
* CONCATENATE 'for material' l_matnr l_plant
* INTO ls_finchdel-msgv2 SEPARATED BY space.
** Note: CT_FINCHDEL is a hashed table
* INSERT ls_finchdel INTO TABLE ct_finchdel.
* ENDIF.
* ENDLOOP.
select single matnr from mbew into l_matnr
where matnr = wa_lips-matnr
and bwkey = l_plant.
if sy-subrc ne 0.
clear ls_finchdel.
ls_finchdel-vbeln = xlikp-vbeln.
ls_finchdel-pruefung = '99'.
ls_finchdel-msgty = msgtyp.
ls_finchdel-msgid = 'ZSD'.
ls_finchdel-msgno = '001'.
ls_finchdel-msgv1 = 'Please maintain account data'.
concatenate 'for material' wa_lips-matnr l_plant
into ls_finchdel-msgv2 separated by space.
* Note: CT_FINCHDEL is a hashed table
insert ls_finchdel into table ct_finchdel.
endif.
* SELECT salk3 FROM qbew INTO l_salk3
* WHERE matnr = wa_lips-matnr
* AND bwkey = l_plant
* AND sobkz = 'Q'
* AND pspnr = wa_lips-ps_psp_pnr.
*
* IF l_salk3 NE 0.
* CLEAR ls_finchdel.
* ls_finchdel-vbeln = xlikp-vbeln.
* ls_finchdel-pruefung = '99'.
* ls_finchdel-msgty = msgtyp.
* ls_finchdel-msgid = 'ZSD'.
* ls_finchdel-msgno = '001'.
* ls_finchdel-msgv1 = 'The Project Stock Valuation'.
* CONCATENATE 'for material' wa_lips-matnr l_plant 'should be 0'
* INTO ls_finchdel-msgv2 SEPARATED BY space.
** Note: CT_FINCHDEL is a hashed table
* INSERT ls_finchdel INTO TABLE ct_finchdel.
* ENDIF.
* ENDSELECT.
* IF sy-subrc NE 0.
* CLEAR ls_finchdel.
* ls_finchdel-vbeln = xlikp-vbeln.
* ls_finchdel-pruefung = '99'.
* ls_finchdel-msgty = msgtyp.
* ls_finchdel-msgid = 'ZSD'.
* ls_finchdel-msgno = '001'.
* ls_finchdel-msgv1 = 'Please Project Stock Valuation'.
* CONCATENATE 'for material' wa_lips-matnr l_plant
* INTO ls_finchdel-msgv2 SEPARATED BY space.
** Note: CT_FINCHDEL is a hashed table
* INSERT ls_finchdel INTO TABLE ct_finchdel.
* ENDIF.
endloop.
endif.
endif.
endmethod.