Home >Documents >Sample Alv Reports

Sample Alv Reports

Date post:17-Nov-2014
Category:
View:1,790 times
Download:4 times
Share this document with a friend
Description:
Sample ALV Reports
Transcript:

ALV REPORTSReport for header window and template*&--------------------------------------------------------------------* *& Report ZALV * *& * *&--------------------------------------------------------------------* *& * *& * *&--------------------------------------------------------------------* Report ZALV . TABLES: ekko. "ALV Declarations

type-pools: slis. *Data Declaration *---------------TYPES: BEGIN OF t_ekko, ebeln TYPE ekpo-ebeln, ebelp TYPE ekpo-ebelp, statu TYPE ekpo-statu, aedat TYPE ekpo-aedat, matnr TYPE ekpo-matnr, menge TYPE ekpo-menge, meins TYPE ekpo-meins, netpr TYPE ekpo-netpr, peinh TYPE ekpo-peinh, END OF t_ekko.

DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0, wa_ekko TYPE t_ekko. *ALV data declarations 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.

******************************************************************** **** *Start-of-selection. START-OF-SELECTION. perform perform perform perform perform perform data_retrieval. build_fieldcatalog. build_layout. build_events. build_print_params. display_alv_report.

*&--------------------------------------------------------------------* *& Form BUILD_FIELDCATALOG *&--------------------------------------------------------------------* * Build Fieldcatalog for ALV Report *---------------------------------------------------------------------* form build_fieldcatalog. * There are a number of ways to create a fieldcat. * For the purpose of this example i will build the fieldcatalog manualy * by populating the internal table fields individually and then * appending the rows. This method can be the most time consuming but can * also allow you more control of the final product. * 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-emphasize = 'X'. fieldcatalog-key = 'X'. * fieldcatalog-do_sum = 'X'. * fieldcatalog-no_zero = 'X'. append fieldcatalog to fieldcatalog. clear fieldcatalog. fieldcatalog-fieldname fieldcatalog-seltext_m fieldcatalog-col_pos = 'EBELP'. = 'PO Item'. = 1.

append fieldcatalog to fieldcatalog. clear fieldcatalog. fieldcatalog-fieldname = 'STATU'. fieldcatalog-seltext_m = 'Status'. fieldcatalog-col_pos = 2. append fieldcatalog to fieldcatalog. clear fieldcatalog. fieldcatalog-fieldname = 'AEDAT'. fieldcatalog-seltext_m = 'Item change date'. fieldcatalog-col_pos = 3. append fieldcatalog to fieldcatalog. clear fieldcatalog. fieldcatalog-fieldname = 'MATNR'. fieldcatalog-seltext_m = 'Material Number'. fieldcatalog-col_pos = 4. append fieldcatalog to fieldcatalog. clear fieldcatalog. fieldcatalog-fieldname = 'MENGE'. fieldcatalog-seltext_m = 'PO quantity'. fieldcatalog-col_pos = 5. append fieldcatalog to fieldcatalog. clear fieldcatalog. fieldcatalog-fieldname = 'MEINS'. fieldcatalog-seltext_m = 'Order Unit'. fieldcatalog-col_pos = 6. append fieldcatalog to fieldcatalog. clear fieldcatalog. fieldcatalog-fieldname = 'NETPR'. fieldcatalog-seltext_m = 'Net Price'. fieldcatalog-col_pos = 7. fieldcatalog-outputlen = 15. fieldcatalog-datatype = 'CURR'. append fieldcatalog to fieldcatalog. clear fieldcatalog. fieldcatalog-fieldname = 'PEINH'. fieldcatalog-seltext_m = 'Price Unit'. fieldcatalog-col_pos = 8. 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_ekko 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 DATA_RETRIEVAL *&--------------------------------------------------------------------* * Retrieve data form EKPO table and populate itab it_ekko *---------------------------------------------------------------------* form data_retrieval. select up to from into ebeln ebelp statu aedat matnr menge meins netpr peinh 10 rows ekpo table it_ekko.

endform.

" DATA_RETRIEVAL

*------------------------------------------------------------------* * 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 = 'EKKO Table 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.

"todays date

clear: wa_header. * Total No. of Records Selected describe table it_ekko lines ld_lines. ld_linesc = ld_lines. concatenate 'Total No. of Records Selected: ' ld_linesc into t_line separated by space. wa_header-typ = 'A'. wa_header-info = t_line. append wa_header to t_header. clear: wa_header, t_line. call function 'REUSE_ALV_COMMENTARY_WRITE' exporting it_list_commentary = t_header. * i_logo = 'Z_LOGO'. endform. *------------------------------------------------------------------* * 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 it_ekko 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. 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.

Report for different type of layout*&--------------------------------------------------------------------* *& Report ZALV1 * *& * *&--------------------------------------------------------------------* *& * *& * *&--------------------------------------------------------------------* REPORT ZALV1 .

type-pools: slis. data: begin of head occurs 0, matnr type ekpo-matnr, maktx type makt-maktx, EXPAND type c, end of head. data: begin of detail occurs 0, aufnr type afpo-aufnr, matnr type afpo-matnr, werks type aufk-werks, pwerk type afpo-pwerk, psmng type afpo-psmng, end of detail. start-of-selection. select * into corresponding fields of table detail from afpo

inner join aufk on afpo~aufnr = aufk~aufnr inner join afko on afpo~aufnr = afko~aufnr up to 500 rows where aufk~auart = 'G2P1'. if not detail[] is initial. sort detail ascending by matnr. select distinct * into corresponding fields of table head from makt for all entries in detail where matnr = detail-matnr and spras = sy-langu. endif. perform call_alv. *--------------------------------------------------------------------* * FORM call_alv * *--------------------------------------------------------------------* * ........ * *--------------------------------------------------------------------* form call_alv. data: gt_fieldcat gs_keyinfo gs_layout . data: ls_fieldcat type slis_t_fieldcat_alv, type slis_keyinfo_alv, type slis_layout_alv. type slis_fieldcat_alv.

