Totals text and currency sign in alv grid
Hi!
How to display totals text and currency sign in the totals part of the alv grid??
Ex.
5 6
4 9
5 2
Totals: $14 $17
Hi,
For Currency :
https://forums.sdn.sap.com/click.jspa?searchID=11871008&messageID=3564279
https://forums.sdn.sap.com/click.jspa?searchID=11871008&messageID=1019294
For Total_text
Maybe you will find something in examples SALV_OBJECTS.
it's a package in the systems above 6.4 with new ALV. There are nice examples. Main package is SALV.
https://forums.sdn.sap.com/click.jspa?searchID=11871273&messageID=3935361
Regards,
Shiva Kumar
Similar Messages
-
Display totals with currency sign in ALV
Hi,
I have to display totals with currency sign in ALV.
column1 colums2
10 USD
20 USD
30 USD
40 USD
100 USD
Can anybody help on this.
Regsrds,
Zak.Hi,
fieldcatalog-fieldname = 'NETPR'.
fieldcatalog-seltext_m = 'Net Price'.
fieldcatalog-col_pos = 7.
fieldcatalog-outputlen = 15.
fieldcatalog-do_sum = 'X'. "Display column total
fieldcatalog-datatype = 'CURR'. "
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
Thanks
Vikranth -
Mix AVG and Total for the same column in ALV grid
Hi,
We are using CL_GUI_ALV_GRID=>SET_TABLE_FOR_FIRST_DISPLAY, and I'd like to know if the following situation is possible.
Let's say we have a column which contains a number of hours, and we set it up to subtotal by period, but as an average rather than a total (DO_SUM = "C"). This is not a problem so far.
The problem is that we'd like for the "Grand Total" at the bottom of the ALV grid to total all of the subtotal averages, instead of calculating an average.
Ex:
Period Hours
2010/01 6.0
2010/02 7.0
2010/03 2.0
5.0 (This is an average... 6.0 + 7.0 + 2.0 / 3)
2011/01 12.0
2011/02 5.0
2011/03 4.0
7.0 (This is an average... 12.0 + 5.0 + 4.0 / 3)
12.0 (We want this to be a total of 5.0 + 7.0)
So we want the "grand total" line to be 12.0 which is the sum, but it currently comes out as an average.
Therefore we're looking to average at the sub total level, but we want a total of the subtotal levels at the grand total level for the same column.
Thanks,
DenisRefer to the suggestion given by Naimesh here Can we modify a sub-total in ALV making use of function GET_GLOBALS_FROM_SLVC_FULLSCR and the method GET_SUBTOTALS. You can see the parameter ep_collect01 refered in case of subtotals. Can you please check ep_collect00 for grand total in your case.
As said about EP_COLLECT00,here goes a classic example Modify grand total in ALV GRID
BR
Keshav
Edited by: Keshav.T on Sep 21, 2011 9:39 AM -
Total for a Numeric field in ALV Grid display
Hi all,
I am not getting the Total for a Numeric field in ALV Grid output. What might be the problem.
Regards,
Balavardhan.KCheck this code for subtotals and totals..
REPORT ZYFI_REPT007
NO STANDARD PAGE HEADING
LINE-SIZE 300
LINE-COUNT 50
MESSAGE-ID ZYFI.
TABLES : COOI, " Commitments Management: Line Items
LFA1, " Vendor master (general section)
VBEP,
RKPLN.
TABLE TYPES AND INTERNAL TABLES *
DATA : BEGIN OF TYP_COOI ,
OBJNR LIKE COOI-OBJNR,
SAKTO LIKE COOI-SAKTO,
MEGBTR LIKE COOI-MEGBTR,
MEINH LIKE COOI-MEINH,
WKGBTR LIKE COOI-WKGBTR,
REFBN LIKE COOI-REFBN,
RFPOS LIKE COOI-RFPOS,
SGTXT LIKE COOI-SGTXT,
BUDAT LIKE COOI-BUDAT,
LIFNR LIKE COOI-LIFNR,
END OF TYP_COOI.
DATA : BEGIN OF TYP_LFA1 ,
LIFNR LIKE LFA1-LIFNR,
NAME1 LIKE LFA1-NAME1,
END OF TYP_LFA1.
DATA : BEGIN OF IT_OUTTAB OCCURS 0,
OBJNR LIKE COOI-OBJNR,
SAKTO LIKE COOI-SAKTO,
MEGBTR LIKE COOI-MEGBTR,
MEINH LIKE COOI-MEINH,
WKGBTR LIKE COOI-WKGBTR,
REFBN LIKE COOI-REFBN,
RFPOS LIKE COOI-RFPOS,
SGTXT LIKE COOI-SGTXT,
BUDAT LIKE COOI-BUDAT,
LIFNR LIKE COOI-LIFNR,
NAME1 LIKE LFA1-NAME1,
END OF IT_OUTTAB.
DATA : IT_COOI LIKE TYP_COOI OCCURS 0 WITH HEADER LINE,
IT_LFA1 LIKE TYP_LFA1 OCCURS 0 WITH HEADER LINE.
*-- ALV Declarations
TYPE-POOLS SLIS.
DATA: IT_EVENTS TYPE SLIS_T_EVENT,
GS_EVENT TYPE SLIS_ALV_EVENT,
wa_fldcat type slis_fieldcat_alv.
DATA: S_LAYOUT TYPE SLIS_LAYOUT_ALV,
GT_PRINT TYPE SLIS_PRINT_ALV.
DATA: IT_FLDCAT TYPE SLIS_T_FIELDCAT_ALV.
DATA: IT_SORT TYPE SLIS_T_SORTINFO_ALV.
DATA: V_REPID LIKE SY-REPID.
SELECTION SCREEN *
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS : S_KOKRS FOR COOI-KOKRS NO-EXTENSION NO INTERVALS,
" Controlling Area
S_BUKRS FOR COOI-BUKRS NO-EXTENSION NO INTERVALS,
" Company code
S_GJAHR FOR COOI-GJAHR NO-EXTENSION NO INTERVALS,
" Fiscal Year
S_OBJNR FOR RKPLN-AUFNR MATCHCODE OBJECT ORDE,
" Internal order
S_SAKTO FOR COOI-SAKTO MATCHCODE OBJECT KART,
" Cost Element
S_BUDAT FOR COOI-BUDAT, " Debit Date
S_LIFNR FOR COOI-LIFNR. " Vendor
SELECTION-SCREEN END OF BLOCK B1.
S T A R T O F S E L E C T I O N *
START-OF-SELECTION.
*-- Read data
PERFORM GET_DATA.
E N D O F S E L E C T I O N *
END-OF-SELECTION.
*-- Process the data and prepare the output data
PERFORM CALCULATE_FINAL_INFO.
*--Display Report output
PERFORM DISPLAY_REPORT.
FORM CALCULATE_FINAL_INFO *
Process the data and prepare final internal table *
FORM CALCULATE_FINAL_INFO.
DATA : L_OBJNR LIKE COOI-OBJNR.
SORT IT_LFA1 BY LIFNR.
DELETE ADJACENT DUPLICATES FROM IT_LFA1 COMPARING LIFNR.
LOOP AT IT_COOI.
L_OBJNR = IT_COOI-OBJNR+2(20).
SHIFT L_OBJNR LEFT DELETING LEADING '0'.
IF L_OBJNR IN S_OBJNR.
READ TABLE IT_LFA1 WITH KEY LIFNR = IT_COOI-LIFNR.
IF SY-SUBRC EQ 0.
IT_OUTTAB-NAME1 = IT_LFA1-NAME1.
ENDIF.
MOVE-CORRESPONDING IT_COOI TO IT_OUTTAB.
CLEAR IT_OUTTAB-OBJNR.
IT_OUTTAB-OBJNR = L_OBJNR.
APPEND IT_OUTTAB.
CLEAR IT_OUTTAB.
CLEAR IT_LFA1.
CLEAR L_OBJNR.
ENDIF.
ENDLOOP.
ENDFORM.
*& Form GET_DATA
Fetch the Data from the table COOI and LFA1
FORM GET_DATA.
SELECT OBJNR
SAKTO
MEGBTR
MEINH
WKGBTR
REFBN
RFPOS
SGTXT
BUDAT
LIFNR
FROM COOI
INTO TABLE IT_COOI
WHERE BUDAT IN S_BUDAT
AND LIFNR IN S_LIFNR
AND KOKRS IN S_KOKRS
AND BUKRS IN S_BUKRS
AND GJAHR IN S_GJAHR
AND SAKTO IN S_SAKTO.
IF SY-SUBRC EQ 0 .
Get the Vendor name from LFA1
SELECT LIFNR
NAME1
FROM LFA1
INTO TABLE IT_LFA1
FOR ALL ENTRIES IN IT_COOI
WHERE LIFNR EQ IT_COOI-LIFNR.
ELSE.
MESSAGE I999 WITH TEXT-013.
ENDIF.
ENDFORM. " GET_DATA
*& Form DISPLAY_REPORT
Display the output
FORM DISPLAY_REPORT.
PERFORM BUILD_CATALOG.
PERFORM FRM_PREPARE_EVENT_LIST TABLES IT_EVENTS.
IF NOT IT_OUTTAB[] IS INITIAL.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = V_REPID
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
IT_FIELDCAT = IT_FLDCAT
IT_SORT = IT_SORT
IT_EVENTS = IT_EVENTS
TABLES
T_OUTTAB = IT_OUTTAB
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
ELSE.
MESSAGE I999 WITH TEXT-013.
ENDIF.
ENDFORM. " DISPLAY_REPORT
*& Form BUILD_CATALOG
Build the Field catalog for the ALV Report
FORM BUILD_CATALOG.
DATA: V_INDEX LIKE SY-TABIX.
V_REPID = SY-REPID.
DATA: LS_SORT TYPE SLIS_SORTINFO_ALV.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = V_REPID
I_INTERNAL_TABNAME = 'IT_OUTTAB'
I_INCLNAME = V_REPID
CHANGING
CT_FIELDCAT = IT_FLDCAT
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.
READ TABLE IT_FLDCAT WITH KEY FIELDNAME = 'WKGBTR'
TABNAME = 'IT_OUTTAB' INTO WA_FLDCAT.
IF SY-SUBRC EQ 0.
WA_FLDCAT-DO_SUM = 'X'.
MODIFY IT_FLDCAT FROM WA_FLDCAT INDEX SY-TABIX.
ENDIF.
READ TABLE IT_FLDCAT WITH KEY FIELDNAME = 'OBJNR'
TABNAME = 'IT_OUTTAB' INTO WA_FLDCAT.
IF SY-SUBRC EQ 0.
WA_FLDCAT-SELTEXT_L = 'Order'.
WA_FLDCAT-COL_POS = 1.
WA_FLDCAT-DDICTXT = 'L'.
MODIFY IT_FLDCAT FROM WA_FLDCAT INDEX SY-TABIX.
ENDIF.
LS_SORT-FIELDNAME = 'OBJNR'.
LS_SORT-SPOS = 1.
LS_SORT-UP = 'X'.
LS_SORT-SUBTOT = 'X'.
APPEND LS_SORT TO IT_SORT.
ENDFORM. " BUILD_CATALOG
*& Form FRM_PREPARE_EVENT_LIST
Build the Events
FORM FRM_PREPARE_EVENT_LIST TABLES IT_EVENTS TYPE SLIS_T_EVENT.
CLEAR GS_EVENT.
GS_EVENT-NAME = SLIS_EV_TOP_OF_PAGE.
GS_EVENT-FORM = 'TOP_OF_PAGE_REPORT'.
APPEND GS_EVENT TO IT_EVENTS.
ENDFORM. " FRM_PREPARE_EVENT_LIST
TOP OF PAGE
FORM TOP_OF_PAGE_REPORT.
CALL FUNCTION 'Z_YREPORT_HEADER'
EXPORTING
DL_TITLE = SY-TITLE
DL_REPID = SY-CPROG
DL_LINSZ = SY-LINSZ
EXCEPTIONS
OTHERS = 1.
ENDFORM. " FRM_TOP_OF_PAGE_REPORT
*& Form USER_COMMAND
Drill Down Functionality to Call the Transaction ME23
FORM USER_COMMAND USING P_UCOMM LIKE SY-UCOMM
P_SELFIELD TYPE SLIS_SELFIELD.
DATA : L_INDEX LIKE SY-INDEX,
L_REFBN LIKE COOI-REFBN.
L_INDEX = P_SELFIELD-TABINDEX. " holds the selected table index
CLEAR L_REFBN.
CASE P_UCOMM.
*-- On Double Click
WHEN '&IC1'.
CLEAR L_REFBN.
*-- Read the Current Line
READ TABLE IT_OUTTAB INDEX L_INDEX.
IF SY-SUBRC EQ 0.
L_REFBN = IT_OUTTAB-REFBN.
IF NOT L_REFBN IS INITIAL.
*-- Set the BES Paramater Id to the Current line Purchase Order Number
SET PARAMETER ID 'BES' FIELD L_REFBN.
*-- Call the Transaction Purchase Order Display with the above PO Number
CALL TRANSACTION 'ME23' AND SKIP FIRST SCREEN.
ENDIF.
ELSE.
MESSAGE E999 WITH TEXT-014.
ENDIF.
ENDCASE.
ENDFORM. " USER_COMMAND -
Grand Total Text is not printing in ALV
Hi all,
I am not able to print Grand Total text in my report
I am not doing subtotal, i am using only grand totals.
So i have used in the following way
WA_FIELDCAT-DO_SUM = GC_X.
GS_LAYOUT-TOTALS_ONLY = GC_X.
GS_LAYOUT-TOTALS_TEXT = 'Totals'(049).
i am using using ALV GRID DISPLAY FM...its displaying the total amount, buts text is missing...
Can any one tell me what else i have to pass in the layout or fieldcatlog or FMHi AMR,
If you use REUSE_ALV_GRID_DISPLAY function module, i think Total text does not come .but if u use REUSE_ALV_LIST_DISPLAY function module Total text comes .
Check this sample program it let u know ..
"Types
TYPES:
BEGIN OF t_pa0008,
pernr TYPE pa0008-pernr,
lga01 TYPE pa0008-lga01,
bet01 TYPE pa0008-bet01,
END OF t_pa0008.
"Work areas
DATA:
w_pa0008 TYPE t_pa0008.
"Internal tables
DATA:
i_pa0008 TYPE STANDARD TABLE OF t_pa0008.
PARAMETERS:
list TYPE c RADIOBUTTON GROUP gr1,
grid TYPE c RADIOBUTTON GROUP gr1.
" ALV Declarations
" Types Pools
TYPE-POOLS:
slis.
" Types
TYPES:
t_fieldcat TYPE slis_fieldcat_alv,
t_events TYPE slis_alv_event,
t_layout TYPE slis_layout_alv,
t_sort TYPE slis_sortinfo_alv,
t_keyinfo TYPE slis_keyinfo_alv.
" Workareas
DATA:
w_fieldcat TYPE t_fieldcat,
w_events TYPE t_events,
w_sort TYPE t_sort,
w_layout TYPE t_layout,
w_keyinfo TYPE t_keyinfo.
" Internal Tables
DATA:
i_fieldcat TYPE STANDARD TABLE OF t_fieldcat,
i_events TYPE STANDARD TABLE OF t_events,
i_sort TYPE STANDARD TABLE OF t_sort.
START-OF-SELECTION.
PERFORM get_data.
END-OF-SELECTION.
PERFORM build_fieldcatalog. "Fieldcatalog
PERFORM build_events. "Events table
PERFORM buid_layout. "Layout structure.
PERFORM build_sort_tab. "To sort table and get subtotal
PERFORM display_data.
*& Form get_data
FORM get_data.
DATA:l_0008 TYPE pa0008 OCCURS 0 WITH HEADER LINE.
SELECT pernr lga01 bet01
FROM pa0008
INTO CORRESPONDING FIELDS OF l_0008
WHERE begda LE sy-datum
AND endda GE sy-datum.
w_pa0008-pernr = l_0008-pernr.
w_pa0008-lga01 = l_0008-lga01.
w_pa0008-bet01 = l_0008-bet01.
APPEND w_pa0008 TO i_pa0008.
CLEAR w_pa0008.
w_pa0008-pernr = l_0008-pernr.
w_pa0008-lga01 = l_0008-lga02.
w_pa0008-bet01 = l_0008-bet02.
APPEND w_pa0008 TO i_pa0008.
CLEAR w_pa0008.
w_pa0008-pernr = l_0008-pernr.
w_pa0008-lga01 = l_0008-lga03.
w_pa0008-bet01 = l_0008-bet03.
APPEND w_pa0008 TO i_pa0008.
CLEAR w_pa0008.
w_pa0008-pernr = l_0008-pernr.
w_pa0008-lga01 = l_0008-lga04.
w_pa0008-bet01 = l_0008-bet04.
APPEND w_pa0008 TO i_pa0008.
CLEAR w_pa0008.
ENDSELECT.
ENDFORM. "get_data
*& Form build_fieldcatalog
FORM build_fieldcatalog.
PERFORM build_fcat USING:
"Field Int.Table Text
'PERNR' 'I_PA0008' 'PERNR', "Remove this if u dont want in the item table as well as it is there in the header table
'LGA01' 'I_PA0008' 'LGA01',
'BET01' 'I_PA0008' 'BET01'.
ENDFORM. "build_fieldcatalog
*& Form build_events
* text
FORM build_events.
CLEAR:
w_events, i_events[].
w_events-name = 'TOP_OF_PAGE'.
w_events-form = 'TOP_OF_PAGE'.
APPEND w_events TO i_events.
CLEAR w_events.
ENDFORM. "build_events
*& Form display_data
* text
FORM display_data.
DATA:
l_program TYPE sy-repid VALUE sy-repid,
l_fm TYPE RS38L_FNAM.
IF list = 'X'.
l_fm = 'REUSE_ALV_LIST_DISPLAY'.
ELSEIF grid ='X'.
l_fm = 'REUSE_ALV_GRID_DISPLAY'.
ENDIF.
CALL FUNCTION l_fm
EXPORTING
i_callback_program = l_program
is_layout = w_layout
it_fieldcat = i_fieldcat
it_events = i_events
it_sort = i_sort
TABLES
t_outtab = i_pa0008.
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_data
*& Form build_fcat
FORM build_fcat USING l_field l_tab l_text.
w_fieldcat-fieldname = l_field.
w_fieldcat-tabname = l_tab.
w_fieldcat-seltext_m = l_text.
IF l_field = 'BET01'.
w_fieldcat-do_sum = 'X'.
ENDIF.
APPEND w_fieldcat TO i_fieldcat.
CLEAR w_fieldcat.
ENDFORM. " build_fcat
*& Form top_of_page
* text
FORM top_of_page.
DATA :
i_header TYPE slis_t_listheader,
w_header LIKE LINE OF i_header.
DATA:l_date1 TYPE datum,
l_date2 TYPE datum.
w_header-typ = 'S'.
w_header-info = sy-title.
APPEND w_header TO i_header.
CLEAR w_header.
w_header-typ = 'H'.
w_header-info = sy-repid.
APPEND w_header TO i_header.
CLEAR w_header.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = i_header
i_logo = 'ENJOYSAP_LOGO'.
ENDFORM. "top_of_page
*& Form BUILD_sort_tab
FORM build_sort_tab .
CLEAR :i_sort[],w_sort.
w_sort-spos = 1.
w_sort-fieldname = 'PERNR'.
w_sort-tabname = 'I_PA0008'. "header table
w_sort-up = 'X'.
w_sort-subtot = 'X'.
APPEND w_sort TO i_sort.
CLEAR w_sort.
ENDFORM. " BUILD_sort_tab
*& Form buid_layout
FORM buid_layout .
w_layout-totals_text = 'Total'.
w_layout-subtotals_text = 'S.Total'.
ENDFORM. " buid_layout
Regards,
Venkat.O -
Need to add Header and footer in an alv grid display output.
How can I add header and footer in an alv grid dispay output.
For the grid display, I am using the function module "REUSE_ALV_GRID_DISPLAY".HI,
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = gd_repid
i_callback_top_of_page = 'TOP-OF-PAGE'
i_callback_html_end_of_list = 'END_OF_LIST_HTML'
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
i_save = 'X'
tables
t_outtab = it_ekko
exceptions
program_error = 1
others = 2.
FORM end_of_list_html USING end TYPE REF TO cl_dd_document.
DATA: ls_text TYPE sdydo_text_element,
l_grid TYPE REF TO cl_gui_alv_grid,
f(14) TYPE c VALUE 'SET_ROW_HEIGHT'.
ls_text = 'Footer title'.
adds and icon (red triangle)
CALL METHOD end->add_icon
EXPORTING
sap_icon = 'IL'.
adds test (via variable)
CALL METHOD end->add_text
EXPORTING
text = ls_text
sap_emphasis = 'strong'.
adds new line (start new line)
CALL METHOD end->new_line.
display text(bold)
CALL METHOD end->add_text
EXPORTING
text = 'Bold text'
sap_emphasis = 'strong'.
adds new line (start new line)
CALL METHOD end->new_line.
display text(normal)
CALL METHOD end->add_text
EXPORTING
text = 'Nor'.
adds new line (start new line)
CALL METHOD end->new_line.
display text(bold)
CALL METHOD end->add_text
EXPORTING
text = 'Yellow '
sap_emphasis = 'str'.
adds and icon (yellow triangle)
CALL METHOD end->add_icon
EXPORTING
sap_icon = 'IC''.
display text(normal)
CALL METHOD end->add_text
EXPORTING
text = 'Mor'.
*set height of this section
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = l_grid.
CALL METHOD l_grid->parent->parent->(f)
EXPORTING
id = 3
height = 14.
ENDFORM. "end_of_list_html.
This will solve it. Post if you need more help in this.
Regards,
Madhu. -
How can we sort up currency field in alv grid??
Hi GUrus,
Can any one suggest me how to sort the currency field in alv grid...Please help me out of this issue..
Thanks in advance!!!
regards,
Kranthi.hii,
SAP provides a set of ALV (ABAP List Viewer) & function modules, which can be used to enhance the readability and functionality of any report output.
ALV is a flexible tool used for displaying lists.The tool provides common list functions & can be enhanced by self-defined options.
so u will get the option for sorting in your alv report.
Thanks -
Pack and Integer type in ALV grid
Hello,
Can anyone give a small example of how to display fields of type I and P in an ALV grid. Using the alv grid FM and manually filling the fieldcatalog.
Thanks for your help.Hi Moussa Khelifi ,
u can manually fill fieldcatalog like this..
form manual_filling_fieldcatalog.
X_FIELDCAT-FIELDNAME = 'ATWRT'.
X_FIELDCAT-TABNAME = 'TB_FINAL'.
X_FIELDCAT-SELTEXT_L = 'Source of Supply'(001).
X_FIELDCAT-DDICTXT = L_DDICTXT.
X_FIELDCAT-FIELDNAME = 'MATNR'.
X_FIELDCAT-TABNAME = 'TB_FINAL'.
X_FIELDCAT-SELTEXT_L = 'MATERIAL'(002).
X_FIELDCAT-DDICTXT = L_DDICTXT.
APPEND X_FIELDCAT TO TB_FIELDCAT .
endform.
u can directly pass the table to 'REUSE_ALV_GRID_DISPLAY'
regardless of type p or i fields in it.
Regards,
kiran B -
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. -
Change the total and subtotal dynamically in ALV GRID
Hi guys,
I need to change the total and subtotal of field "AMOUNT" dynamically.I am using ALV GRID CONTROL(oops concept).I need to override the standard functionality.I need to show my own subtotal and total line instead of standard one .Hi
I've understood it, I wanted to use OO Grid too, but I had to use the ALV list in order to write my total.
If you need to use OO grid u can try to exclude all funcitonalities for the total, subtotal and sorting and insert in the output table the lines with your totals.
Max -
Text view with price and currency sign
Hello,
I have a textview in an table showing the netprice. The datatype is CURR. I would like to show the currency sign in the same textview, e.g. 1,87. Is this possible and how?
regards
stefanHi Stefan,
Declare another attribute in your table (say final_price) of type string. For all the elements in your node, concatenate the price and currency and fill in the values for final_price. Now, let your text view display final_price.
For example, this is how your data should look in the node
price-curr-final_price
100-------100
24--------24
Hope this helps.
Regards,
Neha -
Display totals on the first line in ALV grid and ALV LIST
Generally we wll display totals at the end..
bu the requirement is to display it in the first line of the column.
how to display the totals in the first line?
I have used ALV GRID and ALV LIST (choice) using function modules.
Plz help me
.for example : Po qty : Should display total po qty on the first line of the Po line item.IN LAYOUT
ILAYOUT-totals_before_items = 'X'.
REGARDS
SHIBA DUTTA -
HOW TO PRINT LONG TEXT OF 255 CHARACTER IN ALV GRID instead of132 Char's
Hi sir/mam
i'm sreekar can any one help me on this please
"As I took a variable 'STR' with 255 length, But still ALV GRID DISPLAYS the same 132 characters, and
When I download the report into excel it is showing the 250 charactered text"
how can i print it in alv grid
FORM BUID_CATALOG .
DATA : COL_POS TYPE I.
COL_POS = COL_POS + 1.
*--DECLARING FIELDCATALOG FOR HEADER
LT_FCAT-COL_POS = COL_POS.
LT_FCAT-FIELDNAME = 'EBELN'.
LT_FCAT-TABNAME = 'LT_FINAL'.
LT_FCAT-SELTEXT_L = 'Purch.doc.no.'(002).
LT_FCAT-REF_FIELDNAME = 'EBELN'.
LT_FCAT-REF_TABNAME = 'EKKO'.
APPEND LT_FCAT.
CLEAR LT_FCAT.
LT_FCAT-COL_POS = COL_POS.
LT_FCAT-FIELDNAME = 'BEDAT'.
LT_FCAT-TABNAME = 'LT_FINAL'.
LT_FCAT-SELTEXT_L = 'Po Date'(003).
LT_FCAT-REF_FIELDNAME = 'EBDAT'.
LT_FCAT-EDIT_MASK = '__.__.____'.
APPEND LT_FCAT.
CLEAR LT_FCAT.
LT_FCAT-COL_POS = COL_POS.
LT_FCAT-FIELDNAME = 'EKGRP'.
LT_FCAT-TABNAME = 'LT_FINAL'.
LT_FCAT-SELTEXT_L = 'Purch.Grp'(004).
LT_FCAT-REF_FIELDNAME = 'BKGRP'.
APPEND LT_FCAT.
CLEAR LT_FCAT.
LT_FCAT-COL_POS = COL_POS.
LT_FCAT-FIELDNAME = 'EKNAM'.
LT_FCAT-TABNAME = 'LT_FINAL'.
LT_FCAT-SELTEXT_L = 'Purch.Grp. Name'(005).
LT_FCAT-REF_FIELDNAME = 'EKNAM'.
APPEND LT_FCAT.
CLEAR LT_FCAT.
LT_FCAT-COL_POS = COL_POS.
LT_FCAT-FIELDNAME = 'LIFNR'.
LT_FCAT-TABNAME = 'LT_FINAL'.
LT_FCAT-SELTEXT_L = 'Vendor No.'(006).
LT_FCAT-REF_FIELDNAME = 'ELIFN'.
APPEND LT_FCAT.
CLEAR LT_FCAT.
LT_FCAT-COL_POS = COL_POS.
LT_FCAT-FIELDNAME = 'NAME1'.
LT_FCAT-TABNAME = 'LT_FINAL'.
LT_FCAT-SELTEXT_L = 'Vendor Name'(007).
LT_FCAT-REF_FIELDNAME = 'NAME1_GP'.
APPEND LT_FCAT.
CLEAR LT_FCAT.
LT_FCAT-COL_POS = COL_POS.
LT_FCAT-FIELDNAME = 'ZTERM'.
LT_FCAT-TABNAME = 'LT_FINAL'.
LT_FCAT-SELTEXT_L = 'Pay.Code'(008).
LT_FCAT-REF_FIELDNAME = 'ZTERM'.
APPEND LT_FCAT.
CLEAR LT_FCAT.
LT_FCAT-COL_POS = COL_POS.
LT_FCAT-FIELDNAME = 'TEXT1'.
LT_FCAT-TABNAME = 'LT_FINAL'.
LT_FCAT-SELTEXT_L = 'Own explanation'(009).
LT_FCAT-REF_FIELDNAME = 'DZTERM'.
LT_FCAT-OUTPUTLEN = '30'.
LT_FCAT-DDICTXT = 'L'.
APPEND LT_FCAT.
CLEAR LT_FCAT.
LT_FCAT-COL_POS = COL_POS.
LT_FCAT-FIELDNAME = 'WAERS'.
LT_FCAT-TABNAME = 'LT_FINAL'.
LT_FCAT-SELTEXT_L = 'Curr'(010).
LT_FCAT-REF_FIELDNAME = 'WAERS'.
APPEND LT_FCAT.
CLEAR LT_FCAT.
LT_FCAT-COL_POS = COL_POS.
LT_FCAT-FIELDNAME = 'NETWR'.
LT_FCAT-TABNAME = 'LT_FINAL'.
LT_FCAT-SELTEXT_L = 'Net Value'(011).
LT_FCAT-REF_FIELDNAME = 'BWERT'.
APPEND LT_FCAT.
CLEAR LT_FCAT.
ENDFORM. " BUID_CATALOG
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_BUFFER_ACTIVE = 'X'
I_BACKGROUND_ID = 'ALV_BACKGROUND'
IS_LAYOUT = GS_LAYOUT
IT_FIELDCAT = LT_FCAT[]
I_SAVE = G_SAVE
IS_VARIANT = GS_VARIANT
IMPORTING
E_EXIT_CAUSED_BY_CALLER = G_EXIT_CAUSED_BY_CALLER
ES_EXIT_CAUSED_BY_USER = GS_EXIT_CAUSED_BY_USER
TABLES
T_OUTTAB = LT_FINAL[]
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
IF SY-SUBRC = 0.
IF G_EXIT_CAUSED_BY_CALLER = 'X'.
ELSE.
IF GS_EXIT_CAUSED_BY_USER-BACK = 'X'. "F3
EXIT.
ELSE.
IF GS_EXIT_CAUSED_BY_USER-EXIT = 'X'. "F15
LEAVE TO SCREEN 1000.
ELSE.
IF GS_EXIT_CAUSED_BY_USER-CANCEL = 'X'. "F12
LEAVE TO SCREEN 1000.
ELSE.
EXIT.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ELSE.
ENDIF.
ENDFORM. " DISPLAY_DATA
CALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = SY-MANDT
ID = 'F15' "ls_thead-tdid PAYMENT TERMS
LANGUAGE = SY-LANGU "ls_thead-tdspras "CURRENT LANGUAGE 'E'
NAME = NAME "ls_thead-tdname PO NUMBER LW_EKKO-EBELN
OBJECT = 'EKKO' "ls_thead-tdobject TABLE NAME EKKO
IMPORTING
HEADER = HTEXT
TABLES
LINES = LTEXT
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
NOT_FOUND = 4
OBJECT = 5
REFERENCE_CHECK = 6
WRONG_ACCESS_TO_ARCHIVE = 7
OTHERS = 8.
IF SY-SUBRC = 0.
LOOP AT LTEXT.
IF LTEXT-TDLINE NE ''.
MOVE LTEXT-TDLINE TO WA_WORD-TEXT.
APPEND WA_WORD TO LT_SENTENCE.
ENDIF.
ENDLOOP.
ENDIF.
LOOP AT LT_SENTENCE INTO WA_WORD.
COUNT = COUNT + 1.
IF COUNT = 1.
STR = WA_WORD-TEXT.
LW_FINAL-TEXT1 = STR.
ELSEIF COUNT = 2 OR COUNT = 3 OR COUNT = 4 OR COUNT = 5 OR COUNT = 6 OR COUNT = 7 OR COUNT = 8.
CONCATENATE STR WA_WORD-TEXT INTO STR SEPARATED BY SPACE.
LW_FINAL-TEXT1 = STR.
ENDIF.
ENDLOOP.can you provide an example of how to wrap the text i have like this please see the below code and correct if any errors
FORM GET_TEXT_LINES .
DATA :NAME TYPE THEAD-TDNAME.
NAME = LW_EKKO-EBELN.
V_TABIX = SY-TABIX.
CALLING FUNCTION READ_TEXT FOR PAYMENT TEXTS
CALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = SY-MANDT "CLIENT ID 200/600/400
ID = 'F15' "ls_thead-tdid "PAYMENT TERMS TEXT ID 'F15'
LANGUAGE = SY-LANGU "ls_thead-tdspras "CURRENT LANGUAGE 'E'
NAME = NAME "ls_thead-tdname "PO NUMBER LW_EKKO-EBELN
OBJECT = 'EKKO' "ls_thead-tdobject "TABLE NAME EKKO
IMPORTING
HEADER = HTEXT "LS_THEAD
TABLES
LINES = LTEXT "LT_LINES[]
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
NOT_FOUND = 4
OBJECT = 5
REFERENCE_CHECK = 6
WRONG_ACCESS_TO_ARCHIVE = 7
OTHERS = 8.
IF SY-SUBRC = 0.
LOOP AT LTEXT.
IF LTEXT-TDLINE NE ''.
MOVE LTEXT-TDLINE TO WA_WORD-TEXT.
APPEND WA_WORD TO LT_SENTENCE.
ENDIF.
ENDLOOP.
ENDIF.
Word Wrap the text in multiple lines
LOOP AT LT_SENTENCE INTO WA_WORD.
CALL FUNCTION 'RKD_WORD_WRAP'
EXPORTING
TEXTLINE = WA_WORD-TEXT
OUTPUTLEN = 100
TABLES
OUT_LINES = LT_SENTENCE
EXCEPTIONS
OUTPUTLEN_TOO_LARGE = 1
OTHERS = 2.
IF SY-SUBRC EQ 0.
IF not LT_SENTENCE IS INITIAL.
READ TABLE LT_SENTENCE INTO WA_WORD INDEX v_tabix.
LW_FINAL-TEXT1 = WA_WORD_TEXT.
MODIFY LT_FINAL FROM LW_FINAL INDEX V_TABIX.
ENDLOOP.
CLEAR: LT_SENTENCE.
ENDFORM. " GET_TEXT_LINES
*& Form LAYOUT_INIT
text
-->P_GS_LAYOUT text
FORM LAYOUT_INIT USING RS_LAYOUT TYPE SLIS_LAYOUT_ALV.
*"Build layout for list display
RS_LAYOUT-DETAIL_POPUP = 'X'.
ENDFORM. " LAYOUT_INIT
*& Form EVENTTAB_BUILD
text
-->P_GT_EVENTS[] text
FORM EVENTTAB_BUILD USING RT_EVENTS TYPE SLIS_T_EVENT.
*"Registration of events to happen during list display
DATA: LS_EVENT TYPE SLIS_ALV_EVENT.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = RT_EVENTS.
READ TABLE RT_EVENTS WITH KEY NAME = SLIS_EV_AFTER_LINE_OUTPUT
INTO LS_EVENT.
IF SY-SUBRC = 0.
APPEND LS_EVENT TO RT_EVENTS.
ENDIF.
ENDFORM. " EVENTTAB_BUILD
*& Form AFTER_LINE_OUTPUT
text
--> p1 text
<-- p2 text
FORM AFTER_LINE_OUTPUT.
CLEAR :COUNT,LT_SENTENCE.
LOOP AT LT_SENTENCE INTO WA_WORD.
READ TABLE LT_SENTENCE INTO WA_WORD INDEX V_TABIX.
CHECK SY-SUBRC = 0.
CALL FUNCTION 'RKD_WORD_WRAP'
EXPORTING
TEXTLINE = WA_WORD-TEXT
OUTPUTLEN = 20
TABLES
OUT_LINES = LT_SENTENCE.
DESCRIBE TABLE LT_SENTENCE LINES V_TABIX.
CHECK V_TABIX > 1.
COUNT = COUNT + 1.
IF COUNT = 1.
STR = WA_WORD-TEXT.
LW_FINAL-TEXT1 = STR.
ELSEIF COUNT = 2 OR COUNT = 3 OR COUNT = 4 OR COUNT = 5 OR COUNT = 6 OR COUNT = 7 OR COUNT = 8.
CONCATENATE STR WA_WORD-TEXT INTO STR SEPARATED BY SPACE.
LW_FINAL-TEXT1 = STR.
ENDIF.
ENDLOOP.
ENDFORM. " AFTER_LINE_OUTPUT -
Regarding subtotals and new page in ALV Grid
Hi All,
I have 5 employees in my internal table and each employee having five records.
Now iam displaying total employees in ALV grid and calculating their totals at the end of the hole records.
But i need to display the sub totals for each employee and i need new page for each employee.
means 1) New page for each employye
2) sub totals for each employee
3) grand total for all employees
How can i proceed for this requirement in ALV grid?For subtotals first you need to set the do_sum = 'X' in the fieldcatalog for the columns you want totals.
fieldcat-fieldname = 'ABC'.
fieldcat-do_sum = 'X'.
Append fieldcat to it_fieldcat,
for subtotals you need to populate the SORT table.
sort-fieldname = 'EMPLOYEE'.
sort-up = 'X'.
sort-group = '*'. "<----- this is for new page
"you can view new page in preview / print /
"if you are using the list function
sort-subtot = 'X'.
append sort to it_sort.
pass this it_sort to it_sort of the alv function. -
How to create command button called 'Remarks' and Check box in ALV GRID?
Hi, Experts,
Requirement is: in the ALVE GRID report output, user select a record by clicking the check box and pressing the button 'Remarks' it will take me into other transaction from the output list.
Please help me out.
Reward points.
SekharHi Chandra Shekar,
Check the following sample program. 2 things to remember.
1. Check the callback subroutine PF_STATUS_SET and create PF status for the program.and also ur REMARKS button in the application tool. Comments are made every where wherever those are needed. After creating Pf status execute the report.
2.Once you select records by selecting checkboxes, u have to press on Refresh button( that is there on application toolbar), then only for selected records, CHECK field in the internal is updated. After that press on REMARKS button .
REPORT zvenkat_alv_grid.
TABLES:t001.
"Types
TYPES:
BEGIN OF t_1001,
check TYPE c,
bukrs TYPE t001-bukrs,
butxt TYPE t001-butxt,
ort01 TYPE t001-ort01,
land1 TYPE t001-land1,
END OF t_1001.
"Work area
DATA:
w_t001 TYPE t_1001.
"Internal table
DATA:
i_t001 TYPE STANDARD TABLE OF t_1001.
" ALV Declarations
* Types Pools
TYPE-POOLS:
slis.
* Types
TYPES:
t_fieldcat TYPE slis_fieldcat_alv,
t_events TYPE slis_alv_event,
t_layout TYPE slis_layout_alv.
* Workareas
DATA:
w_fieldcat TYPE t_fieldcat,
w_events TYPE t_events,
w_layout TYPE t_layout.
* Internal Tables
DATA:
i_fieldcat TYPE STANDARD TABLE OF t_fieldcat,
i_events TYPE STANDARD TABLE OF t_events.
*& start of selection
START-OF-SELECTION.
PERFORM get_data.
*& end-of-selection.
END-OF-SELECTION.
PERFORM build_fieldcatlog.
PERFORM build_events.
PERFORM build_layout.
PERFORM list_display.
*& Form get_data
FORM get_data .
SELECT bukrs
butxt
ort01
land1
FROM t001
INTO CORRESPONDING FIELDS OF TABLE i_t001
UP TO 30 ROWS.
ENDFORM. " get_data
*& Form build_fieldcatlog
FORM build_fieldcatlog .
CLEAR:w_fieldcat,i_fieldcat[].
PERFORM build_fcatalog USING:
'CHECK' 'I_T001' ' ',
'BUKRS' 'I_T001' 'BUKRS',
'BUTXT' 'I_T001' 'BUTXT',
'ORT01' 'I_T001' 'ORT01',
'LAND1' 'I_T001' 'LAND1'.
ENDFORM. "BUILD_FIELDCATLOG
*& Form BUILD_FCATALOG
FORM build_fcatalog USING l_field l_tab l_text.
w_fieldcat-fieldname = l_field.
w_fieldcat-tabname = l_tab.
w_fieldcat-seltext_m = l_text.
IF l_field = 'CHECK'..
w_fieldcat-checkbox = 'X'.
w_fieldcat-edit = 'X'.
ENDIF.
APPEND w_fieldcat TO i_fieldcat.
CLEAR w_fieldcat.
ENDFORM. " build_fieldcatlog
*& Form build_events
* text
FORM build_events.
CLEAR :
w_events, i_events[].
w_events-name = 'TOP_OF_PAGE'."Event Name
w_events-form = 'TOP_OF_PAGE'."Callback event subroutine
APPEND w_events TO i_events.
CLEAR w_events.
w_events-name = 'USER_COMMAND' .
w_events-form = 'USER_COMMAND' .
APPEND w_events TO i_events.
CLEAR w_events.
w_events-name = 'PF_STATUS_SET' .
w_events-form = 'PF_STATUS_SET' .
APPEND w_events TO i_events.
CLEAR w_events.
ENDFORM. "build_events
*& Form build_layout
FORM build_layout .
w_layout-colwidth_optimize = 'X'.
w_layout-zebra = 'X'.
ENDFORM. " build_layout
*& Form list_display
FORM list_display .
DATA:
l_program TYPE sy-repid.
l_program = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = l_program
is_layout = w_layout
it_fieldcat = i_fieldcat
it_events = i_events
TABLES
t_outtab = i_t001
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. " list_display
*& Form top_of_page
FORM top_of_page.
DATA :
li_header TYPE slis_t_listheader,
w_header LIKE LINE OF li_header.
DATA:
l_date TYPE char10.
WRITE sy-datum TO l_date.
w_header-typ = 'H'.
CONCATENATE sy-repid ':' 'From Date' l_date INTO w_header-info SEPARATED BY space.
APPEND w_header TO li_header.
CLEAR w_header.
w_header-typ = 'S'.
w_header-info = sy-title.
APPEND w_header TO li_header.
CLEAR w_header.
w_header-typ = 'A'.
w_header-info = sy-uname.
APPEND w_header TO li_header.
CLEAR w_header.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = li_header.
ENDFORM. "top_of_page
*& Form pf_status_set
FORM pf_status_set USING extab TYPE slis_t_extab.
"Procedure to set own pf-status.
"1.Goto Transaction code SE41
"2.give program = SAPLKKBL and status = STANDARD_FULLSCREEN.
"3.Click on Application toolbar STATUS button
"4.Give ur program name Status name that is to be used in the program using SET pf-status statement
"5.Create ur button REMARKS.
SET PF-STATUS 'STATUS1' EXCLUDING extab.
ENDFORM. "pf_status_set
*& Form user_command
FORM user_command USING ucomm LIKE sy-ucomm
selfield TYPE slis_selfield.
CASE ucomm .
WHEN 'REMARKS'."When u click on remarks button.
LOOP AT i_t001 INTO w_t001 WHERE check = 'X'.
WRITE :/ w_t001-bukrs, 'Checked'.
ENDLOOP.
ENDCASE.
ENDFORM. "user_command
I hope that it helps u .
Regards,
Venkat.O
Maybe you are looking for
-
All of the sudden my computer is running slow
I ran Etre here are my results Hardware Information: iMac (24-inch, Early 2009) iMac - model: iMac9,1 1 2.66 GHz Intel Core 2 Duo CPU: 2 cores 4 GB RAM Video Information: NVIDIA GeForce 9400 - VRAM: 256 MB System Software: Mac
-
How do I get google on my Ipad
I have just brought an apple air 2 Ipad and learning quickly but I need to get the google icon on the screen can anyone tell me the best way? Ta
-
Senior Members Please Help :(
Recenly bought r9 290 card not detecting in Device manger - First of all here are my specifications : Motherboard :MSI Z68AGD80 (b3) Processor : I5 2500k 8GB Ram Gskill 5tb HDD +1 SSD 256 GB PSU : corsair TX 750 I even flashed the motherboard bios wi
-
Anyone install this yet? If so, what are your thoughts on it. http://www.sun.com/download/index.jsp?cat=Systems%20Administration&tab=3&subcat=Systems%20Management
-
This just started. I have to pretend to reply to the messages to get them to display!