Académique Documents
Professionnel Documents
Culture Documents
type
type
type
type
type
likp-vbeln, "delivery
lips-posnr, "delivery item
likp-lfdat, "delivery date
likp-lfart, "delivery type
likp-vstel, "shipping point
likp-kunnr, "ship-to party
likp-wadat_ist, "actual goods movement date
lips-lfimg,
lips-meins,
vbap-vbelv,
vbap-posnv,
vbak-auart,
"quantity
"UoM
"sales order
"sales order item
"? sales order type sau vbap-posar item typ
e
kwmeng
type vbap-kwmeng, "sales order quantity
wbstk
type vbuk-wbstk, "total goods movement status
end of ty_itab,
begin of ty_del,
vbeln
type
posnr
type
lfdat
type
lfart
type
vstel
type
kunnr
type
wadat_ist type
lfimg
type
meins
type
end of ty_del,
likp-vbeln, "delivery
lips-posnr, "delivery item
likp-lfdat, "delivery date
likp-lfart, "delivery type
likp-vstel, "shipping point
likp-kunnr, "ship-to party
likp-wadat_ist, "actual goods movement date
lips-lfimg, "quantity
lips-meins, "UoM
begin of ty_s_order,
vbeln_v
type vbap-vbeln, "sales order
posnr_v
type vbap-posnr, "sales order item
auart
type vbak-auart, "? sales order type sau vbap-posar item typ
e
*
kwmeng
type vbap-kwmeng, "sales order quantity
wbstk
type vbuk-wbstk, "total goods movement status
end of ty_s_order,
begin of ty_vbuk,
wbstk
type vbuk-wbstk, "total goods movement status
end of ty_vbuk.
data: gs_del
it_del
gs_s_order
it_s_order
it_vb
gs_vb
gs_delivery
gs_delivery2
it_delivery
it_delivery2
gs_delivery3
it_delivery3
gs_fieldcat
it_fieldcat
it_vbfa
gs_vbfa
type
type
type
type
type
type
type
type
type
type
type
type
type
type
ty_del,
table of ty_del,
ty_s_order,
table of ty_s_order,
table of ty_vbuk,
ty_vbuk,
ty_itab,
ty_itab,
table of ty_itab,
table of ty_itab,
ty_itab,
table of ty_itab,
slis_fieldcat_alv, "slis_fieldcat_alv,
slis_t_fieldcat_alv, "slis_t_fieldcat_alv.
initialization.
gx_variant-report = sy-repid.
CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
EXPORTING
i_save
= g_save
CHANGING
cs_variant = gx_variant
EXCEPTIONS
not_found = 2.
IF sy-subrc = 0.
p_var = gx_variant-variant.
ENDIF.
** F4 Help for Varient
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_var.
**-- Display all existing variants
g_variant-report = sy-repid.
* Utilizing the name of the report, this function module will search for a list
of
* variants and will fetch the selected one into the parameter field for variants
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
EXPORTING
is_variant = g_variant
i_save
= g_save
IMPORTING
e_exit
= g_exit
es_variant = gx_variant
EXCEPTIONS
not_found = 2.
IF sy-subrc = 2.
MESSAGE ID sy-msgid TYPE 'S'
NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
IF g_exit = space.
p_var = gx_variant-variant.
ENDIF.
ENDIF.
start-of-selection.
perform select.
perform catalog.
perform sort.
perform variant.
perform display.
*&---------------------------------------------------------------------*
*&
Form SELECT
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
* --> p1
text
* <-- p2
text
*----------------------------------------------------------------------*
form SELECT .
select a~vbeln
b~posnr
a~lfdat
a~lfart
a~vstel
a~kunnr
a~wadat_ist
b~lfimg
b~meins
from likp as a inner join lips as b on a~vbeln = b~vbeln
into corresponding fields of table it_delivery
where a~vbeln in so_dl
and a~lfdat in so_dl_dt
and a~lfart in so_dl_ty
and a~vstel in so_sh_po
and a~kunnr in so_s_to.
*move-corresponding it_del to it_delivery.
*loop at it_del into gs_del.
* move-corresponding gs_del to gs_delivery.
* append gs_delivery to it_delivery.
*endloop.
*select vbelv posnv vbeln posnn
* from vbfa
* into corresponding fields of table it_delivery2
* for all entries in it_delivery
* where vbeln = it_delivery-vbeln and
*
posnn = it_delivery-posnr.
*
vbtyp_n = 'J'.
select *
from vbfa
into corresponding fields of table it_vbfa
for all entries in it_delivery
where vbeln = it_delivery-vbeln and
posnn = it_delivery-posnr and
vbtyp_n = 'J'.
select y~vbeln
y~posnr
x~auart
y~kwmeng
FROM vbak as x inner join vbap as y on x~vbeln = y~vbeln
into table it_s_order
for all entries in it_vbfa
where y~vbeln = it_vbfa-vbelv and
y~posnr = it_vbfa-posnv.
* and y~posnr = it_vbfa-posnr.
*loop at it_vbfa into gs_vbfa.
loop at it_s_order into gs_s_order.
move-corresponding gs_s_order to gs_delivery2.
append gs_delivery2 to it_delivery2.
endloop.
*endloop.
loop at it_delivery into gs_delivery.
*
*
*
*
*
*
*
*
*
gs_delivery2-vbeln = gs_delivery-vbeln.
gs_delivery2-posnr = gs_delivery-posnr.
gs_delivery2-lfdat = gs_delivery-lfdat.
gs_delivery2-lfart = gs_delivery-lfart.
gs_delivery2-vstel = gs_delivery-vstel.
gs_delivery2-kunnr = gs_delivery-kunnr.
gs_delivery2-wadat_ist = gs_delivery-wadat_ist.
gs_delivery2-lfimg = gs_delivery-lfimg.
gs_delivery2-meins = gs_delivery-meins.
gs_delivery-vbeln_v = gs_delivery2-vbeln_v.
gs_delivery-posnr_v = gs_delivery2-posnr_v.
gs_delivery-auart = gs_delivery2-auart.
gs_delivery-kwmeng = gs_delivery2-kwmeng.
select wbstk
from vbuk
into corresponding fields of table it_vb
for all entries in it_vbfa
where vbeln = it_vbfa-vbelv.
loop at it_vb into gs_vb.
move-corresponding gs_vb to gs_delivery3.
append gs_delivery3 to it_delivery3.
endloop.
loop at it_delivery into gs_delivery.
gs_delivery-wbstk = gs_delivery3-wbstk.
modify it_delivery from gs_delivery index sy-tabix transporting wbstk.
endloop.
endform.
" SELECT
*&---------------------------------------------------------------------*
*&
Form CATALOG
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
* --> p1
text
* <-- p2
text
*----------------------------------------------------------------------*
form CATALOG .
gs_fieldcat-col_pos = 1.
gs_fieldcat-fieldname = 'VBELN'.
gs_fieldcat-tabname = 'IT_DELIVERY'.
gs_fieldcat-seltext_m = 'Del'.
gs_fieldcat-emphasize = 'C111'.
gs_fieldcat-fix_column = 'X'.
append gs_fieldcat to it_fieldcat.
clear gs_fieldcat.
gs_fieldcat-col_pos = 2.
gs_fieldcat-fieldname = 'POSNR'.
gs_fieldcat-tabname = 'IT_DELIVERY'.
gs_fieldcat-seltext_m = 'Del Item'.
gs_fieldcat-emphasize = 'C111'.
gs_fieldcat-fix_column = 'X'.
append gs_fieldcat to it_fieldcat.
clear gs_fieldcat.
gs_fieldcat-col_pos =
gs_fieldcat-fieldname
gs_fieldcat-tabname =
gs_fieldcat-seltext_m
append gs_fieldcat to
clear gs_fieldcat.
3.
= 'LFDAT'.
'IT_DELIVERY'.
= 'Del Date'.
it_fieldcat.
gs_fieldcat-col_pos =
gs_fieldcat-fieldname
gs_fieldcat-tabname =
gs_fieldcat-seltext_m
append gs_fieldcat to
clear gs_fieldcat.
4.
= 'LFART'.
'IT_DELIVERY'.
= 'Del type'.
it_fieldcat.
gs_fieldcat-col_pos =
gs_fieldcat-fieldname
gs_fieldcat-tabname =
gs_fieldcat-seltext_m
append gs_fieldcat to
clear gs_fieldcat.
5.
= 'VSTEL'.
'IT_DELIVERY'.
= 'Shi point'.
it_fieldcat.
gs_fieldcat-col_pos =
gs_fieldcat-fieldname
gs_fieldcat-tabname =
gs_fieldcat-seltext_m
append gs_fieldcat to
clear gs_fieldcat.
6.
= 'KUNNR'.
'IT_DELIVERY'.
= 'Shi to party'.
it_fieldcat.
gs_fieldcat-col_pos =
gs_fieldcat-fieldname
gs_fieldcat-tabname =
gs_fieldcat-seltext_m
append gs_fieldcat to
clear gs_fieldcat.
7.
= 'WADAT_IST'.
'IT_DELIVERY'.
= 'Actual gds mov date'.
it_fieldcat.
gs_fieldcat-col_pos = 9.
gs_fieldcat-fieldname = 'LFIMG'.
gs_fieldcat-tabname = 'IT_DELIVERY'.
gs_fieldcat-seltext_m = 'LFIMG'.
* gs_fieldcat-outputlen = 0.
* gs_fieldcat-no_output = 'X'.
gs_fieldcat-do_sum = 'X'.
append gs_fieldcat to it_fieldcat.
clear gs_fieldcat.
gs_fieldcat-col_pos =
gs_fieldcat-fieldname
gs_fieldcat-tabname =
gs_fieldcat-seltext_m
append gs_fieldcat to
clear gs_fieldcat.
10.
= 'MEINS'.
'IT_DELIVERY'.
= 'UoM'.
it_fieldcat.
gs_fieldcat-col_pos =
gs_fieldcat-fieldname
gs_fieldcat-tabname =
gs_fieldcat-seltext_m
append gs_fieldcat to
clear gs_fieldcat.
11.
= 'VBELN_V'.
'IT_DELIVERY'.
= 'Sal order'.
it_fieldcat.
gs_fieldcat-col_pos =
gs_fieldcat-fieldname
gs_fieldcat-tabname =
gs_fieldcat-seltext_m
append gs_fieldcat to
clear gs_fieldcat.
12.
= 'POSNR_V'.
'IT_DELIVERY'.
= 'Sal ord item'.
it_fieldcat.
gs_fieldcat-col_pos =
gs_fieldcat-fieldname
gs_fieldcat-tabname =
gs_fieldcat-seltext_m
append gs_fieldcat to
clear gs_fieldcat.
13.
= 'AUART'.
'IT_DELIVERY'.
= 'Sal ord type'.
it_fieldcat.
gs_fieldcat-col_pos = 14.
gs_fieldcat-fieldname = 'KWMENG'.
gs_fieldcat-tabname = 'IT_DELIVERY'.
gs_fieldcat-seltext_m = 'Sal ord quantity'.
gs_fieldcat-do_sum = 'X'.
append gs_fieldcat to it_fieldcat.
clear gs_fieldcat.
gs_fieldcat-col_pos =
gs_fieldcat-fieldname
gs_fieldcat-tabname =
gs_fieldcat-seltext_m
append gs_fieldcat to
clear gs_fieldcat.
8.
= 'WBSTK'.
'IT_DELIVERY'.
= 'Tot gds mov'.
it_fieldcat.
endform.
" CATALOG
*&---------------------------------------------------------------------*
*&
Form DISPLAY
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
* --> p1
text
* <-- p2
text
*----------------------------------------------------------------------*
form DISPLAY .
gd_repid = sy-repid.
g_variant-variant = p_var.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
I_SCREEN_END_COLUMN
= 0
I_SCREEN_END_LINE
= 0
I_HTML_HEIGHT_TOP
= 0
I_HTML_HEIGHT_END
= 0
IT_ALV_GRAPHICS
=
IT_HYPERLINK
=
IT_ADD_FIELDCAT
=
IT_EXCEPT_QINFO
=
IR_SALV_FULLSCREEN_ADAPTER
=
IMPORTING
E_EXIT_CAUSED_BY_CALLER
=
ES_EXIT_CAUSED_BY_USER
=
TABLES
t_outtab
= it_delivery
EXCEPTIONS
PROGRAM_ERROR
= 1
OTHERS
= 2
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
endform.
" DISPLAY
*&---------------------------------------------------------------------*
*&
Form SORT
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
* --> p1
text
* <-- p2
text
*----------------------------------------------------------------------*
form SORT .
clear gs_sort.
if p_sort_s = 'X'.
gs_sort-fieldname = 'VSTEL'.
gs_sort-spos = '1'.
gs_sort-up = 'X'.
append gs_sort to it_sort.
endif.
if p_sort_d = 'X'.
gs_sort-fieldname = 'LFDAT'.
gs_sort-spos = '2'.
gs_sort-up = 'X'.
append gs_sort to it_sort.
endif.
endform.
" SORT
*&---------------------------------------------------------------------*
*&
Form VARIANT
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
* --> p1
text
* <-- p2
text
*----------------------------------------------------------------------*
form VARIANT .
g_variant-variant = p_var.
g_variant-report = sy-repid.
Title
wa_header-typ = 'H'.
wa_header-info = 'ALV cu functii'.
APPEND wa_header TO t_header.
CLEAR wa_header.
* Date
wa_header-typ = 'S'.
wa_header-key = 'Date: '.
CONCATENATE sy-datum+6(2) '.'
sy-datum+4(2) '.'
sy-datum(4) INTO wa_header-info.
APPEND wa_header TO t_header.
CLEAR: wa_header.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = t_header.
"Today's date