Blocked ALV sub total Display
hi,
I'm working with Blocked ALV. In my program, passed the Fieldcatlog-do_sum = 'X' . But then also i'm not getting totals. For that what i want to do in Blocked ALV.
Regards,
Bab
Hi,
For ALV Totals you can try doing,
DATA : it_field TYPE slis_t_fieldcat_alv,
wa_field TYPE slis_fieldcat_alv.
DATA: itab_sort TYPE slis_t_sortinfo_alv,
wa_sort TYPE slis_sortinfo_alv.
wa_field-fieldname = 'MENGE'.
wa_field-tabname = 'IT_TAB'.
wa_field-outputlen = 20.
wa_field-seltext_l ='Quantity'.
wa_field-input = ' '.
wa_field-edit = ' '.
wa_field-col_pos = '4'.
wa_field-hotspot = 'X'.
wa_field-do_sum = 'X'. "For totalling
APPEND wa_field TO it_field.
CLEAR wa_field.
*Manintainig internal table for sorting
wa_sort-spos = 1.
wa_sort-fieldname = 'EBELP'.
wa_sort-tabname = 'IT_tab'.
wa_sort-up = 'X'.
wa_sort-subtot = 'X'. "For totalling
APPEND wa_sort TO itab_sort.
CLEAR wa_sort.
Then you can pass these two internal tables in Reuse ALV grid Function Module.
Hope it helps
Regards
Mansi
Similar Messages
-
ALV Sub total texts. displayed in list not in grid.
Hi,
I am displaying data using alv and sub-totals on a particular column.
i am getting the sub-totals but i am not getting the sub-total texts when i am displaying data in a grid.
'REUSE_ALV_GRID_DISPLAY'.
i am getting subtotals and subtotal texts when i am diSplAying in list.
'REUSE_ALV_LIST_DISPLAY'.
but i want to get subtotal texts using alv grid, is it possible, if so please send me the code.
Any help in this regard is highly appreciated.
Thanks in advance for your help.Hi,
Actually i have wriitten the same code, in the alv. I am using Function modules. for the same code the sub-total and total text is appearing in the list output. but not in the grid output.
code.
wa_layout-zebra = 'X'.
wa_layout-subtotals_text = 'Total'.
wa_layout-totals_text = 'Sum of Marks'.
alv statement.
is_layout = wa_layout
Declaration.
DATA : wa_layout type slis_layout_alv.
for the same declarations (Above) list is showing the texts but not the grid.
Any help in this regard is highly appreciated. -
hi,
in alv i want sub total text for purchase order.
can you check my code . i am not getting.
TYPE-POOLS: slis.
TABLES: ekko,ekpo,eket.
TYPES: BEGIN OF ty_ekko,
lifnr TYPE elifn,
ebeln TYPE ebeln,
ebeln1 TYPE ebeln,
bsart TYPE esart,
ekorg TYPE ekorg,
ekgrp TYPE bkgrp,
ernam TYPE ernam,
END OF ty_ekko,
BEGIN OF ty_ekpo,
ebeln TYPE ebeln,
matnr TYPE matnr,
ebelp TYPE ebelp,
ebelp1 TYPE ebelp,
menge TYPE bstmg,
meins TYPE bstme,
netpr TYPE bprei,
werks TYPE ewerk,
END OF ty_ekpo,
BEGIN OF ty_eket,
ebeln TYPE ebeln,
ebelp TYPE ebelp,
etenr TYPE eeten,
eindt TYPE eindt,
END OF ty_eket,
BEGIN OF ty_final,
slno TYPE sy-dbcnt,
lifnr TYPE elifn,
ebeln TYPE ebeln,
ebeln1 TYPE ebeln,
bsart TYPE esart,
ekorg TYPE ekorg,
ekgrp TYPE bkgrp,
ernam TYPE ernam,
matnr TYPE matnr,
ebelp TYPE ebelp,
ebelp1 TYPE ebelp,
menge TYPE bstmg,
meins TYPE bstme,
netpr TYPE bprei,
werks TYPE ewerk,
eindt TYPE eindt,
END OF ty_final.
DATA: it_ekko TYPE STANDARD TABLE OF ty_ekko,
it_ekpo TYPE STANDARD TABLE OF ty_ekpo,
it_eket TYPE STANDARD TABLE OF ty_eket,
it_final TYPE STANDARD TABLE OF ty_final,
it_fieldcat TYPE slis_t_fieldcat_alv,
it_alv_top_of_page TYPE slis_t_listheader,
it_sort TYPE slis_t_sortinfo_alv,
it_event TYPE slis_t_event,
l_repid TYPE syrepid,
slno TYPE i VALUE 1.
DATA: wa_ekko TYPE ty_ekko,
wa_ekpo TYPE ty_ekpo,
wa_eket TYPE ty_eket,
wa_final TYPE ty_final,
wa_fieldcat TYPE slis_fieldcat_alv,
wa_alv_top_of_page TYPE slis_listheader,
wa_sort TYPE slis_sortinfo_alv,
wa_layout TYPE slis_layout_alv.
wa_event TYPE slis_alv_event.
CONSTANTS:
c_header TYPE char1
VALUE 'H', "Header in ALV
c_item TYPE char1
VALUE 'S'.
SELECTION-SCREEN BEGIN OF BLOCK blk WITH FRAME TITLE text-001.
SELECT-OPTIONS: s_aedat FOR ekko-aedat.
SELECTION-SCREEN END OF BLOCK blk.
START-OF-SELECTION.
PERFORM validation.
PERFORM retrive_data.
PERFORM sub_build_header.
PERFORM sub_field_catalog.
PERFORM sub_populate_layout.
PERFORM sub_populate_sort.
PERFORM sub_get_event.
*END-OF-SELECTION.
Perform to display ALV report
PERFORM sub_alv_report_display.
*FORM validation .
SELECT SINGLE * FROM ekko WHERE aedat IN s_aedat .
IF sy-subrc <> 0.
MESSAGE e001(zram).
ENDIF.
*ENDFORM. " validation
FORM retrive_data .
SELECT lifnr
ebeln
ebeln
bsart
ekorg
ekgrp
ernam FROM ekko INTO TABLE it_ekko
INTO CORRESPONDING FIELDS OF TABLE it_ekko
WHERE aedat IN s_aedat .
IF it_ekko[] IS NOT INITIAL.
SELECT ebeln
ebelp
ebelp
matnr
menge
meins
netpr
werks FROM ekpo
INTO corresponding fields of TABLE it_ekpo
FOR ALL ENTRIES IN it_ekko
WHERE ebeln = it_ekko-ebeln .
if sy-subrc = 0.
SELECT ebeln
ebelp
etenr
eindt
FROM eket INTO TABLE it_eket
FOR ALL ENTRIES IN it_ekpo
WHERE ebeln = it_ekpo-ebeln .
endif.
ENDIF.
ENDIF.
LOOP AT it_ekko INTO wa_ekko.
READ TABLE it_ekpo INTO wa_ekpo
WITH KEY ebeln = wa_ekko-ebeln.
READ TABLE it_eket INTO wa_eket
WITH KEY ebeln = wa_ekpo-ebeln.
wa_final-slno = slno.
wa_final-lifnr = wa_ekko-lifnr.
wa_final-ebeln = wa_ekko-ebeln.
wa_final-bsart = wa_ekko-bsart.
wa_final-ekgrp = wa_ekko-ekgrp.
wa_final-ekorg = wa_ekko-ekorg.
wa_final-ernam = wa_ekko-ernam.
wa_final-ebelp = wa_ekpo-ebelp.
wa_final-matnr = wa_ekpo-matnr.
wa_final-menge = wa_ekpo-menge.
wa_final-meins = wa_ekpo-meins.
wa_final-netpr = wa_ekpo-netpr.
wa_final-werks = wa_ekpo-werks.
wa_final-eindt = wa_eket-eindt.
slno = slno + 1.
APPEND wa_final TO it_final.
ENDLOOP.
ENDFORM. " retrive_data
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 it_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 it_alv_top_of_page.
CLEAR: l_r_line,
l_date.
ENDFORM. " sub_build_header
FORM sub_field_catalog .
REFRESH it_fieldcat.
wa_fieldcat-row_pos = '01'. " p_rowpos. "Row
wa_fieldcat-col_pos = '01'. "p_colpos. "Column
wa_fieldcat-fieldname = 'SLNO'. "p_fldnam. "Field Name
wa_fieldcat-tabname = 'IT_FINAL'. "p_tabnam. "Internal Table Name
wa_fieldcat-just = ' '. "p_justif. "Screen Justified
wa_fieldcat-seltext_l = 'SLNo'. "p_seltext. "Field Text
wa_fieldcat-do_sum = ' '.
wa_fieldcat-outputlen = '4' .
wa_fieldcat-no_out = ' '. "p_out. "No output
wa_fieldcat-tech = ' '. "p_tech. "Technical field
wa_fieldcat-qfieldname = ' '. "p_qfield. "Quantity unit
wa_fieldcat-qtabname = ' '. "p_qtab . "Quantity table
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-row_pos = '01'. " p_rowpos. "Row
wa_fieldcat-col_pos = '02'. "p_colpos. "Column
wa_fieldcat-fieldname = 'LIFNR'. "p_fldnam. "Field Name
wa_fieldcat-tabname = 'IT_FINAL'. "p_tabnam. "Internal Table Name
wa_fieldcat-just = ' '. "p_justif. "Screen Justified
wa_fieldcat-seltext_l = 'Supplier Name'. "p_seltext. "Field Text
wa_fieldcat-do_sum = ' '.
wa_fieldcat-outputlen = '12' .
wa_fieldcat-no_out = ' '. "p_out. "No output
wa_fieldcat-tech = ' '. "p_tech. "Technical field
wa_fieldcat-qfieldname = ' '. "p_qfield. "Quantity unit
wa_fieldcat-qtabname = ' '. "p_qtab . "Quantity table
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-row_pos = '01'. " p_rowpos. "Row
wa_fieldcat-col_pos = '03'. "p_colpos. "Column
wa_fieldcat-fieldname = 'EBELN'. "p_fldnam. "Field Name
wa_fieldcat-tabname = 'IT_FINAL'. "p_tabnam. "Internal Table Name
wa_fieldcat-just = ' '. "p_justif. "Screen Justified
wa_fieldcat-seltext_l = 'PO No'. "p_seltext. "Field Text
wa_fieldcat-do_sum = ' '.
wa_fieldcat-outputlen = '15' .
wa_fieldcat-no_out = ' '. "p_out. "No output
wa_fieldcat-tech = ' '. "p_tech. "Technical field
wa_fieldcat-qfieldname = ' '. "p_qfield. "Quantity unit
wa_fieldcat-qtabname = ' '. "p_qtab . "Quantity table
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-row_pos = '01'. " p_rowpos. "Row
wa_fieldcat-col_pos = '03'. "p_colpos. "Column
wa_fieldcat-fieldname = 'EBELN1'. "p_fldnam. "Field Name
wa_fieldcat-tabname = 'IT_FINAL'. "p_tabnam. "Internal Table Name
wa_fieldcat-just = ' '. "p_justif. "Screen Justified
wa_fieldcat-seltext_l = 'PO No'. "p_seltext. "Field Text
wa_fieldcat-do_sum = ' '.
wa_fieldcat-no_out = ' '. "p_out. "No output
wa_fieldcat-tech = 'X'. "p_tech. "Technical field
wa_fieldcat-qfieldname = ' '. "p_qfield. "Quantity unit
wa_fieldcat-qtabname = ' '. "p_qtab . "Quantity table
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
ENDFORM. " sub_field_catalog
FORM sub_populate_layout .
CLEAR wa_layout.
wa_layout-colwidth_optimize = 'X'." Optimization of Col width
ENDFORM. " sub_populate_layout
FORM sub_populate_sort .
Sort on material
wa_sort-spos = '01' .
wa_sort-fieldname = 'EBELN'.
wa_sort-tabname = 'IT_FINAL'.
wa_sort-up = 'X'.
wa_sort-subtot = 'X'.
APPEND wa_sort TO it_sort.
CLEAR wa_sort.
Sort on plant
wa_sort-spos = '02'.
wa_sort-fieldname = 'EBELP'.
wa_sort-tabname = 'IT_FINAL'.
wa_sort-up = 'X'.
wa_sort-subtot = 'X'.
APPEND wa_sort TO it_sort.
CLEAR wa_sort.
ENDFORM. " sub_populate_sort
FORM sub_get_event .
CONSTANTS : c_formname_subtotal_text TYPE slis_formname VALUE
'SUBTOTAL_TEXT'.
data : wa_event TYPE slis_alv_event.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 4
IMPORTING
et_events = it_event
EXCEPTIONS
list_type_wrong = 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.
Subtotal
READ TABLE it_event INTO wa_event
WITH KEY name = slis_ev_subtotal_text.
IF sy-subrc = 0.
MOVE c_formname_subtotal_text TO wa_event-form.
MODIFY it_event FROM wa_event INDEX sy-tabix.
ENDIF.
ENDFORM. " sub_get_event
FORM sub_alv_report_display .
l_repid = sy-repid .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
i_callback_program = l_repid
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
i_callback_top_of_page = 'SUB_ALV_TOP_OF_PAGE'
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
is_layout = wa_layout
it_fieldcat = it_fieldcat
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
it_sort = it_sort
IT_FILTER =
IS_SEL_HIDE =
i_default = 'X'
i_save = 'A'
IS_VARIANT =
IT_EVENTS = i_event
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
IR_SALV_FULLSCREEN_ADAPTER =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = it_final
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. " sub_alv_report_display
FORM sub_alv_top_of_page. "#EC CALLED
To write header for the ALV
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = it_alv_top_of_page.
ENDFORM. "alv_top_of_page
FORM subtotal_text CHANGING
p_total TYPE any
p_subtot_text TYPE slis_subtot_text.
Material level sub total
IF p_subtot_text-criteria = 'EBELN'.
p_subtot_text-display_text_for_subtotal
= 'The Nett price of PO No'(009).
ENDIF.
Plant level sub total
IF p_subtot_text-criteria = 'EBELP'.
p_subtot_text-display_text_for_subtotal = 'Total Purchase Order value placed'(010).
ENDIF.
ENDFORM. "subtotal_texthi ,
try the given below code ...
"*************INTERNAL TABLE FR SORTING***********************
DATA: it_sort TYPE slis_t_sortinfo_alv.
"******** WORK AREA FR FIELD CATALOG *************************
DATA: wa_sort TYPE slis_sortinfo_alv.
wa_sort-fieldname = 'EBELN'."field name
wa_sort-tabname = 'IT_TAB'."internal table name
wa_sort-up = 'X'.
wa_sort-subtot ='X'.
APPEND wa_sort TO it_sort.
CLEAR wa_sort.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
it_sort = it_sort
ENDFORM. "alv
hope this helps
Regards
RItesh J -
Hi gurus,
I have a problem, please help me out.
Iam doing an report program with alv display. In that iam calculating the AVG for the workcenter wise for the field TAT.
please observe my below o/p in general ALv format.
work center-- TAT- Tat(Yes/no)
qm0010------ 1 -- yes
qm0010-------2 -- yes
qm0010------ 4 -- yes
qm0010------ 7 -- No (because >5)
Subtotal(qm0010)--3 (avg caluculated)
qm0020-- 4 --- yes
qm0020-7-- No (because >5)
qm0020--10 - No (because >5)
qm002010- No (because >5)
Subtotal(qm0020)-- 7 (avg caluculated).
this is the rough o/p iam getting . this is acheived by programming the Field catalog for TAT field i.e... do_sum = 'C'.
then giving the sort table to REUSE_ALV_GRID_DISPLAY.
Now my problem is:
I want the avg to be calcuted by the business formula which is:
avg = sum of(TAT within 5 days) / total no of the entries .
Ex:
work center-- TAT- Tat(Yes/no)
qm0010------ 1 -- yes
qm0010-------2 -- yes
qm0010------ 4 -- yes
qm0010------ 7 -- No (because >5)
Subtotal(qm0010)---*7/4=2 (avg caluculated for tat<5)*
qm0020-- 4 --- yes
qm0020-7-- No (because >5)
qm0020--10 - No (because >5)
qm002010- No (because >5)
Subtotal(qm0020)--4/4=1 (avg caluculated for tat<5).
How can i acheive the above, since in field catalog and alv, i think we cannot pass any conditions(like for TAT which is less than 5). So is there any other way to acheive the above.
Please understand the problem and give me(please directly dont suggest any programs , since iam not a expert to understand)..
Please explain me in detail. Points will be duly rewarded.
Thanks in advance........Chaitu
Edited by: chaitanya on May 30, 2008 12:33 PM
Edited by: chaitanya on May 30, 2008 12:38 PM
Edited by: chaitanya on May 30, 2008 12:39 PMHi Chaitanya,
You can display in your report with totals and sub-totals using alv, but not average. That functionality has not provided by sap. Do one thing add one more extra column Average in your output, do the calculation for average and pass the value in the coding itself. Then last display your report with Average field.
Rgds,
Bujji -
Reg. ALV- Sub total?
Hi Experts,
How to hide the column values in ALV? That is I need to display the sub-total values alone and not to show the other values in the ALV output. Take for e.g
1 2 2 andre
2 3 4 brown
3 5 6 subtotal
2 2 3 A
1 1 1 B
1 1 1 C
1 1 2 D
5 5 7 subtotal
If the alv output is like this means, I want to display the 3, 5, 6 fields alone how to hide the first column colum field values alone i.e 1 & 2. Then in second part of the ALV how to hide the first column values 2,1,1 & 1 alone.
Regards,
SakthiHi Tarun,
Thanks for your reply.
If I give that no_out = 'X' in the sense it will hide the whole column.
I need How to hide the values alone and need to display the column subtotal.
Those values need to be displayed as blank in the output.
How to do that?
The output normally will be like this.
1 1 1 A
1 2 3 B
1 1 1 C
3 4 5 subtotal
1 2 3 E
1 1 1 F
2 3 4 SubTotal
But what I need is
1 1 A
2 3 B
1 1 C
3 4 5 SubTotal
2 3 E
1 1 F
2 3 4 Sub Total
Like this I need to hide a single column values alone not along with sub total values. The first column values should not appear but subtotal value should appear. -
Hi
In ALV grid I want subtotal for accounts group INCOME ( 300000,301000,302007 sub total-1) again Expenses( 400000,401012,403001) subtotal-2 like wise etc there are more than 3 groups
Please help.
Regards
Vinayak M. Deosthali.Hi Vinayak,
By now I think you understand how to give Subtotals for a column by filling it in SORT table.
I think you can achieve your requirement by adding one more column to your display called "Account Group" or just "Group" and fill it with INCOME for 300000, 301000, 302007 and similarily EXPENSES for 400000, 401012, 403001 etc.
And then fill your SORT table with this field and set properties UP = 'X', SUBTOT = 'X' for it.
You can actually keep this column at the very end of the grid (by adding it to the field catalog at the very end) if you dont want it to appear next to other important columns.
Hope this helps..
Sri
Message was edited by: Srikanth Pinnamaneni
Message was edited by: Srikanth Pinnamaneni -
hai friends
iam useing alv grid display to dispaly the report
in that report i have LIFNR,BUKRS,BUDAT,DMBTR , SHKZG,WAERS from BSIK table
the problem is
SHIKZG field we have values like S and H.
so particular LIFNR may have both S and H values
hear the requirement is
in particular LIFNR S valus should be subtracted from H values . and display the total after subtacting in sub totals.
how can i do this
pls any body help me
thanks
srikanth vipparlaYour requirement is not clear how ever you can try this
Right click on the characterustic and select display tab in that select Supress result rows -> Never
It will give you the subtotals.
If that does not work out follow the link and see if that is what you want. If none is helpful please elaborate your requirement with some numbers.
http://help.sap.com/saphelp_nw04s/helpdata/en/03/17f13a2f160f28e10000000a114084/frameset.htm
Hope this helps.
~Abhijit -
Hi all,
I have a requirement to change few fields in existing ALV.
1) i have data like this in ALV.
GROUP G/L ACCOUNT LC USD
100 10 5 5
100 11 6 4
100 12 3 3
100 11 3 2
200 10 5 5
200 11 6 4
200 12 3 3
200 11 3 2
now for particular GROUP (ex: 100) i need the sub totals of LC(5633=17) and USD(5432=14)
it should be shown before the GROUP 200 begins.
now the output should come as:
GROUP G/L ACCOUNT LC USD
100 10 5 5
11 6 4
12 3 3
11 3 2
TOTAL 17 14
200 10 5 5
11 6 4
12 3 3
11 3 2
TOTAL 17 14
Is there any way to do this..please help
thanks,
prasanthHai Prasanth,
Try this.
LR_SORTS = LR_TABLE->GET_SORTS( ).
LR_AGGREGATIONS = LR_TABLE->GET_AGGREGATIONS( ).
PERFORM SET_AGGREGATIONS USING LR_AGGREGATIONS '<lc fieldname>'.
PERFORM SET_SORTS USING LR_SORTS '<group filedname>' 1
1 'X' .
Double click SET_AGGREGATIONS
*& Form SET_AGGREGATIONS
text
-->P_LR_AGGREGATIONS text
-->P_0834 text
FORM SET_AGGREGATIONS USING IR_AGGREGATIONS TYPE REF TO CL_SALV_AGGREGATIONS
L_COL TYPE ANY.
CONSTANTS: L_1 TYPE SALV_DE_AGGREGATION VALUE '1'.
TRY.
IR_AGGREGATIONS->SET_NUMERICAL_AGGREGATION( ABAP_FALSE ).
TRY.
IR_AGGREGATIONS->ADD_AGGREGATION(
COLUMNNAME = L_COL
AGGREGATION = L_1 ).
CATCH CX_SALV_DATA_ERROR CX_SALV_EXISTING CX_SALV_NOT_FOUND.
MESSAGE I023(SALV_EXCEPTION).
CATCH CX_SALV_METHOD_NOT_SUPPORTED.
MESSAGE I028(SALV_EXCEPTION) WITH SPACE SPACE SPACE SPACE.
ENDTRY.
CATCH CX_SALV_METHOD_NOT_SUPPORTED.
MESSAGE I028(SALV_EXCEPTION) WITH SPACE SPACE SPACE SPACE.
ENDTRY.
ENDFORM. " SET_AGGREGATIONS
Double click SET_SORTS
*& Form SET_SORTS
text
-->P_LR_SORTS text
-->P_0827 text
-->P_1 text
-->P_1 text
-->P_0830 text
FORM SET_SORTS USING IR_SORTS TYPE REF TO CL_SALV_SORTS
L_COL TYPE ANY
L_POS TYPE I
L_SEQ TYPE SALV_DE_SORT_SEQUENCE
L_TOT TYPE SAP_BOOL.
TRY.
IR_SORTS->SET_GROUP_ACTIVE( ABAP_FALSE ).
TRY.
IR_SORTS->ADD_SORT(
COLUMNNAME = L_COL
POSITION = L_POS
SEQUENCE = L_SEQ
SUBTOTAL = L_TOT
CATCH CX_SALV_DATA_ERROR CX_SALV_EXISTING CX_SALV_NOT_FOUND.
MESSAGE I023(SALV_EXCEPTION).
CATCH CX_SALV_METHOD_NOT_SUPPORTED.
MESSAGE I028(SALV_EXCEPTION) WITH SPACE SPACE SPACE SPACE.
ENDTRY.
CATCH CX_SALV_METHOD_NOT_SUPPORTED.
MESSAGE I028(SALV_EXCEPTION) WITH SPACE SPACE SPACE SPACE.
ENDTRY.
ENDFORM. " SET_SORTS -
Sub Total display in Samrtforms
Hi ,
I need to display sub totals in my smartform.Infact I have used Calcualtions Tab Under TABLE with Operation "Total" and Time "After Loop" which is displaying wrong values when Internal Table values are spanned to multiple pages. Can any body help me.
Regards,
Srinivas>
SRINI VASA wrote:
> I can not create any text node after Main Window and according to my requirement, I need to display my sub total in footer of my table inside Main Window.
"..............Main window
".......................Table with loop
"...........................main area with flow logic calculate sum here in some temp variable
"..................................footer, print here your temp with text node
No need to create text node after main window -
HI
AM DOING A ALV report in se 38 in which i need to display the subtotals on plant wise ,storage location wise apart from the grand total..please help me
with regards
vijayHEY BUT D VARIABLES IN D FIRST FIELS ARE NOT ADDED...I WANT D VARIABLE IN D FIELDS FIELD1 AND FIELD 3 TO B ADDED AND ALSO IN MY CASE I CANT GIVE D VALUES DEY R RETRIEVED FROM D TABLE....PLZZ GO THRU D CODE BELOW
REPORT ZSALES1.
DATA:X TYPE I,Y TYPE I,a type i,b type i.
TABLES:VBRP.
TYPE-POOLS:SLIS.
TYPES:BEGIN OF T_VBRP,
VBELN TYPE VBRP-VBELN,
FBUDA TYPE VBRP-FBUDA,
WERKS TYPE VBRP-WERKS,
LGORT TYPE VBRP-LGORT,
NETWR TYPE VBRP-NETWR,
Y TYPE I,
END OF T_VBRP.
DATA:IT_VBRP TYPE STANDARD TABLE OF T_VBRP INITIAL SIZE 0 WITH HEADER LINE ,
WA_VBRP TYPE T_VBRP.
SELECT-OPTIONS DATE FOR VBRP-FBUDA OBLIGATORY.
SELECT-OPTIONS:PLANT FOR VBRP-WERKS NO INTERVALS.
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.
perform data_retrieval.
perform build_fieldcatalog.
perform build_layout.
perform display_alv_report.
FORM build_fieldcatalog.
fieldcatalog-FIELDNAME = 'FBUDA'.
fieldcatalog-seltext_m = 'DATE '.
fieldcatalog-col_pos = 0.
fieldcatalog-tabname = 'it_vbrp'.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-FIELDNAME = 'VBELN'.
fieldcatalog-seltext_m = 'BILLING DOCUMENT NUMBER '.
fieldcatalog-col_pos = 1.
fieldcatalog-tabname = 'it_vbrp'.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-FIELDNAME = 'WERKS'.
fieldcatalog-seltext_m = 'PLANT '.
fieldcatalog-col_pos = 2.
fieldcatalog-tabname = 'it_vbrp'.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-FIELDNAME = 'LGORT'.
fieldcatalog-seltext_m = 'STORAGE LOCATION '.
fieldcatalog-col_pos = 3.
fieldcatalog-tabname = 'it_vbrp'.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-FIELDNAME = 'NETWR'.
fieldcatalog-seltext_m = 'NET VALUE'.
fieldcatalog-col_pos = 4.
FIELDCATALOG-DO_SUM = 'Y'.
fieldcatalog-tabname = 'it_vbrp'.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
ENDFORM.
FORM build_layout.
gd_layout-NO_INPUT = 'X'.
gd_layout-colwidth_optimize = 'X'.
GD_LAYOUT-TOTALS_TEXT = 'TOTALS'(201).
ENDFORM.
form display_alv_report.
gd_repid = sy-repid.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = gd_repid
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
i_save = 'X'
tables
t_outtab = IT_VBRP
exceptions
program_error = 1
others = 2.
if sy-subrc <> 0.
endif.
endform. " DISPLAY_ALV_REPORT
form data_retrieval.
select FBUDA VBELN WERKS LGORT NETWR
from vbrp
into CORRESPONDING FIELDS OF TABLE IT_VBRP
WHERE FBUDA in date and
WERKS IN PLANT.
X = IT_VBRP-NETWR .
ADD X TO Y.
endform.
PLZ EXECUTE D CODE ONCE SO U WIL,GET A CLEAR IDEA
THANKS
VIJAY -
Query Designer - Structure - Sub-totals display
Hi
I am currently creating a structure with different levels and I woul like to have the subtotal I calculate in the various formulas in the structure below the data and not above like it is now.
For example now :
lvl1Total Net Sales
***lvl2Gross Sales
***lvl2Discounts
What I would like :
***lvl2Gross Sales
***lvl2Discounts
lvl1Total Net Sales
I tried in the query properties/ Row & Colums to change 'result position' but it does not work.
Anyone has a clue ?
Thank you very mucn
Edited by: Nico0 on Mar 4, 2009 4:39 PMYour requirement is not clear how ever you can try this
Right click on the characterustic and select display tab in that select Supress result rows -> Never
It will give you the subtotals.
If that does not work out follow the link and see if that is what you want. If none is helpful please elaborate your requirement with some numbers.
http://help.sap.com/saphelp_nw04s/helpdata/en/03/17f13a2f160f28e10000000a114084/frameset.htm
Hope this helps.
~Abhijit -
Sub Total Button in Report Painter Output
Hi,
I am working on the Balance Sheet Report in the Report Painter and i am trying to display the sub totaling display in the output.
In this i had defined the row which is based on the range of Account Number and it has the series i.e. 100000,30000,200000 etc..
Is it possible to display the output sub total on the basis of the Account Number Series which is mentioned above. As in a ALV Report we have the sub total button in report output.
If it is,then please provide me guidelines for it ......
Edited by: ricx .s on Jul 29, 2009 6:47 AMHi,
Try this code,
it working,
Data : X_SORT TYPE SLIS_SORTINFO_ALV,
IT_SORT TYPE SLIS_T_SORTINFO_ALV,
X_SORT-SPOS = 1. " Field number of ALV on which u want to sort
X_SORT-FIELDNAME = 'SEGMENT' . " field name
X_SORT-TABNAME = 'IT_ALV1'(001). "table name same as ur alv table name
X_SORT-UP = 'X'. " put up as 'X'
X_SORT-SUBTOT = 'X'. " Sub total allowed
APPEND X_SORT TO IT_SORT. "append
CLEAR X_SORT. "clear x_SORT
"in ALV_GRID_DISPLAY pass the it sort in it_SORT
IT_SORT = IT_SORT
Thanks
Arun Kayal -
hi gurus,
In my report program i have a monthly report displaying the data for that month.
1. Now in my ALV grid i want The SUB-TOTALS for the work center wise data for a field of the alv. there are many workcenters data in my report. So after the end of each work center , i want the subtotal of a calculated TAT field.
2. At the end of the report, I want the average TAT(field calculated by my report program) for that month.
So how can i make the coding for the above.
Iam a fresher to this field, so give me in detail.
regards,
chaitanyaHi
i am giving a sample example for subtotals of alv.
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 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. -
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 experts,
i have tried to subtotal in blocked alv. i used the coding for sorting in grid display. its working in FM reuse_alv_grid_display.
but its not working in blocked alv, i.e., in FM reuse_alv_block_list_append .
so what to do ?
kind regards,
debendrahi all,
yes my question has been answered.
as per below.
have to maintain this line : WA_SORT-TABNAME = 'IT_MUSTER'
where IT_MUSTER is the table name.
FORM APPEND USING FTAB TYPE C FDATA TYPE STANDARD TABLE.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
IS_LAYOUT = layout
IT_FIELDCAT = it_fcat
I_TABNAME = FTAB
IT_EVENTS = it_event
IT_SORT = IT_SORT
TABLES
T_OUTTAB = FDATA.
ENDFORM.
Form sort.
WA_SORT-TABNAME = 'IT_MUSTER'.
wa_sort-fieldname = 'MON'.
wa_sort-SUBTOT = 'X'.
append wa_sort to it_sort.
clear wa_sort.
Endform.
ragards,
debendra
Maybe you are looking for
-
Seagate FreeAgent Desk 1TB causes windows crash and to go in a reboot loop
I bought this Seagate external USB HDD 1000Gb capacity and have been using this for a while. I was able to backup about 500gb of data. This external hdd was permanently hooked on to my computer which has win XP pro (4gb ram, 2.66Ghz CPU Pentium). I h
-
Break Report group wise in different sheets in excel
Hi, Can we split the xml report into different sheets in excel depending on the xml node hierarchy ? I don't want to mail the report. Regards,
-
Hello, DST: the SQL Cluster did not change the time by itself.. Where should I look for the issue. The time was changed manually to continue processing.... Thanks, Dom System Center Operations Manager 2007 / System Center Configuration Manager 2007 R
-
Files missing from install directory
not sure what's happened to my computer but I can no longer install programs or updates for programs as I get the message "files missing from install directory" How did they get corrupt in the first place? I get this when trying to download yahoo mes
-
ICal on Leopard possessed by evil spirit
Is iCal on Leopard inhabited by an evil spirit? Apparently. Why else would iCal refuse to let me do what I want IN MY OWN CALENDAR and instead try to impose its own will? If someone sends me an invite, I get an email and click through to iCal. Now an