clear gs_keyinfo. gs_keyinfo-header01 = 'MATNR'. gs_keyinfo-item01 = 'MATNR'. clear ls_fieldcat. ls_fieldcat-fieldname = 'MATNR'. ls_fieldcat-reptext_ddic = 'Material'. ls_fieldcat-tabname = 'HEAD'. ls_fieldcat-outputlen = 18. append ls_fieldcat to gt_fieldcat. clear ls_fieldcat. ls_fieldcat-fieldname = 'MAKTX'. ls_fieldcat-reptext_ddic = 'Description'. ls_fieldcat-tabname = 'HEAD'.

ls_fieldcat-outputlen = 40. append ls_fieldcat to gt_fieldcat. clear ls_fieldcat. ls_fieldcat-fieldname = 'AUFNR'. ls_fieldcat-reptext_ddic = 'Production Order'. ls_fieldcat-tabname = 'DETAIL'. ls_fieldcat-outputlen = 12. append ls_fieldcat to gt_fieldcat. clear ls_fieldcat. ls_fieldcat-fieldname = 'WERKS'. ls_fieldcat-reptext_ddic = 'Production Plant'. ls_fieldcat-tabname = 'DETAIL'. ls_fieldcat-outputlen = 4. append ls_fieldcat to gt_fieldcat. clear ls_fieldcat. ls_fieldcat-fieldname = 'PWERK'. ls_fieldcat-reptext_ddic = 'Planning Plant'. ls_fieldcat-tabname = 'DETAIL'. ls_fieldcat-outputlen = 4. append ls_fieldcat to gt_fieldcat. clear ls_fieldcat. ls_fieldcat-fieldname = 'PSMNG'. ls_fieldcat-reptext_ddic = 'Quantity'. ls_fieldcat-tabname = 'DETAIL'. ls_fieldcat-outputlen = 20. append ls_fieldcat to gt_fieldcat. gs_layout-expand_fieldname = 'EXPAND'. call function 'REUSE_ALV_HIERSEQ_LIST_DISPLAY' exporting it_fieldcat = gt_fieldcat[] is_layout = gs_layout i_tabname_header = 'HEAD' i_tabname_item = 'DETAIL' is_keyinfo = gs_keyinfo tables t_outtab_header = head t_outtab_item = detail. endform.

To display different colors in alv*&--------------------------------------------------------------------* *& Report ZALVCOLOR * *& * *&--------------------------------------------------------------------* *& * *& * *&--------------------------------------------------------------------* REPORT ZALVCOLOR . " General Material Data " ALV Global types " Data to display " Material number "#EC

DATA : mara TYPE mara. TYPE-POOLS: slis. FIELD-SYMBOLS : TYPE table. SELECT-OPTIONS : s_matnr FOR mara-matnr.

SELECTION-SCREEN : SKIP, BEGIN OF LINE,COMMENT 5(27) v_1 FOR FIELD p_max. NEEDED PARAMETERS p_max(2) TYPE n DEFAULT '50' OBLIGATORY. SELECTION-SCREEN END OF LINE.

*--------------------------------------------------------------------* INITIALIZATION. v_1 = 'Maximum of lines to display'. *--------------------------------------------------------------------* START-OF-SELECTION. PERFORM f_read_data. PERFORM f_display_data. *--------------------------------------------------------------------* * Form f_read_data *--------------------------------------------------------------------*

FORM f_read_data. FIELD-SYMBOLS : TYPE TYPE TYPE TYPE TYPE DATA: lp_struct lp_struct2 lp_table lp_table2 ls_lvc_cat lt_lvc_cat TYPE TYPE TYPE TYPE TYPE TYPE ANY, ANY, ANY, ANY, table. REF TO data, REF TO data, REF TO data, REF TO data, lvc_s_fcat, lvc_t_fcat.

" Data read from DB

" Pointer to dynamic table " Pointer to dynamic table " Field catalog

* First column CLEAR ls_lvc_cat. ls_lvc_cat-fieldname = 'MATNR'. ls_lvc_cat-ref_table = 'MARA'. APPEND ls_lvc_cat TO lt_lvc_cat. * 2nd column CLEAR ls_lvc_cat. ls_lvc_cat-fieldname = 'MAKTX'. ls_lvc_cat-ref_table = 'MAKT'. APPEND ls_lvc_cat TO lt_lvc_cat. * 3rd column CLEAR ls_lvc_cat. ls_lvc_cat-fieldname = 'MATKL'. ls_lvc_cat-ref_table = 'MARA'. APPEND ls_lvc_cat TO lt_lvc_cat. * Create 1st internal table CALL METHOD cl_alv_table_create=>create_dynamic_table EXPORTING it_fieldcatalog = lt_lvc_cat IMPORTING ep_table = lp_table. ASSIGN lp_table->* TO . * Read data into 1st internal table SELECT matnr maktx matkl INTO TABLE FROM v_matnr UP TO p_max ROWS WHERE matnr IN s_matnr. * Create 2nd internal table * Checkbox CLEAR ls_lvc_cat. ls_lvc_cat-fieldname = 'CHECKBOX'.

APPEND ls_lvc_cat TO lt_lvc_cat. * Table color CLEAR ls_lvc_cat. ls_lvc_cat-fieldname ls_lvc_cat-ref_table ls_lvc_cat-ref_field APPEND ls_lvc_cat TO

= 'TABCOLOR'. = 'CALENDAR_TYPE'. = 'COLTAB'. lt_lvc_cat.

