Professional Documents
Culture Documents
12) y Unapproved Pos Report
12) y Unapproved Pos Report
TYPE-POOLS : SLIS.
LIKE
LIKE
LIKE
LIKE
LIKE
LIKE
LIKE
LIKE
LIKE
LIKE
LIKE
LIKE
LIKE
LIKE
LIKE
LIKE
LIKE
LIKE
LIKE
LIKE
LIKE
EKPO-EBELN
, " PO No
EKKN-PS_PSP_PNR
, " WBSE
EKKN-NPLNR
, " Network Activity
EKKN-PROJN
, " Porject No
EKPO-TXZ01
, " Item Description
EKPO-WERKS
, " Plant Code
EKKN-SAKTO
, " GL Account
EKKN-KOSTL
, " Cost Center
EKKN-FIPOS
, " Commitment Item
EKKN-AUFNR
, " Maintenance Order
EKKO-BEDAT
, " PO DATE
T16FS-FRGGR
, " Release group
T16FS-FRGSX
, " Release strategy
T16FS-FRGC1
, " Release code 1
T16FS-FRGC2
, " Release code 2
T16FS-FRGC3
, " Release code 3
T16FS-FRGC4
, " Release code 4
T16FS-FRGC5
, " Release code 5
T16FS-FRGC6
, " Release code 6
T16FS-FRGC7
, " Release code 7
T16FS-FRGC8
, " Release code 8
FRGCO
LIKE
T16FC-FRGCO
REL_CODE
TYPE
REL_CODE_DESC
IPTIONS
AGE1
AGE2
AGE3
AGE4
LIKE
LIKE
LIKE
LIKE
STRING
, " CONCATENATED Release code
TYPE
STRING
, " CONCATENATED Release code DESCR
VTBBEWE-ATAGE,
VTBBEWE-ATAGE,
VTBBEWE-ATAGE,
VTBBEWE-ATAGE,
END OF itab.
data: it_itab TYPE STANDARD TABLE of itab INITIAL SIZE 0 ,
wa_itab type itab.
data: fieldcatalog type slis_t_fieldcat_alv with header line,
gd_tab_group type slis_t_sp_group_alv,
gd_layout
type slis_layout_alv,
gd_repid
like sy-repid,
gt_events
type slis_t_event,
gd_prntparams type slis_print_alv.
Selection-screen begin of block B3 with frame title text-001.
SELECT-OPTIONS:
EBELN
FOR EKPO-EBELN,
PS_PNR
NPLNR
PROJN
TXZ01
WERKS
SAKTO
KOSTL
FIPOS
AUFNR
BEDAT
FOR
FOR
FOR
FOR
FOR
FOR
FOR
FOR
FOR
FOR
EKKN-PS_PSP_PNR,
EKKN-NPLNR,
EKKN-PROJN,
EKPO-TXZ01,
EKPO-WERKS,
EKKN-SAKTO,
EKKN-KOSTL,
EKKN-FIPOS,
EKKN-AUFNR,
EKKO-BEDAT.
"
"
"
"
"
"
"
"
"
"
Release
Release
Release
Release
Release
Release
Release
Release
Release
Release
code 1
code 1
code 2
code 3
code 4
code 5
code 6
code 7
code 8
Strategy Code
IN
IN
IN
IN
IN
IN
IN
IN
IN
IN
EBELN AND
PS_PNR AND
NPLNR AND
PROJN AND
TXZ01 AND
WERKS AND
SAKTO AND
KOSTL AND
FIPOS AND
AUFNR AND
EKKO~BEDAT
IN BEDAT AND
EKKO~frgke Not IN ('Y','R') .
APPEND WA_ITAB TO IT_ITAB.
Endselect.
*&---------------------------------------------------------------------*
*&
Data fields to store number of days, months and years from specified dat
e to current date
*&---------------------------------------------------------------------*
DATA: EDAYS LIKE VTBBEWE-ATAGE,
EMONTHS LIKE VTBBEWE-ATAGE,
EYEARS LIKE VTBBEWE-ATAGE,
DESC_TEMP
type
String,
" Release code 8.
FRGC1_TEMP
LIKE
T16FS-FRGC1
, " Release code 1
FRGC2_TEMP
LIKE
T16FS-FRGC2
, " Release code 2
FRGC3_TEMP
LIKE
T16FS-FRGC3
, " Release code 3
FRGC4_TEMP
LIKE
T16FS-FRGC4
, " Release code 4
FRGC5_TEMP
LIKE
T16FS-FRGC5
, " Release code 5
FRGC6_TEMP
LIKE
T16FS-FRGC6
, " Release code 6
FRGC7_TEMP
LIKE
T16FS-FRGC7
, " Release code 7
FRGC8_TEMP
LIKE
T16FS-FRGC8.
" Release code 8.
data: FROMDATE LIKE VTBBEWE-DBERVON.
*&---------------------------------------------------------------------*
*&
Looping at internal table to process the Document Date in Document
*&
inorder to calculate total number of days, months and years from specifi
ed date to current date
*&---------------------------------------------------------------------*
LOOP AT IT_ITAB INTO WA_ITAB.
FROMDATE = wa_itab-BEDAT.
IF wa_itab-FRGC1 ne ''.
SELECT T16FD~FRGCT into DESC_TEMP from T16FD
where T16FD~FRGGR = wa_itab-FRGGR
and T16FD~FRGCO = wa_itab-FRGC1.
endselect.
CONCATENATE
CONCATENATE
CONCATENATE
CONCATENATE
SPACE .
endif.
IF wa_itab-FRGC2 ne ''.
SELECT T16FD~FRGCT into DESC_TEMP from T16FD
where T16FD~FRGGR = wa_itab-FRGGR
and T16FD~FRGCO = wa_itab-FRGC2.
endselect.
CONCATENATE wa_itab-REL_CODE wa_itab-FRGC2 ', ' space INTO wa_itab-REL_CODE .
CONCATENATE wa_itab-REL_CODE '' INTO wa_itab-REL_CODE SEPARATED BY SPACE.
CONCATENATE wa_itab-REL_CODE_DESC DESC_TEMP ', ' space INTO wa_itab-REL_CODE_D
ESC .
CONCATENATE wa_itab-REL_CODE_DESC '' INTO wa_itab-REL_CODE_DESC SEPARATED BY
SPACE .
endif.
IF wa_itab-FRGC3 ne ''.
SELECT T16FD~FRGCT into DESC_TEMP from T16FD
where T16FD~FRGGR = wa_itab-FRGGR
and T16FD~FRGCO = wa_itab-FRGC3.
endselect.
CONCATENATE wa_itab-REL_CODE wa_itab-FRGC3 ', ' INTO wa_itab-REL_CODE .
CONCATENATE wa_itab-REL_CODE '' INTO wa_itab-REL_CODE SEPARATED BY SPACE.
CONCATENATE wa_itab-REL_CODE_DESC DESC_TEMP ', ' INTO wa_itab-REL_CODE_DESC .
CONCATENATE wa_itab-REL_CODE_DESC '' INTO wa_itab-REL_CODE_DESC SEPARATED BY
SPACE .
endif.
IF wa_itab-FRGC4 ne ''.
SELECT T16FD~FRGCT into DESC_TEMP from T16FD
where T16FD~FRGGR = wa_itab-FRGGR
and T16FD~FRGCO = wa_itab-FRGC4.
endselect.
CONCATENATE wa_itab-REL_CODE wa_itab-FRGC4 ', ' INTO wa_itab-REL_CODE .
CONCATENATE wa_itab-REL_CODE '' INTO wa_itab-REL_CODE SEPARATED BY SPACE.
CONCATENATE wa_itab-REL_CODE_DESC DESC_TEMP ', ' INTO wa_itab-REL_CODE_DESC .
CONCATENATE wa_itab-REL_CODE_DESC '' INTO wa_itab-REL_CODE_DESC SEPARATED BY
SPACE .
endif.
IF wa_itab-FRGC5 ne ''.
SELECT T16FD~FRGCT into DESC_TEMP from T16FD
where T16FD~FRGGR = wa_itab-FRGGR
and T16FD~FRGCO = wa_itab-FRGC5.
endselect.
CONCATENATE wa_itab-REL_CODE wa_itab-FRGC5 ', ' INTO wa_itab-REL_CODE .
CONCATENATE wa_itab-REL_CODE '' INTO wa_itab-REL_CODE SEPARATED BY SPACE.
CONCATENATE wa_itab-REL_CODE_DESC DESC_TEMP ', ' INTO wa_itab-REL_CODE_DESC .
CONCATENATE wa_itab-REL_CODE_DESC '' INTO wa_itab-REL_CODE_DESC SEPARATED BY
SPACE .
endif.
IF wa_itab-FRGC6 ne ''.
SELECT T16FD~FRGCT into DESC_TEMP from T16FD
where T16FD~FRGGR = wa_itab-FRGGR
and T16FD~FRGCO = wa_itab-FRGC6.
endselect.
CONCATENATE wa_itab-REL_CODE wa_itab-FRGC6 ', ' INTO wa_itab-REL_CODE .
CONCATENATE wa_itab-REL_CODE '' INTO wa_itab-REL_CODE SEPARATED BY SPACE.
CONCATENATE wa_itab-REL_CODE_DESC DESC_TEMP ', ' INTO wa_itab-REL_CODE_DESC .
CONCATENATE wa_itab-REL_CODE_DESC '' INTO wa_itab-REL_CODE_DESC SEPARATED BY
SPACE .
endif.
IF wa_itab-FRGC7 ne ''.
SELECT T16FD~FRGCT into DESC_TEMP from T16FD
where T16FD~FRGGR = wa_itab-FRGGR
and T16FD~FRGCO = wa_itab-FRGC7.
endselect.
CONCATENATE wa_itab-REL_CODE wa_itab-FRGC7 ', ' INTO wa_itab-REL_CODE .
CONCATENATE wa_itab-REL_CODE '' INTO wa_itab-REL_CODE SEPARATED BY SPACE.
CONCATENATE wa_itab-REL_CODE_DESC DESC_TEMP ', ' INTO wa_itab-REL_CODE_DESC .
CONCATENATE wa_itab-REL_CODE_DESC '' INTO wa_itab-REL_CODE_DESC SEPARATED BY
SPACE .
endif.
IF wa_itab-FRGC8 ne ''.
SELECT T16FD~FRGCT into DESC_TEMP from T16FD
*&---------------------------------------------------------------------*
*&
Form BUILD_FIELDCATALOG
*&---------------------------------------------------------------------*
*
Build Fieldcatalog for ALV Report
*----------------------------------------------------------------------*
form build_fieldcatalog.
*
*
*
*
*
* Beware though, you need to ensure that all fields required are
* populated. When using some of functionality available via ALV, such as
* total. You may need to provide more information than if you were
fieldcatalog-fieldname = 'PS_PSP_PNR'.
" field Name
fieldcatalog-seltext_m = 'WBSE'.
" Field heading
fieldcatalog-col_pos
= 0.
" col position
fieldcatalog-outputlen = 10.
" output Lenght
fieldcatalog-emphasize = 'X'.
" Emphasize (highlight columns
in color)
*fieldcatalog-key
= 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'NPLNR'.
fieldcatalog-seltext_m = 'Network Activity'.
fieldcatalog-col_pos
= 0.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
in color)
*fieldcatalog-key
= 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'PROJN'.
fieldcatalog-seltext_m = 'Project No'.
fieldcatalog-col_pos
= 0.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
in color)
*fieldcatalog-key
= 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'TXZ01'.
fieldcatalog-seltext_m = 'Item Description'.
fieldcatalog-col_pos
= 0.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
in color)
*fieldcatalog-key
= 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname
fieldcatalog-seltext_m
fieldcatalog-col_pos
fieldcatalog-outputlen
fieldcatalog-emphasize
=
=
=
=
=
'WERKS'.
'Plant Code'.
0.
10.
'X'.
in color)
*fieldcatalog-key
= 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'SAKTO'.
fieldcatalog-seltext_m = 'GL Account'.
fieldcatalog-col_pos
= 0.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
in color)
*fieldcatalog-key
= 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'KOSTL'.
fieldcatalog-seltext_m = 'Cost Center'.
fieldcatalog-col_pos
= 0.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
in color)
*fieldcatalog-key
= 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'FIPOS'.
fieldcatalog-seltext_m = 'Commitment Item'.
fieldcatalog-col_pos
= 0.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
in color)
*fieldcatalog-key
= 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
"
"
"
"
"
field Name
Field heading
col position
output Lenght
Emphasize (highlight columns
fieldcatalog-fieldname = 'AUFNR'.
" field Name
fieldcatalog-seltext_m = 'Maintenance Order'.
" Field heading
fieldcatalog-col_pos
= 0.
" col position
fieldcatalog-outputlen = 10.
" output Lenght
fieldcatalog-emphasize = 'X'.
" Emphasize (highlight columns
in color)
*fieldcatalog-key
= 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'BEDAT'.
" field Name
fieldcatalog-seltext_m = 'Document Creation Date'.
" Field heading
fieldcatalog-col_pos
= 0.
" col position
fieldcatalog-outputlen = 10.
" output Lenght
fieldcatalog-emphasize = 'X'.
" Emphasize (highlight columns
in color)
*fieldcatalog-key
= 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
"fieldcatalog-fieldname = 'FRGC1'.
"fieldcatalog-seltext_m = 'RC 1'.
"fieldcatalog-col_pos
= 0.
"fieldcatalog-outputlen = 10.
"fieldcatalog-emphasize = 'X'.
in color)
"*fieldcatalog-key
= 'X'.
"append fieldcatalog to fieldcatalog.
"clear fieldcatalog.
"fieldcatalog-fieldname = 'FRGC2'.
"fieldcatalog-seltext_m = 'RC 2'.
"fieldcatalog-col_pos
= 0.
"fieldcatalog-outputlen = 10.
"fieldcatalog-emphasize = 'X'.
in color)
"*fieldcatalog-key
= 'X'.
"append fieldcatalog to fieldcatalog.
"clear fieldcatalog.
"fieldcatalog-fieldname = 'FRGC3'.
"fieldcatalog-seltext_m = 'RC 3'.
"fieldcatalog-col_pos
= 0.
"fieldcatalog-outputlen = 10.
"fieldcatalog-emphasize = 'X'.
in color)
"*fieldcatalog-key
= 'X'.
"append fieldcatalog to fieldcatalog.
"clear fieldcatalog.
"fieldcatalog-fieldname = 'FRGC4'.
"fieldcatalog-seltext_m = 'RC 4'.
"fieldcatalog-col_pos
= 0.
"fieldcatalog-outputlen = 10.
"fieldcatalog-emphasize = 'X'.
in color)
"*fieldcatalog-key
= 'X'.
"append fieldcatalog to fieldcatalog.
"clear fieldcatalog.
"fieldcatalog-fieldname = 'FRGC5'.
"fieldcatalog-seltext_m = 'RC 5'.
"fieldcatalog-col_pos
= 0.
"fieldcatalog-outputlen = 10.
"fieldcatalog-emphasize = 'X'.
in color)
"*fieldcatalog-key
= 'X'.
"append fieldcatalog to fieldcatalog.
"clear fieldcatalog.
"fieldcatalog-fieldname
= 'FRGC6'.
"fieldcatalog-fieldname = 'FRGC7'.
"fieldcatalog-seltext_m = 'RC 7'.
"fieldcatalog-col_pos
= 0.
"fieldcatalog-outputlen = 10.
"fieldcatalog-emphasize = 'X'.
in color)
"*fieldcatalog-key
= 'X'.
"append fieldcatalog to fieldcatalog.
"clear fieldcatalog.
"fieldcatalog-fieldname = 'FRGC8'.
"fieldcatalog-seltext_m = 'RC 8'.
"fieldcatalog-col_pos
= 0.
"fieldcatalog-outputlen = 10.
"fieldcatalog-emphasize = 'X'.
in color)
"*fieldcatalog-key
= 'X'.
"append fieldcatalog to fieldcatalog.
"clear fieldcatalog.
"fieldcatalog-fieldname = 'FRGCO'.
" field Name
"fieldcatalog-seltext_m = 'Release Strategy Code'.
" Field heading
"fieldcatalog-col_pos
= 0.
" col position
"fieldcatalog-outputlen = 10.
" output Lenght
"fieldcatalog-emphasize = 'X'.
" Emphasize (highlight columns
in color)
"*fieldcatalog-key
= 'X'.
"append fieldcatalog to fieldcatalog.
"clear fieldcatalog.
fieldcatalog-fieldname = 'REL_CODE'.
fieldcatalog-seltext_m = 'Release Code'.
fieldcatalog-col_pos
= 0.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
in color)
*fieldcatalog-key
= 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname
fieldcatalog-seltext_m
fieldcatalog-col_pos
fieldcatalog-outputlen
fieldcatalog-emphasize
in color)
=
=
=
=
=
'REL_CODE_DESC'.
" field Name
'Release Code Description'.
" Field heading
0.
" col position
10.
" output Lenght
'X'.
" Emphasize (highlight columns
*fieldcatalog-key
= 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'AGE1'.
" field Name
fieldcatalog-seltext_m = 'Pending since 0-30 Days'.
" Field heading
fieldcatalog-col_pos
= 0.
" col position
fieldcatalog-outputlen = 10.
" output Lenght
fieldcatalog-emphasize = 'X'.
" Emphasize (highlight columns
in color)
*fieldcatalog-key
= 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'AGE2'.
" field Name
fieldcatalog-seltext_m = 'Pending since 31-60 Days'.
" Field heading
fieldcatalog-col_pos
= 0.
" col position
fieldcatalog-outputlen = 10.
" output Lenght
fieldcatalog-emphasize = 'X'.
" Emphasize (highlight columns
in color)
*fieldcatalog-key
= 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'AGE3'.
" field Name
fieldcatalog-seltext_m = 'Pending since 61-90 Days'.
" Field heading
fieldcatalog-col_pos
= 0.
" col position
fieldcatalog-outputlen = 10.
" output Lenght
fieldcatalog-emphasize = 'X'.
" Emphasize (highlight columns
in color)
*fieldcatalog-key
= 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'AGE4'.
" field Name
fieldcatalog-seltext_m = 'Pending since More than 90 Days'.
" Field heading
fieldcatalog-col_pos
= 0.
" col position
fieldcatalog-outputlen = 10.
" output Lenght
fieldcatalog-emphasize = 'X'.
" Emphasize (highlight columns
in color)
*fieldcatalog-key
= 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
endform.
" BUILD_FIELDCATALOG
*&---------------------------------------------------------------------*
*&
Form BUILD_LAYOUT
*&---------------------------------------------------------------------*
*
Build layout for ALV grid report
*----------------------------------------------------------------------*
form build_layout.
gd_layout-no_input
= 'X'.
gd_layout-colwidth_optimize = 'X'.
gd_layout-totals_text
= 'Totals'(201).
* gd_layout-totals_only
= 'X'.
* gd_layout-f2code
= 'DISP'. "Sets fcode for when double
*
"click(press f2)
* gd_layout-zebra
= 'X'.
* gd_layout-group_change_edit = 'X'.
* gd_layout-header_text
= 'helllllo'.
endform.
" BUILD_LAYOUT
*&---------------------------------------------------------------------*
*&
Form DISPLAY_ALV_REPORT
*&---------------------------------------------------------------------*
*
Display report using ALV grid
*----------------------------------------------------------------------*
form display_alv_report.
gd_repid = sy-repid.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program
= gd_repid
i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM
*
i_callback_user_command = 'USER_COMMAND'
*
i_grid_title
= outtext
is_layout
= gd_layout
it_fieldcat
= fieldcatalog[]
*
it_special_groups
= gd_tabgroup
it_events
= gt_events
is_print
= gd_prntparams
i_save
= 'X'
*
is_variant
= z_template
tables
t_outtab
= it_itab
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_ALV_REPORT
*-------------------------------------------------------------------*
* Form TOP-OF-PAGE
*
*-------------------------------------------------------------------*
* ALV Report Header
*
*-------------------------------------------------------------------*
Form top-of-page.
*ALV Header declarations
data: t_header type slis_t_listheader,
wa_header type slis_listheader,
t_line like wa_header-info,
ld_lines type i,
ld_linesc(10) type c.
* Title
wa_header-typ = 'H'.
wa_header-info = 'Review of Unapproved POs Report'.
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.
"todays date
importing
et_events = gt_events[].
read table gt_events with key name = slis_ev_end_of_page
into ls_event.
if sy-subrc = 0.
move 'END_OF_PAGE' to ls_event-form.
append ls_event to gt_events.
endif.
read table gt_events with key name = slis_ev_end_of_list
into ls_event.
if sy-subrc = 0.
move 'END_OF_LIST' to ls_event-form.
append ls_event to gt_events.
endif.
endform.
" BUILD_EVENTS
*&---------------------------------------------------------------------*
*&
Form BUILD_PRINT_PARAMS
*&---------------------------------------------------------------------*
*
Setup print parameters
*----------------------------------------------------------------------*
form build_print_params.
gd_prntparams-reserve_lines = '3'. "Lines reserved for footer
gd_prntparams-no_coverpage = 'X'.
endform.
" BUILD_PRINT_PARAMS
*&---------------------------------------------------------------------*
*&
Form END_OF_PAGE
*&---------------------------------------------------------------------*
form END_OF_PAGE.
data: listwidth type i,
ld_pagepos(10) type c,
ld_page(10)
type c.
write: sy-uline(50).
skip.
write:/40 'Page:', sy-pagno .
endform.
*&---------------------------------------------------------------------*
*&
Form END_OF_LIST
*&---------------------------------------------------------------------*
form END_OF_LIST.
data: listwidth type i,
ld_pagepos(10) type c,
ld_page(10)
type c.
skip.
write:/40 'Page:', sy-pagno .
endform.