2007 May 03 11:08 AM
Hello,
I would like to print in a same screen two ALV grid with different command for each.
The two grid will be linked.
One is the header of the datas and the second represent the items of the selected data in the the header grid.
example user will get all sales order details and when user click on any sales order than on the same screen below i get the item data of that sales order...
how can i do that
Do you have any example for me, please ?
Thanks in advance for help,
Best regards,
Taran
2007 May 03 11:11 AM
Hi
use ALV hierarchial display function module for this.
see the sample code for this
REPORT zwmr_pick_status_report NO STANDARD PAGE HEADING
MESSAGE-ID zw.
************************************************************************
Type Pools
*
************************************************************************
TYPE-POOLS: icon, slis.
************************************************************************
Tables
*
************************************************************************
TABLES: tvst,
likp,
t30b,
vekp,
*{ INSERT UKMK900355 4
zhu_to_link, "AS03
*} INSERT
zpallettr,
vttk, "MB01
zvantr.
************************************************************************
Types
*
************************************************************************
TYPES:
BEGIN OF ty_data,
lgtor LIKE likp-lgtor, " door
vbeln LIKE likp-vbeln, " delivery
wbstk LIKE vbuk-wbstk, " Goods movement status
kostk LIKE vbuk-kostk, " Picking status
posnr LIKE lips-posnr, " item
route LIKE likp-route, " route
wadat LIKE likp-wadat, " goods issue date
lvsta LIKE vbup-lvsta, " warehouse status
packvorschr LIKE vekp-packvorschr, " pack mnemonic
exidv LIKE vekp-exidv, " handling unit
zpallet_no(10), "like zpallettr-zpallet_no, " pallet no
zdep_point LIKE zpallettr-zdep_point, "Departur Point "Jvdm01
zcount_check LIKE zpallettr-zcount_check," count check flag
zvan_no(10), "like zvantr-zvan_no, " van no
zvan_print LIKE zvantr-zvan_print, " van manifest print
tknum LIKE vttk-tknum, " Shipment No "ANV 11523
zeod_print LIKE zvantr-zeod_print, " eod manifest print
zzpackclass LIKE vekp-zzpackclass, " package class
zzti LIKE vekp-zzti, " T.I. value
vstel LIKE likp-vstel, "Shipping point RM050906
anzpk TYPE znopack, "No of packages in dlv MB01+
END OF ty_data.
TYPES:BEGIN OF x_likp ,
vbeln LIKE likp-vbeln,
vstel LIKE likp-vstel, "RM050906
lgtor LIKE likp-lgtor,
zzroute2lgtor LIKE likp-zzroute2lgtor, "MB01
route LIKE likp-route,
wadat LIKE likp-wadat,
zz2route LIKE likp-zz2route, "MB01+
zzexproute LIKE likp-zzexproute, "MB01+
zzroute2 LIKE likp-zzroute2, "MB01+
anzpk LIKE likp-anzpk,
END OF x_likp.
TYPES: BEGIN OF x_vbuk,
vbeln TYPE vbuk-vbeln,
wbstk TYPE vbuk-wbstk, " Goods movement status
kostk TYPE vbuk-kostk, " Picking status
END OF x_vbuk.
TYPES: BEGIN OF x_lips,
vbeln TYPE lips-vbeln, " delivery
posnr TYPE lips-posnr, " item
pstyv TYPE lips-pstyv,
matnr TYPE lips-matnr,
charg TYPE lips-charg,
END OF x_lips.
TYPES: BEGIN OF x_vbup,
vbeln TYPE vbup-vbeln, " delivery
posnr TYPE vbup-posnr, " item
lvsta TYPE vbup-lvsta, " warehouse status
END OF x_vbup.
TYPES: BEGIN OF x_vepo,
venum TYPE vepo-venum, "Internal Handling Unit
Number
vepos TYPE vepo-vepos, "Handling Unit Item
vbeln TYPE vepo-vbeln, " delivery
posnr TYPE vepo-posnr, " item
exidv TYPE vekp-exidv,
END OF x_vepo.
TYPES: BEGIN OF x_vepo1,
venum TYPE vekp-venum, "Internal Handling Unit
Number
exidv TYPE vekp-exidv,
END OF x_vepo1.
Start of changes by ANV SR#11523
TYPES: BEGIN OF x_vttp,
tknum TYPE tknum, " Shipment No
tpnum TYPE tpnum, " Item No
vbeln TYPE vbup-vbeln, " delivery
laufk LIKE vttk-laufk, " leg indicator MB01+
END OF x_vttp.
End of changes by ANV SR#11523
************************************************************************
Data
*
************************************************************************
RANGES: r_del FOR likp-vbeln,
r_lgtor FOR likp-lgtor.
RANGES: r_vanno FOR zvantr-zvan_no,
r_palno FOR zpallettr-zpallet_no.
DATA: BEGIN OF number_range OCCURS 0,
mark(1),
id(3),
num(10) TYPE n,
desc LIKE zpalletmd-zdesc,
END OF number_range.
DATA: t_disp_tab TYPE STANDARD TABLE OF zpickdisp,
t_data_tab TYPE ty_data OCCURS 0 WITH HEADER LINE,
it_likp TYPE x_likp OCCURS 0 WITH HEADER LINE, "SUM
it_vbuk TYPE x_vbuk OCCURS 0 WITH HEADER LINE, "SUM
it_lips TYPE x_lips OCCURS 0 WITH HEADER LINE, "SUM
it_vbup TYPE x_vbup OCCURS 0 WITH HEADER LINE, "SUM
it_vepo TYPE x_vepo OCCURS 0 WITH HEADER LINE, "SUM
it_vepo2 TYPE x_vepo OCCURS 0 WITH HEADER LINE, "SUM
*{ INSERT UKMK900355 3
t_vepo_low TYPE x_vepo OCCURS 0 WITH HEADER LINE, " AS01
*} INSERT
it_vepo1 TYPE x_vepo1 OCCURS 0 WITH HEADER LINE, "SUM
it_vttp TYPE x_vttp OCCURS 0 WITH HEADER LINE, "ANV SR#11523
t_disp_head TYPE STANDARD TABLE OF zpickhead.
DATA wa_item_tab TYPE zpickdisp OCCURS 0 WITH HEADER LINE.
"ANV SR#11113
DATA: w_numrnge LIKE number_range,
w_number(10) TYPE n.
DATA: t_likp LIKE likp OCCURS 0 WITH HEADER LINE,
t_lips LIKE lips OCCURS 0 WITH HEADER LINE,
t_vbuk LIKE vbuk OCCURS 0 WITH HEADER LINE,
t_vbup LIKE vbup OCCURS 0 WITH HEADER LINE,
t_vepo LIKE vepo OCCURS 0 WITH HEADER LINE,
t_vekp LIKE vekp OCCURS 0 WITH HEADER LINE,
t_vantr LIKE zvantr OCCURS 0 WITH HEADER LINE,
t_pallettr LIKE zpallettr OCCURS 0 WITH HEADER LINE,
w_likp like likp,
w_lips LIKE lips,
w_vbuk LIKE vbuk,
w_vbup LIKE vbup,
w_vepo LIKE vepo,
w_vekp LIKE vekp,
w_vepo TYPE x_vepo1,
w_vbup TYPE x_vbup,
w_vttp TYPE x_vttp, " ANV SR#11523
w_lips TYPE x_lips,
w_vbuk TYPE x_vbuk,
w_likp TYPE x_likp, "MB01-+
w_tplst LIKE vttk-tplst. "MB01+
DATA: s_variant LIKE disvariant, "MB01+
def_variant LIKE disvariant.
ALV DATA *****
DATA:
g_grid TYPE REF TO cl_gui_alv_grid,
g_sort TYPE slis_t_sortinfo_alv,
g_custom_container TYPE REF TO cl_gui_custom_container,
g_layout TYPE slis_layout_alv,
gt_fieldcat TYPE slis_t_fieldcat_alv,
t_fldcat LIKE LINE OF gt_fieldcat,
g_keyinfo TYPE slis_keyinfo_alv,
gt_events TYPE slis_t_event,
gs_event TYPE slis_alv_event,
w_sy_repid LIKE sy-repid.
DATA: BEGIN OF seltab OCCURS 0.
INCLUDE STRUCTURE rsparams.
DATA: END OF seltab.
SYSTEM GENERATED TABLE CONTROL DATA ********
DECLARATION OF TABLECONTROL 'TC_TABCON' ITSELF
CONTROLS: tc_tabcon TYPE TABLEVIEW USING SCREEN 0100.
LINES OF TABLECONTROL 'TC_TABCON'
DATA: g_tc_tabcon_lines LIKE sy-loopc.
DATA: ok_code LIKE sy-ucomm.
************************************************************************
Constants
*
************************************************************************
CONSTANTS: c_data_class LIKE klah-class VALUE 'DG_DATA',
c_mat_class LIKE rmclf-klart VALUE '001',
c_pack LIKE lips-mtart VALUE 'VERP',
c_a(1) VALUE 'A',
c_b(1) VALUE 'B',
c_c(1) VALUE 'C',
c_yes(1) VALUE 'X',
c_no(1) VALUE ' '.
************************************************************************
Selection screen
*
************************************************************************
standard report select options block
SELECTION-SCREEN BEGIN OF BLOCK a WITH FRAME TITLE text-002.
SELECT-OPTIONS:
s_wadat FOR likp-wadat NO-EXTENSION OBLIGATORY. " Goods Issue Date
*parameters: "TR01-
p_vstel like tvst-vstel obligatory. " Shipping Point "TR01-
SELECT-OPTIONS: "TR01+
p_vstel FOR tvst-vstel. " Shipping Point "TR01+
SELECT-OPTIONS:
s_lfart FOR likp-lfart, " Delivery type
s_lgtor FOR t30b-lgtor, " Door selection
s_exidv FOR vekp-exidv, " Handling Unit
s_vbeln FOR likp-vbeln, " Delivery "MB01-+
s_lfdat FOR likp-lfdat. " Delivery date
PARAMETERS:
p_exdata AS CHECKBOX. " Show extra columns flag
SELECTION-SCREEN END OF BLOCK a.
van/pallet specific select options block
SELECTION-SCREEN BEGIN OF BLOCK b WITH FRAME TITLE text-001.
SELECT-OPTIONS:
s_palno FOR zpallettr-zpallet_no, " no-extension,
s_vanno FOR zvantr-zvan_no. " no-extension.
SELECT-OPTIONS:
s_deppnt FOR zpallettr-zdep_point, "Jvdm01
s_tplst FOR vttk-tplst. "MB01
SELECTION-SCREEN END OF BLOCK b.
MB01 - START - Display variant
SELECTION-SCREEN BEGIN OF BLOCK c WITH FRAME TITLE text-019.
PARAMETERS: p_vari LIKE disvariant-variant.
SELECTION-SCREEN END OF BLOCK c.
MB01 - END
************************************************************************
Value Request Events
*
************************************************************************
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_palno-low.
CLEAR: number_range, w_number .
REFRESH number_range.
select numbers and display pop up screen for selection
PERFORM select_pal_nos.
s_palno-low = w_number.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_palno-high.
CLEAR: number_range, w_number .
REFRESH number_range.
select numbers and display pop up screen for selection
PERFORM select_pal_nos.
s_palno-high = w_number.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_vanno-low.
CLEAR: number_range, w_number .
REFRESH number_range.
select numbers and display pop up screen for selection
PERFORM select_van_nos.
s_vanno-low = w_number.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_vanno-high.
CLEAR: number_range, w_number .
REFRESH number_range.
select numbers and display pop up screen for selection
PERFORM select_van_nos.
s_vanno-high = w_number.
MB01 - START - display variant
F4-Help for variant
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.
PERFORM f4_for_variant.
MB01 - END
************************************************************************
At Selection Screen
*
************************************************************************
AT SELECTION-SCREEN.
PERFORM validate_selections.
************************************************************************
Initialization
*
************************************************************************
INITIALIZATION.
MB01 - START INSERT
1. Transportation planning point
Import transportation planning point from user parameters and
populate
select option.
GET PARAMETER ID 'TDP' FIELD w_tplst.
MOVE: 'I' TO s_tplst-sign,
'EQ' TO s_tplst-option,
w_tplst TO s_tplst-low.
APPEND s_tplst.
2. Display variant
CLEAR s_variant.
s_variant-report = sy-repid.
Get default variant
s_def_variante = s_variant.
CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
EXPORTING
i_save = 'A'
CHANGING
cs_variant = s_variant
EXCEPTIONS
not_found = 2.
IF sy-subrc = 0.
p_vari = s_variant-variant.
ENDIF.
MB01 - END INSERT
************************************************************************
Start of selection
*
************************************************************************
START-OF-SELECTION.
clear all data tables
CLEAR: t_likp,
it_likp,
t_lips,
t_vbuk,
t_vbup,
t_vepo,
t_vantr,
t_pallettr,
w_likp,
w_lips,
w_vbuk,
w_vbup,
w_vepo,
w_vekp.
REFRESH: t_likp,
it_likp,
t_lips,
t_vbuk,
t_vbup,
t_vepo,
t_vantr,
t_pallettr.
select data for ALV
due to different input parameters being used, to streamline the data
selection process, different selection methods are required
IF NOT s_vanno IS INITIAL
OR NOT s_palno IS INITIAL
OR NOT s_deppnt IS INITIAL. "Jvdm01
if selecting by van/pallet number, need to select the data from the
handling unit upwards to delivery
PERFORM select_data_up.
ELSE.
otherwise the data can be selected from the delivery downwards
PERFORM select_data_down.
ENDIF.
************************************************************************
End of selection
*
************************************************************************
END-OF-SELECTION.
call hierarchical ALV display function module
CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
EXPORTING
i_callback_program = 'ZWMR_PICK_STATUS_REPORT'
i_callback_pf_status_set = 'SET_STATUS'
i_callback_user_command =
'USER_COMMAND' "custom gui status form
is_layout = g_layout "user command form
it_fieldcat = gt_fieldcat
it_sort = g_sort
i_save = 'X' "MB01+
is_variant = s_variant
it_events = gt_events
i_tabname_header = 't_disp_head'
i_tabname_item = 't_disp_tab'
i_structure_name_header = 'ZPICKHEAD'
i_structure_name_item = 'ZPICKDISP'
is_keyinfo = g_keyinfo
TABLES
t_outtab_header = t_disp_head
t_outtab_item = t_disp_tab.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
************************************************************************
************************************************************************
FORMS
*
************************************************************************
************************************************************************
Includes inserted by Screen Painter Wizard. DO NOT CHANGE THIS LINE!
INCLUDE zwmr_pick_o01.
INCLUDE zwmr_pick_status_reporto01 .
INCLUDE zwmr_pick_i01.
INCLUDE zwmr_pick_status_reporti01 .
INCLUDE zwmr_pick_f01.
INCLUDE zwmr_pick_status_reportf01 .
&----
*& Form select_pal_nos
&----
select pallet numbers for search help
----
FORM select_pal_nos.
DATA: BEGIN OF t_palno OCCURS 0,
zpallet_no LIKE zpallettr-zpallet_no,
END OF t_palno.
select all available pallet numbers
SELECT DISTINCT zpallet_no FROM zpallettr
INTO CORRESPONDING FIELDS OF TABLE t_palno.
LOOP AT t_palno.
get pallet id
SELECT SINGLE zpallet_id FROM zpallettr
INTO number_range-id
WHERE zpallet_no = t_palno-zpallet_no.
get pallet description
SELECT SINGLE zdesc FROM zpalletmd
INTO number_range-desc
WHERE zpallet_id = number_range-id.
number_range-num = t_palno-zpallet_no.
append to search help table
APPEND number_range.
ENDLOOP.
call pop up dialog box
CALL SCREEN 0100 STARTING AT 5 5.
ENDFORM. " select_pal_nos
*
&----
*& Form select_van_nos
&----
select van numbers for search help
----
FORM select_van_nos.
DATA: BEGIN OF t_vanno OCCURS 0,
zvan_no LIKE zvantr-zvan_no,
END OF t_vanno.
select available van numbers
SELECT DISTINCT zvan_no FROM zvantr
INTO CORRESPONDING FIELDS OF TABLE t_vanno.
LOOP AT t_vanno.
select van id
SELECT SINGLE zvan_id FROM zvantr
INTO number_range-id
WHERE zvan_no = t_vanno-zvan_no.
select van description (maintained in pallet tables)
SELECT SINGLE zdesc FROM zpalletmd
INTO number_range-desc
WHERE zpallet_id = number_range-id.
number_range-num = t_vanno-zvan_no.
append to search help table
APPEND number_range.
ENDLOOP.
call pop up dialog box
CALL SCREEN 0100 STARTING AT 5 5.
ENDFORM. " select_van_nos
&----
*& Form select_data_down
&----
select data if selecting from delivery down
----
FORM select_data_down.
select all deliveries from LIKP that fulfill selection criteria
Start SU01 optmization changes
SELECT vbeln vstel lgtor route wadat "RM050906
SELECT vbeln vstel lgtor route wadat
zzroute2lgtor zz2route zzexproute zzroute2 anzpk "MB01-+
FROM likp INTO CORRESPONDING FIELDS OF TABLE it_likp"MB01-+
WHERE vbeln IN s_vbeln
AND vstel IN p_vstel
AND lfart IN s_lfart
AND wadat IN s_wadat
AND lfdat IN s_lfdat "MB01+
AND
( lgtor IN s_lgtor OR zzroute2lgtor IN s_lgtor ) ."MB01+
IF sy-subrc NE 0.
no data found
MESSAGE i007.
EXIT.
ENDIF.
IF NOT t_likp[] IS INITIAL. "SUM
IF NOT it_likp[] IS INITIAL.
SORT it_likp BY vbeln. "SUM
select sales document headers from VBUK
SELECT vbeln wbstk kostk
FROM vbuk INTO TABLE it_vbuk
FOR ALL ENTRIES IN it_likp "SUM
WHERE vbeln EQ it_likp-vbeln. "SUM
SORT it_vbuk BY vbeln.
select all relevant delivery items from LIPS
SELECT vbeln posnr pstyv matnr charg
FROM lips INTO TABLE it_lips
FOR ALL ENTRIES IN it_likp
WHERE vbeln EQ it_likp-vbeln
AND pckpf NE 'B' "cannot be packed "AS05
AND pstyv NE 'ZPAC' "AS05
AND pstyv NE 'ZGDP' "TR02+ "AS05
AND lfimg GT 0. "TR01+
ENDIF.
IF NOT it_lips[] IS INITIAL.
select all sales document line items from VBUP
SORT it_lips BY vbeln posnr. "SUM
SELECT vbeln posnr lvsta
FROM vbup INTO TABLE it_vbup
FOR ALL ENTRIES IN it_lips
WHERE vbeln EQ it_lips-vbeln
AND posnr = it_lips-posnr.
SORT it_vbup BY vbeln posnr.
select corresponding handling unit ID's (venum)
*----
TR03 Replace
start
select * from vepo appending corresponding fields of table t_vepo
for all entries in t_lips
where vbeln = t_lips-vbeln
and posnr = t_lips-posnr
and matnr = t_lips-matnr
and charg = t_lips-charg.
SELECT vepoVENUM vepoVEPOS vepovbeln vepoposnr
FROM vepo as vepo
INNER JOIN vekp as vekp ON vepovenum = vekpvenum
APPENDING corresponding fields of table it_vepo
FOR ALL ENTRIES IN it_lips
WHERE vepo~vbeln = it_lips-vbeln
AND vepo~posnr = it_lips-posnr
AND vepo~matnr = it_lips-matnr
AND vepo~charg = it_lips-charg
AND vekp~exidv IN s_exidv.
SELECT venum vepos vbeln posnr
FROM vepo INTO TABLE it_vepo2
FOR ALL ENTRIES IN it_lips
WHERE vbeln = it_lips-vbeln
AND posnr = it_lips-posnr
AND matnr = it_lips-matnr
AND charg = it_lips-charg.
SORT it_vepo2 BY venum vepos.
*{ INSERT UKMK900355 1
Ice-multis: replace lower-level HUs with highest level " AS01
PERFORM replace_highest_hu. " AS01
*} INSERT
Start of changes by ANV SR#11523
MB01 - extract shipment header as well to populate leg indicator
Therefore, join vttp with vttk
Limit as well by transportation planning point
SELECT vttptknum vttptpnum vttpvbeln vttklaufk
FROM vttp INNER JOIN vttk
ON vttptknum = vttktknum
INTO TABLE it_vttp
FOR ALL ENTRIES IN it_lips
WHERE vttp~vbeln = it_lips-vbeln
AND vttk~tplst IN s_tplst.
MB01 - END
End of changes by ANV SR#11523
IF NOT it_vepo2[] IS INITIAL.
SELECT venum exidv
FROM vekp INTO TABLE it_vepo1
FOR ALL ENTRIES IN it_vepo2
WHERE venum = it_vepo2-venum
AND exidv IN s_exidv.
ENDIF.
SORT it_vepo1 BY venum.
CLEAR: w_vepo, it_vepo.
LOOP AT it_vepo1.
READ TABLE it_vepo2 WITH KEY venum = it_vepo1-venum.
IF sy-subrc = 0.
it_vepo2-exidv = it_vepo1-exidv.
MODIFY it_vepo2 TRANSPORTING exidv
WHERE venum = it_vepo1-venum .
ENDIF.
ENDLOOP.
DELETE it_vepo2 WHERE exidv IS initial.
it_vepo[] = it_vepo2[].
*----
TR03 Replace end
ENDIF.
build process table
PERFORM move_to_table.
ENDFORM. "select_data_down
&----
*& Form select_data_up
&----
select data if selecting from van/pallet up
----
FORM select_data_up.
IF NOT s_vanno IS INITIAL.
if van then select van numbers and hence pallet numbers
SELECT * FROM zvantr INTO TABLE t_vantr
WHERE zvan_no IN s_vanno.
and vstel eq p_vstel."TR01-
IF NOT t_vantr[] IS INITIAL.
SORT t_vantr BY zvan_id zvan_no vstel zpallet_no. "SUM
SELECT * FROM zpallettr INTO TABLE t_pallettr
FOR ALL ENTRIES IN t_vantr
WHERE zpallet_no EQ t_vantr-zpallet_no
AND zdep_point IN s_deppnt. "Jvdm01
and vstel eq p_vstel."TR01-
ENDIF.
ELSE.
otherwise can get pallet numbers directly
SELECT * FROM zpallettr INTO TABLE t_pallettr
WHERE zpallet_no IN s_palno
AND zdep_point IN s_deppnt. "Jvdm01
and vstel eq p_vstel."TR01-
ENDIF.
IF NOT t_pallettr[] IS INITIAL.
from the pallet nos. we can select the handling units
SORT t_pallettr BY zpallet_id zpallet_no vstel exidv. "SUM
SELECT * FROM vekp INTO TABLE t_vekp
FOR ALL ENTRIES IN t_pallettr
WHERE exidv EQ t_pallettr-exidv
AND exidv NE space
AND exidv IN s_exidv "TR03+
AND ( exida = 'E' "TR01+
OR exida = 'F' ). "TR01+
ENDIF.
SORT t_vekp BY venum. "SUM
IF NOT t_vekp[] IS INITIAL.
build vbeln range from t_vekp.
LOOP AT t_vekp.
r_del-sign = 'I'.
r_del-option = 'EQ'.
r_del-low = t_vekp-vpobjkey.
APPEND r_del.
ENDLOOP.
select all deliveries from LIKP that correspond to HU's
SELECT * FROM likp INTO TABLE t_likp
WHERE vbeln IN r_del
AND wadat IN s_wadat
AND lfart IN s_lfart.
ENDIF.
MB01- START
SELECT vbeln lgtor route wadat
FROM likp INTO TABLE it_likp
WHERE vbeln IN r_del
AND wadat IN s_wadat
AND lfart IN s_lfart.
SELECT vbeln vstel lgtor route wadat
zzroute2lgtor zz2route zzexproute zzroute2 anzpk "MB01-+
FROM likp INTO CORRESPONDING FIELDS OF TABLE it_likp
WHERE vbeln IN r_del
AND lfart IN s_lfart
AND wadat IN s_wadat "MB01-+
AND lfdat IN s_lfdat. "MB01+
MB01- END
ENDIF.
IF NOT it_likp[] IS INITIAL.
SORT it_likp BY vbeln . "SUM
select sales document headers from VBUK
SELECT * FROM vbuk INTO TABLE t_vbuk
FOR ALL ENTRIES IN t_likp
WHERE vbeln EQ t_likp-vbeln.
SELECT vbeln wbstk kostk
FROM vbuk INTO TABLE it_vbuk
FOR ALL ENTRIES IN it_likp
WHERE vbeln EQ it_likp-vbeln.
SORT it_vbuk BY vbeln. "SUM
select all relevant delivery items from LIPS
SELECT * FROM lips INTO TABLE t_lips
FOR ALL ENTRIES IN t_likp
WHERE vbeln EQ t_likp-vbeln
AND pstyv NE 'ZPAC'
AND pstyv NE 'ZGDP' "TR02+
AND lfimg GT 0. "TR01+
SELECT vbeln posnr pstyv matnr charg
FROM lips INTO TABLE it_lips
FOR ALL ENTRIES IN it_likp
WHERE vbeln EQ it_likp-vbeln
AND pckpf NE 'B' "cannot be packed "AS05
AND pstyv NE 'ZPAC' "AS05
AND pstyv NE 'ZGDP' "TR02+ "AS05
AND lfimg GT 0. "TR01+
ENDIF.
IF NOT it_lips[] IS INITIAL.
SORT it_lips BY vbeln posnr. "SUM
select all sales document line items from VBUP
SELECT * FROM vbup INTO TABLE t_vbup
FOR ALL ENTRIES IN t_lips
WHERE vbeln EQ t_lips-vbeln
AND posnr = t_lips-posnr.
Start of changes by ANV SR#11523
MB01 - START
join vttp with vttk to obtain leg indicator
SELECT tknum tpnum vbeln
FROM vttp INTO TABLE it_vttp
FOR ALL ENTRIES IN it_lips
WHERE vbeln = it_lips-vbeln.
SELECT vttptknum vttptpnum vttpvbeln vttklaufk
FROM vttp INNER JOIN vttk
ON vttptknum = vttktknum
INTO TABLE it_vttp
FOR ALL ENTRIES IN it_lips
WHERE vttp~vbeln = it_lips-vbeln
AND vttk~tplst IN s_tplst.
MB01 - END
End of changes by ANV SR#11523
SELECT vbeln posnr lvsta
FROM vbup INTO TABLE it_vbup
FOR ALL ENTRIES IN it_lips
WHERE vbeln EQ it_lips-vbeln
AND posnr = it_lips-posnr.
SORT t_vbup BY vbeln posnr. "SUM
select corresponding handling unit ID's (venum)
SELECT * FROM vepo APPENDING CORRESPONDING FIELDS OF TABLE t_vepo
FOR ALL ENTRIES IN t_lips
WHERE vbeln = t_lips-vbeln
AND posnr = t_lips-posnr
AND matnr = t_lips-matnr
AND charg = t_lips-charg.
SELECT venum vepos vbeln posnr
FROM vepo APPENDING CORRESPONDING FIELDS OF TABLE it_vepo
FOR ALL ENTRIES IN it_lips
WHERE vbeln = it_lips-vbeln
AND posnr = it_lips-posnr
AND matnr = it_lips-matnr
AND charg = it_lips-charg.
*{ INSERT UKMK900355 1
it_vepo2[] = it_vepo[]. " DS01
PERFORM replace_highest_hu. " DS01
it_vepo[] = it_vepo2[]. " DS01
*} INSERT
ENDIF.
build process table
PERFORM move_to_table.
ENDFORM. "select_data_up
&----
*& Form move_to_table
&----
move data to processing table
----
FORM move_to_table.
LOOP AT it_vepo.
CLEAR t_data_tab.
delivery lines.
CLEAR w_lips.
READ TABLE it_lips WITH KEY vbeln = it_vepo-vbeln
posnr = it_vepo-posnr
INTO w_lips BINARY SEARCH. "SUM
MOVE-CORRESPONDING w_lips TO t_data_tab.
sales document line items
CLEAR w_vbup.
READ TABLE it_vbup WITH KEY vbeln = it_vepo-vbeln
posnr = it_vepo-posnr
INTO w_vbup BINARY SEARCH. "SUM
if w_vbup-kosta = space. "TR01-
not relevant for picking
delete t_vepo. "TR01-
continue. "TR01-
else. "TR01-
MOVE-CORRESPONDING w_vbup TO t_data_tab.
endif. "TR01-
sales doc header
CLEAR w_vbuk.
READ TABLE it_vbuk WITH KEY vbeln = it_vepo-vbeln
INTO w_vbuk BINARY SEARCH. "SUM
MOVE-CORRESPONDING w_vbuk TO t_data_tab.
delivery header
CLEAR w_likp.
READ TABLE it_likp WITH KEY vbeln = it_vepo-vbeln
INTO w_likp BINARY SEARCH. "SUM
MOVE-CORRESPONDING w_likp TO t_data_tab.
MB01 - START
DATA: w_routetype TYPE i. "0=non-global,1=1st route,2=2nd
route,3=both
At this point move DOOR2 if it falls within the global route scenario
and the door2 is satisfies the selection criteria for door
1. Does delivery fall within global route scenario
CLEAR w_routetype.
IF w_likp-zz2route = 'Y' .
1.a. First route - does door1 satisfy the selection criteria
IF w_likp-lgtor IN s_lgtor.
w_routetype = 1.
MOVE w_likp-zzexproute TO t_data_tab-route.
1.b. Second route - does door2 satisfy the selection criteria
ELSEIF w_likp-zzroute2lgtor IN s_lgtor.
here we need to move door2 to lgtor
w_routetype = 2.
MOVE w_likp-zzroute2lgtor TO t_data_tab-lgtor.
MOVE w_likp-zzroute2 TO t_data_tab-route.
ENDIF.
If both routes satsify the criteria, append for 2nd leg ***REVISIT!
IF w_likp-lgtor IN s_lgtor AND w_likp-zzroute2lgtor IN s_lgtor.
w_routetype = 3.
ENDIF.
ENDIF.
MB01 - END
Start of changes by ANV SR#11523
MB01 - If the delivery falls within the global route scenario... need
to select either preliminary shipment leg OR subsequent leg
when laufk= 1 (prelim) and linked to route1, if laufk = 2 (subseq) &
linked to route2
Shipment Number
SORT it_vttp BY vbeln laufk.
CLEAR w_vttp.
CASE w_routetype.
WHEN 0.
READ TABLE it_vttp WITH KEY vbeln = it_vepo-vbeln
INTO w_vttp BINARY SEARCH.
WHEN 1.
READ TABLE it_vttp WITH KEY vbeln = it_vepo-vbeln
laufk = '1'
INTO w_vttp BINARY SEARCH.
WHEN 2.
READ TABLE it_vttp WITH KEY vbeln = it_vepo-vbeln
laufk = '3'
INTO w_vttp BINARY SEARCH.
WHEN 3. "REVISIT
ENDCASE.
MOVE w_vttp-tknum TO t_data_tab-tknum.
MB01 - END
End of changes by ANV SR#11523
select handling unit info using vepo entry
CLEAR w_vekp.
IF t_vekp[] IS INITIAL.
SELECT SINGLE * FROM vekp INTO w_vekp
WHERE venum = it_vepo-venum.
ELSE.
READ TABLE t_vekp WITH KEY venum = it_vepo-venum
INTO w_vekp BINARY SEARCH. "SUM
.
IF sy-subrc NE 0.
SELECT SINGLE * FROM vekp INTO w_vekp
WHERE venum = t_vepo-venum.
ENDIF.
ENDIF.
MOVE-CORRESPONDING w_vekp TO t_data_tab.
*{ INSERT UKMK900355 2
WM status for HU "AS03
SELECT SINGLE * FROM zhu_to_link WHERE lgnum EQ w_vekp-lgnum"AS03
AND exidv EQ w_vekp-exidv."AS03
IF sy-subrc EQ 0. "AS03
IF zhu_to_link-zpick_comp EQ space. "AS03
t_data_tab-lvsta = 'B'. "AS03
ELSE. "AS03
t_data_tab-lvsta = 'C'. "AS03
ENDIF. "AS03
ENDIF. "AS03
*} INSERT
select pallet / van load information "Jvdm01-
SELECT SINGLE zpallet_no zcount_check FROM zpallettr "Jvdm01-
INTO (t_data_tab-zpallet_no, "Jvdm01-
t_data_tab-zcount_check) "Jvdm01-
WHERE exidv EQ w_vekp-exidv. "Jvdm01-
PERFORM read_pallet. "MB01+
SELECT SINGLE zpallet_no zcount_check zdep_point "Jvdm01+
FROM zpallettr "Jvdm01+
INTO (t_data_tab-zpallet_no, "Jvdm01+
t_data_tab-zcount_check, "Jvdm01+
t_data_tab-zdep_point) "Jvdm01+
WHERE exidv EQ w_vekp-exidv. "Jvdm01+
WHERE exidv EQ w_vekp-exidv "MB01-+
AND zpallet_id = t_data_tab-lgtor."MB01+
MB01 - INSERT START
If pallet number specified and
we are in the global route scenario & both doors fall within the
selection criteria, we need to copy the one that is currently in a
specified pallet
*
IF NOT s_palno IS INITIAL AND not t_data_tab-zpallet_no in s_palno
AND w_routetype = '3' .
Switch doors & get 2nd shipment
MOVE w_likp-zzroute2lgtor TO t_data_tab-lgtor.
MOVE w_likp-zzroute2 TO t_data_tab-route.
Read subsequent leg shipment
READ TABLE it_vttp WITH KEY vbeln = it_vepo-vbeln
laufk = '3'
INTO w_vttp BINARY SEARCH.
IF sy-subrc = 0.
MOVE w_vttp-tknum TO t_data_tab-tknum.
ENDIF.
PERFORM read_pallet. "MB01+
ENDIF.
MB01 - INSERT END
IF NOT t_data_tab-zpallet_no IN s_palno. "TR01+
CONTINUE. "TR01+
ENDIF. "TR01+
IF sy-subrc = 0. "mb01+
perform read_van. "MB01+
SELECT SINGLE zvan_no zvan_print zeod_print FROM zvantr
INTO (t_data_tab-zvan_no,
t_data_tab-zvan_print,
t_data_tab-zeod_print)
WHERE zpallet_no EQ t_data_tab-zpallet_no.
MB01 - INSERT START
If van number specified and
we are in the global route scenario & both doors fall within the
selection criteria, we need to copy the one that is currently on a
specified van
IF NOT s_vanno IS INITIAL AND not t_data_tab-zvan_no in s_vanno AND
w_routetype = '3' .
Switch doors & get 2nd shipment
MOVE w_likp-zzroute2lgtor TO t_data_tab-lgtor.
MOVE w_likp-zzroute2 TO t_data_tab-route.
Read subsequent leg shipment
READ TABLE it_vttp WITH KEY vbeln = it_vepo-vbeln
laufk = '3'
INTO w_vttp BINARY SEARCH.
IF sy-subrc = 0.
MOVE w_vttp-tknum TO t_data_tab-tknum.
ENDIF.
PERFORM read_pallet. "MB01+
perform read_van.
ENDIF. "mb01-
*
MB01 - INSERT END
IF NOT t_data_tab-zvan_no IN s_vanno. "TR01+
CONTINUE. "TR01+
ENDIF. "TR01+
ENDIF.
APPEND t_data_tab.
ENDLOOP.
*-----> TR01+ start
If the delivery has yet to be packed, then need to include in report
Thus delete t_lips here and if any entries left after looping through
t_vepo, these will also need to be added to t_data_tab
if the selection is by handling unit though we do not want
these"TR03+
IF s_exidv IS INITIAL. "TR03+
*{ REPLACE UKMK900355 1
*\ LOOP AT it_vepo.
*\ READ TABLE it_lips WITH KEY vbeln = it_vepo-vbeln
*\ posnr = it_vepo-posnr
*\ BINARY SEARCH. "SUM
*\ .
*\ IF sy-subrc = 0.
*\ DELETE it_lips INDEX sy-tabix.
*\ ENDIF.
*\ ENDLOOP.
Higher-level HUs can contain more than one delivery item " AS01
LOOP AT it_lips. " AS01
READ TABLE t_vepo_low WITH KEY vbeln = it_lips-vbeln " AS01
posnr = it_lips-posnr. " AS01
CHECK sy-subrc EQ 0. " AS01
DELETE it_lips. " AS01
ENDLOOP. " AS01
*} REPLACE
IF NOT it_lips[] IS INITIAL.
move any unpacked items to the data table
PERFORM move_lips_to_table.
ENDIF.
ENDIF. "TR03+
*<---- TR01+ End
get relevant status icons
PERFORM select_icons.
prepare ALV data
PERFORM prepare_alv.
ENDFORM. " select_data
&----
*& Form select_icons
&----
select icons for display and move data to display table
----
FORM select_icons.
DATA: w_disp_tab LIKE zpickdisp,
w_disp_head LIKE zpickhead,
w_color LIKE zpickdisp-color,
ov_icon LIKE zpickdisp-ov_icon,
gi_icon LIKE zpickdisp-gi_icon,
to_icon LIKE zpickdisp-to_icon,
lp_icon LIKE zpickdisp-lp_icon,
pc_icon LIKE zpickdisp-pc_icon,
lv_icon LIKE zpickdisp-lv_icon,
vm_icon LIKE zpickdisp-vm_icon,
em_icon LIKE zpickdisp-em_icon,
sp_icon LIKE zpickdisp-sp_icon, " ANV SR#11523
t_ovst_tab LIKE t_disp_tab WITH HEADER LINE.
CONSTANTS: c_col1(3) VALUE 'C10',
c_col2(3) VALUE 'C20'.
SORT t_data_tab BY lgtor vbeln.
w_color = c_col2.
LOOP AT t_data_tab.
AT NEW lgtor.
fill ALV header table
CLEAR w_disp_head.
w_disp_head-lgtor = t_data_tab-lgtor.
APPEND w_disp_head TO t_disp_head.
ENDAT.
goods issue status & overall amber/green only
CASE t_data_tab-wbstk.
WHEN c_c.
MOVE icon_green_light TO gi_icon.
MOVE icon_green_light TO ov_icon.
WHEN OTHERS.
MOVE icon_red_light TO gi_icon.
MOVE icon_yellow_light TO ov_icon.
ENDCASE.
transfer order status
CASE t_data_tab-lvsta.
WHEN c_a.
MOVE icon_red_light TO to_icon.
WHEN c_b.
MOVE icon_yellow_light TO to_icon.
WHEN c_c.
MOVE icon_green_light TO to_icon.
WHEN space.
write N/A
to_icon = 'N/A'.
ENDCASE.
loaded to pallet status
IF NOT t_data_tab-zpallet_no IS INITIAL.
MOVE icon_green_light TO lp_icon.
ELSE.
MOVE icon_red_light TO lp_icon.
ENDIF.
pallet count status
IF NOT t_data_tab-zcount_check IS INITIAL.
MOVE icon_green_light TO pc_icon.
ELSE.
MOVE icon_red_light TO pc_icon.
ENDIF.
loaded to van status
IF NOT t_data_tab-zvan_no IS INITIAL.
MOVE icon_green_light TO lv_icon.
ELSE.
MOVE icon_red_light TO lv_icon.
ENDIF.
van manifest status
IF NOT t_data_tab-zvan_print IS INITIAL.
MOVE icon_green_light TO vm_icon.
ELSE.
MOVE icon_red_light TO vm_icon.
ENDIF.
Start of changes by ANV SR#11523
Shipment status
IF NOT t_data_tab-tknum IS INITIAL.
MOVE icon_green_light TO sp_icon.
ELSE.
MOVE icon_red_light TO sp_icon.
ENDIF.
End of changes by ANV SR#11523
end of day manifest status
IF NOT t_data_tab-zeod_print IS INITIAL.
MOVE icon_green_light TO em_icon.
ELSE.
MOVE icon_red_light TO em_icon.
ENDIF.
move working data table to display table
MOVE-CORRESPONDING t_data_tab TO w_disp_tab.
w_disp_tab-ov_icon = ov_icon.
w_disp_tab-gi_icon = gi_icon.
w_disp_tab-to_icon = to_icon.
w_disp_tab-lp_icon = lp_icon.
w_disp_tab-pc_icon = pc_icon.
w_disp_tab-lv_icon = lv_icon.
w_disp_tab-vm_icon = vm_icon.
w_disp_tab-em_icon = em_icon.
w_disp_tab-sp_icon = sp_icon. "ANV SR#11523
w_disp_tab-color = w_color.
fill N/A values for initial fields for display
IF w_disp_tab-packvorschr IS INITIAL.
w_disp_tab-packvorschr = 'N/A'.
ENDIF.
IF w_disp_tab-exidv IS INITIAL.
w_disp_tab-exidv = 'N/A'.
ENDIF.
IF w_disp_tab-zpallet_no IS INITIAL.
WRITE 'N/A' TO w_disp_tab-zpallet_no.
ENDIF.
IF w_disp_tab-zvan_no IS INITIAL.
WRITE 'N/A' TO w_disp_tab-zvan_no.
ENDIF.
display different color for new doc number
AT END OF vbeln.
IF w_color = c_col1.
w_color = c_col2.
ELSEIF w_color = c_col2.
w_color = c_col1.
ENDIF.
ENDAT.
APPEND w_disp_tab TO t_disp_tab.
CLEAR w_disp_tab.
ENDLOOP.
we have all the icons in display but need to check the overall status
as this refers to the line items
green and amber statuses already set and use the same criteria as the
goods issue status unless detected as red here
DATA: ov_stat_red(1).
CLEAR w_disp_tab.
SORT t_disp_tab BY vbeln.
LOOP AT t_disp_tab INTO w_disp_tab.
AT NEW vbeln.
check all line items for delivery
LOOP AT t_data_tab WHERE vbeln = w_disp_tab-vbeln.
IF t_data_tab-lvsta = c_a.
set overall status to red
ov_stat_red = c_yes.
EXIT.
ELSE.
leave green/amber status icon as previosly determined
ENDIF.
ENDLOOP.
IF ov_stat_red = c_yes.
set overall status to red for all items in that delivery
CLEAR ov_stat_red.
MOVE icon_red_light TO w_disp_tab-ov_icon.
MODIFY t_disp_tab FROM w_disp_tab TRANSPORTING ov_icon
WHERE vbeln = w_disp_tab-vbeln.
ENDIF.
ENDAT.
ENDLOOP.
ENDFORM. " select_icons
&----
*& Form fill_layout
&----
fill ALV layout parameters
----
FORM fill_layout.
CLEAR g_layout.
g_layout-colwidth_optimize = c_yes. " column width optimisation
g_layout-zebra = space. " alternate line colors
g_layout-box_fieldname = 'MARK'. " checkbox fieldname
g_layout-info_fieldname = 'COLOR'. " highlight row indicator
g_layout-no_vline = space. " vertical line
g_layout-key_hotspot = space. " hotspot field
g_layout-f2code = 'PICK'. " F2 ok_code
g_layout-numc_sum = c_yes. " sum numc fields
g_layout-box_tabname = 't_disp_head'. " checkbox table name
g_layout-expand_fieldname = 'EXPAND'. " expand field name
ENDFORM. " fill_layout
&----
*& Form fill_sort
&----
fill ALV sort table
----
FORM fill_sort.
DATA: w_g_sort TYPE slis_sortinfo_alv.
w_g_sort-spos = 1.
w_g_sort-fieldname = 'LGTOR'.
w_g_sort-tabname = 't_disp_tab'.
w_g_sort-up = c_yes.
APPEND w_g_sort TO g_sort.
w_g_sort-spos = 2.
w_g_sort-fieldname = 'VBELN'.
w_g_sort-tabname = 't_disp_tab'.
w_g_sort-up = c_yes.
APPEND w_g_sort TO g_sort.
w_g_sort-spos = 3.
w_g_sort-fieldname = 'POSNR'.
w_g_sort-tabname = 't_disp_tab'.
w_g_sort-up = c_yes.
APPEND w_g_sort TO g_sort.
w_g_sort-spos = 4.
w_g_sort-fieldname = 'WADAT'.
w_g_sort-tabname = 't_disp_tab'.
w_g_sort-up = c_yes.
APPEND w_g_sort TO g_sort.
ENDFORM. " fill_sort
&----
*& Form fill_fieldcat
&----
Fill field category structure for ALV
----
FORM fill_fieldcat.
CLEAR t_fldcat.
create field catalogue for header table
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = 'ZWMR_PICK_STATUS_REPORT'
i_internal_tabname = 't_disp_head'
i_structure_name = 'ZPICKHEAD'
i_client_never_display = c_yes
CHANGING
ct_fieldcat = gt_fieldcat[].
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ceate field catalogue for items table
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = 'ZWMR_PICK_STATUS_REPORT'
i_internal_tabname = 't_disp_tab'
i_structure_name = 'ZPICKDISP'
i_client_never_display = c_yes
CHANGING
ct_fieldcat = gt_fieldcat[].
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
modify field catalogue for this report
set no display flag if not requested on selection screen
IF p_exdata NE c_yes.
t_fldcat-no_out = c_yes.
MODIFY gt_fieldcat FROM t_fldcat TRANSPORTING no_out
WHERE fieldname EQ 'PACKVORSCHR'
OR fieldname EQ 'EXIDV'
OR fieldname EQ 'ZPALLET_NO'
OR fieldname EQ 'ZVAN_NO'
OR fieldname EQ 'ZZPACKCLASS'
OR fieldname EQ 'ZZTI'.
ENDIF.
set no display flag for item level LGTOR field
t_fldcat-no_out = c_yes.
MODIFY gt_fieldcat FROM t_fldcat TRANSPORTING no_out
WHERE fieldname EQ 'LGTOR'
AND tabname EQ 't_disp_tab'.
prevent display of technical fields
t_fldcat-tech = c_yes.
MODIFY gt_fieldcat FROM t_fldcat TRANSPORTING tech
WHERE fieldname EQ 'EXPAND'
OR fieldname EQ 'SELKZ'.
set vbeln as key
t_fldcat-key = c_yes.
MODIFY gt_fieldcat FROM t_fldcat TRANSPORTING key
WHERE fieldname EQ 'VBELN'.
prevent scrolling for info fields
t_fldcat-fix_column = c_yes.
MODIFY gt_fieldcat FROM t_fldcat TRANSPORTING fix_column
WHERE fieldname EQ 'VBELN'.
ENDFORM. " fill_fieldcat
&----
*& Form prepare_ALV
&----
Fill ALV parameters
----
FORM prepare_alv.
fill ALV key info
g_keyinfo-header01 = 'LGTOR'.
g_keyinfo-item01 = 'LGTOR'.
fill ALV events
gs_event-name = 'TOP_OF_PAGE'.
gs_event-form = 'TOP_OF_PAGE'.
APPEND gs_event TO gt_events.
fill ALV sort table
PERFORM fill_sort.
fill ALV layout structure
PERFORM fill_layout.
fill ALV field category
PERFORM fill_fieldcat.
ENDFORM. " prepare_ALV
&----
*& Form user_command
&----
form called on user command from ALV list
----
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
DATA: index TYPE i,
w_disp_head LIKE LINE OF t_disp_head,
w_door LIKE likp-lgtor.
CLEAR r_lgtor. REFRESH r_lgtor.
CASE r_ucomm.
WHEN 'PICK'. " Double click line
Start of changes by ANV SR#11113
Check field clicked on within ALVgrid report
IF rs_selfield-fieldname = 'VBELN'.
Read data table, using index of row user clicked on
READ TABLE t_disp_tab INTO wa_item_tab INDEX
rs_selfield-tabindex.
Set parameter ID for transaction screen field
SET PARAMETER ID 'VL' FIELD wa_item_tab-vbeln.
CALL TRANSACTION 'VL03N' AND SKIP FIRST SCREEN.
ENDIF.
End of changes by ANV SR#11113
WHEN 'VANM'. " Van Manifest button
read the header table where has been selected
LOOP AT t_disp_head INTO w_disp_head WHERE mark = c_yes.
r_lgtor-sign = 'I'.
r_lgtor-option = 'EQ'.
r_lgtor-low = w_disp_head-lgtor.
APPEND r_lgtor.
ENDLOOP.
print the van manifest
PERFORM print_van_manifest TABLES r_lgtor.
WHEN 'EODM'. " EOD Manifest button
read the header table where has been selected
LOOP AT t_disp_head INTO w_disp_head WHERE mark = c_yes.
r_lgtor-sign = 'I'.
r_lgtor-option = 'EQ'.
r_lgtor-low = w_disp_head-lgtor.
APPEND r_lgtor.
ENDLOOP.
print the end of day manifest
PERFORM print_eod_manifest TABLES r_lgtor.
WHEN 'REFR'. "Refresh
refresh display
w_sy_repid = sy-repid.
CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'
EXPORTING
curr_report = w_sy_repid
TABLES
selection_table = seltab.
exceptions
not_found = 1
no_report = 2
others = 3.
IF sy-subrc = 0.
SUBMIT (w_sy_repid) WITH SELECTION-TABLE seltab.
ENDIF.
ENDCASE.
ENDFORM.
&----
*& Form set_status
&----
form used to set custom gui status for ALV
----
FORM set_status USING rt_extab TYPE slis_t_extab.
DATA: t_stat_excl TYPE slis_t_extab,
w_stat_excl LIKE LINE OF t_stat_excl.
w_stat_excl-fcode = '&RNT'.
APPEND w_stat_excl TO t_stat_excl.
SET PF-STATUS 'ZSTANDARD' EXCLUDING t_stat_excl.
ENDFORM.
&----
*& Form validate_selections
&----
text
----
FORM validate_selections.
IF NOT s_lgtor IS INITIAL.
IF NOT s_exidv IS INITIAL
OR NOT s_vbeln IS INITIAL
OR NOT s_palno IS INITIAL
OR NOT s_vanno IS INITIAL.
MESSAGE e020.
EXIT.
ENDIF.
ENDIF.
IF NOT s_exidv IS INITIAL.
IF NOT s_lgtor IS INITIAL
OR NOT s_vbeln IS INITIAL
OR NOT s_palno IS INITIAL
OR NOT s_vanno IS INITIAL.
MESSAGE e020.
EXIT.
ENDIF.
ENDIF.
IF NOT s_vbeln IS INITIAL.
IF NOT s_exidv IS INITIAL
OR NOT s_lgtor IS INITIAL
OR NOT s_palno IS INITIAL
OR NOT s_vanno IS INITIAL.
MESSAGE e020.
EXIT.
ENDIF.
ENDIF.
IF NOT s_palno IS INITIAL.
IF NOT s_exidv IS INITIAL
OR NOT s_vbeln IS INITIAL
OR NOT s_lgtor IS INITIAL
OR NOT s_vanno IS INITIAL.
MESSAGE e020.
EXIT.
ENDIF.
ENDIF.
IF NOT s_vanno IS INITIAL.
IF NOT s_exidv IS INITIAL
OR NOT s_vbeln IS INITIAL
OR NOT s_palno IS INITIAL
OR NOT s_lgtor IS INITIAL.
MESSAGE e020.
EXIT.
ENDIF.
ENDIF.
ENDFORM. " validate_selections
&----
*& Form top_of_page
&----
form called by ALV genarator for top_of_page event
----
FORM top_of_page.
SORT s_vbeln BY sign DESCENDING option DESCENDING.
SORT s_palno BY sign DESCENDING option DESCENDING.
SORT s_vanno BY sign DESCENDING option DESCENDING.
SORT s_wadat BY sign DESCENDING option DESCENDING.
SORT s_exidv BY sign DESCENDING option DESCENDING.
Van Number summary
LOOP AT s_vanno.
AT NEW sign.
IF s_vanno-sign = 'I'.
FORMAT COLOR 5 ON.
WRITE:/ 'Van Numbers Included:'(003).
FORMAT COLOR OFF.
ELSEIF s_vanno-sign = 'E'.
FORMAT COLOR 6 ON.
WRITE:/ 'Van Numbers Excluded:'(004).
FORMAT COLOR OFF.
ENDIF.
ENDAT.
CASE s_vanno-option.
WHEN 'EQ'.
WRITE:/ 'Equal to'(013), 15 s_vanno-low.
WHEN 'NE'.
WRITE:/ 'Not equal to'(014), 15 s_vanno-low.
WHEN 'BT'.
WRITE:/ 'Between'(015), 15 s_vanno-low, ' and '(016),
s_vanno-high.
ENDCASE.
AT LAST.
SKIP.
ENDAT.
ENDLOOP.
Pallet Number summary
LOOP AT s_palno.
AT NEW sign.
IF s_palno-sign = 'I'.
FORMAT COLOR 5 ON.
WRITE:/ 'Pallet Numbers Included:'(005).
FORMAT COLOR OFF.
ELSEIF s_palno-sign = 'E'.
FORMAT COLOR 6 ON.
WRITE:/ 'Pallet Numbers Excluded:'(006).
FORMAT COLOR OFF.
ENDIF.
ENDAT.
CASE s_palno-option.
WHEN 'EQ'.
WRITE:/ 'Equal to'(013), 15 s_palno-low.
WHEN 'NE'.
WRITE:/ 'Not equal to'(014), 15 s_palno-low.
WHEN 'BT'.
WRITE:/ 'Between'(015), 15 s_palno-low, ' and '(016),
s_palno-high.
ENDCASE.
AT LAST.
SKIP.
ENDAT.
ENDLOOP.
Delivery Number summary
LOOP AT s_vbeln.
AT NEW sign.
IF s_vbeln-sign = 'I'.
FORMAT COLOR 5 ON.
WRITE:/ 'Delivery Numbers Included:'(007).
FORMAT COLOR OFF.
ELSEIF s_vanno-sign = 'E'.
FORMAT COLOR 6 ON.
WRITE:/ 'Delivery Numbers Excluded:'(008).
FORMAT COLOR OFF.
ENDIF.
ENDAT.
CASE s_vbeln-option.
WHEN 'EQ'.
WRITE:/ 'Equal to'(013), 15 s_vbeln-low.
WHEN 'NE'.
WRITE:/ 'Not equal to'(014), 15 s_vbeln-low.
WHEN 'BT'.
WRITE:/ 'Between'(015), 15 s_vbeln-low, ' and '(016),
s_vbeln-high.
ENDCASE.
AT LAST.
SKIP.
ENDAT.
ENDLOOP.
HU Number summary
LOOP AT s_exidv.
AT NEW sign.
IF s_exidv-sign = 'I'.
FORMAT COLOR 5 ON.
WRITE:/ 'Handling Unit Numbers Included:'(009).
FORMAT COLOR OFF.
ELSEIF s_vanno-sign = 'E'.
FORMAT COLOR 6 ON.
WRITE:/ 'Handling Unit Numbers Excluded:'(010).
FORMAT COLOR OFF.
ENDIF.
ENDAT.
CASE s_exidv-option.
WHEN 'EQ'.
WRITE:/ 'Equal to'(013), 15 s_exidv-low.
WHEN 'NE'.
WRITE:/ 'Not equal to'(014), 15 s_exidv-low.
WHEN 'BT'.
WRITE:/ 'Between'(015), 15 s_exidv-low, ' and '(016),
s_exidv-high.
ENDCASE.
AT LAST.
SKIP.
ENDAT.
ENDLOOP.
Date range summary
CHECK NOT s_wadat IS INITIAL.
FORMAT COLOR 5 ON.
WRITE:/ 'Date Range: '(011), s_wadat-low, ' to '(012).
IF s_wadat-option = 'BT'.
WRITE s_wadat-high.
ELSE.
WRITE s_wadat-low.
ENDIF.
FORMAT COLOR OFF.
ENDFORM. " top_of_page
&----
*& Form print_van_manifest
&----
submit the van manifest report to a printer
----
FORM print_van_manifest TABLES p_lgtor STRUCTURE r_lgtor.
CLEAR: r_vanno, r_palno.
REFRESH: r_vanno, r_palno.
DATA: vans TYPE i,
lv_range(1) TYPE c, "RM050906
lv_no_vstel(1) TYPE c, "RM050906
lv_lines TYPE i, "RM050906
lv_tabix LIKE sy-tabix, "RM050906
lv_vstel LIKE zshippt_manifest-vstel, "RM050906
BEGIN OF lt_hus OCCURS 0, "RM050906
exidv LIKE vekp-exidv, "RM050906
END OF lt_hus, "RM050906
BEGIN OF lt_msg OCCURS 0, "RM050906
msg(50) TYPE c, "RM050906
END OF lt_msg, "RM050906
lt_vstel LIKE zshippt_manifest OCCURS 0 WITH
HEADER LINE, "RM050906
lt_dummy LIKE t_data_tab OCCURS 0 WITH HEADER LINE. "RM050906
CLEAR: lt_hus[], lt_vstel[], lt_dummy[], "RM050906
lt_hus, lt_vstel,lt_dummy, lv_no_vstel. "RM050906
SELECT * FROM zshippt_manifest INTO TABLE lt_vstel. "RM050906
lt_dummy[] = t_data_tab[]. "RM050906
fill selection screen parameters for van manifest
LOOP AT t_data_tab WHERE lgtor IN p_lgtor.
*-- Begin RM050906
*-- Packages being printed are not in a shipment
lv_tabix = sy-tabix.
AT NEW lgtor.
READ TABLE t_data_tab INDEX lv_tabix.
LOOP AT lt_dummy WHERE lgtor = t_data_tab-lgtor.
*-- For each HU in the selected door, check that each shipping point
*-- exists in the bespoke table
READ TABLE lt_vstel WITH KEY vstel = lt_dummy-vstel.
IF sy-subrc NE 0.
*-- Shipping point not in bespoke table
lv_no_vstel = 'Y'.
EXIT.
ENDIF.
ENDLOOP.
ENDAT.
IF t_data_tab-tknum IS INITIAL.
lt_hus-exidv = t_data_tab-exidv.
APPEND lt_hus.
CLEAR lt_hus.
ENDIF.
*-- End RM050906
IF NOT t_data_tab-zvan_no IS INITIAL " it is loaded to van
and t_data_tab-kostk eq 'C' " pick status C = Complete
"TR01-
AND ( t_data_tab-kostk EQ 'C' "TR01+
OR t_data_tab-kostk EQ space ). "TR01+
begin TR01-
and t_data_tab-zvan_print ne c_yes " no van manifest has been
" printed
and t_data_tab-zeod_print ne c_yes. " no eod manifest has been
" printed
end TR01-
fill van number range
r_vanno-sign = 'I'.
r_vanno-option = 'EQ'.
r_vanno-low = t_data_tab-zvan_no.
APPEND r_vanno.
fill pallet number range
r_palno-sign = 'I'.
r_palno-option = 'EQ'.
r_palno-low = t_data_tab-zpallet_no.
APPEND r_palno.
ENDIF.
ENDLOOP.
DELETE ADJACENT DUPLICATES FROM r_vanno COMPARING low.
DESCRIBE TABLE r_vanno LINES vans.
*-- Begin RM050906
*-- If the shipping point input on the selection screen is a single
*-- shipping point(no range or multiple selections) and it is present
*-- on ZSHIPPT_MANIFEST, then do not do any further checks. Otherwise
*-- if any of the packages being printed on the manifest are not in a
*-- shipment, do not print the manifest and output an error message
CLEAR: lv_lines, lv_range, lv_vstel.
DESCRIBE TABLE p_vstel LINES lv_lines.
IF lv_lines = 1.
READ TABLE p_vstel INDEX 1.
IF NOT p_vstel-high IS INITIAL AND
p_vstel-high NE p_vstel-low.
*-- Shipping point range
lv_range = 'Y'.
ELSE.
*-- Now check that the single shipping point is on ZSHIPPT_MANIFEST
READ TABLE lt_vstel WITH KEY vstel = p_vstel-low.
IF sy-subrc NE 0.
*-- Shipping point not on bespoke table ZSHIPPT_MANIFEST
lv_no_vstel = 'Y'.
ENDIF.
ENDIF.
ELSE.
*-- Shipping point multiple selections
lv_range = 'Y'.
ENDIF.
*-- End RM050906
IF vans = 0.
error no vans available for van manifest report
MESSAGE e025(zw).
*-- Begin RM050906 - Display error message
ELSEIF lv_range = 'Y' AND "Multi shipng pts or single ship. pt
"not on ZSHIPPT_MANIFEST table
lv_no_vstel = 'Y' AND "Multi shipng pts not on bespoke tab
NOT lt_hus[] IS INITIAL. "Pack. being printed r not in shipmnt
*-- Now build table to display Handling units that are not in Shipment
lt_msg-msg =
'The following Handling Units are not in Shipment'(018).
APPEND lt_msg.
CLEAR lt_msg.
lt_msg-msg = '----
'.
APPEND lt_msg.
CLEAR lt_msg.
APPEND LINES OF lt_hus TO lt_msg.
CALL FUNCTION 'POPUP_WITH_TABLE_DISPLAY'
EXPORTING
endpos_col = '80'
endpos_row = '12'
startpos_col = '20'
startpos_row = '05'
titletext = 'HUs not in a Shipment'(017)
TABLES
valuetab = lt_msg
EXCEPTIONS
break_off = 1
OTHERS = 2.
EXIT.
*-- End RM050906
ELSE.
submit van manifest report straight to printer
SUBMIT zwmr_manifest_reports TO SAP-SPOOL
WITH s_vanno IN r_vanno
commented out pending decision on CR 140 solution design ***
with s_date in s_wadat
AND RETURN.
ENDIF.
on completion of the van manifest, the shipment status 'loading end'
needs to be set if any of the handling units on the van are the last
in a particular shipment to be despatched
PERFORM load_end_validate TABLES r_palno.
ENDFORM. " print_van_manifest
&----
*& Form print_eod_manifest
&----
submit the end of day manifest report to a printer
----
FORM print_eod_manifest TABLES p_lgtor STRUCTURE r_lgtor.
RANGES: r_vanno FOR zvantr-zvan_no.
DATA: vans TYPE i.
fill selection screen parameters for van manifest
LOOP AT t_data_tab WHERE lgtor IN p_lgtor.
IF NOT t_data_tab-zvan_no IS INITIAL " it is loaded to van
AND t_data_tab-kostk EQ 'C' " pick status C = Complete
AND t_data_tab-zeod_print NE c_yes. " no eod manifest has been
" printed
fill van number range
r_vanno-sign = 'I'.
r_vanno-option = 'EQ'.
r_vanno-low = t_data_tab-zvan_no.
APPEND r_vanno.
ENDIF.
ENDLOOP.
DELETE ADJACENT DUPLICATES FROM r_vanno COMPARING low.
DESCRIBE TABLE r_vanno LINES vans.
IF vans = 0.
error no vans available for eod manifest report
MESSAGE e027(zw).
ELSE.
submit van manifest report straight to printer
SUBMIT zwmr_manifest_reports TO SAP-SPOOL
WITH s_vanno IN r_vanno
WITH p_repflg EQ c_yes
commented out pending decision on CR 140 solution design ***
with s_date in s_wadat
AND RETURN.
ENDIF.
ENDFORM. " print_eod_manifest
&----
*& Form load_end_validate
&----
Determine on van manifest print whether or not any of the
handling units on the vans in quection are the last of a
particular shipment to be loaded. If so set the 'loading end'
status of that shipment.
----
-->P_PALNO pallet number range
----
FORM load_end_validate TABLES p_palno STRUCTURE r_palno.
local data
RANGES: r_vbeln FOR likp-vbeln,
r_tknum FOR vttk-tknum,
r_ldend FOR vttk-tknum.
DATA: l_t_paltr LIKE STANDARD TABLE OF zpallettr WITH HEADER LINE,
l_t_vekp LIKE STANDARD TABLE OF vekp WITH HEADER LINE,
l_t_likp LIKE STANDARD TABLE OF likp WITH HEADER LINE,
l_t_vepo LIKE STANDARD TABLE OF vepo WITH HEADER LINE,
lt_vepo LIKE STANDARD TABLE OF vepo WITH HEADER
LINE,"RM290806
l_t_vantr LIKE STANDARD TABLE OF zvantr WITH HEADER LINE,
l_t_lips LIKE STANDARD TABLE OF lips WITH HEADER LINE,
l_t_vttp LIKE STANDARD TABLE OF vttp WITH HEADER LINE.
DATA: not_last(1) TYPE c. " not last flag
DATA: w_stlad LIKE vttk-stlad. "TR01+
get all pallets on the vans
SELECT * FROM zpallettr INTO TABLE l_t_paltr
WHERE zpallet_no IN p_palno.
CHECK NOT l_t_paltr[] IS INITIAL.
get all handling units on the pallets
SELECT * FROM vekp INTO TABLE l_t_vekp
FOR ALL ENTRIES IN l_t_paltr
WHERE exidv = l_t_paltr-exidv
AND ( exida = 'E'
OR exida = 'F' ).
CHECK NOT l_t_vekp[] IS INITIAL.
build range of deliveries from vekp-vpobjkey
LOOP AT l_t_vekp.
r_vbeln-sign = 'I'.
r_vbeln-option = 'EQ'.
r_vbeln-low = l_t_vekp-vpobjkey.
APPEND r_vbeln.
ENDLOOP.
select all deliveries associated with the handling units
SELECT * FROM likp INTO TABLE l_t_likp
WHERE vbeln IN r_vbeln.
CHECK NOT l_t_likp[] IS INITIAL.
select shipment line items that correspond to deliveries
SELECT * FROM vttp INTO TABLE l_t_vttp
FOR ALL ENTRIES IN l_t_likp
WHERE vbeln = l_t_likp-vbeln.
CHECK NOT l_t_vttp[] IS INITIAL.
get associated shipment numbers.
LOOP AT l_t_vttp.
if status already set, do not include "TR01+
SELECT SINGLE stlad FROM vttk INTO w_stlad "TR01+
WHERE tknum = l_t_vttp-tknum. "TR01+
IF w_stlad NE c_yes. "TR01+
CLEAR w_stlad.
r_tknum-sign = 'I'.
r_tknum-option = 'EQ'.
r_tknum-low = l_t_vttp-tknum.
APPEND r_tknum.
ENDIF. "TR01+
ENDLOOP.
SORT r_tknum BY low.
DELETE ADJACENT DUPLICATES FROM r_tknum COMPARING low.
we now have a list of shipment numbers affected by the printing
of the van manifest just carried out.
next we need to get a complete list of handling units associated with
these shipments, and check if they have been loaded firstly to a
pallet and then to a van, and if so check that the van manifest
report
has been printed
if all handling units for a particular shipment have been loaded and
the van manifest printed, then we need to update the status flag of
the shipment to "Loading End"
DATA: lin TYPE i,
ind TYPE i,
w_tknum LIKE vttk-tknum.
*{ INSERT UKMK900355 1
Prevent all shipments from being selected " AS01
CHECK NOT r_tknum[] IS INITIAL. " AS01
*} INSERT
make sure we have all items for all shipments
SELECT * FROM vttp APPENDING CORRESPONDING FIELDS OF TABLE l_t_vttp
WHERE tknum IN r_tknum.
CHECK NOT l_t_vttp[] IS INITIAL.
SORT l_t_vttp BY tknum vbeln.
delete duplicate lines
DELETE ADJACENT DUPLICATES FROM l_t_vttp COMPARING tknum vbeln.
now get all delivery items.
SELECT * FROM lips INTO TABLE l_t_lips
FOR ALL ENTRIES IN l_t_vttp
WHERE vbeln = l_t_vttp-vbeln
AND pstyv NE 'ZPAC'
AND pstyv NE 'ZGDP'. "TR02+
CHECK NOT l_t_lips[] IS INITIAL.
now get handling units
SELECT * FROM vepo INTO TABLE l_t_vepo
FOR ALL ENTRIES IN l_t_lips
WHERE vbeln = l_t_lips-vbeln
AND posnr = l_t_lips-posnr
AND matnr = l_t_lips-matnr
AND charg = l_t_lips-charg.
CHECK NOT l_t_vepo[] IS INITIAL.
SELECT * FROM vekp APPENDING CORRESPONDING FIELDS OF TABLE l_t_vekp
FOR ALL ENTRIES IN l_t_vepo
WHERE venum = l_t_vepo-venum.
SORT l_t_vekp BY exidv.
CHECK NOT l_t_vekp[] IS INITIAL.
delete duplicate lines
DELETE ADJACENT DUPLICATES FROM l_t_vekp COMPARING exidv.
now get pallet data
SELECT * FROM zpallettr
APPENDING CORRESPONDING FIELDS OF TABLE l_t_paltr
FOR ALL ENTRIES IN l_t_vekp
WHERE exidv = l_t_vekp-exidv
AND zload = c_yes. " loaded to van
CHECK NOT l_t_paltr[] IS INITIAL.
SORT l_t_paltr BY exidv. "RM290806
delete duplicate lines
DELETE ADJACENT DUPLICATES FROM l_t_paltr COMPARING exidv.
now get van data
SELECT * FROM zvantr INTO TABLE l_t_vantr
FOR ALL ENTRIES IN l_t_paltr
WHERE zpallet_no = l_t_paltr-zpallet_no
AND zvan_print = c_yes. " van manifest printed
we now have all delivery, handling unit, pallet and van
information, so can now check each shipment in turn for complete
loading
DESCRIBE TABLE r_tknum LINES lin.
r_ldend[] = r_tknum[].
SORT l_t_vttp BY tknum vbeln.
ind = 1.
DO lin TIMES.
READ TABLE r_tknum INDEX ind.
w_tknum = r_tknum-low.
for this shipment we need to find all hu's and determine
whether loaded and van manifest printed
shipment item
LOOP AT l_t_vttp WHERE tknum = w_tknum.
delivery item
LOOP AT l_t_vepo WHERE vbeln = l_t_vttp-vbeln.
read HU item
CLEAR l_t_vekp.
READ TABLE l_t_vekp WITH KEY venum = l_t_vepo-venum.
read pallet
CLEAR l_t_paltr.
READ TABLE l_t_paltr WITH KEY exidv = l_t_vekp-exidv.
IF sy-subrc = 0.
read van
CLEAR l_t_vantr.
READ TABLE l_t_vantr
WITH KEY zpallet_no = l_t_paltr-zpallet_no.
IF sy-subrc = 0.
HU has been loaded to a van that has had the van manifest
printed
ELSE.
IF l_t_paltr-zpallet_no IN p_palno.
database table not yet updated but HU is loaded
ELSE.
pallet not on van, or van manifest not printed for van
not_last = c_yes.
EXIT.
ENDIF.
ENDIF.
ELSE.
HU or pallet not loaded
not_last = c_yes.
EXIT.
ENDIF.
ENDLOOP.
*-- Begin RM290806
*-- Replace lower-level HUs with highest level and check again
IF not_last = c_yes.
CLEAR: it_vepo2[], it_vepo2.
LOOP AT l_t_vepo.
MOVE-CORRESPONDING l_t_vepo TO it_vepo2.
APPEND it_vepo2.
CLEAR it_vepo2.
ENDLOOP.
SORT it_vepo2 BY venum vepos.
Ice-multis: replace lower-level HUs with highest level
PERFORM replace_highest_hu.
CLEAR: lt_vepo[], lt_vepo.
LOOP AT it_vepo2.
MOVE-CORRESPONDING it_vepo2 TO lt_vepo.
APPEND lt_vepo.
CLEAR lt_vepo.
ENDLOOP.
*-- Delivery item
LOOP AT lt_vepo WHERE vbeln = l_t_vttp-vbeln.
*-- Read HU item
CLEAR l_t_vekp.
READ TABLE l_t_vekp WITH KEY venum = lt_vepo-venum.
*-- Read Pallet
CLEAR l_t_paltr.
READ TABLE l_t_paltr WITH KEY exidv = l_t_vekp-exidv.
IF sy-subrc = 0.
*-- Read Van
CLEAR l_t_vantr.
READ TABLE l_t_vantr
WITH KEY zpallet_no = l_t_paltr-zpallet_no.
IF sy-subrc = 0.
*-- HU has been loaded to a van that has had the van manifest printed
CLEAR not_last.
ELSE.
IF l_t_paltr-zpallet_no IN p_palno.
*-- Database table not yet updated but HU is loaded
CLEAR not_last.
ELSE.
*-- Pallet not on van, or van manifest not printed for van
not_last = c_yes.
EXIT.
ENDIF.
ENDIF.
ELSE.
*-- HU or pallet not loaded
not_last = c_yes.
EXIT.
ENDIF.
ENDLOOP.
ENDIF.
*-- End RM290806
if not_last = yes, then the last HU has NOT been loaded therefore
we can exit the looping for this shipment
IF not_last = c_yes.
EXIT.
ENDIF.
ENDLOOP.
IF not_last = c_yes.
remove shipment from load end range
DELETE r_ldend WHERE low = w_tknum.
not_last = c_no.
ENDIF.
ADD 1 TO ind.
ENDDO.
if we have any shipments in the load end range (r_ldend) then submit
update status report
CHECK NOT r_ldend[] IS INITIAL.
SUBMIT ztrr_rv56trsl WITH p_aload = c_yes
WITH p_cship = c_no
WITH k_tknum IN r_ldend.
ENDFORM. " load_end_validate
*----
> TR01+ start
&----
*& Form move_lips_to_table
&----
This form mirrors the move_to_table functionality for items
that have not been packed (i.e. without an entry in VEPO)
----
FORM move_lips_to_table.
LOOP AT it_lips.
CLEAR t_data_tab.
delivery line items
MOVE-CORRESPONDING it_lips TO t_data_tab.
sales document line items
CLEAR w_vbup.
READ TABLE it_vbup WITH KEY vbeln = it_lips-vbeln
posnr = it_lips-posnr
INTO w_vbup BINARY SEARCH. "SUM
MOVE-CORRESPONDING w_vbup TO t_data_tab.
*{ INSERT UKMK900355 1
WM status of handling unit
SELECT SINGLE * FROM ZHU_TO_LINK WHERE LGNUM EQ
*} INSERT
sales doc header
CLEAR w_vbuk.
READ TABLE it_vbuk WITH KEY vbeln = it_lips-vbeln
INTO w_vbuk BINARY SEARCH. "SUM
MOVE-CORRESPONDING w_vbuk TO t_data_tab.
delivery header
CLEAR w_likp.
READ TABLE it_likp WITH KEY vbeln = it_lips-vbeln
INTO w_likp BINARY SEARCH. "SUM
MOVE-CORRESPONDING w_likp TO t_data_tab.
Start of changes by ANV SR#11523
Shipment Number
CLEAR w_vttp.
READ TABLE it_vttp WITH KEY vbeln = it_lips-vbeln
INTO w_vttp BINARY SEARCH.
MOVE w_vttp-tknum TO t_data_tab-tknum.
End of changes by ANV SR#11523
APPEND t_data_tab.
ENDLOOP.
ENDFORM. " move_lips_to_table
*<----
TR01+ end
*{ INSERT UKMK900355 1
&----
*& Form REPLACE_HIGHEST_HU
&----
Replace pouches in IT_VEPO2 with ice-boxes
----
FORM replace_highest_hu.
TABLES: ZHUMS. " Activation of automatic packing for shipping points
DATA: ls_objects TYPE hum_object,
it_header TYPE hum_hu_header_t,
ls_header TYPE vekpvb,
it_items TYPE hum_hu_item_t,
ls_item TYPE vepovb,
ls_vepo2 LIKE it_vepo2,
l_venum LIKE vekp-venum,
l_tabix LIKE sy-tabix. " AS 20.07.2006
t_vepo_low[] = it_vepo2[].
CLEAR it_likp.
LOOP AT it_vepo2.
l_tabix = sy-tabix. "AS 14.10.2006
IF ls_objects-objkey NE it_vepo2-vbeln. "AS 14.10.2006
IF IT_LIKP-VBELN NE IT_VEPO2-VBELN. "AS 14.10.2006
READ TABLE IT_LIKP WITH KEY VBELN = IT_VEPO2-VBELN."AS 14.10.2006
IF ZHUMS-VSTEL NE IT_LIKP-VSTEL. "...
SELECT SINGLE * FROM ZHUMS WHERE VSTEL EQ IT_LIKP-VSTEL.
ENDIF.
CHECK ZHUMS-AUTOP EQ 'X'. "AS 14.10.2006
ls_objects-object = '01'.
ls_objects-objkey = it_vepo2-vbeln.
LS_OBJECTS-OBJKEY = IT_LIKP-VBELN. "AS 14.10.2006
CALL FUNCTION 'HU_GET_HUS'
EXPORTING
is_objects = ls_objects
IMPORTING
et_header = it_header
et_items = it_items
EXCEPTIONS
hus_locked = 1
no_hu_found = 2
fatal_error = 3
OTHERS = 4.
CHECK sy-subrc EQ 0.
ENDIF.
IF ZHUMS-VSTEL NE IT_LIKP-VSTEL.
SELECT SINGLE * FROM ZHUMS WHERE VSTEL EQ IT_LIKP-VSTEL.
ENDIF.
CHECK ZHUMS-AUTOP EQ 'X'.
l_venum = it_vepo2-venum.
DO.
READ TABLE it_header INTO ls_header
WITH KEY venum = l_venum.
IF sy-subrc NE 0
OR ls_header-uevel IS INITIAL.
EXIT.
ENDIF.
l_venum = ls_header-uevel.
ENDDO.
One line per HU
IF ls_header-venum NE it_vepo2-venum.
READ TABLE it_vepo2 INTO ls_vepo2
WITH KEY venum = ls_header-venum.
IF sy-subrc NE 0.
it_vepo2-venum = ls_header-venum.
CLEAR: it_vepo2-vepos.
Data from delivery item might later not be well defined
IT_VEPO2-POSNR.
MODIFY it_vepo2.
ELSE.
DELETE it_vepo2.
ENDIF.
ELSE.
READ TABLE it_vepo2 INTO ls_vepo2
WITH KEY venum = ls_header-venum.
IF sy-tabix LT l_tabix.
CLEAR it_vepo2-posnr.
MODIFY it_vepo2 INDEX sy-tabix.
DELETE it_vepo2.
ENDIF.
ENDIF.
CONTINUE.
CHECK ls_header-venum NE it_vepo2-venum.
READ TABLE IT_HEADER INTO LS_HEADER
WITH KEY VENUM = IT_VEPO2-VENUM.
CHECK SY-SUBRC EQ 0
AND NOT LS_HEADER-UEVEL IS INITIAL.
READ TABLE IT_HEADER INTO LS_HEADER
WITH KEY VENUM = LS_HEADER-UEVEL.
CHECK SY-SUBRC EQ 0.
READ TABLE it_vepo2 INTO ls_vepo2 WITH KEY venum = ls_header-venum.
IF sy-subrc NE 0.
it_vepo2-venum = ls_header-venum.
CLEAR: it_vepo2-vepos.
Data from delivery item might later not be well defined
IT_VEPO2-POSNR.
IT_VEPO2-EXIDV = LS_HEADER-EXIDV.
MODIFY it_vepo2.
ELSE.
DELETE it_vepo2.
ENDIF.
ENDLOOP.
ENDFORM. " REPLACE_HIGHEST_HU
Reward points if useful
Regards
Anji