* Create 2nd internal table CALL METHOD cl_alv_table_create=>create_dynamic_table EXPORTING it_fieldcatalog = lt_lvc_cat IMPORTING ep_table = lp_table2. ASSIGN lp_table2->* TO . * Create structure = structure of the 1st internal table CREATE DATA lp_struct LIKE LINE OF . ASSIGN lp_struct->* TO . * Create structure = structure of the 2nd internal table CREATE DATA lp_struct2 LIKE LINE OF . ASSIGN lp_struct2->* TO . * Move data from 1st internal table --> 2nd internal table LOOP AT ASSIGNING . DESCRIBE TABLE lt_lvc_cat. CLEAR . * * Fill the internal to display DO sy-tfill TIMES. READ TABLE lt_lvc_cat INTO ls_lvc_cat INDEX sy-index. For each field of lt_lvc_cat. ASSIGN COMPONENT ls_lvc_cat-fieldname OF STRUCTURE TO . IF sy-subrc NE 0. EXIT .ENDIF. ASSIGN COMPONENT ls_lvc_cat-fieldname OF STRUCTURE TO . IF sy-subrc NE 0. EXIT .ENDIF. = . ENDDO. Modify color ASSIGN COMPONENT 'TABCOLOR' OF STRUCTURE TO . IF sy-subrc EQ 0. PERFORM f_modify_color USING 'MAKTX' . PERFORM f_modify_color USING 'MATKL' . ENDIF. APPEND TO . ENDLOOP.

*

ENDFORM. " f_read_data *--------------------------------------------------------------------* * Form F_DISPLAY_DATA *--------------------------------------------------------------------* FORM f_display_data. * Macro definition DEFINE m_sort. add 1 to ls_sort-spos. ls_sort-fieldname = &1. ls_sort-down = 'X'. append ls_sort to lt_sort. END-OF-DEFINITION. DATA: ls_layout lt_sort ls_sort ls_fieldcat lt_fieldcat TYPE TYPE TYPE TYPE TYPE slis_layout_alv, slis_t_sortinfo_alv, slis_sortinfo_alv, slis_fieldcat_alv, slis_t_fieldcat_alv.

" Field catalog

* Build Fieldcatalog - First column CLEAR ls_fieldcat. ls_fieldcat-fieldname = 'MATNR'. ls_fieldcat-ref_tabname = 'MARA'. ls_fieldcat-key = 'X'. APPEND ls_fieldcat TO lt_fieldcat. * Build Fieldcatalog - 2nd column CLEAR ls_fieldcat. ls_fieldcat-fieldname = 'MAKTX'. ls_fieldcat-ref_tabname = 'MAKT'. APPEND ls_fieldcat TO lt_fieldcat. * Build Fieldcatalog - 3rd column CLEAR ls_fieldcat. ls_fieldcat-fieldname = 'MATKL'. ls_fieldcat-ref_tabname = 'MARA'. APPEND ls_fieldcat TO lt_fieldcat. * Layout ls_layout-zebra = 'X'. ls_layout-colwidth_optimize = 'X'. ls_layout-box_fieldname = 'CHECKBOX'. ls_layout-coltab_fieldname = 'TABCOLOR'. m_sort 'MATNR'. " Sort by creation date

* Display data CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING is_layout it_fieldcat it_sort TABLES t_outtab

= ls_layout = lt_fieldcat = lt_sort = .

ENDFORM. " F_DISPLAY_DATA *--------------------------------------------------------------------* * Form F_modify_color *--------------------------------------------------------------------* FORM f_modify_color USING u_fieldname TYPE lvc_fname ut_tabcolor TYPE table. DATA: l_rnd_value TYPE datatype-integer2, ls_tabcolor TYPE lvc_s_scol. * Random value CALL FUNCTION 'RANDOM_I2' EXPORTING rnd_min = 0 rnd_max = 3 IMPORTING rnd_value = l_rnd_value. CLEAR ls_tabcolor. ls_tabcolor-fname = u_fieldname. CASE l_rnd_value. WHEN 0. ls_tabcolor-color-col ls_tabcolor-color-int ls_tabcolor-color-inv WHEN 1. ls_tabcolor-color-col ls_tabcolor-color-int ls_tabcolor-color-inv WHEN 2. ls_tabcolor-color-col ls_tabcolor-color-int ls_tabcolor-color-inv WHEN 3. ls_tabcolor-color-col ls_tabcolor-color-int ls_tabcolor-color-inv ENDCASE.

= 1. = 0. = 0. = 3. = 0. = 0. = 5. = 0. = 0. = 6. = 0. = 0.

" Blue.

" Yellow.

" Green.

" Red.

INSERT ls_tabcolor INTO TABLE ut_tabcolor. ENDFORM. " F_MODIFY_COLOR

Alv grid to print logo on the header with radio buttons*&--------------------------------------------------------------------* *& Report ZALVDEMO * *& * *&--------------------------------------------------------------------* *& * *& * *&--------------------------------------------------------------------* REPORT ZALVDEMO.

TABLES : J_1IEXCHDR, " header table J_1IEXCDTL, " item table J_1IPART2, " Excise Part II details LFA1, " vendor master table J_1IMOVEND, " vendor excise details table MSEG, " Document Segment: Material MKPF, " Header: Material Document DD07T, " domain text table T001W. " Plant and Branch Details DATA : BEGIN OF IT_CHDR OCCURS 100, DOCNO LIKE J_1IEXCHDR-DOCNO, DOCYR LIKE J_1IEXCHDR-DOCYR, EXNUM LIKE J_1IEXCHDR-EXNUM, EXDAT LIKE J_1IEXCHDR-EXDAT, WERKS LIKE J_1IEXCHDR-WERKS, EXBED LIKE J_1IEXCHDR-EXBED, EXCCD LIKE J_1IEXCHDR-EXCCD, ECS LIKE J_1IEXCHDR-ECS, END OF IT_CHDR. DATA : BEGIN OF IT_CDTL OCCURS 100, DOCYR LIKE J_1IEXCDTL-DOCYR, DOCNO LIKE J_1IEXCDTL-DOCNO, EXNUM LIKE J_1IEXCDTL-EXNUM, EXDAT LIKE J_1IEXCDTL-EXDAT, LIFNR LIKE J_1IEXCDTL-LIFNR, MATNR LIKE J_1IEXCDTL-MATNR, MAKTX LIKE J_1IEXCDTL-MAKTX, CHAPID LIKE J_1IEXCDTL-CHAPID, EXBAS LIKE J_1IEXCDTL-EXBAS,

