- 浏览: 169303 次
- 性别:
- 来自: 成都
文章分类
REPORT zalv_test.
TABLES: ekko.
TYPE-POOLS:slis.
TYPES: BEGIN OF x_data,
ebeln TYPE char30,
ebelp TYPE ebelp,
matnr TYPE matnr,
matnr1 TYPE matnr,
ntgew TYPE entge,[img][/img]
END OF x_data.
TYPES: BEGIN OF x_data_tot,
const(15),
ebeln TYPE char30,
ebelp TYPE ebelp,
matnr TYPE matnr,
matnr1 TYPE matnr,
ntgew TYPE entge,
END OF x_data_tot.
DATA: i_ekpo TYPE STANDARD TABLE OF x_data INITIAL SIZE 0,
i_ekpo_tot TYPE STANDARD TABLE OF x_data_tot INITIAL SIZE 0,
i_fieldcat TYPE slis_t_fieldcat_alv,
i_alv_top_of_page TYPE slis_t_listheader,
i_events TYPE slis_t_event,
i_sort TYPE slis_t_sortinfo_alv,
i_event TYPE slis_t_event.
DATA:wa_ekko TYPE x_data,
wa_ekko_tot TYPE x_data_tot,
wa_layout TYPE slis_layout_alv,
wa_events TYPE slis_alv_event,
wa_sort TYPE slis_sortinfo_alv.
CONSTANTS:c_header TYPE char1 VALUE 'H',
c_item TYPE char1 VALUE 'S'.
START-OF-SELECTION.
SELECT ebeln ebelp matnr matnr ntgew FROM ekpo INTO TABLE i_ekpo UP TO 10 ROWS.
LOOP AT i_ekpo INTO wa_ekko.
MOVE-CORRESPONDING wa_ekko TO wa_ekko_tot.
wa_ekko_tot-ntgew = sy-tabix.
wa_ekko_tot-const = 'Grand Total'.
APPEND wa_ekko_tot TO i_ekpo_tot.
ENDLOOP.
IF sy-subrc EQ 0.
SORT i_ekpo_tot BY ebeln ebelp matnr.
ENDIF.
PERFORM sub_field_catalog.
PERFORM sub_populate_layout.
PERFORM sub_populate_sort.
PERFORM sub_get_event.
END-OF-SELECTION.
PERFORM sub_alv_report_display.
*&---------------------------------------------------------------------*
*& Form sub_field_catalog
*&---------------------------------------------------------------------*
FORM sub_field_catalog.
PERFORM sub_fill_alv_field_catalog USING:
'01' '01' 'CONST' 'I_EKPO_TOT' 'L'
' '(005) 'X' 'X' ' ' ' ',
'01' '01' 'EBELN' 'I_EKPO_TOT' 'L'
'Doc No'(003) ' ' ' ' ' ' ' ',
'01' '02' 'EBELP' 'I_EKPO_TOT' 'L'
'Item No'(004) ' ' ' ' ' ' ' ',
'01' '03' 'MATNR' 'I_EKPO_TOT' 'L'
'Material No'(005) 'X' 'X' ' ' ' ',
'01' '03' 'MATNR1' 'I_EKPO_TOT' 'L'
'Material No'(005) ' ' ' ' ' ' ' ',
'01' '04' 'NTGEW' 'I_EKPO_TOT' 'R'
'Net Weight'(007) ' ' ' ' ' ' ' '.
ENDFORM. "sub_field_catalog
*&---------------------------------------------------------------------*
*& Form sub_fill_alv_field_catalog
*&---------------------------------------------------------------------*
FORM sub_fill_alv_field_catalog USING p_rowpos TYPE sycurow
p_colpos TYPE sycucol
p_fldnam TYPE fieldname
p_tabnam TYPE tabname
p_justif TYPE char1
p_seltext TYPE dd03p-scrtext_l
p_out TYPE char1
p_tech TYPE char1
p_qfield TYPE slis_fieldname
p_qtab TYPE slis_tabname.
DATA: wa_lfl_fcat TYPE slis_fieldcat_alv.
wa_lfl_fcat-row_pos = p_rowpos.
wa_lfl_fcat-col_pos = p_colpos.
wa_lfl_fcat-fieldname = p_fldnam.
wa_lfl_fcat-tabname = p_tabnam.
wa_lfl_fcat-just = p_justif.
wa_lfl_fcat-seltext_l = p_seltext.
wa_lfl_fcat-no_out = p_out.
wa_lfl_fcat-tech = p_tech.
wa_lfl_fcat-qfieldname = p_qfield.
wa_lfl_fcat-qtabname = p_qtab.
IF p_fldnam EQ 'NTGEW'.
wa_lfl_fcat-do_sum = 'X'.
ENDIF.
APPEND wa_lfl_fcat TO i_fieldcat.
CLEAR wa_lfl_fcat.
ENDFORM. "sub_fill_alv_field_catalog
*&---------------------------------------------------------------------*
*& Form sub_populate_layout
*&---------------------------------------------------------------------*
FORM sub_populate_layout.
CLEAR wa_layout.
wa_layout-colwidth_optimize = 'X'.
wa_layout-no_totalline = 'X'.
ENDFORM. "sub_populate_layout
*&---------------------------------------------------------------------*
*& Form sub_populate_sort
*&---------------------------------------------------------------------*
FORM sub_populate_sort.
wa_sort-spos = '01'.
wa_sort-fieldname = 'CONST'.
wa_sort-tabname = 'I_EKPO_TOT'.
wa_sort-up = 'X'.
wa_sort-subtot = 'X'.
APPEND wa_sort TO i_sort.
CLEAR wa_sort.
wa_sort-spos = '02'.
wa_sort-fieldname = 'MATNR'.
wa_sort-tabname = 'I_EKPO_TOT'.
wa_sort-up = 'X'.
wa_sort-subtot = 'X'.
APPEND wa_sort TO i_sort.
CLEAR wa_sort.
ENDFORM. "sub_populate_sort
*&---------------------------------------------------------------------*
*& Form sub_get_event
*&---------------------------------------------------------------------*
FORM sub_get_event.
CONSTANTS: c_formname_subtotal_text TYPE slis_formname VALUE 'SUBTOTAL_TEXT'.
DATA: l_s_event TYPE slis_alv_event.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 4
IMPORTING
et_events = i_event
EXCEPTIONS
list_type_wrong = 0
OTHERS = 0.
READ TABLE i_event INTO l_s_event WITH KEY name = slis_ev_subtotal_text.
IF sy-subrc EQ 0.
MOVE c_formname_subtotal_text TO l_s_event-form.
MODIFY i_event FROM l_s_event INDEX sy-tabix.
ENDIF.
ENDFORM. "sub_get_event
*&---------------------------------------------------------------------*
*& Form sub_alv_report_display
*&---------------------------------------------------------------------*
FORM sub_alv_report_display.
DATA:l_repid TYPE syrepid.
l_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = l_repid
is_layout = wa_layout
it_fieldcat = i_fieldcat
it_sort = i_sort
it_events = i_event
i_default = 'X'
i_save = 'A'
TABLES
t_outtab = i_ekpo_tot
EXCEPTIONS
program_error = 1
OTHERS = 2.
ENDFORM. "sub_alv_report_display
*&---------------------------------------------------------------------*
*& Form subtotal_text
*&---------------------------------------------------------------------*
* -->P_TOTAL text
* -->P_SUBTOT_TEXT text
*----------------------------------------------------------------------*
FORM subtotal_text CHANGING
p_total TYPE any
p_subtot_text TYPE slis_subtot_text.
IF p_subtot_text-criteria = 'MATNR'.
p_subtot_text-display_text_for_subtotal =
'Material level total'.
ENDIF.
ENDFORM. "subtotal_text
TABLES: ekko.
TYPE-POOLS:slis.
TYPES: BEGIN OF x_data,
ebeln TYPE char30,
ebelp TYPE ebelp,
matnr TYPE matnr,
matnr1 TYPE matnr,
ntgew TYPE entge,[img][/img]
END OF x_data.
TYPES: BEGIN OF x_data_tot,
const(15),
ebeln TYPE char30,
ebelp TYPE ebelp,
matnr TYPE matnr,
matnr1 TYPE matnr,
ntgew TYPE entge,
END OF x_data_tot.
DATA: i_ekpo TYPE STANDARD TABLE OF x_data INITIAL SIZE 0,
i_ekpo_tot TYPE STANDARD TABLE OF x_data_tot INITIAL SIZE 0,
i_fieldcat TYPE slis_t_fieldcat_alv,
i_alv_top_of_page TYPE slis_t_listheader,
i_events TYPE slis_t_event,
i_sort TYPE slis_t_sortinfo_alv,
i_event TYPE slis_t_event.
DATA:wa_ekko TYPE x_data,
wa_ekko_tot TYPE x_data_tot,
wa_layout TYPE slis_layout_alv,
wa_events TYPE slis_alv_event,
wa_sort TYPE slis_sortinfo_alv.
CONSTANTS:c_header TYPE char1 VALUE 'H',
c_item TYPE char1 VALUE 'S'.
START-OF-SELECTION.
SELECT ebeln ebelp matnr matnr ntgew FROM ekpo INTO TABLE i_ekpo UP TO 10 ROWS.
LOOP AT i_ekpo INTO wa_ekko.
MOVE-CORRESPONDING wa_ekko TO wa_ekko_tot.
wa_ekko_tot-ntgew = sy-tabix.
wa_ekko_tot-const = 'Grand Total'.
APPEND wa_ekko_tot TO i_ekpo_tot.
ENDLOOP.
IF sy-subrc EQ 0.
SORT i_ekpo_tot BY ebeln ebelp matnr.
ENDIF.
PERFORM sub_field_catalog.
PERFORM sub_populate_layout.
PERFORM sub_populate_sort.
PERFORM sub_get_event.
END-OF-SELECTION.
PERFORM sub_alv_report_display.
*&---------------------------------------------------------------------*
*& Form sub_field_catalog
*&---------------------------------------------------------------------*
FORM sub_field_catalog.
PERFORM sub_fill_alv_field_catalog USING:
'01' '01' 'CONST' 'I_EKPO_TOT' 'L'
' '(005) 'X' 'X' ' ' ' ',
'01' '01' 'EBELN' 'I_EKPO_TOT' 'L'
'Doc No'(003) ' ' ' ' ' ' ' ',
'01' '02' 'EBELP' 'I_EKPO_TOT' 'L'
'Item No'(004) ' ' ' ' ' ' ' ',
'01' '03' 'MATNR' 'I_EKPO_TOT' 'L'
'Material No'(005) 'X' 'X' ' ' ' ',
'01' '03' 'MATNR1' 'I_EKPO_TOT' 'L'
'Material No'(005) ' ' ' ' ' ' ' ',
'01' '04' 'NTGEW' 'I_EKPO_TOT' 'R'
'Net Weight'(007) ' ' ' ' ' ' ' '.
ENDFORM. "sub_field_catalog
*&---------------------------------------------------------------------*
*& Form sub_fill_alv_field_catalog
*&---------------------------------------------------------------------*
FORM sub_fill_alv_field_catalog USING p_rowpos TYPE sycurow
p_colpos TYPE sycucol
p_fldnam TYPE fieldname
p_tabnam TYPE tabname
p_justif TYPE char1
p_seltext TYPE dd03p-scrtext_l
p_out TYPE char1
p_tech TYPE char1
p_qfield TYPE slis_fieldname
p_qtab TYPE slis_tabname.
DATA: wa_lfl_fcat TYPE slis_fieldcat_alv.
wa_lfl_fcat-row_pos = p_rowpos.
wa_lfl_fcat-col_pos = p_colpos.
wa_lfl_fcat-fieldname = p_fldnam.
wa_lfl_fcat-tabname = p_tabnam.
wa_lfl_fcat-just = p_justif.
wa_lfl_fcat-seltext_l = p_seltext.
wa_lfl_fcat-no_out = p_out.
wa_lfl_fcat-tech = p_tech.
wa_lfl_fcat-qfieldname = p_qfield.
wa_lfl_fcat-qtabname = p_qtab.
IF p_fldnam EQ 'NTGEW'.
wa_lfl_fcat-do_sum = 'X'.
ENDIF.
APPEND wa_lfl_fcat TO i_fieldcat.
CLEAR wa_lfl_fcat.
ENDFORM. "sub_fill_alv_field_catalog
*&---------------------------------------------------------------------*
*& Form sub_populate_layout
*&---------------------------------------------------------------------*
FORM sub_populate_layout.
CLEAR wa_layout.
wa_layout-colwidth_optimize = 'X'.
wa_layout-no_totalline = 'X'.
ENDFORM. "sub_populate_layout
*&---------------------------------------------------------------------*
*& Form sub_populate_sort
*&---------------------------------------------------------------------*
FORM sub_populate_sort.
wa_sort-spos = '01'.
wa_sort-fieldname = 'CONST'.
wa_sort-tabname = 'I_EKPO_TOT'.
wa_sort-up = 'X'.
wa_sort-subtot = 'X'.
APPEND wa_sort TO i_sort.
CLEAR wa_sort.
wa_sort-spos = '02'.
wa_sort-fieldname = 'MATNR'.
wa_sort-tabname = 'I_EKPO_TOT'.
wa_sort-up = 'X'.
wa_sort-subtot = 'X'.
APPEND wa_sort TO i_sort.
CLEAR wa_sort.
ENDFORM. "sub_populate_sort
*&---------------------------------------------------------------------*
*& Form sub_get_event
*&---------------------------------------------------------------------*
FORM sub_get_event.
CONSTANTS: c_formname_subtotal_text TYPE slis_formname VALUE 'SUBTOTAL_TEXT'.
DATA: l_s_event TYPE slis_alv_event.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 4
IMPORTING
et_events = i_event
EXCEPTIONS
list_type_wrong = 0
OTHERS = 0.
READ TABLE i_event INTO l_s_event WITH KEY name = slis_ev_subtotal_text.
IF sy-subrc EQ 0.
MOVE c_formname_subtotal_text TO l_s_event-form.
MODIFY i_event FROM l_s_event INDEX sy-tabix.
ENDIF.
ENDFORM. "sub_get_event
*&---------------------------------------------------------------------*
*& Form sub_alv_report_display
*&---------------------------------------------------------------------*
FORM sub_alv_report_display.
DATA:l_repid TYPE syrepid.
l_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = l_repid
is_layout = wa_layout
it_fieldcat = i_fieldcat
it_sort = i_sort
it_events = i_event
i_default = 'X'
i_save = 'A'
TABLES
t_outtab = i_ekpo_tot
EXCEPTIONS
program_error = 1
OTHERS = 2.
ENDFORM. "sub_alv_report_display
*&---------------------------------------------------------------------*
*& Form subtotal_text
*&---------------------------------------------------------------------*
* -->P_TOTAL text
* -->P_SUBTOT_TEXT text
*----------------------------------------------------------------------*
FORM subtotal_text CHANGING
p_total TYPE any
p_subtot_text TYPE slis_subtot_text.
IF p_subtot_text-criteria = 'MATNR'.
p_subtot_text-display_text_for_subtotal =
'Material level total'.
ENDIF.
ENDFORM. "subtotal_text
发表评论
-
DISABLE button(FCODE) from the GUI-Status
2014-08-04 15:54 5751. Goto-> Attributes->Pus ... -
Handy SAP function module to automate user events
2013-11-28 09:49 697*Begin-Auto triggers ENTER comm ... -
set Billing block to blank for Sals Order
2013-04-17 15:16 746FM: SD_WF_ORDER_DEL_BILLING_BLO ... -
set Billing block to blank for Sals Order
2013-04-17 15:16 715FM: SD_WF_ORDER_DEL_BILLING_BLO ... -
Unpermitted combination of business object BUS2032 and sales doc. category H
2013-01-25 14:20 4050Q: create New Sales Order using ... -
Function Module: get all users who have specific role
2013-01-25 14:16 588CALL FUNCTION 'RSRA_USERS_O ... -
Create a SELECT-OPTIONS in a module pool screen
2012-03-07 15:35 988source:http://abap-explorer.blo ... -
Converting OTF data from script to Spool Request
2012-03-06 17:25 0source:http://forums.sdn.sap.co ... -
Calculate the days, months and years between 2 dates.
2012-02-21 16:14 794FORM compute_2date_diff. DAT ... -
Retrieving Domain fixed values
2012-02-16 11:13 784source:http://www.saptechnical. ... -
If 1 equals 2, what’s the purpose?
2012-02-16 10:59 795source:http://sapport.blogspot. ... -
get status name for batch input session
2012-01-31 14:47 888Line 601 in program SAPMSBDC_CC ... -
create zip folder with cl_abap_zip
2011-12-05 18:11 1178REPORT ztest. DATA: gv_file ... -
MIRO
2011-11-29 10:39 2031from: http://help-sap.blogspot. ... -
Create Vendor or Customer_master Data
2011-11-23 16:22 2847To Create or Change Vendor_mast ... -
Pay attention to the following points when using append structures
2011-10-27 13:43 1274You cannot create append str ... -
Help Views
2011-10-20 10:46 691source:http://help.sap.com/saph ... -
What is the Different Types and Usage of Views
2011-10-19 23:06 811source:http://www.sap-img.com/a ... -
Upload a Comma Delimited CSV file that contains commas in data
2011-09-23 17:22 2190source:http://wiki.sdn.sap.com/ ... -
What is the difference between SET SCREEN and CALL SCREEN ?
2011-09-19 21:50 700source:http://www.saptechies.co ...
相关推荐
Following the methodology of the original text, the book focuses on the POSIX standard shell, and teaches you how to develop programs in this useful programming environment, taking full advantage of ...
WordPress Complete_ set up, customize, and market your blog.pdf
3.4.3 Creating Supporting Text and Legends 3.4.4 Text Placement 3.4.5 Special Text Character Formats 3.4.6 Using Subplot to Create Multiple Axes 3.5 SPECIALIZED 2-D PLOTTING 3.5.1 Bar Graphs 3.5.2 ...
Softgroup .Net Advanced Panel enhance the user interface of your applications with ability to customize background gradient effects, border and corners aspects, display image with text and many other ...
3.4.3 Creating Supporting Text and Legends 3.4.4 Text Placement 3.4.5 Special Text Character Formats 3.4.6 Using Subplot to Create Multiple Axes 3.5 SPECIALIZED 2-D PLOTTING 3.5.1 Bar Graphs 3.5.2 ...
•Work with text and type in an InDesign document, including finding and changing text. •Create dialog boxes and other user-interface items. •Customize and add menus and create menu actions. •...
Eliminate unnecessary code by taking advantage of the MVVM pattern in Silverlight and WPF using this book and eBook - less code, fewer bugs Build an enterprise application using Silverlight and WPF,...
With more and more systems being run under UNIX and Linux, the ability to program and customize the shell quickly and reliably to get the best out of any individual system is becoming a more and more ...
In Lesson 1 you learn how to organize columns and rows of data into a range so that you can effectively sort, filter, subtotal, and outline the data. Then you learn how to protect the data from ...
In this tutorial, we'll cover some of the basics of Unicode-encoded text and Unicode files, and how to view and manipulate it in UltraEdit. Search and delete lines found UEStudio and UltraEdit provide...
In addition to presenting code and configurations in the reflowable text format, we have included images of the code that mimic the presentation found in the print book; therefore, where the ...
Deploy Customize Jar file in Oracle EBS R12.pdf
This book also includes detailed coverage of how to customize your workflows and access them in a variety of ways and situations so you can maximize the advantages of this technology. What you'll ...
In the Marker List tab, you can change the marker colors, change the marker text, and delete unnecessary markers. The auto marker is a new feature to automatically select text that is the same as ...
Customize UI in a LabVIEW application介绍了在LabVIEW中构建有效用户界面的提示和技巧。在LabVIEW中进行编码的一个主要好处是提供了内置的控制和指标库。由于LabVIEW在设计时充分考虑了工程师和科学家,因此该库...
Customize Rules 使用附件中的 myrules 中的内容覆盖 Customize 的内容然后保存
Akka in Action shows you how to build message-oriented systems with Akka. This comprehensive, hands-on tutorial introduces each concept with a working example. You’ll start with the big picture of ...
Like music and movies, video games are rapidly becoming an integral part of our lives.... such as support for multiple platforms, and granting users the ability to extend and customize your games.
These will bring you sky to life and offer plenty options to customize. Clouds performance is optimized by using techs like temporal reprojection and LOD system. In addition there are also fast flat ...