*&---------------------------------------------------------------------*
*& Form display_data
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
form display_data.
define alv_field.
clear wa_alv_field1 .
wa_alv_field1-fieldname = &1.
wa_alv_field1-edit = &2.
wa_alv_field1-seltext_m = &3.
wa_alv_field1-checkbox = &4."CURR 指定数据类型
wa_alv_field1-ref_tabname = &5 .
wa_alv_field1-ref_fieldname = &6 .
wa_alv_field1-hotspot = &7.
wa_alv_field1-outputlen = &8.
append wa_alv_field1 to wa_alv_fieldcat1 .
end-of-definition.
alv_field 'SEL' 'X' 'Select' 'X' '' '' 'X' '6'.
alv_field 'KUNNR_SD' '' 'Sold-to' '' 'VBAK' 'KUNNR' '' '10'.
alv_field 'KLPRZ' '' 'Credit limit used(%)' '' '' '' '' '10'. "M11
alv_field 'NAME_SD' '' 'Sold-to Name' '' '' '' '' '15'.
alv_field 'KUNNR' '' 'Ship-to' '' 'KUWEV' 'KUNNR' '' '10'.
alv_field 'NAME1' '' 'Ship-to Name' '' '' '' '' '15'.
alv_field 'VKORG' '' 'Location' '' '' '' '' '5'.
alv_field 'BSTNK' '' 'PO' '' '' '' '' '10'.
alv_field 'AUART' '' 'Order Type' '' 'VBAK' 'AUART' '' '6'.
alv_field 'VGBEL' '' 'SO No' '' 'VBAP' 'VBELN' 'X' '10'.
alv_field 'VBELN' '' 'DN' '' 'LIPS' 'VBELN' 'X' '10'..
alv_field 'LIFSK' '' 'Block status' '' '' '' '' '6'.
alv_field 'KOSTA' '' 'Pick' '' '' '' '' '5'.
alv_field 'WBSTA' '' 'GI' '' '' '' '' '3'.
alv_field 'FKSTA' '' 'Billing' '' '' '' '' '5'.
alv_field 'WADAT' '' 'Planed GI Date' '' '' '' '' '10'.
alv_field 'WAUHR' '' 'Planed GI Time' '' '' '' '' '8'.
alv_field 'WADAT_IST' '' 'Actual GI date' '' '' '' '' '10'.
alv_field 'MATNR' '' 'P/N' '' 'MARA' 'MATNR' '' '18'.
alv_field 'LFIMG' '' 'QTY' '' '' '' '' ''.
alv_field 'RFMNG' '' 'Pick qty' '' '' '' '' ''.
alv_field 'VRKME' '' 'Unit' '' '' '' '' '4'.
alv_field 'ARKTX' '' 'Desc' '' '' '' '' ''.
alv_field 'KDMAT' '' 'Cust P/N' '' '' '' '' ''.
alv_field 'BEZEI' '' 'Shipping type' '' '' '' '' ''.
alv_field 'NTGEW' '' 'Net weight' '' '' '' '' ''.
alv_field 'BRGEW' '' 'Gross weight' '' '' '' '' ''.
alv_field 'VOLUM' '' 'CBM' '' '' '' '' ''.
alv_field 'ZTERM' '' 'payment terms' '' '' '' '' ''.
alv_field 'INCO1' '' 'incoterms 1' '' '' '' '' ''.
alv_field 'INCO2' '' 'incoterms 2' '' '' '' '' ''.
alv_field 'VBELN_VF' '' 'Billing No.' '' 'VBRP' 'VBELN' 'X' '12'."
alv_field 'SERNP' '' 'Serial number profile' '' '' '' '' ''.
alv_field 'LANDX' '' '消费国' '' '' '' '' ''.
alv_field 'ABLAD' '' 'Unloading Point' '' '' '' '' ''.
alv_field 'TDLINE' '' 'PMC REMARK' '' '' '' '' ''.
alv_field 'STATUS' '' 'Serial No. Status' '' '' '' '' ''.
alv_field 'POSEX' '' 'PO Item' '' '' '' '' '3'. "M5 add
alv_field 'VGPOS' '' 'SO Item' '' '' '' '' '3'. "M8 add
alv_field 'POSNR' '' 'DN Item' '' '' '' '' '3'. "M8 add
alv_field 'GROES' '' 'Size/dimensions' '' '' '' '' ''. "M8 add
alv_field 'CTNNO' '' 'Total Carton' '' '' '' '' ''. "M9 add
if lv_price = 'X'.
alv_field 'KBETR' '' 'SO Price' '' '' '' '' ''.
alv_field 'KPEIN' '' 'Price Unit' '' '' '' '' ''.
endif.
alv_field 'MAHNS' '' 'Overdue' '' '' '' '' ''.
data: i_grid_settings type lvc_s_glay .
i_grid_settings-edt_cll_cb = 'X' .
data:i_save type c.
i_save = 'A'.
if lw_layout is initial.
perform set_layout.
endif.
sort itab2 by vbeln wadat vgbel matnr.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = sy-repid
is_layout = lw_layout
it_fieldcat = wa_alv_fieldcat1
i_callback_user_command = 'ALV_USER_COMMAND'
* i_grid_settings = i_grid_settings
i_save = i_save
i_callback_pf_status_set = gs_status
tables
t_outtab = itab2.
endform . "display_data
*&---------------------------------------------------------------------*
*& Form ALV_USER_COMMAND
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->R_UCOMM text
* -->RS_SELFIELD text
*----------------------------------------------------------------------*
form alv_user_command using r_ucomm like sy-ucomm
rs_selfield type slis_selfield. "响应ALV点击自定义按钮之后的事件
data: lv_vbeln_vf like vbrp-vbeln.
case r_ucomm.
when '&IC1'.
if rs_selfield-fieldname ='VBELN' and rs_selfield-value <>''.
check rs_selfield-value is not initial.
set parameter id :'VL' field rs_selfield-value .
if sy-uname+0(3) = 'MST'.
call transaction 'ZVL02N_PI' and skip first screen .
elseif sy-uname+0(3) = 'MGC'.
call transaction 'ZVL02N_SHIP' and skip first screen .
else.
call transaction 'VL02N' and skip first screen .
endif.
wait up to 1 seconds.
perform change_status using rs_selfield-value .
rs_selfield-refresh = 'X'.
rs_selfield-col_stable = 'X'.
rs_selfield-row_stable = 'X'.
elseif rs_selfield-fieldname ='VGBEL' and rs_selfield-value <>''.
set parameter id :'AUN' field rs_selfield-value .
call transaction 'VA03' and skip first screen .
elseif rs_selfield-fieldname ='VBELN_VF' and rs_selfield-value <>''.
lv_vbeln_vf = rs_selfield-value.
set parameter id :'VF' field lv_vbeln_vf .
call transaction 'VF03' and skip first screen .
elseif rs_selfield-fieldname ='SEL'.
lv_tabix = rs_selfield-tabindex.
perform select_single using lv_tabix.
rs_selfield-refresh = 'X'.
rs_selfield-col_stable = 'X'.
rs_selfield-row_stable = 'X'.
endif.
when 'APPR'.
read table itab2 with key sel = 'X'.
if sy-subrc eq 0.
perform approved_dn.
rs_selfield-refresh = 'X'.
rs_selfield-col_stable = 'X'.
rs_selfield-row_stable = 'X'.
endif.
when 'SELALL'.
perform select_all.
rs_selfield-refresh = 'X'.
rs_selfield-col_stable = 'X'.
rs_selfield-row_stable = 'X'.
when 'DSEALL'.
perform deselect_all.
rs_selfield-refresh = 'X'.
rs_selfield-col_stable = 'X'.
rs_selfield-row_stable = 'X'.
when 'REFRESH'.
submit zsdrsp001 with s_refsh = 'X'
with s_ddate in s_ddate
with s_spoint in s_spoint
with s_sorg in s_sorg
with s_chan in s_chan
with s_div in s_div
with s_sparty in s_sparty
with s_shipt in s_shipt
with s_vbeln in s_vbeln
with s_so in s_so
with s_kosta in s_kosta
with s_wbsta in s_wbsta
with s_fksta in s_fksta
with s_lifsk in s_lifsk
with s_vsart in s_vsart.
endcase.
endform. "alv_user_command
*& Form display_data
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
form display_data.
define alv_field.
clear wa_alv_field1 .
wa_alv_field1-fieldname = &1.
wa_alv_field1-edit = &2.
wa_alv_field1-seltext_m = &3.
wa_alv_field1-checkbox = &4."CURR 指定数据类型
wa_alv_field1-ref_tabname = &5 .
wa_alv_field1-ref_fieldname = &6 .
wa_alv_field1-hotspot = &7.
wa_alv_field1-outputlen = &8.
append wa_alv_field1 to wa_alv_fieldcat1 .
end-of-definition.
alv_field 'SEL' 'X' 'Select' 'X' '' '' 'X' '6'.
alv_field 'KUNNR_SD' '' 'Sold-to' '' 'VBAK' 'KUNNR' '' '10'.
alv_field 'KLPRZ' '' 'Credit limit used(%)' '' '' '' '' '10'. "M11
alv_field 'NAME_SD' '' 'Sold-to Name' '' '' '' '' '15'.
alv_field 'KUNNR' '' 'Ship-to' '' 'KUWEV' 'KUNNR' '' '10'.
alv_field 'NAME1' '' 'Ship-to Name' '' '' '' '' '15'.
alv_field 'VKORG' '' 'Location' '' '' '' '' '5'.
alv_field 'BSTNK' '' 'PO' '' '' '' '' '10'.
alv_field 'AUART' '' 'Order Type' '' 'VBAK' 'AUART' '' '6'.
alv_field 'VGBEL' '' 'SO No' '' 'VBAP' 'VBELN' 'X' '10'.
alv_field 'VBELN' '' 'DN' '' 'LIPS' 'VBELN' 'X' '10'..
alv_field 'LIFSK' '' 'Block status' '' '' '' '' '6'.
alv_field 'KOSTA' '' 'Pick' '' '' '' '' '5'.
alv_field 'WBSTA' '' 'GI' '' '' '' '' '3'.
alv_field 'FKSTA' '' 'Billing' '' '' '' '' '5'.
alv_field 'WADAT' '' 'Planed GI Date' '' '' '' '' '10'.
alv_field 'WAUHR' '' 'Planed GI Time' '' '' '' '' '8'.
alv_field 'WADAT_IST' '' 'Actual GI date' '' '' '' '' '10'.
alv_field 'MATNR' '' 'P/N' '' 'MARA' 'MATNR' '' '18'.
alv_field 'LFIMG' '' 'QTY' '' '' '' '' ''.
alv_field 'RFMNG' '' 'Pick qty' '' '' '' '' ''.
alv_field 'VRKME' '' 'Unit' '' '' '' '' '4'.
alv_field 'ARKTX' '' 'Desc' '' '' '' '' ''.
alv_field 'KDMAT' '' 'Cust P/N' '' '' '' '' ''.
alv_field 'BEZEI' '' 'Shipping type' '' '' '' '' ''.
alv_field 'NTGEW' '' 'Net weight' '' '' '' '' ''.
alv_field 'BRGEW' '' 'Gross weight' '' '' '' '' ''.
alv_field 'VOLUM' '' 'CBM' '' '' '' '' ''.
alv_field 'ZTERM' '' 'payment terms' '' '' '' '' ''.
alv_field 'INCO1' '' 'incoterms 1' '' '' '' '' ''.
alv_field 'INCO2' '' 'incoterms 2' '' '' '' '' ''.
alv_field 'VBELN_VF' '' 'Billing No.' '' 'VBRP' 'VBELN' 'X' '12'."
alv_field 'SERNP' '' 'Serial number profile' '' '' '' '' ''.
alv_field 'LANDX' '' '消费国' '' '' '' '' ''.
alv_field 'ABLAD' '' 'Unloading Point' '' '' '' '' ''.
alv_field 'TDLINE' '' 'PMC REMARK' '' '' '' '' ''.
alv_field 'STATUS' '' 'Serial No. Status' '' '' '' '' ''.
alv_field 'POSEX' '' 'PO Item' '' '' '' '' '3'. "M5 add
alv_field 'VGPOS' '' 'SO Item' '' '' '' '' '3'. "M8 add
alv_field 'POSNR' '' 'DN Item' '' '' '' '' '3'. "M8 add
alv_field 'GROES' '' 'Size/dimensions' '' '' '' '' ''. "M8 add
alv_field 'CTNNO' '' 'Total Carton' '' '' '' '' ''. "M9 add
if lv_price = 'X'.
alv_field 'KBETR' '' 'SO Price' '' '' '' '' ''.
alv_field 'KPEIN' '' 'Price Unit' '' '' '' '' ''.
endif.
alv_field 'MAHNS' '' 'Overdue' '' '' '' '' ''.
data: i_grid_settings type lvc_s_glay .
i_grid_settings-edt_cll_cb = 'X' .
data:i_save type c.
i_save = 'A'.
if lw_layout is initial.
perform set_layout.
endif.
sort itab2 by vbeln wadat vgbel matnr.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = sy-repid
is_layout = lw_layout
it_fieldcat = wa_alv_fieldcat1
i_callback_user_command = 'ALV_USER_COMMAND'
* i_grid_settings = i_grid_settings
i_save = i_save
i_callback_pf_status_set = gs_status
tables
t_outtab = itab2.
endform . "display_data
*&---------------------------------------------------------------------*
*& Form ALV_USER_COMMAND
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->R_UCOMM text
* -->RS_SELFIELD text
*----------------------------------------------------------------------*
form alv_user_command using r_ucomm like sy-ucomm
rs_selfield type slis_selfield. "响应ALV点击自定义按钮之后的事件
data: lv_vbeln_vf like vbrp-vbeln.
case r_ucomm.
when '&IC1'.
if rs_selfield-fieldname ='VBELN' and rs_selfield-value <>''.
check rs_selfield-value is not initial.
set parameter id :'VL' field rs_selfield-value .
if sy-uname+0(3) = 'MST'.
call transaction 'ZVL02N_PI' and skip first screen .
elseif sy-uname+0(3) = 'MGC'.
call transaction 'ZVL02N_SHIP' and skip first screen .
else.
call transaction 'VL02N' and skip first screen .
endif.
wait up to 1 seconds.
perform change_status using rs_selfield-value .
rs_selfield-refresh = 'X'.
rs_selfield-col_stable = 'X'.
rs_selfield-row_stable = 'X'.
elseif rs_selfield-fieldname ='VGBEL' and rs_selfield-value <>''.
set parameter id :'AUN' field rs_selfield-value .
call transaction 'VA03' and skip first screen .
elseif rs_selfield-fieldname ='VBELN_VF' and rs_selfield-value <>''.
lv_vbeln_vf = rs_selfield-value.
set parameter id :'VF' field lv_vbeln_vf .
call transaction 'VF03' and skip first screen .
elseif rs_selfield-fieldname ='SEL'.
lv_tabix = rs_selfield-tabindex.
perform select_single using lv_tabix.
rs_selfield-refresh = 'X'.
rs_selfield-col_stable = 'X'.
rs_selfield-row_stable = 'X'.
endif.
when 'APPR'.
read table itab2 with key sel = 'X'.
if sy-subrc eq 0.
perform approved_dn.
rs_selfield-refresh = 'X'.
rs_selfield-col_stable = 'X'.
rs_selfield-row_stable = 'X'.
endif.
when 'SELALL'.
perform select_all.
rs_selfield-refresh = 'X'.
rs_selfield-col_stable = 'X'.
rs_selfield-row_stable = 'X'.
when 'DSEALL'.
perform deselect_all.
rs_selfield-refresh = 'X'.
rs_selfield-col_stable = 'X'.
rs_selfield-row_stable = 'X'.
when 'REFRESH'.
submit zsdrsp001 with s_refsh = 'X'
with s_ddate in s_ddate
with s_spoint in s_spoint
with s_sorg in s_sorg
with s_chan in s_chan
with s_div in s_div
with s_sparty in s_sparty
with s_shipt in s_shipt
with s_vbeln in s_vbeln
with s_so in s_so
with s_kosta in s_kosta
with s_wbsta in s_wbsta
with s_fksta in s_fksta
with s_lifsk in s_lifsk
with s_vsart in s_vsart.
endcase.
endform. "alv_user_command