EXBED LIKE J_1IEXCDTL-EXBED, ECS LIKE J_1IEXCDTL-ECS, MENGE LIKE J_1IEXCDTL-MENGE, MEINS LIKE J_1IEXCDTL-MEINS, RDOC2 LIKE J_1IEXCDTL-RDOC2, END OF IT_CDTL. DATA TEXT(10). DATA : BEGIN OF IT_OUT OCCURS 0, SERIALNO LIKE J_1IPART2-SERIALNO, TEXT1 LIKE TEXT, EXNUM LIKE J_1IEXCDTL-EXNUM, EXDAT LIKE J_1IEXCDTL-EXDAT, NAME LIKE LFA1-NAME1, DDTEXT LIKE DD07T-DDTEXT, EXCCD LIKE J_1IEXCHDR-EXCCD, BUDAT LIKE MKPF-BUDAT, EXBAS LIKE IT_CDTL-EXBAS, EXBED LIKE IT_CDTL-EXBED, ECS LIKE IT_CDTL-ECS, MATNR LIKE IT_CDTL-MATNR, MAKTX LIKE IT_CDTL-MAKTX, CHAPID LIKE IT_CDTL-CHAPID, MENGE LIKE IT_CDTL-MENGE, MEINS LIKE IT_CDTL-MEINS, DEL_IND(1), END OF IT_OUT. DATA IT_PART2 LIKE J_1IPART2 OCCURS 0 WITH HEADER LINE. DATA S_NO(4) . DATA DB_CNT LIKE SY-TABIX. DATA EBELN_T LIKE MSEG-EBELN . *-----------------------------------TYPE-POOLS : SLIS. DATA : AFIELD TYPE SLIS_FIELDCAT_ALV. DATA : LIST_HEADER TYPE SLIS_T_LISTHEADER, FIELDCAT TYPE SLIS_T_FIELDCAT_ALV, LS_FTCAT TYPE LVC_S_FCAT, SORTCAT TYPE SLIS_T_SORTINFO_ALV, SORTCAT_LN LIKE LINE OF SORTCAT, G_REPID LIKE SY-REPID, G_BACK_GROUND(70), "like bapibds01-objkey, GS_VARIANT LIKE DISVARIANT, G_SAVE , GT_EVENTS TYPE SLIS_T_EVENT, ALV_EVENT TYPE SLIS_ALV_EVENT, EVENTCAT TYPE SLIS_T_EVENT, EVENTCAT_LN LIKE LINE OF EVENTCAT,

LAYOUT_IN TYPE SLIS_LAYOUT_ALV, LAYOUT_IN1 TYPE SLIS_LAYOUT_ALV. CONSTANTS : GC_FORMNAME_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE', GC_FORMNAME_USER_COMMAND TYPE SLIS_FORMNAME VALUE 'USER_COMMAND', GC_FORMNAME_BEFORE_OUTPUT TYPE SLIS_FORMNAME VALUE 'BEFORE_OUTPUT'. * ALV_EVENT TYPE SLIS_ALV_EVENT, *------------------------------------DATA EX_NO LIKE IT_CHDR-EXNUM VALUE 0. DATA REGTYP_1 LIKE J_1IPART2-REGTYP. SELECTION-SCREEN BEGIN OF BLOCK B WITH FRAME. PARAMETERS WERKS TYPE J_1IEXCHDR-WERKS. SELECT-OPTIONS : BUDAT FOR J_1IEXCHDR-EXDAT. PARAMETERS : R1 RADIOBUTTON GROUP GRP DEFAULT 'X', R2 RADIOBUTTON GROUP GRP. SELECTION-SCREEN END OF BLOCK B. INITIALIZATION. G_REPID = SY-REPID. G_SAVE = 'A'. * PERFORM BUILD_EVENT USING GT_EVENTS[]. PERFORM ALV_EVENT_INIT. AT SELECTION-SCREEN. REFRESH LIST_HEADER. PERFORM TOP_OF_PAGE_LIST_HEADER USING LIST_HEADER. START-OF-SELECTION. * PERFORM ALV_EVENT_INIT. G_REPID = SY-REPID. G_BACK_GROUND = ' ' . IF R1 = 'X'. CLEAR R2. CLEAR : REGTYP_1. REGTYP_1 = 'A'. ELSEIF R2 = 'X'. CLEAR R1.CLEAR : REGTYP_1. REGTYP_1 = 'C'. ENDIF. SELECT * FROM J_1IPART2 INTO CORRESPONDING FIELDS OF TABLE IT_PART2 WHERE REGTYP = REGTYP_1 AND TRNTYP = 'GRPO' AND BUDAT IN BUDAT. * DOCYR = IT_CDTL-DOCYR AND

