Subtotals text in ALV
Hi All,
I want subtotals text in ALV GRID. For this iam seeing a standard program 'BCALV_TEST_FULLSCREEN'.Iam giving subtotal text on selection screen,but its not displayed in output.How to view the text.
When i executed another program BCALV_TEST_LIST, iam able to get the subtotal text in output, what ever i give the text on the selction screen.
Regards,
Kiran I
Hi,
Chk out this:
*& Form BUILD_LAYOUT
Build layout for ALV grid report
form build_layout.
gd_layout-no_input = 'X'.
gd_layout-colwidth_optimize = 'X'.
gd_layout-totals_text = 'Totals'(201).
gd_layout-totals_only = 'X'.
gd_layout-f2code = 'DISP'. "Sets fcode for when double
"click(press f2)
gd_layout-zebra = 'X'.
gd_layout-group_change_edit = 'X'.
gd_layout-header_text = 'helllllo'.
endform. " BUILD_LAYOUT
Best Regards,
Anjali
Similar Messages
-
How Should I use EVENT SUBTOTALS_TEXT in an ALV.
i_events-name = 'SUBTOTALS_TEXT'
i_events-form = 'SUBTOTAL'.
how this event can be <i><b>handled</b></i> in an ALVHi,
<b>FORM subtotal_text CHANGING p_ep_subtot_line_r TYPE any
p_es_subtottxt_info_r TYPE slis_subtot_text."#EC CALLED</b>
DATA: l_st_subtot_line LIKE LINE OF t_outtab_list.
FIELD-SYMBOLS: <fs1> TYPE ANY, "report structure
<fs_field> TYPE ANY. "field of structure
* Retrieve the subtotal line
ASSIGN p_ep_subtot_line_r TO <fs1>.
IF sy-subrc NE 0.
UNASSIGN <fs1>.
ELSE.
* retrieve field value for subtotal criteria
ASSIGN COMPONENT p_es_subtottxt_info_r-criteria
OF STRUCTURE <fs1> TO
<fs_field>.
IF sy-subrc <> 0.
UNASSIGN <fs_field>.
ELSE.
l_st_subtot_line = p_ep_subtot_line_r.
CASE p_es_subtottxt_info_r-criteria.
WHEN 'GLOB'.
IF l_st_subtot_line-glob_ct <> 0.
l_st_subtot_line-variance
= l_st_subtot_line-variance / l_st_subtot_line-spart_ct.
ENDIF.
p_es_subtottxt_info_r-display_text_for_subtotal =
'Average at Highest Level'.
WHEN 'SPART'.
IF l_st_subtot_line-spart_ct <> 0.
l_st_subtot_line-variance
= l_st_subtot_line-variance / l_st_subtot_line-spart_ct.
ENDIF.
CONCATENATE 'Average Level 4 @ Division ' <fs_field>
INTO p_es_subtottxt_info_r-display_text_for_subtotal
SEPARATED BY space.
WHEN 'PRDHA1'.
IF l_st_subtot_line-prdha1_ct <> 0.
l_st_subtot_line-variance
= l_st_subtot_line-variance / l_st_subtot_line-spart_ct.
ENDIF.
CONCATENATE 'Average Level 3 @ Category ' <fs_field>
INTO p_es_subtottxt_info_r-display_text_for_subtotal
SEPARATED BY space.
WHEN 'PRDHA2'.
IF l_st_subtot_line-prdha2_ct <> 0.
l_st_subtot_line-variance
= l_st_subtot_line-variance / l_st_subtot_line-spart_ct.
ENDIF.
CONCATENATE 'Average Level 2 @ Class ' <fs_field>
INTO p_es_subtottxt_info_r-display_text_for_subtotal
SEPARATED BY space.
WHEN 'PRDHA3'.
IF l_st_subtot_line-prdha3_ct <> 0.
l_st_subtot_line-variance
= l_st_subtot_line-variance / l_st_subtot_line-spart_ct.
ENDIF.
CONCATENATE 'Average Level 1 @ Sub-Class ' <fs_field>
INTO p_es_subtottxt_info_r-display_text_for_subtotal
SEPARATED BY space.
ENDCASE.
p_ep_subtot_line_r = l_st_subtot_line.
ENDIF.
ENDIF.
ENDFORM. "get_subtotal_txt
Regards
vijay -
ALV SUBTOTALS TEXTS: how can we use 'slis_subtot_text' structure
hi
in SLIS type pool
there is a structure
<b>slis_subtot_text</b>
i think this for custom subtotal texts
other that standard
but how do we use it
where is this structure to be given as parameterHi Srikant,
You can use the subtotal text in ALV.
Before using the subtotal,. you have to sort the List using the field for which total has to be calculated.
DATA: lt_sort TYPE slis_t_sortinfo_alv.
DATA: lw_sort TYPE slis_sortinfo_alv.
CONSTANTS:
lc_value_x TYPE ebstyp VALUE 'X'.
v_repid = sy-repid.
lw_sort-fieldname = fieldname.
lw_sort-up = lc_value_x.
lw_sort-subtot = lc_value_x.
lw_sort-stext = 'Subttotal'.
APPEND lw_sort TO lt_sort.
*call function to display the report
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = v_repid
i_callback_top_of_page = 'TOP_OF_PAGE'
it_fieldcat = ut_fieldcattab
it_sort = lt_sort
TABLES
t_outtab = ct_output_values_tab
EXCEPTIONS
program_error = 1
OTHERS = 2.
Regards,
Yogesh -
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 -
Hi gurus,
I'm displaying a list using Hierarchial ALV's. I'm displaying subtotals for field AMOUNT.
Now I have 2 issues.
1) while displaying subtotals exactly after the list, and exactly before the subtotal is displayed, one extra line is getting added and displayed in the output.
Could anyone let me know how to remove this unnecessary line.
2) Also how to display certain text exactly beside the SUBTOTAL.
Thanks
Natasha SSHi,
Please visit the links:
1. http://wiki.sdn.sap.com/wiki/display/Snippets/DisplaysubtotaltextinALV+grid
2. http://help.sap.com/saphelp_bw/helpdata/en/ee/c8e056d52611d2b468006094192fe3/content.htm
3. Passing the Total/Subtotal Text in ALV
These links gives you the idea about the subtotal_text.
May this info helps you.
Regards.
Deepak Sharma -
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. -
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 -
Reg: passing totals /subtotals of a ALV to a smartform
I have a editable ALV report which has a button to call a smartform . Once the user edits some fields I need to pass the refreshed total to the smartform. I want to know - in what structure the totals/subtotals of the ALV report are stored.
Banu,
Even if you figure out how to get the subtotals / totals from a ALV, I would still suggest you to use the features of SMART Forms to calculate the same again in the form.
http://help.sap.com/saphelp_nw04/helpdata/en/55/610e2db57911d4b62c006094192fe3/content.htm
So, that way if your form is triggered even without doing the subtotalling done by the user you are on the safer side as the form will still display what you have designed it for.
Regards,
Ravi
Note :Please mark all the helpful answers -
Display a Long Text in ALV report
Hi,
I want to display the PO header long text in ALV Report that is 255 character width.
Please help me out how to do this.
please it is very urgent
Thanks and regards
KrishnaUse READ_TEXT and concatenate the first lines of the text.
CALL FUNCTION 'READ_TEXT'
EXPORTING
id = 'F01'
language = sy-langu
name = lv_name " purchase order with leading zeroes
object = 'EKKO'
TABLES
lines = t_lines
EXCEPTIONS
OTHERS = 8.
Regards -
How to get Grand Total Text in ALV GRID
Hi Folks,
I am able to get the SUBTOTAL TEXT .....But i need...
How to get Grand Total Text in ALV GRID Display...
Can any one give a Solution for this...Hi Surendar,
Check out this code.. this is showing Total Text in Toal line in the very first column.
REPORT zsales_ord_det_1 .
TABLES: ztable_10.
TYPE-POOLS: slis.
DATA: BEGIN OF it OCCURS 0,
srno(6) type c,
name LIKE ztable_10-name,
age LIKE ztable_10-age,
END OF it.
DATA : BEGIN OF it_temp OCCURS 0,
name LIKE ztable_10-name,
age LIKE ztable_10-age,
END OF it_temp.
DATA: i_fieldcat TYPE slis_t_fieldcat_alv,
wa_fieldcat TYPE slis_fieldcat_alv.
DATA: v_repid LIKE sy-repid,
i_index TYPE STANDARD TABLE OF i WITH HEADER LINE,
gs_layout TYPE slis_layout_alv,
gd_layout TYPE slis_layout_alv,
i_sort TYPE STANDARD TABLE OF slis_sortinfo_alv,
wa_sort TYPE slis_sortinfo_alv.
START-OF-SELECTION.
v_repid = sy-repid.
SELECT * FROM ztable_10 INTO TABLE it_temp.
LOOP AT it_temp .
it-srno = 'Total'.
it-name = it_temp-name.
it-age = it_temp-age.
APPEND it.
ENDLOOP.
END-OF-SELECTION.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = v_repid
i_internal_tabname = 'IT'
I_STRUCTURE_NAME =
I_CLIENT_NEVER_DISPLAY = 'X'
i_inclname = v_repid
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
CHANGING
ct_fieldcat = i_fieldcat[]
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
wa_fieldcat-row_pos = 1.
wa_fieldcat-col_pos = 1.
wa_fieldcat-fieldname = 'SRNO'.
wa_fieldcat-tabname = it.
append wa_fieldcat to i_fieldcat.
LOOP AT i_fieldcat INTO wa_fieldcat.
IF wa_fieldcat-fieldname = 'AGE'.
wa_fieldcat-do_sum = 'X'.
MODIFY i_fieldcat FROM wa_fieldcat.
ENDIF.
IF wa_fieldcat-fieldname = 'SRNO'.
Hide this field so that it can display it's content i.e.
Total text in Subtotal level
wa_fieldcat-tech = 'X'.
wa_fieldcat-no_out = 'X'.
MODIFY i_fieldcat FROM wa_fieldcat TRANSPORTING tech no_out.
ENDIF.
ENDLOOP.
wa_sort-spos = 1.
wa_sort-fieldname = 'SRNO'.
wa_sort-up = 'X'.
wa_sort-subtot = 'X'.
APPEND wa_sort TO i_sort.
gd_layout-no_totalline = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
i_callback_program = v_repid
I_CALLBACK_PF_STATUS_SET = ' '
i_callback_user_command = 'USER_COMMAND'
I_CALLBACK_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 = gd_layout
it_fieldcat = i_fieldcat[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
it_sort = i_sort
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
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
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
I_HTML_HEIGHT_TOP =
I_HTML_HEIGHT_END =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = it
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.
Regards,
Seema -
Reg: Adding spaces between texts in ALV list header
Hi All,
I was implementing a client requirement for ALV. The list header should contain something of this format.
Pgm Id: ZZZ01
After this list header it is ALV display.
I did this using the concatenate statement.
ex: Concatenate 'PgmID' sy-repid into listheader seperated by space.
But this is not showing spaces between text in ALV display. See I want a tabspace between the texts in headr. Any idea on how to mak it?
RakeshDepending on Fontsize the space might be so narrow that you believe its not there.
check in the debugger if there is really a space in the string, the clause "separated by space" will insert one for sure.
May be you'reshowing the ALV before you are modifying the listheader?
Another approach is using strings, blanks at the end of a string are not deleted
concatenate 'ABC ' 'XYZ' into s.
and
concatenate `ABC ` `XYZ` into s.
will give different results, be aware of the difference in the quots in both cases. Using the second example you can insert as many blanks as you want. -
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 -
How to use Standard Text in ALV
How to use Standard Text in ALV header part? Can you please help me by giving the answer?
Hi ,
You can read the Standard text using read_text function module and then print in LV header part. -
How to get a Footer text in alv grid?
Hi,
am using RESUE_ALV_COMMENTARy_write... it is getting only on top of page..
suggest me to get Footer text in ALV GRiD.
Regards,
sodanapalli
Moderator message: please do more research before asking, all points removed (both replies were copy/pasted anyway)
Edited by: Thomas Zloch on May 19, 2011 5:41 PMStep1: Populate the ALV event table with 'END_OF_LIST' event
Step2: Populate the footer text in to an internal table which is of type
slis_t_listheader.
Step3: Create a subroutine with name 'END_OF_LIST' and with in this form we have to call the function module u2018REUSE_ALV_COMMENTARY_WRITEu2019.
Step4: Now call the function module REUSE_ALV_GRID_DISPLAYu2019 to display the ALV report. Whenever u2018END_OF_LIST' event is get fired it executes the subroutine END_OF_LIST and displays the text into the footer of the ALV GRID.
Code:
*& Report Z_TEST_ALV
REPORT z_test_alv.
TYPE-POOLS: slis.
DATA: i_mara TYPE STANDARD TABLE OF mara INITIAL SIZE 0,
i_events TYPE slis_t_event,
i_end_of_page TYPE slis_t_listheader,
w_events TYPE slis_alv_event,
v_repid LIKE sy-repid.
START-OF-SELECTION.
SELECT * FROM
mara INTO TABLE i_mara
UP TO 100 ROWS.
CHECK sy-subrc = 0.
PERFORM populate_alv_event.
PERFORM comment_build USING i_end_of_page[].
PERFORM display_grid.
*& Form POPULATE_ALV_EVENT
FORM populate_alv_event .
Populate event table
w_events-name = 'END_OF_LIST'.
w_events-form = 'END_OF_LIST'.
APPEND w_events TO i_events.
ENDFORM. " POPULATE_ALV_EVENT
*& Form COMMENT_BUILD
FORM comment_build USING p_i_end_of_page TYPE slis_t_listheader.
DATA: ls_line TYPE slis_listheader.
REFRESH p_i_end_of_page.
CLEAR ls_line.
ls_line-typ = 'H'.
ls_line-info = 'This is end of list'(001).
APPEND ls_line TO p_i_end_of_page.
ENDFORM. " COMMENT_BUILD
*& Form end_of_list
FORM end_of_list.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = i_end_of_page.
ENDFORM. "end_of_list
*& Form DISPLAY_GRID
FORM display_grid .
v_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = v_repid
i_structure_name = 'MARA'
it_events = i_events
TABLES
it_outtab = i_mara
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
ENDIF.
ENDFORM. " DISPLAY_GRID
Check the output where footer will be displayed as 'THIS IS END OF LIST' -
How to wrap the heading text in alv.
HI all,
I need help, how to wrap the heading text in alv.
can any help ... plz..
Advanced Thanks
Regards
GUhapriyanHello GuhaPriyan,
I assume that you're referring to the ALV Grid's title. The maximum length for this title is 70 characters and this would generally fit in the one line.
Are you intending to wrap it because you purposefully want the text to come in two lines? In that case, I'm not sure that it's possible.
But otherwise, there's an option in the Layout called SMALLTITLE. You can set this attribute so that the title would be displayed in a amaller font and hopefully, all of your text shows up on the screen.
Regards,
Anand Mandalika.
Maybe you are looking for
-
I have been emailing pictures from my ipad to my computer and have been going along nicely and now when I went to send 5 pictures to my computer from my ipad I am getting a message that says " cannot send mail The message was rejected by the server"
-
Why do I have a Gray Screen on my 4s after updating to iOS 8.1.2??
I updated my iPhone 4s to the new operating system, iOS 8.1.2 (12B440), and now have a grey screen (no color). No, the grayscale is not on. The color comes in and out at times but only for seconds at a time. Could it be the new update? And if it is,
-
NEED HELP FOR INTERACTIVE REPORT..PARAMETERISED
I have a report which output is displayed after a field is selected from select list.. The output of query is empty .. This is the query .... it doesnt work when i try to put the value of variable in other page...and call it from the query like below
-
Combine install cd's onto a dvd?
I dl'd the 5.2 64 bit cd images, 1-6. Can I somehow combine all the images [or at least 2-6] on 1 dvd in a manner that the installer will [automatically] find them? Thanks, -nat
-
Can not print pdf file with firefox 29.0 pdf preview plugin. Why?
Can not print pdf file with firefox 29.0 pdf preview plugin. Why?