REPORT zalvgrid NO STANDARD PAGE HEADING.
*&---------------------------------------------------------------------*
*& Written By : Sheila Titchener - www.iconet-ltd.co.uk
& Date : January 2006
*&
*&---------------------------------------------------------------------*
* Includes logo and white background - optimized field size
*&---------------------------------------------------------------------*
* ALV
TYPE-POOLS: slis.
*----------------
* extracted Notification date
TYPES: BEGIN OF ty_data,
qmnum TYPE qmnum,
qmdat TYPE qmdat,
mzeit TYPE mzeit,
erdat TYPE erdat,
erzeit TYPE erzeit,
ernam TYPE ernam,
END OF ty_data.
* ALV print table
TYPES: BEGIN OF ty_out,
qmnum TYPE qmnum,
qmdat TYPE qmdat,
mzeit TYPE mzeit,
erdat TYPE erdat,
erzeit TYPE erzeit,
ernam TYPE ernam,
END OF ty_out.
*----------------------------------------------------------------------*
DATA: viqmel TYPE viqmel.
*----------------------------------------------------------------------*
* Internal tables and their work areas
*----------------------------------------------------------------------*
DATA: w_data TYPE ty_data,
t_data TYPE TABLE OF ty_data.
DATA: w_out TYPE ty_out,
t_out TYPE TABLE OF ty_out.
*----------------------------------------------------------------------*
* Headings.
*----------------------------------------------------------------------*
DATA: BEGIN OF h1,
print_date(10),
sdate(10),
END OF h1.
*
*----------------------------------------------------------------------*
* Data for ALV
*----------------------------------------------------------------------*
INCLUDE
INCLUDE
*---------
CONSTANTS:
*---------
gc_formname_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE'.
DATA: gt_fieldcat TYPE slis_t_fieldcat_alv,
gs_layout TYPE slis_layout_alv,
gs_print TYPE slis_print_alv,
gt_sort TYPE slis_t_sortinfo_alv,
gt_sp_group TYPE slis_t_sp_group_alv,
gt_events TYPE slis_t_event.
*
DATA: g_repid LIKE sy-repid.
DATA: gt_list_top_of_page TYPE slis_t_listheader.
DATA: g_save(1) TYPE c.
*----------------------------------------------------------------------*
* Report Selections
*----------------------------------------------------------------------*
PARAMETERS: plant LIKE viqmel-iwerk VALUE CHECK OBLIGATORY
MEMORY ID wrk,
sorg LIKE vbak-vkorg OBLIGATORY MEMORY ID vko.
SELECTION-SCREEN SKIP 1.
SELECT-OPTIONS: wkcentre FOR viqmel-arbpl,
nottype FOR viqmel-qmart,
notnum FOR viqmel-qmnum,
crdate FOR viqmel-erdat NO-EXTENSION,
createby FOR viqmel-ernam.
*-------
* MACROS
*-------
* FIELD CATALOGUE ENTRY FOR Keyed FIELDS
DEFINE catfield.
*----------------
* 1= Fieldname, 2= Description, 3=Key
clear ls_fieldcat.
ls_fieldcat-fieldname = &1.
ls_fieldcat-key = &3.
ls_fieldcat-hotspot = &3.
* ls_fieldcat-key_sel = 'X'.
ls_fieldcat-tabname = 'T_OUT'.
* Output length will be optimised by ALV
* ls_fieldcat-outputlen = '6'.
ls_fieldcat-seltext_m = &2.
append ls_fieldcat to gt_fieldcat.
* color C or X 1-9 = color number 0/1 intensified 0/1 inverse
ls_fieldcat-emphasize = 'C100'.
END-OF-DEFINITION.
*----------------
* FIELD CATALOGUE ENTRY FOR SUMMED FIELDS
DEFINE catsum.
*----------------
* 1= Fieldname, 2= color, 3= Description,
clear ls_fieldcat.
ls_fieldcat-fieldname = &1.
ls_fieldcat-do_sum = 'X'.
ls_fieldcat-key_sel = 'X'.
ls_fieldcat-tabname = 'T_OUT'.
ls_fieldcat-emphasize = &2.
ls_fieldcat-seltext_m = &3.
append ls_fieldcat to gt_fieldcat.
END-OF-DEFINITION.
*---------------------------------------------------------------------*
INITIALIZATION.
*----------------------------------------------------------------------*
g_repid = sy-repid.
* set to-date as today
crdate-high = sy-datum.
crdate-option = 'EQ'.
crdate-sign = 'I'.
APPEND crdate TO crdate.
REFRESH gt_fieldcat.
PERFORM e01_fieldcat_init .
PERFORM e03_eventtab_build USING gt_events[].
PERFORM e06_t_sort_build USING gt_sort[].
*----------------------------------------------------------------------*
AT SELECTION-SCREEN ON plant.
*----------------------------------------------------------------------*
*----------------------------------------------------------------------*
START-OF-SELECTION.
*----------------------------------------------------------------------*
PERFORM e04_comment_build USING gt_list_top_of_page[].
PERFORM selection.
*----------------------------------------------------------------------*
END-OF-SELECTION.
*----------------------------------------------------------------------*
PERFORM e05_layout_build USING gs_layout. "wg. Parameters
* Call ABAP/4 List Viewer
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_background_id = 'WHITE'
i_callback_program = g_repid
i_callback_user_command = 'USER_COMMAND'
is_layout = gs_layout
it_fieldcat = gt_fieldcat[]
* i_save = 'A'
is_print = gs_print
it_events = gt_events[]
TABLES
t_outtab = t_out.
*---------------------------------------------------------------------*
* FORM E01_FIELDCAT_INIT *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
* --> E01_LT_FIELDCAT *
*---------------------------------------------------------------------*
FORM e01_fieldcat_init.
DATA: ls_fieldcat TYPE slis_fieldcat_alv.
* BASIC FIELDS
catfield 'QMNUM' text-024 'X'.
catfield 'QMDAT' text-023 ' '.
catfield 'MZEIT' text-022 ' '.
catfield 'ERDAT' text-021 ' '.
catfield 'ERZEIT' text-020 ' '.
catfield 'ERNAM' text-019 ' '.
ENDFORM.
*---------------------------------------------------------------------*
* FORM E02_DATA_ADD *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
* --> *
*---------------------------------------------------------------------*
FORM e02_data_add .
LOOP AT t_data INTO w_data.
MOVE-CORRESPONDING w_data TO w_out.
PERFORM get_disp_task.
PERFORM get_tsrl_status.
APPEND w_out TO t_out.
ENDLOOP.
ENDFORM.
*---------------------------------------------------------------------*
* FORM E03_EVENTTAB_BUILD *
*---------------------------------------------------------------------*
* Set up TOP-OF-PAGE event processing *
*---------------------------------------------------------------------*
* --> E03_LT_EVENTS *
*---------------------------------------------------------------------*
FORM e03_eventtab_build USING e03_lt_events TYPE slis_t_event.
DATA: ls_event TYPE slis_alv_event.
*
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = e03_lt_events.
READ TABLE e03_lt_events WITH KEY name = slis_ev_top_of_page
INTO ls_event.
IF sy-subrc = 0.
MOVE gc_formname_top_of_page TO ls_event-form.
APPEND ls_event TO e03_lt_events.
ENDIF.
ENDFORM.
*---------------------------------------------------------------------*
* FORM E04_COMMENT_BUILD *
*---------------------------------------------------------------------*
* Create Headings
*
*---------------------------------------------------------------------*
* --> E04_LT_TOP_OF_PAGE *
*---------------------------------------------------------------------*
FORM e04_comment_build USING e04_lt_top_of_page TYPE slis_t_listheader.
DATA: ls_line TYPE slis_listheader.
DATA: l_date(10).
*
* Title Typ H
CLEAR ls_line.
ls_line-typ = 'H'.
ls_line-info = sy-title.
APPEND ls_line TO e04_lt_top_of_page.
* head 1
CLEAR ls_line.
* Plant
ls_line-key = text-101.
ls_line-info = plant.
ls_line-typ = 'S'.
APPEND ls_line TO e04_lt_top_of_page.
* Sales Org
ls_line-key = text-102.
ls_line-info = sorg.
APPEND ls_line TO e04_lt_top_of_page.
* Maintenance Work Centre
IF NOT wkcentre[] IS INITIAL.
ls_line-key = text-105.
ls_line-info = wkcentre-low.
APPEND ls_line TO e04_lt_top_of_page.
ENDIF.
* Notification Type
IF NOT nottype[] IS INITIAL.
ls_line-key = text-106.
ls_line-info = nottype-low.
APPEND ls_line TO e04_lt_top_of_page.
ENDIF.
* Notification Number
IF NOT notnum[] IS INITIAL.
ls_line-key = text-107.
ls_line-info = notnum-low.
APPEND ls_line TO e04_lt_top_of_page.
ENDIF.
* Created From
ls_line-key = text-103.
WRITE crdate-low TO l_date DD/MM/YYYY.
ls_line-info = l_date.
APPEND ls_line TO e04_lt_top_of_page.
* Created to
ls_line-key = text-104.
WRITE crdate-high TO l_date DD/MM/YYYY.
ls_line-info = l_date.
APPEND ls_line TO e04_lt_top_of_page.
*
ENDFORM.
*---------------------------------------------------------------------*
* FORM E05_LAYOUT_BUILD *
*---------------------------------------------------------------------*
* ALV Layout options *
*---------------------------------------------------------------------*
* <-> E05_LS_LAYOUT *
*---------------------------------------------------------------------*
FORM e05_layout_build USING e05_ls_layout TYPE slis_layout_alv.
e05_ls_layout-zebra = 'X'.
e05_ls_layout-colwidth_optimize = 'X'.
* e05_ls_layout-lights_fieldname = 'LIGHTS'.
ENDFORM.
*---------------------------------------------------------------------*
* FORM E06_T_SORT_BUILD *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
* --> E06_LT_SORT *
*---------------------------------------------------------------------*
FORM e06_t_sort_build USING e06_lt_sort TYPE slis_t_sortinfo_alv.
* DATA: ls_sort TYPE slis_sortinfo_alv.
ENDFORM.
*---------------------------------------------------------------------*
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
*---------------------------------------------------------------------*
* called by ALV list viewer
*-----------------------------------------------------------------------
CASE rs_selfield-sel_tab_field.
WHEN 'T_OUT-QMNUM'.
SET PARAMETER ID 'IQM' FIELD rs_selfield-value.
CALL TRANSACTION 'IW53' AND SKIP FIRST SCREEN.
ENDCASE.
ENDFORM.
*---------------------------------------------------------------------*
* FORM SELECTION *
*---------------------------------------------------------------------*
* Select data from CATSDB *
*---------------------------------------------------------------------*
FORM selection.
SELECT * FROM viqmel
INTO CORRESPONDING FIELDS OF TABLE t_data
WHERE iwerk = plant
AND vkorg = sorg
AND arbpl IN wkcentre
AND qmart IN nottype
AND qmnum IN notnum
AND erdat IN crdate
AND ernam IN createby.
*
PERFORM e02_data_add.
ENDFORM.
*---------------------------------------------------------------------*
* FORM TOP_OF_PAGE *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
FORM top_of_page.
* create logo in transaction OAER - Business Documents
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
i_logo = 'LOGO'
it_list_commentary = gt_list_top_of_page.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form get_disp_task
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM get_disp_task.
ENDFORM. " get_disp_task
*&---------------------------------------------------------------------*
*& Form get_tsrl_status
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM get_tsrl_status.
ENDFORM. " get_tsrl_status
Tuesday, May 6, 2008
Sample ABAP Program of ALV Grid
Labels:
Sample ABAP Code Programs
Subscribe to:
Post Comments (Atom)
Blog Archive
-
▼
2008
(300)
-
▼
May
(80)
- Object oriented programming (OOP) All Steps
- Object oriented programming (OOP) Step2
- Object oriented programming (OOP) Step-by-step
- Object oriented programming (OOP) explained with a...
- Interview Question on BAPI, RFC, ABAP Objects, Tables
- The Other 50 ABAP Interview Faq's
- More than 100 ABAP Interview Faq's
- Events in Report
- Example: The IDoc Type ORDERS01
- Program for Outbound IDOC
- Basic Configuration in IDOC
- Sample ABAP Program to Upload table using new func...
- Sample ABAP Program for Submitting report with sel...
- Sample ABAP Program for Submitting report with sel...
- Sample ABAP Program for Sending SAP Mail
- Sample ABAP Program for Search Layout sets for giv...
- Sample ABAP Program for Sapscript PerForm Module
- Sample ABAP Program for Create IDOC
- Sample ABAP Program for Output file to application...
- Sample ABAP Program for Module Pool Skeleton
- Sample ABAP Program for Module Pool containing scr...
- Sample ABAP Program for MB1B Call Transaction
- Sample ABAP Program of Function Module to Convert ...
- Sample ABAP Program of FTP Function Module
- Sample ABAP Program to EXPORT LIST TO MEMORY
- Sample ABAP Program to Execute Unix command from w...
- Sample ABAP Program to Get Output in EXCEL
- Sample ABAP Program to Implement EDI
- Sample Program to dynamically change upload/downlo...
- Sample ABAP Program to download table using new fu...
- Sample ABAP Program to Download file to Presentati...
- Sample ABAP Program to display pop message to avoi...
- Sample ABAP Program of ALV Grid
- Sample ABAP Program of Dialogue Module Pool
- Sample ABAP Program to DIALOGUE FLOW LOGIC
- Sample ABAP Program to Delete a file from the appl...
- Sample ABAP Program to Compare to Unix or PC files...
- Sample ABAP Program to Colour cells in ALV
- Sample ABAP Program to Calculate difference betwee...
- Sample ABAP Program of BW User Exit
- Sample SAP ABAP Program to Browse a file on the ap...
- Sample SAP ABAP Program of ALV Grid control using ...
- SE30 - Runtime Analysis Tool
- List of System fields
- Write a report that displays the text 'Hello world...
- HR (Human Resource) Tutorials Free downloads
- FI (Financial) Tutorials Free downloads
- PM (Plant Maintenance) Tutorials Free downloads
- WM (Warehouse Management) Tutorials Free downloads
- QM (Quality Management) Tutorials Free downloads
- PP (Production Planning) Tutorials Free downloads
- SD (Sales and Distribution) Tutorials Free downloads
- MM (Material Management) Tutorials Free downloads
- IDOC INTRODUCTION & STRUCTURE
- Step-by-Step Guide for using LSMW to Update Custom...
- LIST of TABLES
- Transporting Objects and Standard Text from one cl...
- SAP R/3 INTERVIEW ARCHITECTURE QUESTIONS
- SAP TRANSACTIONS INTERVIEW QUESTIONS
- SAP MODULARIZATION INTERVIEW QUESTIONS
- SAP LOGICAL DATABASE INTERVIEW QUESTIONS
- SAP R/3 DATA DICTIONARY INTERVIEW QUESTIONS
- SAP BDC INTERVIEW QUESTIONS & ANSWERS
- SAP ABAP MENU PAINTER & SCREEN PAINTER Tutorials
- SAP ABAP WORKFLOW Tutorials PDF Free downloads
- SAP ABAP ITS Tutorials PDF Free downloads
- SAP ABAP EDI Tutorials PDF Free downloads
- SAP ABAP BAPI Tutorials PDF Free downloads
- SAP ABAP Change&Transport System Tutorials PDF Fre...
- SAP ABAP OBJECTS Tutorials PDF Free downloads
- SAP ABAP USER EXITS Tutorials PDF Free downloads
- SAP ABAP ALE Tutorials PDF Free downloads
- SAP ABAP IDOC Tutorials PDF Free downloads
- SAP ABAP LSMW Tutorials PDF Free downloads
- SAP ABAP BDC (Batch Data Communication) Tutorials ...
- SAP ABAP SAPSCRIPTS Tutorials Free downloads
- ALV Grid free download
- SAP ABAP INTERACTIVE REPORTING FAQs
- SAP ABAP REPORTING GENERAL
- SAP REPORTS FAQ
-
▼
May
(80)
No comments:
Post a Comment