* DOCNO = IT_CDTL-DOCNO. LOOP AT IT_PART2. SELECT SINGLE * FROM J_1IEXCHDR INTO CORRESPONDING FIELDS OF IT_CHDR WHERE TRNTYP = 'GRPO' AND DOCYR = IT_PART2-DOCYR AND DOCNO = IT_PART2-DOCNO AND WERKS = WERKS AND exdat IN BUDAT. * ORDER BY EXDAT. IF SY-SUBRC = 0. APPEND IT_CHDR. ELSE. CONTINUE. ENDIF. * IF SY-SUBRC 0. * MESSAGE E084. * ENDIF. ENDLOOP. LOOP AT IT_CHDR. SELECT * FROM J_1IEXCDTL INTO CORRESPONDING FIELDS OF IT_CDTL * FOR ALL ENTRIES IN IT_CHDR WHERE TRNTYP = 'GRPO' AND DOCNO = IT_CHDR-DOCNO AND DOCYR = IT_CHDR-DOCYR AND EXNUM = IT_CHDR-EXNUM AND EXDAT = IT_CHDR-EXDAT AND WERKS = IT_CHDR-WERKS. IF SY-SUBRC = 0. APPEND IT_CDTL. ELSE. CONTINUE. ENDIF. ENDSELECT. ENDLOOP. LOOP AT IT_CDTL. CLEAR TEXT. DB_CNT = DB_CNT + 1. READ TABLE IT_CHDR WITH KEY EXNUM = IT_CDTL-EXNUM. READ TABLE IT_PART2 WITH KEY DOCNO = IT_CDTL-DOCNO . IT_OUT-SERIALNO = IT_PART2-SERIALNO. SELECT SINGLE NAME1 FROM LFA1 INTO IT_OUT-NAME WHERE LIFNR = IT_CDTL-LIFNR. SELECT SINGLE * FROM LFA1 WHERE LIFNR = IT_CDTL-LIFNR. IF LFA1-LAND1 EQ 'IN'.

TEXT = 'INVOICE'. IT_OUT-TEXT1 = TEXT. ELSE. TEXT = 'BOE'. IT_OUT-TEXT1 = TEXT. ENDIF. SELECT SINGLE * FROM J_1IMOVEND WHERE LIFNR = IT_CDTL-LIFNR. SELECT SINGLE * FROM DD07T * INTO IT_OUT-DDTEXT WHERE DOMNAME = 'J_1IVTYP' AND DDLANGUAGE = 'EN' AND DOMVALUE_L = J_1IMOVEND-J_1IVTYP. IF DD07T-DDTEXT = 'First Stage Dealer of indigenous excisable goods' OR DD07T-DDTEXT = 'Second Stage Dealer of indigenous excisablegoods'. DD07T-DDTEXT = 'Dealer'. ENDIF. IT_OUT-DDTEXT = DD07T-DDTEXT. * ELSEIF DD07T-DDTEXT = 'Second Stage Dealer of indigenous excisable *goods'. * DD07T-DDTEXT = CLEAR EBELN_T. SELECT SINGLE LFBNR FROM MSEG INTO EBELN_T WHERE MBLNR = IT_CDTL-RDOC2 . SELECT SINGLE * FROM MSEG WHERE BWART = '106' AND LFBNR = EBELN_T ."and * ebeln = ebeln_t. IF SY-SUBRC = 0. IT_OUT-DEL_IND = 'X'. ELSE. IT_OUT-DEL_IND = ' '. ENDIF. SELECT SINGLE BUDAT FROM MKPF INTO IT_OUT-BUDAT WHERE MBLNR = EBELN_T ."MSEG-LFBNR. IT_OUT-EXNUM IT_OUT-EXDAT IT_OUT-EXCCD IT_OUT-EXBAS = = = = IT_CDTL-EXNUM. IT_CDTL-EXDAT. IT_CHDR-EXCCD. IT_CDTL-EXBAS.

IT_OUT-EXBED = IT_CDTL-EXBED. IT_OUT-ECS = IT_CDTL-ECS. IT_OUT-MATNR = IT_CDTL-MATNR. IT_OUT-MAKTX = IT_CDTL-MAKTX. IT_OUT-CHAPID = IT_CDTL-CHAPID. IT_OUT-MENGE = IT_CDTL-MENGE. IT_OUT-MEINS = IT_CDTL-MEINS. APPEND IT_OUT. * EX_NO = IT_CDTL-EXNUM. ENDLOOP. *-------------------------------------------------------* Title Portion IF REGTYP_1 = 'A'. SET TITLEBAR 'PAVAN' WITH DB_CNT. ELSEIF REGTYP_1 = 'C'. SET TITLEBAR 'PAVAN1' WITH DB_CNT. ENDIF. *--------------------------------------------------------AFIELD-COL_POS = 1. AFIELD-FIELDNAME = 'SERIALNO'. AFIELD-SELTEXT_L = 'INPUTS'. AFIELD-JUST = 'L'. APPEND AFIELD TO FIELDCAT. AFIELD-COL_POS = 2. AFIELD-FIELDNAME = 'TEXT1'. AFIELD-SELTEXT_L = 'TYPE OF DOC'. AFIELD-JUST = 'L'. AFIELD-DECIMALS_OUT = '0'. AFIELD-NO_ZERO = 'X'. APPEND AFIELD TO FIELDCAT. AFIELD-COL_POS = 3. AFIELD-FIELDNAME = 'EXNUM'. AFIELD-SELTEXT_L = 'DOC.NO'. AFIELD-JUST = 'L'. APPEND AFIELD TO FIELDCAT. AFIELD-COL_POS = 4. AFIELD-FIELDNAME = 'EXDAT'. AFIELD-SELTEXT_L = 'DOC.DATE'. AFIELD-JUST = 'C'. APPEND AFIELD TO FIELDCAT. AFIELD-COL_POS = 5. AFIELD-FIELDNAME = 'NAME'. AFIELD-SELTEXT_L = 'NAME OF THE SUPPLIER'. AFIELD-NO_ZERO = 'X'. AFIELD-JUST = 'L'.

