Beruflich Dokumente
Kultur Dokumente
*&---------------------------------------------------------------------*
*& Table declaration
*&---------------------------------------------------------------------*
TABLES: ekko.
*&---------------------------------------------------------------------*
*& Type pool declaration
*&---------------------------------------------------------------------*
TYPE-POOLS: slis. " Type pool for ALV
*&---------------------------------------------------------------------*
*& Selection screen
*&---------------------------------------------------------------------*
SELECT-OPTIONS: s_ebeln FOR ekko-ebeln.
*&---------------------------------------------------------------------*
*& Type declaration
*&---------------------------------------------------------------------*
* Type declaration for internal table to store EKPO data
TYPES: BEGIN OF x_data,
ebeln TYPE char30, " Document no.
ebelp TYPE ebelp, " Item no
matnr TYPE matnr, " Material no
matnr1 TYPE matnr, " Material no
werks TYPE werks_d, " Plant
werks1 TYPE werks_d, " Plant
ntgew TYPE entge, " Net weight
gewe TYPE egewe, " Unit of weight
END OF x_data.
*&---------------------------------------------------------------------*
*& Internal table declaration
*&---------------------------------------------------------------------*
DATA:
* Internal table to store EKPO data
i_ekpo TYPE STANDARD TABLE OF x_data INITIAL SIZE 0,
* Internal table for storing field catalog information
i_fieldcat TYPE slis_t_fieldcat_alv,
* Internal table for Top of Page info. in ALV Display
i_alv_top_of_page TYPE slis_t_listheader,
* Internal table for ALV Display events
i_events TYPE slis_t_event,
* Internal table for storing ALV sort information
i_sort TYPE slis_t_sortinfo_alv,
i_event TYPE slis_t_event.
*&---------------------------------------------------------------------*
*& Work area declaration
*&---------------------------------------------------------------------*
DATA:
wa_ekko TYPE x_data,
wa_layout
TYPE slis_layout_alv,
wa_events
TYPE slis_alv_event,
TYPE char1
VALUE 'H',
TYPE char1
VALUE 'S'.
"Header in ALV
*&---------------------------------------------------------------------*
*& Start-of-selection event
*&---------------------------------------------------------------------*
START-OF-SELECTION.
* Select data from ekpo
SELECT ebeln " Doc no
ebelp " Item
matnr " Material
matnr " Material
werks " Plant
werks " Plant
ntgew " Quantity
gewei " Unit
FROM ekpo
INTO TABLE i_ekpo
WHERE ebeln IN s_ebeln
AND ntgew NE '0.00'.
IF sy-subrc = 0.
SORT i_ekpo BY ebeln ebelp matnr .
ENDIF.
* To build the Page header
PERFORM sub_build_header.
* To prepare field catalog
PERFORM sub_field_catalog.
* Perform to populate the layout structure
PERFORM sub_populate_layout.
* Perform to populate the sort table.
PERFORM sub_populate_sort.
* Perform to populate ALV event
* PERFORM sub_get_event.
END-OF-SELECTION.
* Perform to display ALV report
PERFORM sub_alv_report_display.
*&---------------------------------------------------------------------*
*&
Form sub_build_header
*&---------------------------------------------------------------------*
*
To build the header
*----------------------------------------------------------------------*
*
No Parameter
*----------------------------------------------------------------------*
FORM sub_build_header .
* Local data declaration
DATA: l_system
TYPE
l_r_line
TYPE
l_date
TYPE
l_time
TYPE
l_success_records
l_title(300) TYPE
char10 ,
slis_listheader,
char10,
char10,
TYPE i,
c.
"System id
"Hold list header
"Date
"Time
"No of success records
" Title
* Title Display
l_r_line-typ = c_header.
" header
l_title = 'Test report'(001).
l_r_line-info = l_title.
APPEND l_r_line TO i_alv_top_of_page.
CLEAR l_r_line.
* Run date Display
CLEAR l_date.
l_r_line-typ = c_item.
" Item
WRITE: sy-datum TO l_date MM/DD/YYYY.
l_r_line-key = 'Run Date :'(002).
l_r_line-info = l_date.
APPEND l_r_line TO i_alv_top_of_page.
CLEAR: l_r_line,
l_date.
=
=
=
=
=
=
=
=
=
=
p_rowpos.
p_colpos.
p_fldnam.
p_tabnam.
p_justif.
p_seltext.
p_out.
p_tech.
p_qfield.
p_qtab .
IF p_fldnam = 'NTGEW'.
wa_lfl_fcat-do_sum = 'X'.
ENDIF.
APPEND wa_lfl_fcat TO i_fieldcat.
CLEAR wa_lfl_fcat.
"Row
"Column
"Field Name
"Internal Table Name
"Screen Justified
"Field Text
"No output
"Technical field
"Quantity unit
"Quantity table
*
P_total Total
*
p_subtot_text Subtotal text info
*----------------------------------------------------------------------*
FORM subtotal_text CHANGING
p_total TYPE any
p_subtot_text TYPE slis_subtot_text.
* Material level sub total
IF p_subtot_text-criteria = 'MATNR'.
p_subtot_text-display_text_for_subtotal
= 'Material level total'(009).
ENDIF.
* Plant level sub total
IF p_subtot_text-criteria = 'WERKS'.
p_subtot_text-display_text_for_subtotal = 'Plant level total'(010).
ENDIF.
ENDFORM. "subtotal_text