Displaying subtotal text in alv using the fm reuse_alv_grid_display
Hi,
Can someone help me with this, I am having some problem in displaying the subtotal text in subtotal field in alv. I tried populating the layout of the alv with the text that will be displayed on the output but nothing happens. Is is possible to display the subtotal text in alv using the fm reuse_alv_grid_display? If so, what are the things that I must consider to display the subtotal text in alv output.
Please help me with this. I promise to give you points if you resolve this problem.
Thanks,
Gie
Hi ,
Make it use in your code and let me know if u have any concerns...
Use "Subtotal_text" in events table.
here GTOTAL is field in itab on which we sortindf data, and use your own field on which field u want to sort...
refresh gt_event.
clear gw_event.
call function 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = gt_event.
Subtotal
read table gt_event with key name = slis_ev_subtotal_text into gw_event.
if sy-subrc = 0.
move 'SUBTOTAL_TEXT' to gw_event-form.
append gw_event to gt_event.
endif.
form subtotal_text using uw_subtot_line type ty_main
uv_subtottxt type slis_subtot_text. "#EC CALLED
if uv_subtottxt-criteria = 'GTOTAL'.
uv_subtottxt-display_text_for_subtotal = 'TOTAL'.
endif.
*FORM build_sort .
refresh gt_sort.
gw_sort-spos = 1.
gw_sort-fieldname = 'GTOTAL'.
gw_sort-tabname = 'GT_MAIN'.
gw_sort-up = 'X'.
gw_sort-subtot = 'X'.
APPEND gw_sort TO gt_sort.
CLEAR gw_sort.
Reward points once its useful..
Similar Messages
-
Subtotal text in ALV using OO ALV
HI All,
How to display subtotal text in ALV using OO ALV?
My output of ALV should be as follows
COL1 COL2 COL3
ABC 900 M1
PQR 100 M1
M1 Subtotal 1000
XYZ 2100 M2
M2 Subtotal 2100
I could put the subtotal, but couldnu2019t add subtotal text.
My code
TRY.
CALL METHOD cl_salv_table=>factory
IMPORTING
r_salv_table = g_alv
CHANGING
t_table = gt_report
CATCH cx_salv_msg .
ENDTRY.
u2026u2026
*Display the table.
g_alv->display( ).Hi
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
These will defintely help in u displaying subtotal text check it
thanks -
How to get Subtotal text in ALV using OOPS
hi,
Can any one pls help me out getting <b>subtotals text</b> in ALV using OOPS concepts....Pls provide me if any of u have sample code for that......
my code:
data:gr_grid_d0100 type ref to cl_gui_alv_grid.
data : gr_events_d0100 type ref to lcl_events_d0100.
classes**********
class lcl_events_d0100 definition.
public section.
methods:
subtotal_text for event subtotal_text
of cl_gui_alv_grid
importing es_subtottxt_info
ep_subtot_line
e_event_data.
endclass.
class lcl_events_d0100 implementation.
method subtotal_text.
perform d0100_event_subtotal_text using es_subtottxt_info
ep_subtot_line
e_event_data.
endmethod. "subtotal_text
endclass.
data : gr_event_handler type ref to lcl_events_d0100.
SET HANDLER gr_event_handler->subtotal_text FOR wcl_alv_grid_request
FORM d0100_event_subtotal_text USING
es_subtottxt_info TYPE LVC_S_STXT
ep_subtot_line TYPE REF TO data
e_event_data TYPE REF TO cl_alv_event_data.
DATA: l_text TYPE string.
l_text = es_subtottxt_info.
FIELD-SYMBOLS: <fs> TYPE ANY.
ASSIGN e_event_data->m_data->* TO <fs>.
<fs> = text-007.hi vijay
check this code
if you want to use field symbols.
data: total type ref to data,
subtotal1 type ref to data.
field-symbols <total> like gt_sflight.
field-symbols <subtotal1> like gt_sflight.
call method grid1->get_subtotals
importing
ep_collect00 = total
ep_collect01 = subtotal1.
assign total->* to <total>.
assign subtotal1->* to <subtotal1>.
or u can use
U have to do the subtotal column wise.In the field catalog specify the following in addition to the corresponding field name(i.e. Column)
DATA ls_fcat TYPE lvc_s_fcat.
ls_fcat-do_sum = 'X'.
Hope this helps u out.
Thanks & Regards,
naveen -
How to display subtotal text in alv report for particular group of values
Hi,
if material number falls 1 to 10 then i considered be calculate and display subtotal qty amount with subtotal text " Total of the mat1" and if material number falls 11 to 20 then again i need to be claculate and display subtotal qty amount with subtotal text "total of the mat2". if material number falls 21 to 30 then i don't want to display any subtotal and At last grand total also is not required.
Please help me asapjust check the thread...
Can we modify a sub-total in ALV -
Hi,
I have done the subtotal and total operation in ALV report.
I wanted to display the text like
Subtotal: _______
Total : _______
I tried to give the text in th layout like..
GD_LAYOUT-TOTALS_TEXT = 'Total'.
GD_LAYOUT-subtotals_text = 'SubTotal'.
i passed this layout in REUSE_ALV_GRID_DISPLAY
but i am not getting the text in the output. what is wrong?
Can any one please tell me to place the text?
Regards,
Elanthendral.Hi,
Check out the layout work area declaration and passing part. What u have mentioned should work. Try to debug and find it.
Find below the sample code.
DATA: wa_layout TYPE slis_layout_alv, "Layout structure
END-OF-SELECTION.
PERFORM build_layout.
FORM build_layout .
wa_layout-ZEBRA = 'X'.
wa_layout-NO_VLINE = 'X'.
wa_layout-NO_HLINE = 'X'.
wa_layout-CELL_MERGE = 'X'.
wa_layout-EDIT = 'X'.
wa_layout-WINDOW_TITLEBAR = ''.
wa_layout-NO_ULINE_HS = 'X'.
wa_layout-LIGHTS_FIELDNAME = ''.
wa_layout-LIGHTS_TABNAME = ''.
wa_layout-LIGHTS_ROLLNAME = ''.
wa_layout-LIGHTS_CONDENSE = 'X'.
wa_layout-NO_TOTALLINE = 'X'.
wa_layout-NO_SUBTOTALS = 'X'.
wa_layout-TOTALS_BEFORE_ITEMS = 'X'.
wa_layout-TOTALS_ONLY = 'X'.
wa_layout-TOTALS_TEXT = ''.
wa_layout-SUBTOTALS_TEXT = ''.
wa_layout-BOX_FIELDNAME = ''.
wa_layout-BOX_TABNAME = ''.
wa_layout-BOX_ROLLNAME = ''.
wa_layout-CONFIRMATION_PROMPT = 'X'.
wa_layout-HEADER_TEXT = ''.
ENDFORM.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' EXPORTING
i_callback_program = gf_repid
is_layout = gwa_layout
it_fieldcat = gt_catalog
TABLES
t_outtab = gt_line
EXCEPTIONS
program_error = 1
OTHERS = 2.
Regards,
ramya -
Passing the Total/Subtotal Text in ALV
Hi All,
I would like to know is there any chance with ALV to pass Total/Subtotal Text.
PS:I'm not looking for the text ls_layout-totals_text = 'Grand Total'.
ls_layout-subtotals_text = 'SubTotal'.
What i'm looking for is In My below Output:
112365 TDS Windsor Sequencing
112365 TDS Windsor Sequencing
112365 TDS Windsor Sequencing
* Total <Group text> "Here My total amount is showing
112313 Operations and Engineering
* Total <Group text> "Here My total amount is showing
112363 DCX Windsor
* Total <Group text> "Here My total amount is showing
** Subtotal <Group text> "Here My "SUB total" amount is showing of above three totals
I've <Group text> in My Final ALV one of field, but need to show at the place of <Group text> in above output.
PS:And For Totals/Subtotals i'm using standard function of ALV by passing IT_SORT(which is in Reuse_Alv..FM)
Any Hints?
Thank You,
Cheers,
Amit.Hi Amit,
Please check this example..I used the event BEFORE_LINE_OUTPUT to populate the subtotal texts
dynamically..Used the Field-symbols technique to populate the subtotals text...Hope this is what you
are looking for.
TYPE-POOLS: slis,kkblo.
DATA: BEGIN OF wa,
vbeln TYPE vbeln,
posnr TYPE posnr,
matnr TYPE matnr,
netpr TYPE netpr,
waerk TYPE waerk,
text TYPE char20,
END OF wa.
DATA: BEGIN OF wa_vbak,
vbeln TYPE vbeln,
END OF wa_vbak.
DATA: i_event TYPE slis_t_event,
t_sort TYPE slis_t_sortinfo_alv,
s_sort TYPE LINE OF slis_t_sortinfo_alv,
l_s_event TYPE LINE OF slis_t_event.
DATA: t_fieldcatalog TYPE slis_t_fieldcat_alv.
DATA: s_layout TYPE slis_layout_alv.
DATA: v_repid TYPE syrepid.
DATA: s_fieldcatalog TYPE slis_fieldcat_alv.
DATA: itab1 LIKE TABLE OF wa.
DATA: itab LIKE TABLE OF wa_vbak.
START-OF-SELECTION.
* Field catalog populate.
s_fieldcatalog-col_pos = '1'.
s_fieldcatalog-fieldname = 'VBELN'.
s_fieldcatalog-rollname = 'VBELN'.
s_fieldcatalog-outputlen = '12'.
APPEND s_fieldcatalog TO t_fieldcatalog.
CLEAR: s_fieldcatalog.
s_fieldcatalog-col_pos = '2'.
s_fieldcatalog-fieldname = 'POSNR'.
s_fieldcatalog-rollname = 'POSNR'.
APPEND s_fieldcatalog TO t_fieldcatalog.
CLEAR: s_fieldcatalog.
s_fieldcatalog-col_pos = '3'.
s_fieldcatalog-fieldname = 'MATNR'.
s_fieldcatalog-rollname = 'MATNR'.
APPEND s_fieldcatalog TO t_fieldcatalog.
CLEAR: s_fieldcatalog.
s_fieldcatalog-col_pos = '4'.
s_fieldcatalog-fieldname = 'NETPR'.
s_fieldcatalog-ref_tabname = 'VBAP'.
s_fieldcatalog-ref_fieldname = 'NETPR'.
s_fieldcatalog-do_sum = 'X'.
APPEND s_fieldcatalog TO t_fieldcatalog.
CLEAR: s_fieldcatalog.
* Get vbak
SELECT vbeln UP TO 100 ROWS
FROM
vbak
INTO TABLE itab.
IF NOT itab[] IS INITIAL.
* Get vbap
SELECT vbeln posnr matnr netpr waerk arktx
FROM vbap
INTO TABLE itab1
FOR ALL ENTRIES IN itab
WHERE vbeln = itab-vbeln.
ENDIF.
v_repid = sy-repid.
* Build sort internal table.
s_sort-spos = '1'.
s_sort-fieldname = 'VBELN'.
s_sort-tabname = 'ITAB1'.
s_sort-up = 'X'.
s_sort-subtot = 'X'.
s_sort-group = 'UL'.
APPEND s_sort TO t_sort.
* Get alv events.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 2
IMPORTING
et_events = i_event
EXCEPTIONS
list_type_wrong = 0
OTHERS = 0.
* Before line output.
READ TABLE i_event INTO l_s_event
WITH KEY name = 'BEFORE_LINE_OUTPUT'.
IF sy-subrc = 0.
MOVE 'BEFORE_LINE_OUTPUT' TO l_s_event-form.
MODIFY i_event FROM l_s_event INDEX sy-tabix.
ENDIF.
* Populate dummy text.
s_layout-subtotals_text = 'Dummy'.
* Init
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
EXPORTING
i_callback_program = v_repid.
* Append
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
is_layout = s_layout
it_fieldcat = t_fieldcatalog
i_tabname = 'ITAB1'
it_events = i_event
it_sort = t_sort
TABLES
t_outtab = itab1
EXCEPTIONS
program_error = 1
maximum_of_appends_reached = 2
OTHERS = 3.
* Display
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'.
*& Form BEFORE_LINE_OUTPUT
* text
* -->GS_LINEINFO text
FORM before_line_output USING gs_lineinfo TYPE kkblo_lineinfo.
FIELD-SYMBOLS: <fs_layout> TYPE kkblo_layout.
ASSIGN ('(SAPLKKBL)GT_STACK-IS_LAYOUT') TO <fs_layout>.
CHECK sy-subrc = 0.
* Check if it is subtotal line.
CHECK gs_lineinfo-subtot = 'X'.
* Get the text
READ TABLE itab1 INTO wa INDEX gs_lineinfo-sumindex.
IF sy-subrc = 0.
<fs_layout>-subtotals_text = wa-text.
ENDIF.
ENDFORM. "BEFORE_LINE_OUTPUT
Thanks
Naren -
HI ALL,
could any one send me how to display the subtotal Text in ALV grid output with code sample.
with thanks.
kannanhi,
means u want to print some text instead of star ( coming in subtotal) ?
If so than try like,
*& Report ZALV_LIST
REPORT zalv_list.
TABLES : mseg.
TYPE-POOLS : slis.
DATA : BEGIN OF itab OCCURS 0,
mblnr LIKE mseg-mblnr,
matnr LIKE mseg-matnr,
werks LIKE mseg-werks,
menge LIKE mseg-menge,
line_color(4) TYPE c,
END OF itab.
DATA : BEGIN OF itab1 OCCURS 0,
mblnr LIKE mseg-mblnr,
matnr LIKE mseg-matnr,
werks LIKE mseg-werks,
menge LIKE mseg-menge,
line_color(4) TYPE c,
END OF itab1.
DATA : t_fcat TYPE slis_t_fieldcat_alv,
t_eve TYPE slis_t_event,
t_subtot TYPE slis_t_sortinfo_alv,
subtot LIKE LINE OF t_subtot,
wa_fcat LIKE LINE OF t_fcat,
gd_layout TYPE slis_layout_alv.
DATA : gt_menge LIKE mseg-menge,
st_menge LIKE mseg-menge.
SELECTION-SCREEN : BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
SELECT-OPTIONS : doc FOR mseg-mblnr.
SELECTION-SCREEN : END OF BLOCK blk1.
INITIALIZATION.
PERFORM build_cat USING t_fcat.
PERFORM build_eve.
PERFORM build_layout.
START-OF-SELECTION.
PERFORM get_data.
PERFORM display.
*& Form build_cat
text
-->TEMP_FCAT text
FORM build_cat USING temp_fcat TYPE slis_t_fieldcat_alv.
wa_fcat-tabname = 'ITAB'.
wa_fcat-fieldname = 'MBLNR'.
wa_fcat-seltext_m = 'Material Doc.'.
APPEND wa_fcat TO temp_fcat.
CLEAR wa_fcat.
wa_fcat-tabname = 'ITAB'.
wa_fcat-fieldname = 'MATNR'.
wa_fcat-seltext_m = 'Material'.
APPEND wa_fcat TO temp_fcat.
CLEAR wa_fcat.
wa_fcat-tabname = 'ITAB'.
wa_fcat-fieldname = 'WERKS'.
wa_fcat-seltext_m = 'Plant'.
APPEND wa_fcat TO temp_fcat.
CLEAR wa_fcat.
wa_fcat-tabname = 'ITAB'.
wa_fcat-fieldname = 'MENGE'.
wa_fcat-seltext_m = 'Quantity'.
wa_fcat-do_sum = 'Y'.
APPEND wa_fcat TO temp_fcat.
CLEAR wa_fcat.
subtot-spos = 1.
subtot-fieldname = 'MBLNR'.
subtot-tabname = 'ITAB'.
subtot-up = 'X'.
subtot-group = 'X'.
subtot-subtot = 'X'.
subtot-expa = 'X'.
APPEND subtot TO t_subtot.
ENDFORM. "build_cat
*& Form build_eve
text
FORM build_eve.
DATA : wa_eve TYPE slis_alv_event.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = t_eve
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.
READ TABLE t_eve WITH KEY name = slis_ev_top_of_page
INTO wa_eve.
IF sy-subrc = 0.
MOVE 'TOP_OF_PAGE' TO wa_eve-form.
APPEND wa_eve TO t_eve.
ENDIF.
ENDFORM. "build_eve
*& Form build_layout
text
FORM build_layout.
gd_layout-no_input = 'X'.
gd_layout-colwidth_optimize = 'X'.
gd_layout-info_fieldname = 'LINE_COLOR'.
gd_layout-subtotals_text = 'Sub Total'.
ENDFORM. " BUILD_LAYOUT
*& Form get_data
text
FORM get_data.
SELECT mblnr matnr werks menge FROM mseg INTO CORRESPONDING FIELDS OF TABLE itab
WHERE mblnr IN doc.
SORT itab BY mblnr.
LOOP AT itab.
AT NEW mblnr.
LOOP AT itab WHERE mblnr = itab-mblnr.
st_menge = st_menge + itab-menge.
itab1-mblnr = itab-mblnr.
itab1-matnr = itab-matnr.
itab1-werks = itab-werks.
itab1-menge = itab-menge.
APPEND itab1.
ENDLOOP.
itab1-mblnr = 'Sub_Total'.
itab1-matnr = ''.
itab1-werks = ''.
itab1-menge = st_menge.
itab1-line_color = 'C710'.
APPEND itab1.
itab1-line_color = ''.
CLEAR st_menge.
ENDAT.
ENDLOOP.
LOOP AT itab.
gt_menge = gt_menge + itab-menge.
ENDLOOP.
itab1-mblnr = 'Total'.
itab1-matnr = ''.
itab1-werks = ''.
itab1-menge = gt_menge.
itab1-line_color = 'C310'.
APPEND itab1.
ENDFORM. "get_data
*& Form display
text
FORM display.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = 'ZALV_LIST'
is_layout = gd_layout
it_fieldcat = t_fcat
it_sort = t_subtot
it_events = t_eve
TABLES
t_outtab = itab1
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. "display
*& Form top_of_page
text
FORM top_of_page.
WRITE:/ 'Data'.
ENDFORM. "top_of_page
reward if useful....
Edited by: Dhwani shah on Dec 20, 2007 1:20 PM -
Reg: Subtotal text in alv grid.
Hi All,
I need to display the subtotal text in ALV.
If:
data: i_layout type slis_layout_alv.
Then, we can used
i_layout-subtotal_text = my subtotal text.
But my declaration is :
Data: ls_layout type lvc_s_layo.
This dosnt have subtotaltext.
I have tried the method:
method subtotal_text.
perform event_subtotal_text using es_subtottxt_info
ep_subtot_line
e_event_data.
and also used the handle.
as per the coding in : BCALV_TEST_GRID_EVENTS
Still its not working.
Waiting for your valuable inputs.
Thanks & Regards,
AnjaliHi Anjali,
Try this sample code.
REPORT z_demo_alv_sort.
TABLES : vbak.
TYPE-POOLS: slis. " ALV Global types
SELECT-OPTIONS :
s_vkorg FOR vbak-vkorg, " Sales organization
s_kunnr FOR vbak-kunnr, " Sold-to party
s_vbeln FOR vbak-vbeln. " Sales document
SELECTION-SCREEN :
SKIP, BEGIN OF LINE,COMMENT 5(27) v_1 FOR FIELD p_max.
PARAMETERS p_max(2) TYPE n DEFAULT '20' OBLIGATORY.
SELECTION-SCREEN END OF LINE.
DATA:
BEGIN OF gt_vbak OCCURS 0,
vkorg LIKE vbak-vkorg, " Sales organization
kunnr LIKE vbak-kunnr, " Sold-to party
vbeln LIKE vbak-vbeln, " Sales document
netwr LIKE vbak-netwr, " Net Value of the Sales Order
waerk LIKE vbak-waerk, " Document currency
END OF gt_vbak.
INITIALIZATION.
v_1 = 'Maximum of records to read'.
START-OF-SELECTION.
PERFORM f_read_data.
PERFORM f_display_data.
Form f_read_data
FORM f_read_data.
SELECT * INTO CORRESPONDING FIELDS OF TABLE gt_vbak
FROM vbak
UP TO p_max ROWS
WHERE kunnr IN s_kunnr
AND vbeln IN s_vbeln
AND vkorg IN s_vkorg.
ENDFORM. " F_READ_DATA
Form f_display_data
FORM f_display_data.
DEFINE m_fieldcat.
add 1 to ls_fieldcat-col_pos.
ls_fieldcat-fieldname = &1.
ls_fieldcat-ref_tabname = 'VBAK'.
ls_fieldcat-do_sum = &2.
ls_fieldcat-cfieldname = &3.
append ls_fieldcat to lt_fieldcat.
END-OF-DEFINITION.
DEFINE m_sort.
add 1 to ls_sort-spos.
ls_sort-fieldname = &1.
ls_sort-up = 'X'.
ls_sort-subtot = &2.
append ls_sort to lt_sort.
END-OF-DEFINITION.
DATA:
ls_fieldcat TYPE slis_fieldcat_alv,
lt_fieldcat TYPE slis_t_fieldcat_alv,
lt_sort TYPE slis_t_sortinfo_alv,
ls_sort TYPE slis_sortinfo_alv,
ls_layout TYPE slis_layout_alv.
m_fieldcat 'VKORG' '' ''.
m_fieldcat 'KUNNR' '' ''.
m_fieldcat 'VBELN' '' ''.
m_fieldcat 'NETWR' 'X' 'WAERK'.
m_fieldcat 'WAERK' '' ''.
m_sort 'VKORG' 'X'. " Sort by vkorg and subtotal
m_sort 'KUNNR' 'X'. " Sort by kunnr and subtotal
m_sort 'VBELN' ''. " Sort by vbeln
ls_layout-cell_merge = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
is_layout = ls_layout
it_fieldcat = lt_fieldcat
it_sort = lt_sort
TABLES
t_outtab = gt_vbak.
ENDFORM. " F_DISPLAY_DATA
Hope this helps,
Thanks,
Priya. -
Hi,
How to change the subtotal text in ALV grid display using classes.i think if you refresh the grid the subtotals will be refreshed
CALL METHOD gr_alvgrid->REFRESH_TABLE_DISPLAY. -
Display additional Text in ALV Grid
Hello,
I have an ALV Grid display and need to display additional information on the top of the list. I have used the grid-title, but the field is defined as 70 characters and thats not enough.
Is it possible to display more text with alv grid?
Regards MichaelHi Ravi,
I´m creating my alv object orientated and I don´t know, how to manage that now. Can You explain me, where and how I have to do it?
My Dynpro has one custom container and I´m calling the method SET_TABLE_FOR_FIRST_DISPLAY in PBO.
And I need the comment to be printed with the ALV by pressing the print button in the toolbar of the ALV
Thank You!
Message was edited by: Michael Schmidt -
Problem in Displaying Subtotal text in Grid Display
Hi Experts,
I got a problem in passing the Subtotal text and Total Text in Grid Display.In my Case we are calculating Interest Rate for Document Number for Each Assignment Number. If any discount is maintain for document, calculate the interest rate as per the given formula.
So, in this case, Instead of Subtotal text, we can view the 2 dots in Grid display. But in the place of that or else, i want to display the Subtotal. But this not happen in case of Grid Display, I tried in List Display, i can able to display the text.
Here is the Code what i maintain.
wa_sortcat-fieldname = 'ZUONR'.
wa_sortcat-tabname = 'IT_FINAL'.
wa_sortcat-subtot = c_x.
APPEND wa_sortcat TO sortcat.
wa_sortcat-fieldname = 'BUDAT'.
wa_sortcat-tabname = 'IT_FINAL'.
APPEND wa_sortcat TO sortcat.
wa_sortcat-fieldname = 'INTER'. "Interest Rate
wa_sortcat-subtot = c_x.
wa_sortcat-tabname = 'IT_FINAL'.
APPEND wa_sortcat TO sortcat.
Fieldcatalog:
wa_fieldcat-outputlen = c_15. " Interest Rate
wa_fieldcat-do_sum = c_x.
Layout:
alv_layout-colwidth_optimize = c_x.
alv_layout-zebra = c_x.
alv_layout-subtotals_text = 'Subtotal'.
alv_layout-totals_text = 'Total'.
I check in the SDN, But in some Threads, They explain as, We cant display the Subtotal text in Grid display.
Please help me to sort this issue. And clarify this whether this is possible or not.
Thanks in Advance.
SriniHi Naresh,
Thanks for your reply, I added the given code by you to fieldcatalog for Interest rate field. i.e.
wa_fieldcat-outputlen = c_15.
wa_fieldcat-do_sum = c_x.
wa_fieldcat-inttype = 'I'.
Is this is a correct process what you are thinking, or i had to declare for every field what i declare under fieldcatalog.
Regards,
Srini -
Alv- displaying long text in alv output
hi,
as per my requirement, i need to be display long text (length >1000 characters) in alv list or alv grid.
i get the entaire long text and keep it in final internal table and pass it to alv functional module, but it unable to display the compleate long text( in alv-grid).
the alv list displays the complete long text but not in the row, it displays in the second rown and few field labes of long text and its previous field label are displayed in impro[per order.
is there any possible way to display long text in alv.
regards,
revooriHi Ashok,
try to pass the below while filling your long text.
wa_fieldcat-seltext_l = 'Your Long Text'.
wa_fieldcat-ddictxt = 'L'.
for more info check below
Long Text --- 1000 characters
hope it works
Thnaks!
Edited by: Prasanth on Mar 8, 2009 4:03 PM -
how do i change the language of my keyboard and autocorrect to write a text in spanish using the pages app?
Edit > Spelling and Grammar > Show Spelling and Grammar
-
Hello find my mac displays offline when I'm using the actual mac I want to find at the time, can anyone help?, Hello find my mac displays offline when I'm using the actual mac I want to find at the time, can anyone help?
Welcome to the Apple community.
Is your Mac connected to the network via ethernet. Mac's thatareI connected via ethernet cannot be located using "find my phone". -
How to put display on screensaver while still using the beamer?
How can i put my display on screensaver while still using the beamer?
My beamer can be on for a long time, i would like to use my screensaver at the same time, but then the beamer screen also goes to screensaver.
Is there a way to use just the beamer screen, while the computer screen is on screensaver?
I use a macbook pro with Mavericks.
Thanks in advance - DaanWhat you can do is hiding the tabs (see pic below) and force the active tab programmaticily
Hope this helps
Message Edité par TiTou le 09-20-2006 10:35 AM
When my feet touch the ground each morning the devil thinks "bloody hell... He's up again!"
Attachments:
Clipboard01.png 151 KB
Maybe you are looking for
-
Gif loader for background image
I simply want to run an animated gif while my background image loads for a slideshow. I've searched the web and this forum for hours and can't get the various bits of code tips (ajax, jquery) to work because I'm a totaly idiot when it comes to code..
-
extract data when button pressed in forms 9i to a flat file
-
Peculiar Deployment Error in OWB
Hi All, I have a mapping (M_TEST_PROCEDURE) which has the following sequence of operators. Source Table -> Mapping Transformation (Procedure) -> Expression -> Pivot -> Target Table. The mapping validates without any errors. But when tried to deploy t
-
Making a slide show with iPhoto
How do I control the speed of my slideshow? I want to change each slide individually, myself, without the computer automatically changing each slide?
-
Product costing - Template - Flexible function
Dear all, I am using a template in product costing. I would like to use a flexible function, but do not get any result out of it. When I follow the SAP documentation, I constantly run into situations not conform the SAP-documentation. Has anyone set