APPEND AFIELD TO FIELDCAT. AFIELD-COL_POS = 6. AFIELD-FIELDNAME = 'DDTEXT'. AFIELD-SELTEXT_L = 'TYPE-OF-SUPPLIER'. AFIELD-JUST = 'L'. APPEND AFIELD TO FIELDCAT. AFIELD-COL_POS = 7. AFIELD-FIELDNAME = 'EXCCD'. AFIELD-SELTEXT_L = 'ECC OF THE SUPPLIER'. AFIELD-NO_ZERO = 'X'. AFIELD-JUST = 'L'. APPEND AFIELD TO FIELDCAT. AFIELD-COL_POS = 8. AFIELD-FIELDNAME = 'BUDAT'. AFIELD-SELTEXT_L = 'INPUT RECV DATE'. AFIELD-JUST = 'C'. APPEND AFIELD TO FIELDCAT. AFIELD-COL_POS = 9. AFIELD-FIELDNAME = 'EXBAS'. AFIELD-SELTEXT_L = 'ASSESSABLE-VALUE'. AFIELD-DO_SUM = 'X'. AFIELD-JUST = 'R'. AFIELD-DECIMALS_OUT = '2'. APPEND AFIELD TO FIELDCAT. AFIELD-COL_POS = 10. AFIELD-FIELDNAME = 'EXBED'. AFIELD-SELTEXT_L = 'DET OF CREDIT TAKEN CENVAT'. AFIELD-JUST = 'R'. APPEND AFIELD TO FIELDCAT. AFIELD-COL_POS = 11. AFIELD-FIELDNAME = 'ECS'. AFIELD-SELTEXT_L = 'DET OF CREDIT TAKEN E-CESS'. AFIELD-JUST = 'R'. APPEND AFIELD TO FIELDCAT. AFIELD-COL_POS = 12. AFIELD-FIELDNAME = 'MATNR'. AFIELD-SELTEXT_L = 'MATERIAL-CODE'. AFIELD-JUST = 'L'. APPEND AFIELD TO FIELDCAT. AFIELD-COL_POS = 13. AFIELD-FIELDNAME = 'MAKTX'. AFIELD-SELTEXT_L = 'DESCRIPTION'. AFIELD-JUST = 'L'. APPEND AFIELD TO FIELDCAT.

AFIELD-COL_POS = 14. AFIELD-FIELDNAME = 'CHAPID'. AFIELD-SELTEXT_L = 'TARIFF-ID'. AFIELD-JUST = 'L'. APPEND AFIELD TO FIELDCAT. AFIELD-COL_POS = 15. AFIELD-FIELDNAME = 'MENGE'. AFIELD-SELTEXT_L = 'QUANTITY'. AFIELD-JUST = 'R'. AFIELD-DO_SUM = ' '. APPEND AFIELD TO FIELDCAT. AFIELD-COL_POS = 16. AFIELD-FIELDNAME = 'MEINS'. AFIELD-SELTEXT_L = 'UOM'. AFIELD-JUST = 'C'. APPEND AFIELD TO FIELDCAT. AFIELD-COL_POS = 17. AFIELD-FIELDNAME = 'DEL_IND'. AFIELD-SELTEXT_L = 'Deleted'. AFIELD-JUST = 'C'. APPEND AFIELD TO FIELDCAT. * * LAYOUT FOR ZEBRA CATLOG LAYOUT_IN-COLWIDTH_OPTIMIZE = 'X'. LAYOUT_IN-ZEBRA = 'X'. LAYOUT_IN-GET_SELINFOS = 'X'. LAYOUT_IN-CONFIRMATION_PROMPT = 'X'. LAYOUT_IN-DETAIL_POPUP = 'X' . * SORTCAT-decimals = '0'. CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' EXPORTING I_CALLBACK_PROGRAM = G_REPID I_CALLBACK_USER_COMMAND = 'USER_COMMAND' I_SAVE = G_SAVE IS_VARIANT = GS_VARIANT IT_FIELDCAT = FIELDCAT IT_SORT = SORTCAT IS_LAYOUT = LAYOUT_IN IT_EVENTS = EVENTCAT * I_BACKGROUND_ID = g_back_ground TABLES T_OUTTAB = IT_OUT. *&-------------------------------------------------------------------* *& Form TOP_OF_PAGE_LIST_HEADER

*&-------------------------------------------------------------------* * text *--------------------------------------------------------------------* * -->LIST_HEADERtext *--------------------------------------------------------------------* FORM TOP_OF_PAGE_LIST_HEADER USING LIST_HEADER TYPE SLIS_T_LISTHEADER. DATA : HLINE TYPE SLIS_LISTHEADER, TEXT(60) TYPE C. CLEAR : HLINE,TEXT. HLINE-TYP = 'H'. * WRITE 'ROOTS INDUSTRIES LTD' TO TEXT. HLINE-INFO = TEXT. APPEND HLINE TO LIST_HEADER. SELECT SINGLE * FROM T001W WHERE WERKS = WERKS. CLEAR : HLINE,TEXT. HLINE-TYP = 'H'. WRITE 'PLANT :' TO TEXT. WRITE WERKS TO TEXT+8. HLINE-INFO = TEXT. APPEND HLINE TO LIST_HEADER. CLEAR : HLINE,TEXT. HLINE-TYP = 'H'. WRITE T001W-NAME1 TO TEXT. HLINE-INFO = TEXT. APPEND HLINE TO LIST_HEADER. CLEAR : HLINE,TEXT. HLINE-TYP = 'H'. WRITE T001W-STRAS TO TEXT. HLINE-INFO = TEXT. APPEND HLINE TO LIST_HEADER. CLEAR : HLINE,TEXT. HLINE-TYP = 'H'. WRITE T001W-ORT01 TO TEXT. HLINE-INFO = TEXT. APPEND HLINE TO LIST_HEADER. CLEAR : HLINE,TEXT. HLINE-TYP = 'H'. WRITE 'DATE :' TO TEXT. WRITE BUDAT-LOW TO TEXT+7.

