Professional Documents
Culture Documents
11) Z Pending Pos Report
11) Z Pending Pos Report
EKPO-EBELN
EKPO-AEDAT
EKKO-BEDAT
EKKO-LIFNR
LFA1-NAME1
EKPO-KNTTP
EKPO-PSTYP
EKPO-MATNR
EKPO-TXZ01
EKPO-EGLKZ
EKPO-WERKS
T001W-NAME1
EKPO-BUKRS
EKKN-SAKTO
EKKN-KOSTL
EKKN-NPLNR
EKKN-PS_PSP_PNR
EKKN-PROJN
ESSR-ERDAT
ESSR-LBLNI
MSEG-BWART
MKPF-BUDAT
EKPO-MENGE
EKPO-LMEIN
EKPO-BPRME
EKPO-NETWR
EKKO-WAERS
,
,
,
,
,
,
ERFMG
ERFME
DMBTR
"NETWR
MSEG-ERFMG
MSEG-ERFME
MSEG-DMBTR
EKPO-NETWR
LIKE
LIKE
LIKE
LIKE
*BAL_QTY LIKE
*BAL_VAL LIKE
AGE1
AGE2
AGE3
AGE4
END OF
LIKE
LIKE
LIKE
LIKE
itab.
MSEG-ERFME
MSEG-DMBTR
MSEG-SALK3,
MSEG-SALK3,
MSEG-SALK3,
MSEG-SALK3,
, " PO No
, " PO Date
, " PO Date
, " Vendor Code
, " Vendor name
, " Account Category
, " Item Category
, " Material No
, " Material Description
, " Delivery Date
, " Plant Code
, " Plant Description
, " Company Code
, " GL Account
, " Cost Center
, " Network Activity
, " WBSE
, " Project No
, " SES Date
, " SES Doc No
, " GR Release Block Stock / Moment Ty
"
"
"
"
"
"
GRN Date
PO Quantity
Unit
Unit
PO Total Value
PO Total Quantity
, " Quantity
, " Value
COMM
GL_ACC
FOR MSEG-ERFMG,
FOR MSEG-ERFME,
FOR MSEG-DMBTR.
FOR EKKO-FIPOS,
FOR EKKO-SAKTO,
" po number
" PO date
" PO sate
" Vendor Code
" Vendor Name
" Account Catagory
"
EKPO~EBELN
EKKO~BEDAT
EKKO~LIFNR
LFA1~NAME1
EKPO~KNTTP
EKPO~PSTYP
EKPO~MATNR
IN PR_NO AND
IN BEDAT AND
IN LIFNR AND
IN ITM_CAT AND
IN KNTTP AND
IN PSTYP AND
IN MATNR AND
EKPO~TXZ01
EKPO~EGLKZ
EKPO~WERKS
EKPO~BUKRS
EKKN~SAKTO
EKKN~KOSTL
EKKN~NPLNR
EKKN~PS_PSP_PNR
EKKN~PROJN
IN
ESSR~ERDAT
IN
ESSR~LBLNI
IN
MSEG~BWART
IN
MKPF~BUDAT
IN
EKPO~MENGE
IN
EKPO~LMEIN
IN
EKPO~NETWR
IN
EKKO~WAERS
IN
MSEG~ERFMG
MSEG~ERFMG
MSEG~DMBTR
*
*
IN TXZ01 AND
IN EGLKZ AND
IN WERKS AND
IN BUKRS AND
IN SAKTO AND
IN KOSTL AND
IN NPLNR AND
IN PS_PSP AND
PROJN AND
ERDAT AND
LBLNI AND
BWART AND
BUDAT AND
PROJN AND
LMEIN AND
NETWR AND
WAERS AND
IN ERFMG AND
IN ERFME AND
IN DMBTR.
EKKO~FIPOS
EKKO~SAKTO
IN COMM AND
IN GL_ACC AND
*&---------------------------------------------------------------------*
*&
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
simply displaying the result
I.e. Field type may be required in-order for
the 'TOTAL' function to work.
fieldcatalog-fieldname = 'EBELN'.
fieldcatalog-seltext_m = 'Purchase Order'.
fieldcatalog-col_pos
= 0.
fieldcatalog-outputlen = 10.
fieldcatalog-key
= 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname
fieldcatalog-seltext_m
fieldcatalog-col_pos
fieldcatalog-outputlen
fieldcatalog-emphasize
in color)
=
=
=
=
=
'BEDAT'.
'PO Date'.
0.
10.
'X'.
fieldcatalog-key
= 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'LIFNR'.
fieldcatalog-seltext_m = 'Vendor Code'.
fieldcatalog-col_pos
= 0.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
in color)
*fieldcatalog-key
= 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'NAME1'.
fieldcatalog-seltext_m = 'Vendor Name'.
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 = 'KNTTP'.
" field Name
fieldcatalog-seltext_m = 'Account Assignment Category'.
" 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 = 'PSTYP'.
fieldcatalog-seltext_m = 'Item Category'.
fieldcatalog-col_pos
= 0.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
in color)
*fieldcatalog-key
= 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MATNR'.
fieldcatalog-seltext_m = 'Material Code'.
fieldcatalog-col_pos
= 0.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
in color)
*fieldcatalog-key
= 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
"
"
"
"
"
fieldcatalog-fieldname
= 'TXZ01'.
field Name
Field heading
col position
output Lenght
Emphasize (highlight columns
fieldcatalog-fieldname = 'P_NAME1'.
" field Name
fieldcatalog-seltext_m = 'Plant Description'.
" 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 = 'BUKRS'.
fieldcatalog-seltext_m = 'Company 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)
*fieldcatalog-key
=
=
=
=
=
'SAKTO'.
'GL Account'.
0.
10.
'X'.
= 'X'.
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 = '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 = '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 = 'ERDAT'.
fieldcatalog-seltext_m = 'SES Date'.
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
= 'LBLNI'.
= 'SES Doc No'.
fieldcatalog-col_pos
= 0.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
in color)
*fieldcatalog-key
= 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'BWART'.
fieldcatalog-seltext_m = 'Movement Type'.
fieldcatalog-col_pos
= 0.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
in color)
*fieldcatalog-key
= 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'BUDAT'.
fieldcatalog-seltext_m = 'GRN Date'.
fieldcatalog-col_pos
= 0.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
in color)
*fieldcatalog-key
= 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MENGE'.
fieldcatalog-seltext_m = 'PO Quantity'.
fieldcatalog-col_pos
= 0.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
in color)
*fieldcatalog-key
= 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'ERFME'.
" field Name
fieldcatalog-seltext_m = 'Unit'.
" 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
fieldcatalog-seltext_m
fieldcatalog-col_pos
fieldcatalog-outputlen
fieldcatalog-emphasize
in color)
*fieldcatalog-key
=
=
=
=
=
'NETWR'.
'PO Value'.
0.
10.
'X'.
= 'X'.
fieldcatalog-fieldname = 'ERFMG'.
fieldcatalog-seltext_m = 'Quantity'.
fieldcatalog-col_pos
= 0.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
in color)
*fieldcatalog-key
= 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'ERFME'.
" field Name
fieldcatalog-seltext_m = 'Unit'.
" 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 = 'DMBTR'.
fieldcatalog-seltext_m = 'Delivered Value'.
fieldcatalog-col_pos
= 0.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
in color)
*fieldcatalog-key
= 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'WAERS'.
fieldcatalog-seltext_m = 'Currency'.
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
"
"
"
"
"
field Name
Field heading
col position
output Lenght
Emphasize (highlight columns
= 'BAL_QTY'.
= 'Balanced Qty'.
fieldcatalog-col_pos
= 0.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
in color)
*fieldcatalog-key
= 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
"fieldcatalog-fieldname = 'ERFME'.
"field Name
"fieldcatalog-seltext_m = 'Unit'.
" 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 = 'BAL_VAL'.
fieldcatalog-seltext_m = 'Balanced Value'.
fieldcatalog-col_pos
= 0.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
in color)
*fieldcatalog-key
= 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'WAERS'.
fieldcatalog-seltext_m = 'Currency'.
fieldcatalog-col_pos
= 0.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
in color)
*fieldcatalog-key
= 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'AGE1'.
fieldcatalog-seltext_m = '0-30 Days'.
fieldcatalog-col_pos
= 0.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
in color)
*fieldcatalog-key
= 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'AGE2'.
fieldcatalog-seltext_m = '31-60 Days'.
fieldcatalog-col_pos
= 0.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
in color)
*fieldcatalog-key
= 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'AGE3'.
fieldcatalog-seltext_m = '61-90 Days'.
fieldcatalog-col_pos
= 0.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
in color)
*fieldcatalog-key
= 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'AGE4'.
" field Name
fieldcatalog-seltext_m = '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 Pending POs with Aging'.
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
*------------------------------------------------------------------*
*
FORM USER_COMMAND
*
*------------------------------------------------------------------*
*
--> R_UCOMM
*
*
--> RS_SELFIELD
*
*------------------------------------------------------------------*
*FORM user_command USING r_ucomm LIKE sy-ucomm
*
rs_selfield TYPE slis_selfield.
*
** Check function code
* CASE r_ucomm.
*
WHEN '&IC1'.
** Check field clicked on within ALVgrid report
*
IF rs_selfield-fieldname = 'EBELN'.
**
Read data table, using index of row user clicked on
*
READ TABLE itab INTO wa_ekko INDEX rs_selfield-tabindex.
**
Set parameter ID for transaction screen field
*
SET PARAMETER ID 'BES' FIELD wa_ekko-ebeln.
**
Sxecute transaction ME23N, and skip initial data entry screen
*
CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
*
ENDIF.
* ENDCASE.
*ENDFORM.
*&---------------------------------------------------------------------*
*&
Form BUILD_EVENTS
*&---------------------------------------------------------------------*
*
Build events table
*----------------------------------------------------------------------*
form build_events.
data: ls_event type slis_alv_event.
call function 'REUSE_ALV_EVENTS_GET'
exporting
i_list_type = 0
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.
< p="">
<>