Text in total
hi ,
i have an requirenment, i have to display text before total in alv(like payable by you 2890.00) .
am using reuse_alv_grid_display. without appending text in internal table.
check this program...
*& Report Z_ALV_DEMO_TOTAL_TEXT
REPORT z_alv_demo_total_text.
* Type declaration for final table to display the output
TYPES: BEGIN OF ty_mara,
srno TYPE char40, " Storing the total text
matnr TYPE matnr, " Material
ersda TYPE ersda, " Creation date
ernam TYPE ernam, " Created by
laeda TYPE laeda, " Last change date
aenam TYPE aenam, " Last change by
vpsta TYPE vpsta, " Maintenance status
brgew TYPE brgew, " Gross weight
ntgew TYPE ntgew, " Net weight
gewei TYPE gewei, " Weight Unit
END OF ty_mara.
* Type declaration for table storing temp. data
TYPES: BEGIN OF ty_mara_tmp,
matnr TYPE matnr, " Material
ersda TYPE ersda, " Creation date
ernam TYPE ernam, " Created by
laeda TYPE laeda, " Last change date
aenam TYPE aenam, " Last change by
vpsta TYPE vpsta, " Maintenance status
brgew TYPE brgew, " Gross weight
ntgew TYPE ntgew, " Net weight
gewei TYPE gewei, " Weight Unit
END OF ty_mara_tmp.
* Internal table for storing final data
DATA: i_mara TYPE STANDARD TABLE OF ty_mara INITIAL SIZE 0.
* Work area for final table
DATA: w_mara TYPE ty_mara.
* Internal table for storing temp. data
DATA: i_mara_tmp TYPE STANDARD TABLE OF ty_mara_tmp INITIAL SIZE 0.
* Work area for temp. table
DATA: w_mara_tmp TYPE ty_mara_tmp.
* Object variable for ALV grid
DATA: oref1 TYPE REF TO cl_gui_alv_grid.
* Field catalog table for ALV grid
DATA: fieldcat TYPE lvc_t_fcat.
* Workarea for field catalog table
DATA: w_field TYPE lvc_s_fcat.
* Internal table for storing info. for ALV grid
data: i_sort2 TYPE STANDARD TABLE OF lvc_s_sort INITIAL SIZE 0.
* Workarea for sort table
DATA: wa_sort2 TYPE lvc_s_sort.
* Workarea for ALV layout
data: wa_layout TYPE lvc_s_layo.
START-OF-SELECTION.
* Fetch data
SELECT matnr " Material
ersda " Creation date
ernam " Created by
laeda " Last change date
aenam " Last change by
vpsta " Maintenance status
brgew " Gross weight
ntgew " Net weight
gewei " Weight Unit
FROM mara
INTO TABLE i_mara_tmp
UP TO 100 ROWS.
CHECK sy-subrc = 0.
* Populate final table
LOOP AT i_mara_tmp INTO w_mara_tmp.
* Storing the Total text need to be displayed in
* ALV
w_mara-srno = 'Total weight (Gross & Net)'.
w_mara-matnr = w_mara_tmp-matnr.
w_mara-ersda = w_mara_tmp-ersda.
w_mara-ernam = w_mara_tmp-ernam .
w_mara-laeda = w_mara_tmp-laeda.
w_mara-aenam = w_mara_tmp-aenam.
w_mara-vpsta = w_mara_tmp-vpsta.
w_mara-brgew = w_mara_tmp-brgew.
w_mara-ntgew = w_mara_tmp-ntgew.
w_mara-gewei = w_mara_tmp-gewei.
APPEND w_mara TO i_mara.
ENDLOOP.
* Calling the screen to display ALV
CALL SCREEN 100.
*& Module STATUS_0100 OUTPUT
* Display ALV report
MODULE status_0100 OUTPUT.
IF oref1 IS INITIAL.
* Create ALV grid object
* In this case we have not created any custom container in the screen,
* Instead of that dummy container name is passed
* ADVANTAGE: we can run this report in background without any problem
CREATE OBJECT oref1
EXPORTING
i_parent = cl_gui_custom_container=>screen0
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
OTHERS = 5
CHECK sy-subrc = 0.
* Preparing the field catalog
* ZDEMO: Defined in DDIC, it's structure is same as TYPE ty_mara
* defined in the program
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'ZDEMO'
CHANGING
ct_fieldcat = fieldcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc = 0.
LOOP AT fieldcat INTO w_field.
IF w_field-fieldname = 'BRGEW' OR
w_field-fieldname = 'NTGEW'.
* Summation for Gross & Net weight
w_field-do_sum = 'X'.
MODIFY fieldcat FROM w_field TRANSPORTING do_sum.
ENDIF.
IF w_field-fieldname = 'SRNO'.
* Hide this field so that it can display it's content i.e.
* Total text in Subtotal level
w_field-tech = 'X'.
w_field-no_out = 'X'.
MODIFY fieldcat FROM w_field TRANSPORTING tech no_out.
ENDIF.
CLEAR w_field.
ENDLOOP.
ENDIF.
* Populate Sort table with SRNO field so that we can display the total
* text in it's subtotal level
wa_sort2-spos = 1.
wa_sort2-fieldname = 'SRNO'.
wa_sort2-up = 'X'.
wa_sort2-subtot = 'X'.
APPEND wa_sort2 TO i_sort2.
* Hide the total line
wa_layout-no_totline = 'X'.
* Display the ALV grid
CALL METHOD oref1->set_table_for_first_display
EXPORTING
is_layout = wa_layout
CHANGING
it_outtab = i_mara[]
it_fieldcatalog = fieldcat
it_sort = i_sort2
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc <> 0.
ENDIF.
* Set the focus on the grid
CALL METHOD cl_gui_alv_grid=>set_focus
EXPORTING
control = oref1
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
ENDIF.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
Edited by: Arunima Rudra on Mar 16, 2009 2:30 PM
Similar Messages
-
ALV Grid Subtotal text and Total text display
Hello ABAPGuru's
I want to display the subtotal and Total texts. alv grid program runing on background.
Regards
Sweety(Sri)Hello Neil,
Here I have attached my routines.anyway my confusion. I have wrote the routine subtotal_text .but i am not passing ALV GRID FM.
*& Form eventtab_build
&---- This is used to get the list of events
---- <--RI_EVENTS Internal table
FORM eventtab_build CHANGING ri_events TYPE slis_t_event.
Structure for event handling.
DATA: rs_event TYPE slis_alv_event.
Returns table of possible events for a list type.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = ri_events. " Table of events to perform
Read the internal table with the TOP_OF_PAGE and move the
form name to the internal table
READ TABLE ri_events
WITH KEY name = slis_ev_top_of_page INTO rs_event.
IF sy-subrc = 0.
MOVE c_formname TO rs_event-form. " Form name
MODIFY ri_events FROM rs_event
INDEX sy-tabix. " Top of page event
ENDIF.
READ TABLE ri_events
WITH KEY name = slis_ev_end_of_page INTO rs_event.
IF sy-subrc = 0.
MOVE c_form_eop_name TO rs_event-form. " Form name
MODIFY ri_events FROM rs_event
INDEX sy-tabix. " Top of page event
ENDIF.
READ TABLE ri_events
WITH KEY name = slis_ev_subtotal_text INTO rs_event.
IF sy-subrc = 0.
MOVE c_formname_subtotal_text TO rs_event-form. " Formname
MODIFY ri_events FROM rs_event
INDEX sy-tabix. " Top of page event
ENDIF.
*&-- Delete all unneeded events:
DELETE ri_events WHERE form IS INITIAL.
ENDFORM. " eventtab_build
*& Form SUBTOTAL_TEXT
text
--> p1 text
<-- p2 text
FORM SUBTOTAL_TEXT USING ep_subtot_line TYPE type_data
e_event_data TYPE slis_subtot_text.
IF NOT e_event_data-criteria IS INITIAL.
E_EVENT_DATA-DISPLAY_TEXT_FOR_SUBTOTAL = 'Account Total'.
ENDIF.
ENDFORM. "SUBTOTAL_TEXT
*& Form initialise_layout
Initialise Layout
FORM initialise_layout .
i_layout-colwidth_optimize = c_x.
i_layout-group_change_edit = c_x.
*i_layout-subtotals_text = ' a'.
i_layout-detail_popup = c_x.
i_layout-zebra = c_x.
i_layout-no_vline = 'X'.
i_layout-no_hline = 'X'.
i_layout-totals_text = 'Account Total'.
ENDFORM. " initialise_layout
Call the function module to display the report
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = v_program
i_callback_top_of_page = 'TOP_OF_PAGE' "Top Of Page
is_layout = i_layout
it_fieldcat = i_fieldtab
it_sort = i_sort
it_events = i_events " Events
is_print = i_print
i_default = c_x
i_save = c_save
is_variant = v_variant
TABLES
t_outtab = i_data
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.
Regards
Sweety (Sri) -
Problem in displaying total text in total line
Hi...I am facing problem in displaying total text in first column of total line. Width of first column is sufficient to display text "TOTAL". But somehow its not getting displayed....Please Help...?
code is as follows:
ls_layout TYPE slis_layout_alv .
ls_layout-totals_text = 'TOTAL'.
ls_layout-colwidth_optimize = 'X'.
ls_layout-no_vline = 'X'.
ls_layout-no_hline = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = gv_repid " Report ID
i_callback_top_of_page = 'TOP_OF_PAGE'
is_layout = ls_layout
it_fieldcat = gt_fieldcat " Field Catlog
TABLES
t_outtab = gt_cost_output " Output Tablehi me to i have the same problem
FORM create_layout .
data: text(20) TYPE c.
it_layout-window_titlebar = text.
it_layout-colwidth_optimize = 'X'.
it_layout-totals_text = text-013."'Totals'(013).
it_layout-cell_merge = 'X'.
it_layout-zebra = 'X'.
ENDFORM.
but no output total in alv
also i had another broplem i had unit i wanna show it in total line and calc value in header -
Regarding subtotal text and total text
Hi All,
can any body provide example program for ALV total text and subtotal text both using REUSE_ALV_GRID_DISPALY. and
using OOPS.
@@@MODERATOR:: Please dont lock my threads.I have been searching since 2 days for this example and i tried with the provided examples .but they are not worked out ::
FOr your information :
Some of the links i searched in SDN:
http://wiki.sdn.sap.com/wiki/display/ABAP/ALVDisplayTotalTextOrSubtotalText
Re: SubTotal Text in ALV?
http://wiki.sdn.sap.com/wiki/display/ABAP/ALVStandardSumTotalOr+SubtotalHi Naveen,
If you are looking for specific Subtotal text in ALV Grid, then i think it is not possible.
You can use SORT table to get sub-totals based on the columns that you display.
Generally the record existing on the column based on which you sort the table, appears as the sub-total text automatically.....
You can try giving Subtotal text in the LAYOUT as well and pass the layout to the ALV function module.
Best Regards,
Ram. -
Need to display Subtotal text and total text in ALV
HI,
I need help.
I am displaying subtotal and total for cost column which is group by Project type column
My problem is i am able to display the subtotal and total values but not able to display the 'Subtotal' and 'Total' text on that respective row.
I have updated lvc_s_sort table as follow.
ls_sort-spos = 1.
ls_sort-subtot = 'X'.
ls_sort-fieldname = 'SUBTOT'.
ls_sort-up = 'X'.
ls_sort-SELTEXT = 'Subtotal'.
ls_sort-spos = 2.
ls_sort-subtot = 'X'.
ls_sort-fieldname = 'PRART'.
ls_sort-GROUP = 'UL'.
ls_sort-up = 'X'.
Please suggest what should be done to display the text.
Regards,
RachnaYou have to use the event SUBTOTAL_TEXT for the ALV.
the field CRITERIA can be used for checking the field.
and field CRIT_TEXT for the sub total text.
I hope you are aware about how to implement the events in ALV using OOP.
Hope this helps you. -
Text is overlaid on text to render the page unreadable. sometimes columns are totally misaligned.
Reset the page zoom on pages that cause problems: <b>View > Zoom > Reset</b> (Ctrl+0 (zero); Cmd+0 on Mac)<br />
See:
* http://kb.mozillazine.org/Zoom_text_of_web_pages
If you have increased the minimum font size then try the default setting 'none' as a high value can cause issues like you described.
* Tools > Options > Content : Fonts & Colors > Advanced > Minimum Font Size (none)
* Tools > Options > Content : Fonts & Colors > Advanced > [X] "Allow pages to choose their own fonts, instead of my selections above"
See also [[Websites look wrong]]
If you need to increase (or decrease) the font size on websites then look at the NoSquint or Default FullZoom Level extension.
* Default FullZoom Level - https://addons.mozilla.org/firefox/addon/6965
* NoSquint - https://addons.mozilla.org/firefox/addon/2592 -
Help! All text is totally GARBLED & UNREADABLE on Safari 4.02.
OK, so I downloaded the new Safari yesterday and have had MAJOR problems with it ever since. On the majority of sites I go to, the text is completely GARBLED and nothing I do seems to work...I tried changing the text encoding, nothing happened. I can't even Google anything because all the results are unreadable. ALSO, some of my e-mails are coming up garbled as well. What can I do?? What happened here?
Thanks!!What happened here
Either the download was corrupt, OR it revealed existing faults in your system, OR you forgot to restart after the install.
I would suggest you start with a bit of basic maintenance:
Repairing permissions is important, and should always be carried out both before and after any software installation or update.
Go to Disk Utility (this is in your Utilities Folder in your Application folder) and click on the icon of your hard disk (not the one with all the numbers).
In First Aid, click on Repair Permissions.
This only takes a minute or two in Tiger, but much longer in Leopard.
Background information here:
http://docs.info.apple.com/article.html?artnum=25751
and here:
http://docs.info.apple.com/article.html?artnum=302672
An article on troubleshooting Permissions can be found here:
http://support.apple.com/kb/HT2963
By the way, you can ignore any messages about SUID or ACL file permissions, as explained here:
http://support.apple.com/kb/TS1448?viewlocale=en_US
If you were having any serious problems with your Mac you might as well complete the exercise by repairing your hard disk as well. You cannot do this from the same start-up disk. Reboot from your install disk (holding down the C key). Once it opens, select your language, and then go to Disk Utility from the Utilities menu. Select your hard disk as before and click Repair.
Once that is complete reboot again from your usual start-up disk.
More useful reading here:
Resolve startup issues and perform disk maintenance with Disk Utility and fsck
http://support.apple.com/kb/TS1417?viewlocale=en_US
Then Download the Safari 4.0.2 update again and install it, reboot your Mac and repair permissions again. -
Hi friends,
In ALV GRID I need to display text in total like grand Total not in subtotal.
Please let me know the solution .
Thanks in advance
RajendranHi,
R U using FM or Class.
If you are using FM, Grand total cannot be produced. Only using classes we can display Grand Totals.
Its my own experience.
thanks -
ALV GRID - Text for Grand Total
Hi guys,
In ALV Grid, i need to display the Text 'GRAND TOTAL' at the left side of the row(Yellow line).
I have tried searching in the forum but didn't get the answer.
Please advice.
Thanks
ChintuHi
<br><br>
IF you copy and past this might not work but this is the sample code<br><br>
<pre>
REPORT Y_DOWN_TIME_ENTRYSRA.
TABLES : YDOWNTIME1.
TYPE-POOLS : SLIS.
*INTERNAL TABLE DECLARTION
data : l_layout type slis_layout_alv,
x_events type slis_alv_event,
it_events type slis_t_event.
DATA :ITAB LIKE YDOWNTIME1 OCCURS 0 WITH HEADER LINE .
data : GT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
wa_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
**********************SELECTION PARAMETERS ************************
PARAMETERS: CB1 RADIOBUTTON GROUP G1 ,
CB2 RADIOBUTTON GROUP G1 ,
cb3 RADIOBUTTON GROUP G1 ,
CB4 RADIOBUTTON GROUP G1 ,
CB5 RADIOBUTTON GROUP G1 ,
CB6 RADIOBUTTON GROUP G1 ,
CB7 RADIOBUTTON GROUP G1 ,
CB8 RADIOBUTTON GROUP G1 ,
CB9 RADIOBUTTON GROUP G1 .
CB10 RADIOBUTTON GROUP G1,
CB11 RADIOBUTTON GROUP G1.
DATA : A TYPE C.
SELECTION-SCREEN BEGIN OF BLOCK BK1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS :S_EQUNR FOR YDOWNTIME1-EQUNR ,
S_ERDop FOR YDOWNTIME1-ERDAT,
S_MFSTT FOR YDOWNTIME1-MFSTART.
PARAMETERS : P_SHIFT TYPE YDOWNTIME1-SHIFT,
P_CHARG TYPE YDOWNTIME1-CHARG,
p_COGRU TYPE YDOWNTIME1-QMGRP,
P_CODE TYPE YDOWNTIME1-COde,
p_name type ydowntime1-OPNAME,
p_sup TYPE YDOWNTIME1-SUPERVISOR,
P_MANG TYPE YDOWNTIME1-MANG.
SELECTION-SCREEN END OF BLOCK BK1 .
AT SELECTION-SCREEN.
IF CB1 EQ 'X'.
select * from YDOWNTIME1
INTO CORRESPONDING FIELDS OF TABLE ITAB
where erdat in S_ERDop .
ELSEIF CB2 EQ 'X' .
select * from YDOWNTIME1
INTO CORRESPONDING FIELDS OF TABLE ITAB
where erdat in S_ERDop and charg eq p_charg .
ELSEIF CB3 EQ 'X' .
select * from YDOWNTIME1
INTO CORRESPONDING FIELDS OF TABLE ITAB
where erdat in S_ERDop and charg eq p_charg and shift eq P_SHIFT .
ELSEIF CB4 EQ 'X' .
select * from YDOWNTIME1
INTO CORRESPONDING FIELDS OF TABLE ITAB
where code eq p_code and erdat in S_ERDop.
ELSEIF CB5 EQ 'X' .
select * from YDOWNTIME1
INTO CORRESPONDING FIELDS OF TABLE ITAB
where erdat in S_ERDop and EQUNR in S_EQUNR and QMGRP eq p_COGRU.
ELSEIF CB6 EQ 'X' .
select * from YDOWNTIME1
INTO CORRESPONDING FIELDS OF TABLE ITAB
where OPNAME eq p_name and erdat in S_ERDop.
ELSEIF CB7 EQ 'X' .
select * from YDOWNTIME1
INTO CORRESPONDING FIELDS OF TABLE ITAB
where SUPERVISOR eq p_sup and erdat in S_ERDop.
ELSEIF CB8 EQ 'X' .
select * from YDOWNTIME1
INTO CORRESPONDING FIELDS OF TABLE ITAB
where MANG eq p_MANG and erdat in S_ERDop.
ELSEIF CB9 EQ 'X'.
select * from YDOWNTIME1
INTO CORRESPONDING FIELDS OF TABLE ITAB
where erdat in S_ERDop and EQUNR in S_EQUNR.
endif.
loop at itab.
if itab-schno > 1.
A = ' '.
move A to itab-DCOR .
move A to itab-DCCR .
move A to itab-DCNR .
modify itab.
endif.
endloop.
perform create_fieldcat.
data: sort type slis_sortinfo_alv,
it_sort type SLIS_T_SORTINFO_ALV.
sort-fieldname = 'EQUNR'.
sort-up = 'X'.
sort-subtot = 'X'.
APPEND sort to it_sort.
sort-fieldname = 'SHIFT'.
sort-up = 'X'.
*sort-subtot = 'X'.
APPEND sort to it_sort.
l_layout-TOTALS_TEXT = 'TOTAL'.
l_layout-SUBTOTALS_TEXT = 'SUBTOTAL'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
is_layout = l_layout
it_fieldcat = gt_fieldcat
it_events = it_events
it_sort = it_sort
TABLES
T_OUTTAB = 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.
*& Form CREATE_FIELDCAT
text
--> p1 text
<-- p2 text
FORM CREATE_FIELDCAT .
DATA: LS_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
CLEAR LS_FIELDCAT.
LS_FIELDCAT-ROW_POS = '1'.
LS_FIELDCAT-COL_POS = '1'.
LS_FIELDCAT-FIELDNAME = 'ERDAT'.
LS_FIELDCAT-KEY = ''.
LS_FIELDCAT-OUTPUTLEN = '12'.
ls_fieldcat-do_sum = 'X'.
LS_FIELDCAT-SELTEXT_L = 'Date'.
APPEND LS_FIELDCAT TO GT_FIELDCAT.
clear LS_FIELDCAT .
CLEAR LS_FIELDCAT.
LS_FIELDCAT-ROW_POS = '1'.
LS_FIELDCAT-COL_POS = '2'.
LS_FIELDCAT-FIELDNAME = 'UZEIT'.
LS_FIELDCAT-KEY = ''.
LS_FIELDCAT-OUTPUTLEN = '8'.
LS_FIELDCAT-SELTEXT_L = 'Time'.
APPEND LS_FIELDCAT TO GT_FIELDCAT.
clear LS_FIELDCAT .
CLEAR LS_FIELDCAT.
LS_FIELDCAT-ROW_POS = '1'.
LS_FIELDCAT-COL_POS = '2'.
LS_FIELDCAT-FIELDNAME = 'EQUNR'.
LS_FIELDCAT-KEY = ''.
LS_FIELDCAT-OUTPUTLEN = '8'.
LS_FIELDCAT-SELTEXT_L = 'Equipment'.
APPEND LS_FIELDCAT TO GT_FIELDCAT.
clear LS_FIELDCAT .
CLEAR LS_FIELDCAT.
LS_FIELDCAT-ROW_POS = '1'.
LS_FIELDCAT-COL_POS = '2'.
LS_FIELDCAT-FIELDNAME = 'CODE'.
LS_FIELDCAT-KEY = ''.
LS_FIELDCAT-OUTPUTLEN = '12'.
LS_FIELDCAT-SELTEXT_L = 'CODE'.
APPEND LS_FIELDCAT TO GT_FIELDCAT.
clear LS_FIELDCAT .
CLEAR LS_FIELDCAT.
LS_FIELDCAT-ROW_POS = '1'.
LS_FIELDCAT-COL_POS = '3'.
LS_FIELDCAT-FIELDNAME = 'QMGRP'.
LS_FIELDCAT-KEY = ''.
LS_FIELDCAT-OUTPUTLEN = '20'.
LS_FIELDCAT-SELTEXT_L = 'Code Group'.
APPEND LS_FIELDCAT TO GT_FIELDCAT.
clear LS_FIELDCAT .
CLEAR LS_FIELDCAT.
LS_FIELDCAT-ROW_POS = '1'.
LS_FIELDCAT-COL_POS = '3'.
LS_FIELDCAT-FIELDNAME = 'KURZTEXT'.
LS_FIELDCAT-KEY = ''.
LS_FIELDCAT-OUTPUTLEN = '40'.
LS_FIELDCAT-SELTEXT_L = 'Code Text'.
APPEND LS_FIELDCAT TO GT_FIELDCAT.
clear LS_FIELDCAT .
CLEAR LS_FIELDCAT.
LS_FIELDCAT-ROW_POS = '1'.
LS_FIELDCAT-COL_POS = '7'.
LS_FIELDCAT-FIELDNAME = 'DCOR'.
LS_FIELDCAT-KEY = ''.
LS_FIELDCAT-OUTPUTLEN = '14'.
LS_FIELDCAT-SELTEXT_L = 'Opening Dips'.
APPEND LS_FIELDCAT TO GT_FIELDCAT.
clear LS_FIELDCAT .
CLEAR LS_FIELDCAT.
LS_FIELDCAT-ROW_POS = '1'.
LS_FIELDCAT-COL_POS = '8'.
LS_FIELDCAT-FIELDNAME = 'DCCR'.
LS_FIELDCAT-KEY = ''.
LS_FIELDCAT-OUTPUTLEN = '14'.
LS_FIELDCAT-SELTEXT_L = 'Closing Dips'.
APPEND LS_FIELDCAT TO GT_FIELDCAT.
clear LS_FIELDCAT .
CLEAR LS_FIELDCAT.
LS_FIELDCAT-ROW_POS = '1'.
LS_FIELDCAT-COL_POS = '9'.
LS_FIELDCAT-FIELDNAME = 'DCNR'.
LS_FIELDCAT-KEY = ''.
LS_FIELDCAT-OUTPUTLEN = '10'.
ls_fieldcat-do_sum = 'X'.
LS_FIELDCAT-SELTEXT_L = 'Net Dips'.
APPEND LS_FIELDCAT TO GT_FIELDCAT.
clear LS_FIELDCAT .
CLEAR LS_FIELDCAT.
LS_FIELDCAT-ROW_POS = '1'.
LS_FIELDCAT-COL_POS = '9'.
LS_FIELDCAT-FIELDNAME = 'PRO'.
LS_FIELDCAT-KEY = ''.
LS_FIELDCAT-OUTPUTLEN = '10'.
ls_fieldcat-do_sum = 'X'.
LS_FIELDCAT-SELTEXT_L = 'PROD IN LAC'.
APPEND LS_FIELDCAT TO GT_FIELDCAT.
clear LS_FIELDCAT .
CLEAR LS_FIELDCAT.
LS_FIELDCAT-ROW_POS = '1'.
LS_FIELDCAT-COL_POS = '4'.
LS_FIELDCAT-FIELDNAME = 'CHARG'.
LS_FIELDCAT-KEY = ''.
LS_FIELDCAT-OUTPUTLEN = '12'.
ls_fieldcat-do_sum = 'X'.
LS_FIELDCAT-SELTEXT_L = 'Batch Number'.
APPEND LS_FIELDCAT TO GT_FIELDCAT.
clear LS_FIELDCAT .
CLEAR LS_FIELDCAT.
LS_FIELDCAT-ROW_POS = '1'.
LS_FIELDCAT-COL_POS = '6'.
LS_FIELDCAT-FIELDNAME = 'OPNAME'.
LS_FIELDCAT-KEY = ''.
LS_FIELDCAT-OUTPUTLEN = '20'.
LS_FIELDCAT-SELTEXT_L = 'Operators Name'.
APPEND LS_FIELDCAT TO GT_FIELDCAT.
clear LS_FIELDCAT .
CLEAR LS_FIELDCAT.
LS_FIELDCAT-ROW_POS = '1'.
LS_FIELDCAT-COL_POS = '6'.
LS_FIELDCAT-FIELDNAME = 'SUPERVISOR'.
LS_FIELDCAT-KEY = ''.
LS_FIELDCAT-OUTPUTLEN = '20'.
LS_FIELDCAT-SELTEXT_L = 'Supervisor Name'.
APPEND LS_FIELDCAT TO GT_FIELDCAT.
clear LS_FIELDCAT .
CLEAR LS_FIELDCAT.
LS_FIELDCAT-ROW_POS = '1'.
LS_FIELDCAT-COL_POS = '6'.
LS_FIELDCAT-FIELDNAME = 'MANG'.
LS_FIELDCAT-KEY = ''.
LS_FIELDCAT-OUTPUTLEN = '20'.
LS_FIELDCAT-SELTEXT_L = 'Manager'.
APPEND LS_FIELDCAT TO GT_FIELDCAT.
clear LS_FIELDCAT .
CLEAR LS_FIELDCAT.
LS_FIELDCAT-ROW_POS = '1'.
LS_FIELDCAT-COL_POS = '6'.
LS_FIELDCAT-FIELDNAME = 'SHIFT'.
LS_FIELDCAT-KEY = ''.
LS_FIELDCAT-OUTPUTLEN = '20'.
LS_FIELDCAT-SELTEXT_L = 'Shift'.
APPEND LS_FIELDCAT TO GT_FIELDCAT.
clear LS_FIELDCAT .
CLEAR LS_FIELDCAT.
LS_FIELDCAT-ROW_POS = '1'.
LS_FIELDCAT-COL_POS = '9'.
LS_FIELDCAT-FIELDNAME = 'MFSTART'.
LS_FIELDCAT-KEY = ''.
LS_FIELDCAT-OUTPUTLEN = '10'.
LS_FIELDCAT-SELTEXT_L = 'Start Time'.
APPEND LS_FIELDCAT TO GT_FIELDCAT.
clear LS_FIELDCAT .
CLEAR LS_FIELDCAT.
LS_FIELDCAT-ROW_POS = '1'.
LS_FIELDCAT-COL_POS = '9'.
LS_FIELDCAT-FIELDNAME = 'MFEND'.
LS_FIELDCAT-KEY = ''.
LS_FIELDCAT-OUTPUTLEN = '10'.
LS_FIELDCAT-SELTEXT_L = 'End Time'.
APPEND LS_FIELDCAT TO GT_FIELDCAT.
clear LS_FIELDCAT .
CLEAR LS_FIELDCAT.
LS_FIELDCAT-ROW_POS = '1'.
LS_FIELDCAT-COL_POS = '9'.
LS_FIELDCAT-FIELDNAME = 'DURATION'.
LS_FIELDCAT-KEY = ''.
LS_FIELDCAT-OUTPUTLEN = '10'.
ls_fieldcat-do_sum = 'X'.
LS_FIELDCAT-SELTEXT_L = 'DURATION'.
APPEND LS_FIELDCAT TO GT_FIELDCAT.
clear LS_FIELDCAT .
CLEAR LS_FIELDCAT.
LS_FIELDCAT-ROW_POS = '1'.
LS_FIELDCAT-COL_POS = '9'.
LS_FIELDCAT-FIELDNAME = 'ZUNIT'.
LS_FIELDCAT-KEY = ''.
LS_FIELDCAT-OUTPUTLEN = '10'.
LS_FIELDCAT-SELTEXT_L = 'UNIT'.
APPEND LS_FIELDCAT TO GT_FIELDCAT.
clear LS_FIELDCAT .
ENDFORM. " CREATE_FIELDCAT
</pre>
Edited by: Matt on Sep 3, 2009 12:06 PM -
ALV Grid Total Text (OOPS)
Hi All,
I have a simple ALV Grid Report(OOPS), I would like to give a Text for Total Row. In REUSE_ALV_GRID we have the option of giving this text, but i am not able to figure it out how to get the same in OOPS.
Regards
AnupHi Anup,
While using ALV with OOP methodology, you can create an extra row for giving the sum of any field.
In the field catalog, there is a component named 'DO_SUM', if set, will give the total value for the field.
In the method where you fill the field catalog , just add this component.
eg:
form catalog_fill changing p_field_catalog.
data ls_fcat type lvc_s_fcat .
ls_fcat-fieldname = 'CARRID' .
ls_fcat-inttype = 'C' .
ls_fcat-outputlen = '20' .
ls_fcat-coltext = 'Carrier ID' .
ls_fcat-web_field = 'carrid_handle'.
ls_fcat-edit = 'X'.
*ls_fcat-emphasize = 'C310'. "needed for column coloring
append ls_fcat to field_catalog .
clear ls_fcat .
ls_fcat-fieldname = 'FLDATE' .
ls_fcat-ref_table = 'SFLIGHT' .
ls_fcat-ref_table = 'FLDATE' .
ls_fcat-outputlen = '20' .
<b>ls_fcat-do_sum = 'X'.</b>
ls_fcat-coltext = 'Flight Date' .
ls_fcat-web_field = 'fldate_handle'.
append ls_fcat to field_catalog .
clear ls_fcat .
ls_fcat-fieldname = 'PRICE' .
ls_fcat-ref_table = 'SFLIGHT' .
ls_fcat-ref_table = 'PRICE' .
ls_fcat-outputlen = '20' .
ls_fcat-coltext = 'Airfare' .
append ls_fcat to field_catalog .
endform.
In this way, you can get the total of any field in ALV.
Regards,
SP. -
How to display sub total text in ALV grid display reporting
Hi,
I want to display a text 'SUB TOTAL' in Sub total row of an ALV report.
Presently I am getting the name of the field used in sorting to get sub totals. But I required to display own text. Could you please give me solution.
Thanks
Giridhar KarnamFor doing this u need to simply modify the layout properties, please award points if found helpful
DATA: L_LAYOUT TYPE SLIS_LAYOUT_ALV.
L_LAYOUT-SUBTOTALS_TEXT = 'GEN SUBTOT'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IS_LAYOUT = L_LAYOUT
IT_FIELDCAT = IT_FIELDCAT
TABLES
T_OUTTAB = IT_FINAL
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2. -
Hi All,
I have the following requirement in ALV grid display- thru ALV FMs (not using OO ALV)
Inv no Inv type amount
1 A 6
3 A 8
Total average for for A is 14 (14/2)
2 B 6
9 B 3
8 B 4
10 B 7
Total average for for B is 5 (20/4)
Here after every Invoice type i need to calculate average and display with my own text as explained above.
I have searched many sites and tried but not able to get it..
Request you to please help if u have any idea on it.
Thanks.
Regards,
Lokesh*& Report Z_ALV_SUBTOTAL
REPORT z_alv_subtotal.&----
*& 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,
wa_sort TYPE slis_sortinfo_alv.&----
*& Constant declaration
&----CONSTANTS:
c_header TYPE char1
VALUE 'H', "Header in ALV
c_item TYPE char1
VALUE 'S'.&----
*& 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 char10 , "System id
l_r_line TYPE slis_listheader, "Hold list header
l_date TYPE char10, "Date
l_time TYPE char10, "Time
l_success_records TYPE i, "No of success records
l_title(300) TYPE c. " 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.ENDFORM. " sub_build_header
*& Form sub_field_catalog
Build Field Catalog
No Parameter
FORM sub_field_catalog .* Build Field Catalog
PERFORM sub_fill_alv_field_catalog USING: '01' '01' 'EBELN' 'I_EKPO' 'L'
'Doc No'(003) ' ' ' ' ' ' ' ', '01' '02' 'EBELP' 'I_EKPO' 'L'
'Item No'(004) 'X' 'X' ' ' ' ', '01' '03' 'MATNR' 'I_EKPO' 'L'
'Material No'(005) 'X' 'X' ' ' ' ', '01' '03' 'MATNR1' 'I_EKPO' 'L'
'Material No'(005) ' ' ' ' ' ' ' ',
'01' '04' 'WERKS' 'I_EKPO' 'L'
'Plant'(006) 'X' 'X' ' ' ' ', '01' '04' 'WERKS1' 'I_EKPO' 'L'
'Plant'(006) ' ' ' ' ' ' ' ', '01' '05' 'NTGEW' 'I_EKPO' 'R'
'Net Weight'(007) ' ' ' ' 'GEWE' 'I_EKPO'.ENDFORM. " sub_field_catalog&----
*& Form sub_fill_alv_field_catalog
*& For building Field Catalog
*& p_rowpos Row position
*& p_colpos Col position
*& p_fldnam Fldname
*& p_tabnam Tabname
*& p_justif Justification
*& p_seltext Seltext
*& p_out no out
*& p_tech Technical field
*& p_qfield Quantity field
*& p_qtab Quantity table
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.* Local declaration for field catalog
DATA: wa_lfl_fcat TYPE slis_fieldcat_alv. wa_lfl_fcat-row_pos = p_rowpos. "Row
wa_lfl_fcat-col_pos = p_colpos. "Column
wa_lfl_fcat-fieldname = p_fldnam. "Field Name
wa_lfl_fcat-tabname = p_tabnam. "Internal Table Name
wa_lfl_fcat-just = p_justif. "Screen Justified
wa_lfl_fcat-seltext_l = p_seltext. "Field Text
wa_lfl_fcat-no_out = p_out. "No output
wa_lfl_fcat-tech = p_tech. "Technical field
wa_lfl_fcat-qfieldname = p_qfield. "Quantity unit
wa_lfl_fcat-qtabname = p_qtab . "Quantity table IF p_fldnam = '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
Populate ALV layout
No Parameter
FORM sub_populate_layout . CLEAR wa_layout.
wa_layout-colwidth_optimize = 'X'." Optimization of Col widthENDFORM. " sub_populate_layout&----
*& Form sub_populate_sort
Populate ALV sort table
No Parameter
FORM sub_populate_sort .* Sort on material
wa_sort-spos = '01' .
wa_sort-fieldname = 'MATNR'.
wa_sort-tabname = 'I_EKPO'.
wa_sort-up = 'X'.
wa_sort-subtot = 'X'.
APPEND wa_sort TO i_sort .
CLEAR wa_sort.* Sort on plant
wa_sort-spos = '02'.
wa_sort-fieldname = 'WERKS'.
wa_sort-tabname = 'I_EKPO'.
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
Get ALV grid event and pass the form name to subtotal_text
event
No Parameter
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.* Subtotal
READ TABLE i_event INTO l_s_event
WITH KEY name = slis_ev_subtotal_text.
IF sy-subrc = 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
For ALV Report Display
No Parameter
FORM sub_alv_report_display .
DATA: l_repid TYPE syrepid .
l_repid = sy-repid .* This function module for displaying the ALV report
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = l_repid
i_callback_top_of_page = 'SUB_ALV_TOP_OF_PAGE'
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
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE i000 WITH 'Error in ALV report display'(055).
ENDIF.ENDFORM. " sub_alv_report_display&----
FORM sub_alv_top_of_page
Call ALV top of page
No parameter
----FORM sub_alv_top_of_page. "#EC CALLED* To write header for the ALV
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = i_alv_top_of_page.
ENDFORM. "alv_top_of_page&----
*& Form subtotal_text
Build subtotal text
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 -
Regarding totals and sub totals text in alv
Hi all,
i am displaying Totals and subtotals ......but i want to display the text before the the Totals and Subtotals.
Please help me in regarding this..
Thanks in advance,
S.Gangi reddy.hi,
check this report.
*& Report ZGM_ALV_SUBTOTAL_TEXT *
*& Author :
*& Date :
*& Description :
*& Modification History
REPORT ZGM_ALV_SUBTOTAL_TEXT .
*& 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:
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,
wa_sort TYPE slis_sortinfo_alv.
*& Constant declaration
CONSTANTS:
c_header TYPE char1
VALUE 'H', "Header in ALV
c_item TYPE char1
VALUE 'S'.
*& 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 char10 , "System id
l_r_line TYPE slis_listheader, "Hold list header
l_date TYPE char10, "Date
l_time TYPE char10, "Time
l_success_records TYPE i, "No of success records
l_title(300) TYPE c. " 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.ENDFORM. " sub_build_header
*& Form sub_field_catalog
Build Field Catalog
No Parameter
FORM sub_field_catalog .
Build Field Catalog
PERFORM sub_fill_alv_field_catalog USING: '01' '01' 'EBELN'
'I_EKPO' 'L'
'Doc No'(003) ' ' ' ' ' ' ' ', '01' '02' 'EBELP' 'I_EKPO' 'L'
'Item No'(004) 'X' 'X' ' ' ' ', '01' '03' 'MATNR' 'I_EKPO' 'L'
'Material No'(005) 'X' 'X' ' ' ' ', '01' '03' 'MATNR1' 'I_EKPO'
'L'
'Material No'(005) ' ' ' ' ' ' ' ',
'01' '04' 'WERKS' 'I_EKPO' 'L'
'Plant'(006) 'X' 'X' ' ' ' ', '01' '04' 'WERKS1' 'I_EKPO' 'L'
'Plant'(006) ' ' ' ' ' ' ' ', '01' '05' 'NTGEW' 'I_EKPO' 'R'
'Net Weight'(007) ' ' ' ' 'GEWE' 'I_EKPO'.ENDFORM.
" sub_field_catalog*&----
*& Form sub_fill_alv_field_catalog
*& For building Field Catalog
*& p_rowpos Row position
*& p_colpos Col position
*& p_fldnam Fldname
*& p_tabnam Tabname
*& p_justif Justification
*& p_seltext Seltext
*& p_out no out
*& p_tech Technical field
*& p_qfield Quantity field
*& p_qtab Quantity table
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.
Local declaration for field
catalog
DATA: wa_lfl_fcat TYPE slis_fieldcat_alv.
wa_lfl_fcat-row_pos = p_rowpos. "Row
wa_lfl_fcat-col_pos = p_colpos. "Column
wa_lfl_fcat-fieldname = p_fldnam. "Field Name
wa_lfl_fcat-tabname = p_tabnam. "Internal Table Name
wa_lfl_fcat-just = p_justif. "Screen Justified
wa_lfl_fcat-seltext_l = p_seltext. "Field Text
wa_lfl_fcat-no_out = p_out. "No output
wa_lfl_fcat-tech = p_tech. "Technical field
wa_lfl_fcat-qfieldname = p_qfield. "Quantity unit
wa_lfl_fcat-qtabname = p_qtab .
"Quantity table
IF p_fldnam = '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
Populate ALV layout
No Parameter
FORM sub_populate_layout . CLEAR wa_layout.
wa_layout-colwidth_optimize = 'X'.
" Optimization of Col width
ENDFORM. " sub_populate_layout*&----
*& Form sub_populate_sort
Populate ALV sort table
No Parameter
FORM sub_populate_sort .
Sort on material
wa_sort-spos = '01' .
wa_sort-fieldname = 'MATNR'.
wa_sort-tabname = 'I_EKPO'.
wa_sort-up = 'X'.
wa_sort-subtot = 'X'.
APPEND wa_sort TO i_sort .
CLEAR wa_sort.
Sort on plant
wa_sort-spos = '02'.
wa_sort-fieldname = 'WERKS'.
wa_sort-tabname = 'I_EKPO'.
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
Get ALV grid event and pass the form name to subtotal_text
event
No Parameter
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.
Subtotal
READ TABLE i_event INTO l_s_event
WITH KEY name = slis_ev_subtotal_text.
IF sy-subrc = 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
For ALV Report Display
No Parameter
FORM sub_alv_report_display .
DATA: l_repid TYPE syrepid .
l_repid = sy-repid .
This function module for displaying the ALV
report
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = l_repid
i_callback_top_of_page = 'SUB_ALV_TOP_OF_PAGE'
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
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE i000 WITH 'Error in ALV report display'(055).
ENDIF.
ENDFORM.
" sub_alv_report_display*&----
FORM sub_alv_top_of_page
Call ALV top of page
No parameter
FORM sub_alv_top_of_page. "#EC CALLED*
*To write header for the ALV
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = i_alv_top_of_page.
ENDFORM.
"alv_top_of_page*&----
*& Form subtotal_text
Build subtotal text
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_textSelection screen:
\[removed by moderator\]
Edited by: Jan Stallkamp on Sep 3, 2008 6:17 PM -
Hi,
i will give the total-sum (not subtotal) line in OO-GRID an own text. Is it possible?
Regards, DieterHi Dieter,
nowadays I'm facing the same problem. I have explored whole class CL_GUI_ALV_GRID and there is not any standard possibility to put own text in total line. But there is one solution, which is not ideal but functional - using another subtotal (I'm using function module REUSE_ALV_GRID_DISPLAY instead of class CL_GUI_ALV_GRID directly, but the principle is almost the same):
in field catalog put any empty hidden field (this field must exist in your output table too!):
CLEAR l_fieldcat.
l_fieldcat-fieldname = 'TOTAL_TEXT'.
l_fieldcat-seltext_s = 'Total'.
l_fieldcat-seltext_m = 'Total'.
l_fieldcat-seltext_l = 'Total'.
l_fieldcat-reptext_ddic = 'Total'.
l_fieldcat-no_out = 'X'.
APPEND l_fieldcat TO i_fieldcat.
define subtotal by this field, it forces event SUBTOTAL_TEXT:
CLEAR l_sort.
l_sort-spos = 1.
l_sort-fieldname = 'TOTAL_TEXT'.
l_sort-up = 'X'.
l_sort-subtot = 'X'.
APPEND l_sort TO i_sort.
forbid making totals:
s_layout-no_totalline = 'X'.
register event SUBTOTAL_TEXT:
CLEAR l_event.
l_event-name = 'SUBTOTAL_TEXT'.
l_event-form = 'PROCESS_SUBTOTAL_TEXT'.
APPEND l_event TO i_event.
form for processing event SUBTOTAL_TEXT:
* FORM process_subtotal_text *
* --> P_LINE *
* --> P_SST *
FORM process_subtotal_text USING p_line p_sst TYPE slis_subtot_text.
DATA lcl_grid TYPE REF TO cl_gui_alv_grid.
DATA: l_i_fieldcat TYPE lvc_t_fcat,
l_wa_fieldcat TYPE lvc_s_fcat,
l_tabix LIKE sy-tabix.
CASE p_sst-criteria.
WHEN 'TOTAL_TEXT'.
p_sst-display_text_for_subtotal = 'Your own text'.
" This is necessary to avoid users to play with this field (in my case,
" if the TECH attribute was set in definition of field catalog, system
" doesn't display the text)
IF g_set_tech IS INITIAL. "Change field catalog only once
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = lcl_grid.
CALL METHOD lcl_grid->get_frontend_fieldcatalog
IMPORTING
et_fieldcatalog = l_i_fieldcat.
READ TABLE l_i_fieldcat WITH KEY fieldname = 'TOTAL_TEXT'
INTO l_wa_fieldcat.
l_tabix = sy-tabix.
l_wa_fieldcat-tech = 'X'.
MODIFY l_i_fieldcat FROM l_wa_fieldcat INDEX l_tabix.
CALL METHOD lcl_grid->set_frontend_fieldcatalog
EXPORTING
it_fieldcatalog = l_i_fieldcat.
g_set_tech = 'X'.
ENDIF.
WHEN OTHERS. "Another subtotals
ENDCASE.
ENDFORM.
create ALV GRID:
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'...
Regards,
Petr -
Total in REUSE_ALV_BLOCK_LIST_HS_APPEND
hi,
i am using "REUSE_ALV_BLOCK_LIST_HS_APPEND" to display alv in hierarchy.
i have some 5 columns to display, i need to have total for all these 5 columns at the end and text for it as "TOTAL".
i have used DO_SUM in fieldcat and declared layout to display the text as "TOTAL".
even then i am not getting the text and sum.
am not getting the problem here.
pls help...hi,
i am using "REUSE_ALV_BLOCK_LIST_HS_APPEND" to display alv in hierarchy.
i have some 5 columns to display, i need to have total for all these 5 columns at the end and text for it as "TOTAL".
i have used DO_SUM in fieldcat and declared layout to display the text as "TOTAL".
even then i am not getting the text and sum.
am not getting the problem here.
pls help...
Maybe you are looking for
-
Resizing image using CSS - not working in IE
Hello, I have a standard report with couple of columns one of which a image column. The images are of varying sizes and I manged to resize them to a fixed width & height by using CSS code in page header as below: td[headers="ITEM_PICTURE"] img { di
-
HT4009 What if an In-App purchase never downloaded to begin with?
I made an In-App purchase a few days ago and have been trying to contact the company to at least Talk to a representative and figure out what went wrong, but they have been in general, unhelpful, and haven't responded. The only email I've recieved si
-
Importing configurations via Order Import in R12
Hi All, We need some help with this issue we are facing while importing configurations ( PTO ) via order import process. The scenario is like this : we have parent PTO Model Item : A and under this we have 2 Option Classes within the BOM: OC1 & OC2 E
-
Digital Signature on TDS certificate - Vendors
Dear All, Their is possiblity to insert digital signature on TDS certificate given to employees(form 16), but is their any chance of inseting the digital signature on TDS certificate given to Vendors. Thanks & Regards Krishna Chaitanya
-
Getting music off of Ipod onto Itunes using iDump
My hard drive recently crashed so all my music and videos are gone but all it's all on my Ipod. I read about the program iDump that allows you to transfer the stuff on your Ipod onto Itunes but I'm not very technical and couldn't figure out how to us