IF BUDAT-HIGH NE ''. WRITE 'TO' TO TEXT+18. WRITE BUDAT-HIGH TO TEXT+22. ENDIF. HLINE-INFO = TEXT. APPEND HLINE TO LIST_HEADER. ENDFORM. "TOP_OF_PAGE_LIST_HEADER *&-------------------------------------------------------------------* *& Form ALV_EVENT_INIT *&-------------------------------------------------------------------* * text *--------------------------------------------------------------------* FORM ALV_EVENT_INIT . CLEAR ALV_EVENT. ALV_EVENT-NAME = SLIS_EV_TOP_OF_PAGE. ALV_EVENT-FORM = 'ALV_TOP_OF_PAGE'. APPEND ALV_EVENT TO EVENTCAT. CLEAR ALV_EVENT. ALV_EVENT-NAME = SLIS_EV_TOP_OF_LIST. ALV_EVENT-FORM = 'ALV_TOP_OF_LIST'. APPEND ALV_EVENT TO EVENTCAT. * * * * * * * * CLEAR ALV_EVENT. ALV_EVENT-NAME = SLIS_EV_END_OF_LIST. ALV_EVENT-FORM = 'ALV_END_OF_LIST'. APPEND ALV_EVENT TO GT_EVENTS. CLEAR ALV_EVENT. ALV_EVENT-NAME = SLIS_EV_END_OF_PAGE. ALV_EVENT-FORM = 'ALV_END_OF_PAGE'. APPEND ALV_EVENT TO GT_EVENTS.

ENDFORM. "ALV_EVENT_INIT *&-------------------------------------------------------------------* *& Form ALV_TOP_OF_PAGE *&-------------------------------------------------------------------* * text *--------------------------------------------------------------------* FORM ALV_TOP_OF_PAGE. CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING IT_LIST_COMMENTARY = LIST_HEADER I_LOGO = 'ENJOYSAP_LOGO'. ENDFORM. "ALV_TOP_OF_PAGE *&--------------------------------------------------------------------* *& Form BUILD_EVENT *&--------------------------------------------------------------------* * text *---------------------------------------------------------------------* * -->P_GT_EVENTS[] text *---------------------------------------------------------------------* FORM BUILD_EVENT USING P_EVENTS TYPE SLIS_T_EVENT. CALL FUNCTION 'REUSE_ALV_EVENTS_GET' EXPORTING I_LIST_TYPE = 0 IMPORTING ET_EVENTS = P_EVENTS EXCEPTIONS LIST_TYPE_WRONG = 1 OTHERS = 2. READ TABLE P_EVENTS WITH KEY NAME = SLIS_EV_USER_COMMAND INTO ALV_EVENT. IF SY-SUBRC = 0. MOVE GC_FORMNAME_USER_COMMAND TO ALV_EVENT-FORM. APPEND ALV_EVENT TO P_EVENTS. ENDIF. READ TABLE P_EVENTS WITH KEY NAME = SLIS_EV_BEFORE_LINE_OUTPUT INTO ALV_EVENT. IF SY-SUBRC = 0. MOVE GC_FORMNAME_BEFORE_OUTPUT TO ALV_EVENT-FORM. APPEND ALV_EVENT TO P_EVENTS. ENDIF. ENDFORM. " BUILD_EVENT

Alv grid display

report zalvg. TABLES: EKPO. TYPES: BEGIN OF t_ekko, ebeln TYPE ekpo-ebeln, ebelp TYPE ekpo-ebelp, statu TYPE ekpo-statu, aedat TYPE ekpo-aedat, matnr TYPE ekpo-matnr, menge TYPE ekpo-menge, meins TYPE ekpo-meins, netpr TYPE ekpo-netpr, peinh TYPE ekpo-peinh, END OF t_ekko. DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0, wa_ekko TYPE t_ekko. type-pools: slis. 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. perform data_retrieval. perform build_fieldcatalog. perform display_alv_report.

form build_fieldcatalog. * There are a number of ways to create a fieldcat. * For the purpose of this example i will build the fieldcatalog manualy * by populating the internal table fields individually and then * appending the rows. This method can be the most time consuming but can * also allow you more control of the final product. * 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-emphasize = 'X'. fieldcatalog-key = 'X'. * fieldcatalog-do_sum = 'X'. * fieldcatalog-no_zero = 'X'. append fieldcatalog to fieldcatalog. clear fieldcatalog. fieldcatalog-fieldname = 'EBELP'. fieldcatalog-seltext_m = 'PO Item'. fieldcatalog-col_pos = 1. append fieldcatalog to fieldcatalog. clear fieldcatalog. fieldcatalog-fieldname = 'STATU'. fieldcatalog-seltext_m = 'Status'. fieldcatalog-col_pos = 2. append fieldcatalog to fieldcatalog. clear fieldcatalog. fieldcatalog-fieldname = 'AEDAT'. fieldcatalog-seltext_m = 'Item change date'. fieldcatalog-col_pos = 3. append fieldcatalog to fieldcatalog. clear fieldcatalog. fieldcatalog-fieldname = 'MATNR'. fieldcatalog-seltext_m = 'Material Number'. fieldcatalog-col_pos = 4. append fieldcatalog to fieldcatalog. clear fieldcatalog. fieldcatalog-fieldname = 'MENGE'. fieldcatalog-seltext_m = 'PO quantity'. fieldcatalog-col_pos = 5. append fieldcatalog to fieldcatalog. clear fieldcatalog. fieldcatalog-fieldname = 'MEINS'. fieldcatalog-seltext_m = 'Order Unit'. fieldcatalog-col_pos = 6. append fieldcatalog to fieldcatalog. clear fieldcatalog. fieldcatalog-fieldname fieldcatalog-seltext_m fieldcatalog-col_pos fieldcatalog-outputlen = = = = 'NETPR'. 'Net Price'. 7. 15.

fieldcatalog-datatype = 'CURR'. append fieldcatalog to fieldcatalog. clear fieldcatalog. fieldcatalog-fieldname = 'PEINH'. fieldcatalog-seltext_m = 'Price Unit'. fieldcatalog-col_pos = 8. append fieldcatalog to fieldcatalog. clear fieldcatalog. endform. " BUILD_FIELDCATALOG 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' 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_ekko 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. form data_retrieval. select ebeln ebelp statu aedat matnr menge meins netpr peinh from ekpo into table it_ekko. endform.

