Field Description and Total in ALV
Hi Guys,
I have a certain field in my itab that I declared like field dmbtr, I want that field to be summed up in alv so I had to put dmbtr as its reference field when I defined the field catalog for it. However, it now displays the description of dmbtr rather than my own description.
How do I go about this?
Thanks.
Kenny
Hello Kenny
The following fields in the fieldcatalog (LVC_S_FCAT) can be used to modify descriptive texts of the column:
REPTEXT
COLTEXT
SCRTEXT_L
SCRTEXT_M
SCRTEXT_S
COLDDICTXT
SELDDICTXT
TIPDDICTXT
Try to change these field values for your column and see if it has the appropriate effect when the field is summed up.
Regards
Uwe
Similar Messages
-
Do not include some lines in Subtotals and totals in ALV
Hello All,
I am printing a report with all sale order details and Quantities( delveered ,conformed etc..) iam doing subtotals based on the material and Plant.
In this if the document date is less than the SY-DATUM, we should not include the quantity into the subtotals and totals, Only the orders wiht doc date GQ to Sy-datum then display them..
As of now I am using ALV grid display and doing the sums by
l_wa_fcat-do_sum = c_x. (field catalog) for the whole colom) but i want to avoid sum row from tehe calculation based on the condition.
<b>Do we have any way to achive this, like if we want to have separate color for a purticular Cell then we add an extra field in outout table and we link this field with layout-coltab_fieldname in the same way or any other way if we have</b>.
I will be thankfull to if you can provide me your valuable suggesstions on this. it is very urgent. I am trying in all the ways from my side.Hi,
see this code,
Complete code for the ALV grid example
This example shows and ALV grid with flights. After selecting a line a change button can be pushed to display a change screen. After the changes have been saved, the ALV grid screen is displayed again, and the grid is updated with the changes.
The example shows:
How to setup the ALV grid
How to ste focus to the grid
How to set the title of the grid
How to allow a user to save and reuse a grid layout (Variant)
How to customize the ALV grid toolbar
Refresh the grid
Set and get row selection and read line contents
Make and exception field (Traffic light)
Coloring a line
Steps:
Create screen 100 with the ALV grid. Remember to include an exit button
Add a change button to the ALV grid toolbar
Create screen 200 the Change screen
The screens:
The code:
REPORT sapmz_hf_alv_grid .
Type pool for icons - used in the toolbar
TYPE-POOLS: icon.
TABLES: zsflight.
To allow the declaration of o_event_receiver before the
lcl_event_receiver class is defined, decale it as deferred in the
start of the program
CLASS lcl_event_receiver DEFINITION DEFERRED.
G L O B A L I N T E R N A L T A B L E S
*DATA: gi_sflight TYPE STANDARD TABLE OF sflight.
To include a traffic light and/or color a line the structure of the
table must include fields for the traffic light and/or the color
TYPES: BEGIN OF st_sflight.
INCLUDE STRUCTURE zsflight.
Field for traffic light
TYPES: traffic_light TYPE c.
Field for line color
types: line_color(4) type c.
TYPES: END OF st_sflight.
TYPES: tt_sflight TYPE STANDARD TABLE OF st_sflight.
DATA: gi_sflight TYPE tt_sflight.
G L O B A L D A T A
DATA: ok_code LIKE sy-ucomm,
Work area for internal table
g_wa_sflight TYPE st_sflight,
ALV control: Layout structure
gs_layout TYPE lvc_s_layo.
Declare reference variables to the ALV grid and the container
DATA:
go_grid TYPE REF TO cl_gui_alv_grid,
go_custom_container TYPE REF TO cl_gui_custom_container,
o_event_receiver TYPE REF TO lcl_event_receiver.
DATA:
Work area for screen 200
g_screen200 LIKE zsflight.
Data for storing information about selected rows in the grid
DATA:
Internal table
gi_index_rows TYPE lvc_t_row,
Information about 1 row
g_selected_row LIKE lvc_s_row.
C L A S S E S
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
METHODS:
handle_toolbar FOR EVENT toolbar OF cl_gui_alv_grid
IMPORTING
e_object e_interactive,
handle_user_command FOR EVENT user_command OF cl_gui_alv_grid
IMPORTING e_ucomm.
ENDCLASS.
CLASS lcl_event_receiver IMPLEMENTATION
CLASS lcl_event_receiver IMPLEMENTATION.
METHOD handle_toolbar.
Event handler method for event toolbar.
CONSTANTS:
Constants for button type
c_button_normal TYPE i VALUE 0,
c_menu_and_default_button TYPE i VALUE 1,
c_menu TYPE i VALUE 2,
c_separator TYPE i VALUE 3,
c_radio_button TYPE i VALUE 4,
c_checkbox TYPE i VALUE 5,
c_menu_entry TYPE i VALUE 6.
DATA:
ls_toolbar TYPE stb_button.
Append seperator to the normal toolbar
CLEAR ls_toolbar.
MOVE c_separator TO ls_toolbar-butn_type..
APPEND ls_toolbar TO e_object->mt_toolbar.
Append a new button that to the toolbar. Use E_OBJECT of
event toolbar. E_OBJECT is of type CL_ALV_EVENT_TOOLBAR_SET.
This class has one attribute MT_TOOLBAR which is of table type
TTB_BUTTON. The structure is STB_BUTTON
CLEAR ls_toolbar.
MOVE 'CHANGE' TO ls_toolbar-function.
MOVE icon_change TO ls_toolbar-icon.
MOVE 'Change flight' TO ls_toolbar-quickinfo.
MOVE 'Change' TO ls_toolbar-text.
MOVE ' ' TO ls_toolbar-disabled.
APPEND ls_toolbar TO e_object->mt_toolbar.
ENDMETHOD.
METHOD handle_user_command.
Handle own functions defined in the toolbar
CASE e_ucomm.
WHEN 'CHANGE'.
PERFORM change_flight.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMETHOD.
ENDCLASS.
S T A R T - O F - S E L E C T I O N.
START-OF-SELECTION.
SET SCREEN '100'.
*& Module USER_COMMAND_0100 INPUT
MODULE user_command_0100 INPUT.
CASE ok_code.
WHEN 'EXIT'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Module STATUS_0100 OUTPUT
MODULE status_0100 OUTPUT.
DATA:
For parameter IS_VARIANT that is sued to set up options for storing
the grid layout as a variant in method set_table_for_first_display
l_layout TYPE disvariant,
Utillity field
l_lines TYPE i.
After returning from screen 200 the line that was selected before
going to screen 200, should be selected again. The table gi_index_rows
was the output table from the GET_SELECTED_ROWS method in form
CHANGE_FLIGHT
DESCRIBE TABLE gi_index_rows LINES l_lines.
IF l_lines > 0.
CALL METHOD go_grid->set_selected_rows
EXPORTING
it_index_rows = gi_index_rows.
CALL METHOD cl_gui_cfw=>flush.
REFRESH gi_index_rows.
ENDIF.
Read data and create objects
IF go_custom_container IS INITIAL.
Read data from datbase table
PERFORM get_data.
Create objects for container and ALV grid
CREATE OBJECT go_custom_container
EXPORTING container_name = 'ALV_CONTAINER'.
CREATE OBJECT go_grid
EXPORTING
i_parent = go_custom_container.
Create object for event_receiver class
and set handlers
CREATE OBJECT o_event_receiver.
SET HANDLER o_event_receiver->handle_user_command FOR go_grid.
SET HANDLER o_event_receiver->handle_toolbar FOR go_grid.
Layout (Variant) for ALV grid
l_layout-report = sy-repid. "Layout fo report
Setup the grid layout using a variable of structure lvc_s_layo
Set grid title
gs_layout-grid_title = 'Flights'.
Selection mode - Single row without buttons
(This is the default mode
gs_layout-sel_mode = 'B'.
Name of the exception field (Traffic light field) and the color
field + set the exception and color field of the table
gs_layout-excp_fname = 'TRAFFIC_LIGHT'.
gs_layout-info_fname = 'LINE_COLOR'.
LOOP AT gi_sflight INTO g_wa_sflight.
IF g_wa_sflight-paymentsum < 100000.
Value of traffic light field
g_wa_sflight-traffic_light = '1'.
Value of color field:
C = Color, 6=Color 1=Intesified on, 0: Inverse display off
g_wa_sflight-line_color = 'C610'.
ELSEIF g_wa_sflight-paymentsum => 100000 AND
g_wa_sflight-paymentsum < 1000000.
g_wa_sflight-traffic_light = '2'.
ELSE.
g_wa_sflight-traffic_light = '3'.
ENDIF.
MODIFY gi_sflight FROM g_wa_sflight.
ENDLOOP.
Grid setup for first display
CALL METHOD go_grid->set_table_for_first_display
EXPORTING i_structure_name = 'SFLIGHT'
is_variant = l_layout
i_save = 'A'
is_layout = gs_layout
CHANGING it_outtab = gi_sflight.
*-- End of grid setup -
Raise event toolbar to show the modified toolbar
CALL METHOD go_grid->set_toolbar_interactive.
Set focus to the grid. This is not necessary in this
example as there is only one control on the screen
CALL METHOD cl_gui_control=>set_focus EXPORTING control = go_grid.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0200 INPUT
MODULE user_command_0200 INPUT.
CASE ok_code.
WHEN 'EXIT200'.
LEAVE TO SCREEN 100.
WHEN'SAVE'.
PERFORM save_changes.
ENDCASE.
ENDMODULE. " USER_COMMAND_0200 INPUT
*& Form get_data
FORM get_data.
Read data from table SFLIGHT
SELECT *
FROM zsflight
INTO TABLE gi_sflight.
ENDFORM. " load_data_into_grid
*& Form change_flight
Reads the contents of the selected row in the grid, ans transfers
the data to screen 200, where it can be changed and saved.
FORM change_flight.
DATA:l_lines TYPE i.
REFRESH gi_index_rows.
CLEAR g_selected_row.
Read index of selected rows
CALL METHOD go_grid->get_selected_rows
IMPORTING
et_index_rows = gi_index_rows.
Check if any row are selected at all. If not
table gi_index_rows will be empty
DESCRIBE TABLE gi_index_rows LINES l_lines.
IF l_lines = 0.
CALL FUNCTION 'POPUP_TO_DISPLAY_TEXT'
EXPORTING
textline1 = 'You must choose a line'.
EXIT.
ENDIF.
Read indexes of selected rows. In this example only one
row can be selected as we are using gs_layout-sel_mode = 'B',
so it is only ncessary to read the first entry in
table gi_index_rows
LOOP AT gi_index_rows INTO g_selected_row.
IF sy-tabix = 1.
READ TABLE gi_sflight INDEX g_selected_row-index INTO g_wa_sflight.
ENDIF.
ENDLOOP.
Transfer data from the selected row to screenm 200 and show
screen 200
CLEAR g_screen200.
MOVE-CORRESPONDING g_wa_sflight TO g_screen200.
LEAVE TO SCREEN '200'.
ENDFORM. " change_flight
*& Form save_changes
Changes made in screen 200 are written to the datbase table
zsflight, and to the grid table gi_sflight, and the grid is
updated with method refresh_table_display to display the changes
FORM save_changes.
DATA: l_traffic_light TYPE c.
Update traffic light field
Update database table
MODIFY zsflight FROM g_screen200.
Update grid table , traffic light field and color field.
Note that it is necessary to use structure g_wa_sflight
for the update, as the screen structure does not have a
traffic light field
MOVE-CORRESPONDING g_screen200 TO g_wa_sflight.
IF g_wa_sflight-paymentsum < 100000.
g_wa_sflight-traffic_light = '1'.
C = Color, 6=Color 1=Intesified on, 0: Inverse display off
g_wa_sflight-line_color = 'C610'.
ELSEIF g_wa_sflight-paymentsum => 100000 AND
g_wa_sflight-paymentsum < 1000000.
g_wa_sflight-traffic_light = '2'.
clear g_wa_sflight-line_color.
ELSE.
g_wa_sflight-traffic_light = '3'.
clear g_wa_sflight-line_color.
ENDIF.
MODIFY gi_sflight INDEX g_selected_row-index FROM g_wa_sflight.
Refresh grid
CALL METHOD go_grid->refresh_table_display.
CALL METHOD cl_gui_cfw=>flush.
LEAVE TO SCREEN '100'.
ENDFORM. " save_changes -
Desktop icon fields description and control
Hello,
the are several fields in the icon that are on my desktop.
I can click on the upper left corner what does that do ?
There is always a big blue arrow on the lower left cornerseems to be useless because all my icons have it, so it does not indicate any specific action or fact for the icon.
The image of the website comes as a tiny picture in the midle of a big white square, making the website's picture almost invisible.
All my imported from XP desktop icons are identical...Takes terrible time to open the website and then drag n drop the website's image.
How to have a descent and usable desktop ?
Thanks and regards, J. BouchardHello,
still fighting with shotcuts on the desktop.
1-- browser.shell.shortcutFavicons is NOT documented in the fields descriptions of about:config
2--someshortcuts are showing the image but in a tiny size in the midle of a large white square (Windows 7)
3--I found a strange situation where the shortcut is FF while the delete shows the correct image (Window 7)
4-- XP shortcuts compare with W7 of item 1
Hope you can help me to stick to FireFox.
Regards, J. Bouchard -
Subtotals and Totals In ALV Report
Hi Experts,
I have a problem in my current scenario,
I have 3 fields,
KUNNR, WAERS, DMBTR.
000001 USD 100.00
000001 USD 200.00
000002 USD 100.00
000002 USD 400.00
000002 EUR 300.00
000002 EUR 100.00
The above mentioned is the data I have in my internal table & in my ALV report as well, Which is fine...!
Now I need Subtotals for each customer,
Means for customer 000001 The subtotal is 300 (USD)
Means for customer 000002 The subtotal is 500 (USD)
Means for customer 000002 The subtotal is 400 (EUR)
At the end I need grand totals.
USD 800
EUR 400.
Currently My field catalog is given below.
FIELDCATALOG-COL_POS = COL_POS.
FIELDCATALOG-FIELDNAME = 'DMBTR'.
FIELDCATALOG-SELTEXT_M = TEXT-106.
FIELDCATALOG-DO_SUM = 'X'.
APPEND FIELDCATALOG TO FIELDCATALOG.
CLEAR FIELDCATALOG.
what else I need to do for getting individual subtotals by currency and customers.
Thanks & regards,
Dileep .CHi Deelip,
FOR TOTAL:
there is a property of fieldcatalog, that is do_sum.
USE COED LIKE:
PERFORM fieldcat USING:
'1' 'KUNNR' 'I_MARD' 'CUSTOMER NO' ,
'2' 'DMBTR' 'I_MARD' 'CURRENCY' ,
FORM fieldcat USING value(p_0029)
value(p_0030)
value(p_0031)
value(p_0032)
wa_fieldcat-col_pos = p_0029.
wa_fieldcat-fieldname = p_0030.
wa_fieldcat-tabname = p_0031.
wa_fieldcat-reptext = p_0032.
wa_fieldcat-do_sum = 'X'.
APPEND wa_fieldcat TO i_fieldcat.
ENDFORM. " FIELDCAT
in final output you will get the total of currency field.
FOR SUB TOTAL:
decleare: i_sort type standard table of slis_sortinfo_alv,
wa_sort type slis_t_sortinfo_alv.
wa_sort-spos = '1'.
wa_sort-fieldname = 'KUNNR'.
wa_sort-tablename = 'i_final'
wa_sort-up = 'x'
wa_sort-subtot = 'X'.
wa_sort-spos = '2'.
wa_sort-fieldname = 'WAERS'.
wa_sort-tablename = 'i_final'
wa_sort-up = 'x'
wa_sort-subtot = 'X'.
append wa_tab to i_sort.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
it_fieldcat = it_fieldcat
it_sort = i_sort
Hope this can solve your pbs.
Regards,
Tutun -
Subtotal and total in alv report
hi,
i have an ALV REPORT,displaying the fields such as po item(ekpo-menge).but i am unable to perform total and sub total,it gives me a information message 'total cannot b performed'.
can any one help me, how to total and subtotal.Hi,
Please go through the following links. I am sure it will help you.
<a href="http://www.sapfans.com/forums/viewtopic.php?t=20386">http://www.sapfans.com/forums/viewtopic.php?t=20386</a>
<a href="http://www.sapfans.com/forums/viewtopic.php?t=85191">http://www.sapfans.com/forums/viewtopic.php?t=85191</a>
<a href="http://www.sapfans.com/forums/viewtopic.php?t=88401">http://www.sapfans.com/forums/viewtopic.php?t=88401</a>
Please reward helpful answer.
Regards,
Amit Mishra -
How do I change custom field description and name on the project fields PDP
I'm creating a custom PDP for a workflow process and I need to add the folloiwng fields "Project Name" and "Description"
When I try to create Project Name custom field under server settings I get the following message "The custom field name cannot match the name of any intrinsic fields."
So I went to the PDP web part Project fields and I found a field named " Project Name". I added it to the Proejct Fields web part, but it displays as "Name".
How can I change this field that's out of the box? I don't see "Project Name" and "Description" under server settings > Enterprise Custom Fields and Lookup Tables to modify them.
Thank youHi there,
Project Name & description fields are internal fields in project server which you cannot view in Enterprise custom fields in PWA. You will not be able to create with the similar name. There is no way to change these fields as far as I know.
I would suggest to have the new fields name something like Project_Name/ ProjName or Project_Description/ProjDescription .
Hope that helps.Thanks, Amit Khare |EPM Consultant| Blog: http://amitkhare82.blogspot.com http://www.linkedin.com/in/amitkhare82 -
Totals and Sub-Totals in ALV GRID
Could anyone advice, how to display sub-totals and totals in ALV Grid(using FM).
Ex: value1 value2
100 50
200 50
subtotal 300 100
total 400
Thanks in advance...Refer below demo code and see perform Sort_list..
it wil serve ur purpose.
REPORT ZGILL_ALV message-id rp .
type-pools slis.
tables: zgill_main,zgill_details.
data z_fieldcat type slis_t_fieldcat_alv.
data begin of itab occurs 0.
DATA ICON TYPE ICON-ID.
include structure zgill_main.
data salary like zgill_details-salary.
data end of itab.
*data itab1 like table of itab with header line.
data : WA_SORT TYPE SLIS_SORTINFO_ALV,
IT_SORT TYPE SLIS_T_SORTINFO_ALV,
WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
IT_FIELDTAB TYPE SLIS_T_FIELDCAT_ALV,
WA_LAYOUT TYPE SLIS_LAYOUT_ALV.
PARAMETERS: p_list radiobutton group A1,
P_GRID RADIOBUTTON GROUP A1.
SELECT-OPTIONS: S_PERNR FOR ZGILL_MAIN-PERNR.
start-of-selection.
perform fill_itab.
perform sort_list.
**************Start of scenario without container******************************************
*********Method 1***********
perform fill_fieldcat. " Manuallly Preparing Fiedl Catalog
*********Method 2***********
*perform fill_fieldcat1 changing z_fieldcat. "Preparing field catalog with merge function
perform display_alv.
*****************end of scenario without container*****************************************
*& Form fill_itab
text
--> p1 text
<-- p2 text
form fill_itab .
*select * from zgill_main up to 20 rows INTO CORRESPONDING FIELDS OF TABLE itab.
*ITAB1[] = ITAB[].
select apernr aname aorg adob b~salary INTO CORRESPONDING FIELDS OF TABLE itab
from zgill_main as a join zgill_details as b on apernr = bpernr
WHERE A~PERNR IN S_PERNR.
LOOP AT ITAB.
IF ITAB-PERNR < 1111.
ITAB-ICON = '@08@'.
ELSEIF ITAB-PERNR > 1111 AND ITAB-PERNR < 11111111.
ITAB-ICON = '@09@'.
ELSEIF ITAB-PERNR GE 11111111.
ITAB-ICON = '@0A@'.
ENDIF.
MODIFY ITAB INDEX SY-TABIX.
ENDLOOP.
endform. " fill_itab
*& Form display_alv
text
--> p1 text
<-- p2 text
form display_alv .
data repid like sy-repid.
REPID = SY-REPID.
WA_LAYOUT-ZEBRA = 'X'.
WA_LAYOUT-WINDOW_TITLEBAR = 'GRID DISPLAY'.
WA_LAYOUT-SUBTOTALS_TEXT = 'SUBTOTAL'.
WA_LAYOUT-TOTALS_TEXT = 'TOTAL'.
IF P_GRID = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = repid
IT_FIELDCAT = IT_FIELDTAB
IT_SORT = IT_SORT
IS_LAYOUT = WA_LAYOUT
TABLES
t_outtab = itab[]
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
IF sy-subrc <> 0.
message e016 with 'Error in Display'.
ENDIF.
ELSEIF P_LIST = 'X'.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = repid
IT_FIELDCAT = IT_FIELDTAB
IT_SORT = IT_SORT
IS_LAYOUT = WA_LAYOUT
TABLES
t_outtab = itab[]
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
IF sy-subrc <> 0.
message e016 with 'Error in Display'.
ENDIF.
ENDIF.
endform. " display_alv
*& Form fill_fieldcat1
text
--> p1 text
<-- p2 text
form fill_fieldcat1 changing d_fcat type slis_t_fieldcat_alv.
data repid like sy-repid.
data d_fcat1 type slis_t_fieldcat_alv with header line.
REPID = SY-REPID.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = repid
I_INTERNAL_TABNAME = 'ITAB'
I_STRUCTURE_NAME = 'ZGILL_MAIN'
I_CLIENT_NEVER_DISPLAY = 'X'
I_INCLNAME =
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
CHANGING
ct_fieldcat = d_fcat[]
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3.
IF sy-subrc <> 0.
message e016 with 'Error in preparing fiedl catalog'.
ENDIF.
loop at d_fcat into d_fcat1.
case d_fcat1-fieldname.
when 'NAME'.
d_fcat1-reptext_ddic = 'Emp Name'.
MODIFY D_FCAT FROM D_FCAT1.
WHEN 'PERNR'.
d_fcat1-reptext_ddic = 'Emp Num'.
MODIFY D_FCAT FROM D_FCAT1.
WHEN 'ORG'.
d_fcat1-reptext_ddic = 'Org Unit'.
MODIFY D_FCAT FROM D_FCAT1.
endcase.
clear d_fcat1.
endloop.
endform. " fill_fieldcat1
*& Form sort_list
text
--> p1 text
<-- p2 text
form sort_list .
CLEAR WA_SORT.
WA_SORT-FIELDNAME = 'DOB'.
WA_SORT-SPOS = '1'.
WA_SORT-UP = 'X'.
WA_SORT-SUBTOT = 'X'.
APPEND WA_SORT TO IT_SORT.
CLEAR WA_SORT.
WA_SORT-FIELDNAME = 'NAME'.
WA_SORT-SPOS = '1'.
WA_SORT-UP = 'X'.
APPEND WA_SORT TO IT_SORT.
CLEAR WA_SORT.
endform. " sort_list
*& Form fill_fieldcat
text
--> p1 text
<-- p2 text
form fill_fieldcat .
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'ITAB'.
WA_FIELDCAT-FIELDNAME = 'ICON'.
WA_FIELDCAT-SELTEXT_L = 'TRAFFIC'.
WA_FIELDCAT-ICON = 'X'.
WA_FIELDCAT-ddictxt = 'l'.
WA_FIELDCAT-COL_POS = 1.
WA_FIELDCAT-OUTPUTLEN = 10.
APPEND WA_FIELDCAT TO IT_FIELDTAB.
CLEAR WA_FIELDCAT .
WA_FIELDCAT-TABNAME = 'ITAB'.
WA_FIELDCAT-FIELDNAME = 'PERNR'.
WA_FIELDCAT-SELTEXT_L = 'EMP NUMBER'.
WA_FIELDCAT-ddictxt = 'l'.
WA_FIELDCAT-COL_POS = 2.
WA_FIELDCAT-OUTPUTLEN = 10.
APPEND WA_FIELDCAT TO IT_FIELDTAB.
CLEAR WA_FIELDCAT .
when 'maktx'.
WA_FIELDCAT-TABNAME = 'ITAB'.
WA_FIELDCAT-FIELDNAME = 'NAME'.
WA_FIELDCAT-SELTEXT_L = 'EMP NAME'.
WA_FIELDCAT-ddictxt = 'l'.
WA_FIELDCAT-COL_POS = 3.
WA_FIELDCAT-OUTPUTLEN = 15.
APPEND WA_FIELDCAT TO IT_FIELDTAB.
CLEAR WA_FIELDCAT .
WA_FIELDCAT-TABNAME = 'ITAB'.
WA_FIELDCAT-FIELDNAME = 'ORG'.
WA_FIELDCAT-SELTEXT_L = 'ORG UNIT'.
WA_FIELDCAT-COL_POS = 4.
WA_FIELDCAT-OUTPUTLEN = 10.
APPEND WA_FIELDCAT TO IT_FIELDTAB.
CLEAR WA_FIELDCAT .
WA_FIELDCAT-TABNAME = 'ITAB'.
WA_FIELDCAT-FIELDNAME = 'DOB'.
WA_FIELDCAT-SELTEXT_L = 'BIRTH DATE'.
WA_FIELDCAT-COL_POS = 5.
WA_FIELDCAT-OUTPUTLEN = 12.
APPEND WA_FIELDCAT TO IT_FIELDTAB.
CLEAR WA_FIELDCAT .
WA_FIELDCAT-TABNAME = 'ITAB'.
WA_FIELDCAT-FIELDNAME = 'SALARY'.
WA_FIELDCAT-SELTEXT_L = 'SALARY'.
WA_FIELDCAT-COL_POS = 6.
WA_FIELDCAT-OUTPUTLEN = 25.
WA_FIELDCAT-do_sum = 'X'.
APPEND WA_FIELDCAT TO IT_FIELDTAB.
endform. " fill_fieldcat -
ALV Grid Subtotal text and Total text display
Hello ABAPGuru's
I want to display the subtotal and Total texts. alv grid program runing on background.
Regards
Sweety(Sri)Hello Neil,
Here I have attached my routines.anyway my confusion. I have wrote the routine subtotal_text .but i am not passing ALV GRID FM.
*& Form eventtab_build
&---- This is used to get the list of events
---- <--RI_EVENTS Internal table
FORM eventtab_build CHANGING ri_events TYPE slis_t_event.
Structure for event handling.
DATA: rs_event TYPE slis_alv_event.
Returns table of possible events for a list type.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = ri_events. " Table of events to perform
Read the internal table with the TOP_OF_PAGE and move the
form name to the internal table
READ TABLE ri_events
WITH KEY name = slis_ev_top_of_page INTO rs_event.
IF sy-subrc = 0.
MOVE c_formname TO rs_event-form. " Form name
MODIFY ri_events FROM rs_event
INDEX sy-tabix. " Top of page event
ENDIF.
READ TABLE ri_events
WITH KEY name = slis_ev_end_of_page INTO rs_event.
IF sy-subrc = 0.
MOVE c_form_eop_name TO rs_event-form. " Form name
MODIFY ri_events FROM rs_event
INDEX sy-tabix. " Top of page event
ENDIF.
READ TABLE ri_events
WITH KEY name = slis_ev_subtotal_text INTO rs_event.
IF sy-subrc = 0.
MOVE c_formname_subtotal_text TO rs_event-form. " Formname
MODIFY ri_events FROM rs_event
INDEX sy-tabix. " Top of page event
ENDIF.
*&-- Delete all unneeded events:
DELETE ri_events WHERE form IS INITIAL.
ENDFORM. " eventtab_build
*& Form SUBTOTAL_TEXT
text
--> p1 text
<-- p2 text
FORM SUBTOTAL_TEXT USING ep_subtot_line TYPE type_data
e_event_data TYPE slis_subtot_text.
IF NOT e_event_data-criteria IS INITIAL.
E_EVENT_DATA-DISPLAY_TEXT_FOR_SUBTOTAL = 'Account Total'.
ENDIF.
ENDFORM. "SUBTOTAL_TEXT
*& Form initialise_layout
Initialise Layout
FORM initialise_layout .
i_layout-colwidth_optimize = c_x.
i_layout-group_change_edit = c_x.
*i_layout-subtotals_text = ' a'.
i_layout-detail_popup = c_x.
i_layout-zebra = c_x.
i_layout-no_vline = 'X'.
i_layout-no_hline = 'X'.
i_layout-totals_text = 'Account Total'.
ENDFORM. " initialise_layout
Call the function module to display the report
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = v_program
i_callback_top_of_page = 'TOP_OF_PAGE' "Top Of Page
is_layout = i_layout
it_fieldcat = i_fieldtab
it_sort = i_sort
it_events = i_events " Events
is_print = i_print
i_default = c_x
i_save = c_save
is_variant = v_variant
TABLES
t_outtab = i_data
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Regards
Sweety (Sri) -
Regarding field description in report
HI,
I had made a report in which i am displaying the changes made to a material in a purticular month.
it is working fine but 1 field i am looking for is d description which is similar to MM04 tcode when we execute there is field called field description and i want to display it my report also.plzz help me out as it is really urgent to me..
here is d code:-
REPORT ZNEW01 no standard page heading LINE-SIZE 310.
TABLES: cdhdr,cdpos.
DATA : BEGIN OF itab OCCURS 0,
objectclas LIKE cdhdr-objectclas,
objectid LIKE cdhdr-objectid,
username LIKE cdhdr-username,
udate LIKE cdhdr-udate,
utime LIKE cdhdr-utime,
tcode LIKE cdhdr-tcode,
change_ind LIKE cdhdr-change_ind,
changenr LIKE cdhdr-changenr,
END OF itab.
DATA: BEGIN OF itab1 OCCURS 0,
OBJECTCLAS LIKE CDHDR-OBJECTCLAS,
objectid LIKE cdpos-objectid,
changenr LIKE cdpos-changenr,
fname LIKE cdpos-fname,
chngind LIKE cdpos-chngind,
value_new LIKE cdpos-value_new,
value_old LIKE cdpos-value_old,
TABKEY LIKE CDPOS-TABKEY,
END OF itab1.
DATA : BEGIN OF it_final OCCURS 0,
objectclas LIKE cdhdr-objectclas,
objectid LIKE cdhdr-objectid,
username LIKE cdhdr-username,
udate LIKE cdhdr-udate,
utime LIKE cdhdr-utime,
tcode LIKE cdhdr-tcode,
change_ind LIKE cdhdr-change_ind,
changenr LIKE cdhdr-changenr,
fname LIKE cdpos-fname,
chngind LIKE cdpos-chngind,
value_new LIKE cdpos-value_new,
value_old LIKE cdpos-value_old,
TABKEY LIKE CDPOS-TABKEY,
end of it_final.
select-options : m_date for cdhdr-udate.
SELECT objectclas objectid username udate utime tcode change_ind changenr
FROM cdhdr
INTO TABLE itab WHERE objectclas = 'MATERIAL' AND
change_ind = 'U' AND
udate IN m_date.
IF NOT itab[] IS INITIAL.
SELECT objectclas objectid changenr fname chngind value_new value_old TABKEY
FROM cdpos
INTO TABLE itab1
FOR ALL ENTRIES IN itab
WHERE changenr = itab-changenr and chngind = itab-change_ind.
ENDIF.
LOOP AT itab1.
READ TABLE itab WITH KEY changenr = itab1-changenr.
it_final-objectid = itab-objectid.
it_final-username = itab-username.
it_final-udate = itab-udate.
it_final-utime = itab-utime.
it_final-tcode = itab-tcode.
it_final-fname = itab1-fname.
it_final-chngind = itab1-chngind.
it_final-value_old = itab1-value_old.
it_final-value_new = itab1-value_new.
it_final-TABKEY = itab1-TABKEY.
APPEND it_final.
CLEAR it_final.
ENDLOOP.
uline.
write: / 'ITEMID C.PERSON C.DATE C.TIME TCODE OLD VALUE NEW VALUE ORG.UNIT'.
uline.
loop at it_final.
write : / it_final-objectid11(11),12 it_final-username,22 it_final-udate,35 it_final-utime,45 it_final-tcode,55 it_final-value_old,94 it_final-value_new,139 it_final-tabkey21(5).
endloop.
Edited by: ric .s on Feb 21, 2008 11:48 AM
Edited by: ric .s on Feb 21, 2008 12:33 PM
Edited by: Alvaro Tejada Galindo on Feb 21, 2008 3:24 PMCASE ausg-tabname.
WHEN 'DPROW'.
MOVE indtext TO ls_alv_display_position-action.
CLEAR lv_orgunit.
CONCATENATE text-029 space ausg-tabkey(4)
INTO lv_orgunit RESPECTING BLANKS.
MOVE lv_orgunit TO ls_alv_display_position-orgunit.
MOVE text-027 TO ls_alv_display_position-description.
IF indtext NE text-013.
MOVE priod TO ls_alv_display_position-newvalue.
ELSE.
MOVE priod TO ls_alv_display_position-oldvalue.
ENDIF.
APPEND ls_alv_display_position TO
lt_alv_display_position.
CLEAR ls_alv_display_position.
WHEN 'DGESV'.
MOVE indtext TO ls_alv_display_position-action.
CLEAR lv_orgunit.
CONCATENATE text-029 space ausg-tabkey(4)
INTO lv_orgunit RESPECTING BLANKS.
MOVE lv_orgunit TO ls_alv_display_position-orgunit.
MOVE text-030 TO ls_alv_display_position-description.
IF indtext NE text-013.
MOVE priod TO ls_alv_display_position-newvalue.
ELSE.
MOVE priod TO ls_alv_display_position-oldvalue.
ENDIF.
APPEND ls_alv_display_position TO
lt_alv_display_position.
CLEAR ls_alv_display_position.
WHEN 'DUNGV'.
MOVE indtext TO ls_alv_display_position-action.
CLEAR lv_orgunit.
CONCATENATE text-029 space ausg-tabkey(4)
INTO lv_orgunit RESPECTING BLANKS.
MOVE lv_orgunit TO ls_alv_display_position-orgunit.
MOVE text-031 TO ls_alv_display_position-description.
IF indtext NE text-013.
MOVE priod TO ls_alv_display_position-newvalue.
ELSE.
MOVE priod TO ls_alv_display_position-oldvalue.
ENDIF.
APPEND ls_alv_display_position TO
lt_alv_display_position.
CLEAR ls_alv_display_position.
WHEN 'DMKAL'.
MOVE indtext TO ls_alv_display_position-action.
CLEAR lv_orgunit.
CONCATENATE text-029 space ausg-tabkey(4) space
text-050 space ausg-tabkey+4(4)
INTO lv_orgunit RESPECTING BLANKS.
MOVE lv_orgunit TO ls_alv_display_position-orgunit.
APPEND ls_alv_display_position TO
lt_alv_display_position.
CLEAR ls_alv_display_position.
WHEN 'DMAKT'.
MOVE indtext TO ls_alv_display_position-action.
MOVE text-025 TO ls_alv_display_position-description.
MOVE <key> TO ls_alv_display_position-additional_info.
IF indtext NE text-013.
APPEND ls_alv_display_position TO
lt_alv_display_position.
CLEAR ls_alv_display_position.
ENDIF.
WHEN 'DMARM'.
MOVE indtext TO ls_alv_display_position-action.
MOVE text-026 TO ls_alv_display_position-description.
IF indtext NE text-013.
MOVE <key> TO ls_alv_display_position-newvalue.
ELSE.
MOVE <key> TO ls_alv_display_position-oldvalue.
ENDIF.
APPEND ls_alv_display_position TO
lt_alv_display_position.
CLEAR ls_alv_display_position.
WHEN 'DMEAN'.
MOVE indtext TO ls_alv_display_position-action.
MOVE text-051 TO ls_alv_display_position-description.
IF indtext NE text-013.
MOVE <key> TO ls_alv_display_position-newvalue.
ELSE.
MOVE <key> TO ls_alv_display_position-oldvalue.
ENDIF.
APPEND ls_alv_display_position TO
lt_alv_display_position.
CLEAR ls_alv_display_position.
WHEN 'DMAEX'.
MOVE indtext TO ls_alv_display_position-action.
MOVE text-068 TO ls_alv_display_position-description.
IF indtext NE text-013.
MOVE <key> TO ls_alv_display_position-newvalue.
ELSE.
MOVE <key> TO ls_alv_display_position-oldvalue.
ENDIF.
APPEND ls_alv_display_position TO
lt_alv_display_position.
CLEAR ls_alv_display_position.
WHEN 'DMAPE'. "ch zu 30e
MOVE indtext TO ls_alv_display_position-action.
MOVE text-067 TO ls_alv_display_position-description.
IF indtext NE text-013.
MOVE <key> TO ls_alv_display_position-newvalue.
ELSE.
MOVE <key> TO ls_alv_display_position-oldvalue.
ENDIF.
APPEND ls_alv_display_position TO
lt_alv_display_position.
CLEAR ls_alv_display_position.
WHEN 'DMLAN'.
MOVE indtext TO ls_alv_display_position-action.
MOVE text-052 TO ls_alv_display_position-description.
IF indtext NE text-013.
MOVE <key> TO ls_alv_display_position-newvalue.
ELSE.
MOVE <key> TO ls_alv_display_position-oldvalue.
ENDIF.
APPEND ls_alv_display_position TO
lt_alv_display_position.
CLEAR ls_alv_display_position.
WHEN OTHERS.
MOVE indtext TO ls_alv_display_position-action.
CASE ausg-tabname.
WHEN 'MARA'.
MOVE text-055 TO
ls_alv_display_position-description.
WHEN 'MARC'.
MOVE text-056 TO
ls_alv_display_position-description.
WHEN 'MARD'.
MOVE text-057 TO
ls_alv_display_position-description.
WHEN 'MLGN'.
MOVE text-058 TO
ls_alv_display_position-description.
WHEN 'MLGT'.
MOVE text-059 TO
ls_alv_display_position-description.
WHEN 'MBEW'.
MOVE text-064 TO
ls_alv_display_position-description.
WHEN 'MVKE'.
MOVE text-063 TO
ls_alv_display_position-description.
include /nfm/m03a1. "/NFM/
WHEN 'MPOP'.
MOVE text-065 TO
ls_alv_display_position-description.
WHEN OTHERS.
MOVE ausg-tabname TO
ls_alv_display_position-description.
ENDCASE.
include /nfm/m03a3. "/NFM/
if ausg-tabname(6) ne '/NFM/T'. "/NFM/
write: 55 <key>. "/NFM/
endif. "/NFM/
IF indtext NE text-013.
MOVE <key> TO ls_alv_display_position-newvalue.
ELSE.
MOVE <key> TO ls_alv_display_position-oldvalue.
ENDIF.
APPEND ls_alv_display_position TO
lt_alv_display_position.
CLEAR ls_alv_display_position.
ENDCASE. -
Field over flow can not display the total and subtotal in ALV
hi
i am running a z report with huge data in quality system.
in 2 columns and not able to show the total and subtotal in 2 columns
it says field overflow and cannot be dispayed.
value is around 20character integer.You can create a domains with 20 positions and 2 decimal, for example.
Than, associate this domain a data element.
To finish assign that data element to the column you wanna sum.
I hope help. -
ALV: how to display only subtotals and total rows in the output
ALV: how to display only subtotals and total rows in the output
i am getting output
i am getting subtotals for respective fields
but i want to display only subtotals and totals rows in the output
i have tried the
totals_only parameter in slis_layout_alv
but it is not working.hi,
For TOTAL
For the amount field / quantity field in the field catalog give DO_SUM = 'X' for WHOLE total
For SUBTOTAL
For subtotal you will have to create an internal table sort..Let's say you want to do subtotal for each customer..
DATA: lt_sort type SLIS_T_SORTINFO_ALV,
ls_sort type slis_sortinfo_alv.
CLEAR ls_sort.
ls_sort-spos = 1.
ls_sort-fieldname = 'Give the field name that you do the sum'.
ls_sort-up = 'X'.
ls_sort-subtot = 'X'.
APPEND ls_sort TO lt_sort.
fieldcatalog-do_dum = 'X'.
for subtotals
WA_SORT-FIELDNAME = 'ERSDA'.
WA_SORT-SPOS = '2'.
WA_SORT-UP = 'X'.
WA_SORT-SUBTOTAL = 'X'.
APPEND WA_SORT TO IT_SORT.
Refer
http://help.sap.com/saphelp_erp2004/helpdata/en/ee/c8e056d52611d2b468006094192fe3/content.htm
http://sap.ittoolbox.com/groups/technical-functional/sap-dev/doesnt-function-event-subtotal_text-in-alv-713787
regards,
Prabhu
reward if it is helpful -
Need to display Subtotal text and total text in ALV
HI,
I need help.
I am displaying subtotal and total for cost column which is group by Project type column
My problem is i am able to display the subtotal and total values but not able to display the 'Subtotal' and 'Total' text on that respective row.
I have updated lvc_s_sort table as follow.
ls_sort-spos = 1.
ls_sort-subtot = 'X'.
ls_sort-fieldname = 'SUBTOT'.
ls_sort-up = 'X'.
ls_sort-SELTEXT = 'Subtotal'.
ls_sort-spos = 2.
ls_sort-subtot = 'X'.
ls_sort-fieldname = 'PRART'.
ls_sort-GROUP = 'UL'.
ls_sort-up = 'X'.
Please suggest what should be done to display the text.
Regards,
RachnaYou have to use the event SUBTOTAL_TEXT for the ALV.
the field CRITERIA can be used for checking the field.
and field CRIT_TEXT for the sub total text.
I hope you are aware about how to implement the events in ALV using OOP.
Hope this helps you. -
Sub-total and Total for a column having checkboxes in WD ABAP ALV
Hello Experts,
I have used ALV in We bdynpro ABAP to display my output. There are 2 columns that are checkboxes in Output. I want a sub-total and total for those two columns. I know tht total and sub-total functionality is available only for numeric fields .
Is there any other indirect way by which i can achieve the same ?Hi Ragini,
Please refer this thread: [alv total and subtotal|How to display graphs;.
I hope it helps.
Regards
Arjun -
Subtotal in ALV grid for a particular type and Grand total in ALV
Hi,
I need to have sub total for a particular type(eg: goods, services).. and grand total at end in ALV grid..
ALV output required as below:
Type VAT registration number Country Total Gross Amounts Total Tax Amounts Total Amount, ex-tax
Goods ATU12345678 AT 222.42 0 222.42
Goods NL123456789B02 NL 3,417.00 0 3,417.00
Goods Total 3,639.42 - 3,639.42
Services ATU12345678 AT 2,342.34 0 2,342.34
Services NL123456789B02 NL 223.33 0 223.33
Services Total 2,565.67 - 2,565.67
Grand Total 6,205.09 - 6,205.09
Let me as to how to achieve the above type in ALV grid...
Regards
Shivacheck this link..
Grand Totals in ALV grid disply function module
or do like this..
REPORT ZALVTESTFORSUBTOTAL.
tables:pa0008.
type-pools:slis.
types:begin of ty_pa0008,
pernr like pa0008-pernr,
begda like pa0008-begda,
endda like pa0008-endda,
ansal like pa0008-ansal,
lga01 like pa0008-lga01,
bet01 like pa0008-bet01,
end of ty_pa0008.
data:it_pa0008 type standard table of ty_pa0008 with header line.
data:it_fieldcat type SLIS_T_FIELDCAT_ALV,
wa_fieldcat type slis_fieldcat_alv,
it_layout type slis_layout_alv,
WA_events TYPE slis_alv_event,
it_events TYPE slis_t_event.
select-options:s_pernr for pa0008-pernr.
start-of-selection.
perform getD_data.
perform disp_alv.
*& Form getD_data
text
--> p1 text
<-- p2 text
form getD_data .
select pernr
begda
endda
ansal
lga01
bet01
from pa0008
into table it_pa0008
where pernr in s_pernr.
sort it_pa0008 by pernr begda descending.
endform. " getD_data
*& Form disp_alv
text
--> p1 text
<-- p2 text
form disp_alv .
wa_fieldcat-fieldname = 'PERNR'.
wa_FIELDCAT-REPTEXT_DDIC = 'Personnel no'.
*WA_FIELDCAT-no_subtotals = 'X'.
append wa_fieldcat to it_fieldcat.
clear wa_fieldcat.
wa_fieldcat-fieldname = 'BEGDA'.
wa_FIELDCAT-REPTEXT_DDIC = 'Start date'.
append wa_fieldcat to it_fieldcat.
clear wa_fieldcat.
wa_fieldcat-fieldname = 'ENDDA'.
wa_FIELDCAT-REPTEXT_DDIC = 'End date'.
append wa_fieldcat to it_fieldcat.
clear wa_fieldcat.
wa_fieldcat-fieldname = 'ANSAL'.
wa_FIELDCAT-REPTEXT_DDIC = 'Annula salary'.
wa_fieldcat-do_sum = 'X'.
append wa_fieldcat to it_fieldcat.
clear wa_fieldcat.
wa_fieldcat-fieldname = 'LGA01'.
wa_FIELDCAT-REPTEXT_DDIC = 'Wage Type'.
append wa_fieldcat to it_fieldcat.
clear wa_fieldcat.
wa_fieldcat-fieldname = 'BET01'.
wa_FIELDCAT-REPTEXT_DDIC = 'Amount for wagetype'.
append wa_fieldcat to it_fieldcat.
clear wa_fieldcat.
DATA: sort TYPE slis_sortinfo_alv,
it_sort TYPE slis_t_sortinfo_alv.
sort-fieldname = 'PERNR'.
sort-subtot = 'X'.
SORT-UP = 'X'.
APPEND sort TO it_sort.
*sort-fieldname = 'BEGDA'.
*SORT-NO_SUBTOTS = 'X'.
*APPEND sort TO it_sort.
IT_layout-totals_text = 'total text'.
IT_layout-subtotals_text = 'Subtotal text'.
*WA_EVENTS-NAME = 'SUBTOTAL TEXT'.
*WA_EVENTS-FORM = 'SUBTOTAL TEXT'.
*APPEND WA_EVENTS TO IT_EVENTS.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = sy-repid
IS_LAYOUT = it_LAYOUT
IT_FIELDCAT = IT_FIELDCAT
it_sort = it_sort
it_events = it_events
TABLES
t_outtab = it_pa0008 .
endform. " disp_alv -
Multiple lines for field description in ALV
Hi ,
Is there any way to display the field description in multiple lines in ALV grid .
Regards,
PradiptaHi pradipta,
1. No its not possible.
2. At the most, we can set the WIDTH of the
column, to ACCOMODATE the field description.
3. We cannot do WRAP as u require.
regards,
amit m.
Maybe you are looking for
-
I am trying to restrict access to a page by redirecting unauthorized users to another page. The Adobe manual instructs me to: Open the page you want to protect. In the Server Behaviors panel (Window > Server Behaviors), click the Plus button and se
-
Hi I'm a big fan. long time lurker first time poster Currently the position of the tool tip depends on where the cursor first hovers over the image. Is there a way for the tool tip to appear in the same place no mater where the image is hovered? bel
-
I have an all-in-one c4280 printer. I am trying to print labels....when I print on regular paper they are perfectly aligned. When I print on labels....it prints too high and they are all off. I have tried to select specialty paper from the printer
-
SMS 2008 Server time out same time every hour
Our server times out at the same time every hour. Any computer connected to our network at exactly xx:53, any program or anything you are attempted to do goes to the loading circle and says not responding. It stays that way until xx:54. Every hour, e
-
Determine Light Area vs. Dark Area
Here's another unusual one for you. Is there a way to have Photoshop determine if the majority of a selected area is lighter color or darker. As an example, some photos have a fairly consistent brightness/darkness across the image, meaning there are