"see FORM

Alv grid with radio buttons*&--------------------------------------------------------------------* *& Report ZALVGRID_WITH_RADIOBUTTONS * *& * *&--------------------------------------------------------------------* *& * *& * *&--------------------------------------------------------------------* REPORT ZALVGRID_WITH_RADIOBUTTONS .

TYPE-POOLS: abap, icon. " INCLUDE . for releases < 6.20 TYPES: BEGIN OF ty_s_sflight. INCLUDE TYPE sflight. TYPES: button1 TYPE iconname. TYPES: button2 TYPE iconname. TYPES: button3 TYPE iconname. TYPES: button4 TYPE iconname. TYPES: END OF ty_s_sflight. DATA:gt_sflight TYPE STANDARD TABLE OF ty_s_sflight, gs_layout TYPE lvc_s_layo, gt_fcat TYPE lvc_t_fcat. DATA:gd_okcode TYPE ui_func, go_docking TYPE REF TO cl_gui_docking_container, go_grid TYPE REF TO cl_gui_alv_grid. *icon_wd_radio_button_empty TYPE REF TO icon_wd_radio_button_empty. *--------------------------------------------------------------------* * CLASS lcl_eventhandler DEFINITION *--------------------------------------------------------------------* * *--------------------------------------------------------------------* CLASS lcl_eventhandler DEFINITION. PUBLIC SECTION. CLASS-METHODS: handle_hotspot_click FOR EVENT hotspot_click OF cl_gui_alv_grid IMPORTING e_row_id e_column_id

es_row_no sender. ENDCLASS. "lcl_eventhandler DEFINITION *--------------------------------------------------------------------* * CLASS lcl_eventhandler IMPLEMENTATION *--------------------------------------------------------------------* * *--------------------------------------------------------------------* CLASS lcl_eventhandler IMPLEMENTATION. METHOD handle_hotspot_click. * define local data FIELD-SYMBOLS: TYPE ty_s_sflight, TYPE ANY. READ TABLE gt_sflight ASSIGNING INDEX es_row_no-row_id. CHECK ( IS ASSIGNED ). * Set all radio buttons "unselected" -button1 = icon_wd_radio_button_empty. -button2 = icon_wd_radio_button_empty. -button3 = icon_wd_radio_button_empty. -button4 = icon_wd_radio_button_empty. ASSIGN COMPONENT e_column_id-fieldname OF STRUCTURE TO . IF ( IS ASSIGNED ). * Set selected radio button "selected". = icon_wd_radio_button. ENDIF. * Force PAI followed by refresh of table display in PBO CALL METHOD cl_gui_cfw=>set_new_ok_code EXPORTING new_code = 'REFRESH' * IMPORTING * RC = . ENDMETHOD. "handle_hotspot_click ENDCLASS. "lcl_eventhandler IMPLEMENTATION *--------------------------------------------------------------------* * MAIN * *--------------------------------------------------------------------* START-OF-SELECTION. PERFORM select_data. PERFORM init_controls. PERFORM build_fieldcatalog. PERFORM set_layout. CALL METHOD go_grid->set_table_for_first_display EXPORTING * i_structure_name = 'SFLIGHT' is_layout = gs_layout

CHANGING it_fieldcatalog = gt_fcat it_outtab = gt_sflight. * Link docking container to dynpro CALL METHOD go_docking->link EXPORTING repid = syst-repid dynnr = '0100' * CONTAINER = EXCEPTIONS cntl_error = 1 cntl_system_error = 2 lifetime_dynpro_dynpro_link = 3 OTHERS = 4. IF sy-subrc 0. * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ENDIF. CALL SCREEN 100. END-OF-SELECTION. *--------------------------------------------------------------------* * MODULE PBO OUTPUT * *--------------------------------------------------------------------* MODULE pbo OUTPUT. SET PF-STATUS 'MAIN100'. SET TITLEBAR 'MAIN100'. ENDMODULE. "PBO OUTPUT *--------------------------------------------------------------------* * MODULE PAI INPUT * *--------------------------------------------------------------------* MODULE pai INPUT. * Leave report CASE gd_okcode. WHEN 'BACK' OR 'EXIT' OR 'CANC'. SET SCREEN 0. LEAVE SCREEN. * Refresh table display WHEN 'REFRESH'. PERFORM refresh_display. WHEN OTHERS. * do nothing ENDCASE. CLEAR gd_okcode. ENDMODULE. "PAI INPUT *&--------------------------------------------------------------------* *& Form BUILD_FIELDCATALOG

*&--------------------------------------------------------------------* * text *---------------------------------------------------------------------* * --> p1 text * p1 text * refresh_table_display EXPORTING is_stable = ls_stable * I_SOFT_REFRESH = EXCEPTIONS finished = 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. " REFRESH_DISPLAY

*&--------------------------------------------------------------------* *& Form SET_LAYOUT *&--------------------------------------------------------------------* * Set layout for ALV list *---------------------------------------------------------------------* * --> p1 text *

of 51/51
ALV REPORTS Report for header window and template *&------------------------------------------------------------------ ---* *& Report ZALV * *& * *&------------------------------------------------------------------ ---* *& * *& * *&------------------------------------------------------------------ ---* Report ZALV . TABLES: ekko. type-pools: slis. "ALV Declarations *Data Declaration *---------------- TYPES: BEGIN OF t_ekko, ebeln TYPE ekpo-ebeln, ebelp TYPE ekpo-ebelp, statu TYPE ekpo-statu, aedat TYPE ekpo-aedat, matnr TYPE ekpo-matnr, menge TYPE ekpo-menge, meins TYPE ekpo-meins, netpr TYPE ekpo-netpr, peinh TYPE ekpo-peinh, END OF t_ekko. DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0, wa_ekko TYPE t_ekko. *ALV data declarations 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.
Embed Size (px)
Recommended