ALv + Group Lines
Hi...Good Day...
See next.. I have..
1000 xxxx yyyyy
1000 zzzz ccccc
1000 vvvvv rrrrrrrr
2000 www ttttttt
2000 hhhh oooo
Can i do this in alv ???
1000 xxxx yyyyy
zzzz ccccc
vvvvv rrrrrrrr
2000 www ttttttt
hhhh oooo
I guess that alv can do it... But i dont have much time for research..
If somebody knows how do it, i will aprecciate..
Thanks.......
Regards,
Manuel H.
Hi,
You can ALSO use simple alv grid using SORT will work
i_sort-fieldname = 'NUMBER'.
i_sort-down = c_x.
append i_sort.
clear i_sort.
call method grid1->set_table_for_first_display
exporting
is_layout = gs_layout
is_variant = gs_variant
i_save = 'A'
it_toolbar_excluding = i_exclude[]
changing
it_outtab = i_output[]
it_fieldcatalog = i_fieldcat[]
it_sort = i_sort[]
exceptions
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
others = 4.
a®
Similar Messages
-
Hi,
I have an ALV Tree (cl_salv_tree) that's works fine.
But I need to export all data to excel.
I am using OLE objects to do this.
I would like to know if is possible group lines into excel.
For example.
Today works like this
Level1 -
Value 1
---Level2 --- Value 2
---Level2 --- Value 2
Level3 - Value 3
I would like to do this (compress the Leve2, for example)
+ Level1 -
Value 1
Level2 -
Value 2
+---Level2 -
Value 2
Thanks a lot.May be u can try this way. Instead of OLE
" Create a custom icon in the tree toolbar using the following
try.
v_text2 = text-b02. " download to excel
grt_functions->add_function(
name = 'DOWNLOAD'
icon = '@42@'
tooltip = v_text2
position = if_salv_c_function_position=>right_of_salv_functions
catch cx_salv_wrong_call cx_salv_existing.
endtry.
" Make the events for the custom function
data: lr_events type ref to cl_salv_events_tree.
lr_events = grt_tree->get_event( ).
create object grt_events.
set handler grt_events->on_user_command for lr_events.
set handler grt_events->on_double_click for lr_events.
set handler grt_events->on_link_click for lr_events.
set handler grt_events->on_before_user_command for lr_events.
set handler grt_events->on_after_user_command for lr_events.
set handler grt_events->on_keypress for lr_events.
try.
lr_events->add_key_for_keypress( if_salv_c_keys=>f4 ).
lr_events->add_key_for_keypress( if_salv_c_keys=>enter ).
catch cx_salv_msg.
endtry.
" Call the following function module
" in the grt_events->on_user_command method, after arranging
" whichever format of your output table
CALL FUNCTION 'ALV_XXL_CALL'
EXPORTING
i_tabname = 'I_OUT'
IS_LAYOUT = l_xxl_Layout
it_fieldcat = l_xxl_fieldcat
TABLES
it_outtab = it_out
EXCEPTIONS
fatal_error = 1
no_display_possible = 2
OTHERS = 3.
a® -
ALV group by functionality.
Hello, i have an ALV which displays the agreement as well as its items. I have the following scenario.
Alv display:
Suppplier1 Cost center1 Merchandise cat. 1 Amount x
Suppplier1 Cost center1 Merchandise cat. 1 Amount y
Suppplier1 Cost center1 Merchandise cat. 1 Amount z
Assume that the lines above belong to a single agreement, items 10 , 20 and 30 respectively
Since the supplier , cost ,center and merchandise cat are similar and I have hidden the item number from the ALV layout. client wants only 1 line to appear if i sum the amount by supplier, cost center and merchandise cat. Is this possible by the alv grouping functionality?I have the following code so far. It gives me error gd_sort is a table without header line and therefore has no component called Fieldname. I cannot add headerline to gd_sort as that will make the program to dump because of mismatch in data type. Any ideas?
gd_sort TYPE slis_t_sortinfo_alv,
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = repid
i_callback_user_command = 'USER_COMMAND'
is_layout = gd_layout
it_fieldcat = fieldcatalog
it_sort = gd_sort
it_events = gt_events
is_print = gd_prntparams
i_save = 'X'
TABLES
t_outtab = i_zopen_alv
EXCEPTIONS
program_error = 1
OTHERS = 2.
FORM build_sort.
gd_sort-fieldname = 'VBELN_VA'.
APPEND gd_sort.
ENDFORM. "build_sort -
Shrinking Vertical Group Lines
When sorting activities by WBS in Contractor is there a way to shrink the vertical group lines. Default colours are yellow and green. They are massive after a few nested groups.
Any suggestions?
Thanks,
JustinFrom within P. Contractor go to View/ Group and Sort/ and then select the square labeled "Shrink Vertical Group Bands". This will shrink the vertical green/ yellow lines. You may also reduce the font, which will reduce the horizontal green/ yellow lines. Or allow you to pick a better color combination.
-
ALV Grouping specific rows subtotal
Hi Gurus,
I have one peculiar issue like,
For Ex.
Customer Material Amount
12345 m1 100
12346 m1 150
12346 m2 160
12346 m2 165
12347 m2 170
12347 m2 50
12348 m3 150
Now the report is showing as follows:
Customer Material Amount
12345 m1 100
subtotal 100
12346 m1 150
12346 m2 160
12346 m2 165
subtotal 475
12347 m2 170
12347 m2 50
subtotal 220
12348 m3 150
subtotal 150
<b>Total 945</b>
But the requirement is we want the subtotals for material "M2" also only for material M2 not for other materials. So the output should look like following
Customer Material Amount
12345 m1 100
subtotal 100
12346 m1 150
12346 m2 160
12346 m2 165
<b>subtotal 325</b>
subtotal 475
12347 m2 170
12347 m2 50
subtotal 220
12348 m3 150
subtotal 150
Total 945
Hope I am clear to you all, please help me out with the right solution. Urgent !!!
Thanks in advance,
NaveenHi,
Simple ALV report
http://www.sapgenie.com/abap/controls/alvgrid.htm
http://wiki.ittoolbox.com/index.php/Code:Ultimate_ALV_table_toolbox
ALV
1. Please give me general info on ALV.
http://www.sapfans.com/forums/viewtopic.php?t=58286
http://www.sapfans.com/forums/viewtopic.php?t=76490
http://www.sapfans.com/forums/viewtopic.php?t=20591
http://www.sapfans.com/forums/viewtopic.php?t=66305 - this one discusses which way should you use - ABAP Objects calls or simple function modules.
2. How do I program double click in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=11601
http://www.sapfans.com/forums/viewtopic.php?t=23010
Check the program in the following link:
http://sap-img.com/abap/display-secondary-list-using-alv-grid.htm
3. How do I add subtotals (I have problem to add them)...
http://www.sapfans.com/forums/viewtopic.php?t=20386
http://www.sapfans.com/forums/viewtopic.php?t=85191
http://www.sapfans.com/forums/viewtopic.php?t=88401
http://www.sapfans.com/forums/viewtopic.php?t=17335
http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_basic.htm
4. How to add list heading like top-of-page in ABAP lists?
http://www.sapfans.com/forums/viewtopic.php?t=58775
http://www.sapfans.com/forums/viewtopic.php?t=60550
http://www.sapfans.com/forums/viewtopic.php?t=16629
5. How to print page number / total number of pages X/XX in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=29597 (no direct solution)
6. ALV printing problems. The favourite is: The first page shows the number of records selected but I don't need this.
http://www.sapfans.com/forums/viewtopic.php?t=64320
http://www.sapfans.com/forums/viewtopic.php?t=44477
7. How can I set the cell color in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=52107
8. How do I print a logo/graphics in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=81149
http://www.sapfans.com/forums/viewtopic.php?t=35498
http://www.sapfans.com/forums/viewtopic.php?t=5013
9. How do I create and use input-enabled fields in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=84933
http://www.sapfans.com/forums/viewtopic.php?t=69878
10. How can I use ALV for reports that are going to be run in background?
http://www.sapfans.com/forums/viewtopic.php?t=83243
http://www.sapfans.com/forums/viewtopic.php?t=19224
11. How can I display an icon in ALV? (Common requirement is traffic light icon).
http://www.sapfans.com/forums/viewtopic.php?t=79424
http://www.sapfans.com/forums/viewtopic.php?t=24512
12. How can I display a checkbox in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=88376
http://www.sapfans.com/forums/viewtopic.php?t=40968
http://www.sapfans.com/forums/viewtopic.php?t=6919
13. Top-of-page in ALV
selection-screen and top-of-page in ALV
14. ALV Group Heading
http://www.sap-img.com/fu037.htm
How to add list heading like top-of-page in ABAP lists?
http://www.sapfans.com/forums/viewtopic.php?t=58775
http://www.sapfans.com/forums/viewtopic.php?t=60550
http://www.sapfans.com/forums/viewtopic.php?t=16629
15. ALV output to PDF conversion
It has an example code for PDF Conversion.
http://www.erpgenie.com/abap/code/abap51.htm
converting the output of alv in pdf
Go thru these programs they may help u to try on some hands on
ALV Demo program
BCALV_DEMO_HTML
BCALV_FULLSCREEN_DEMO ALV Demo: Fullscreen Mode
BCALV_FULLSCREEN_DEMO_CLASSIC ALV demo: Fullscreen mode
BCALV_GRID_DEMO Simple ALV Control Call Demo Program
BCALV_TREE_DEMO Demo for ALV tree control
BCALV_TREE_SIMPLE_DEMO
BC_ALV_DEMO_HTML_D0100
Regards
ANJI -
Partial grouping of ALV grid lines
Hello.
I have the following table and I want to do a partial grouping of the lines:
Order number | Vendor | Oder line | Order quantity | Total quatity shipped | Track ID | Shipped |
418 | ABC | 01 | 08 | 00 | TR007 | 08 |
418 | ABC | 02 | 10 | 05 | TR008 | 05 |
418 | ABC | 02 | 10 | 05 | TR009 | 05 |
418 | ABC | 03 | 13 | 13 | TR010 | 13 |
Now, if the first three column values of a line are equal, then the equal lines should be partially grouped. In this sample line 2 and 3 are equal, so the result of the grouping should look like this:
Order number | Vendor | Oder line | Order quantity | Total quatity shipped | Track ID | Shipped |
418 | ABC | 01 | 08 | 00 | TR007 | 08 |
| | | | | TR008 | 05 |
418 | ABC | 02 | 10 | 10 ----------------------
| | | | | TR009 | 05 |
418 | ABC | 03 | 13 | 13 | TR010 | 13 |
I've already tried to sort the columns, but then I get the following and this is not what I need:
Order number | Vendor | Oder line | Order quantity | Total quatity shipped | Track ID | Shipped |
418 | ABC | 01 | 08 | 00 | TR007 | 08 |
| ---------------------------------------------------------------------------
| | 02 | 10 | 05 | TR008 | 05 |
| | ---------------------------------------------------------------
| | | 10 | 05 | TR009 | 05 |
| ---------------------------------------------------------------------------
| | 03 | 13 | 13 | TR010 | 13 |
Can someone help me to solve this problem?
Regards,
BenjaminHi Selva
Normally my alv output like this
Deisp date Packing Material Noof packing
18/15/2010 hdp 5
18/05/2010 pail 10
20/052010 hdp 25
I need tha alv out pu like this
Dispatch date 18/05/2010
hdp 5
pail 10
Dispatch date 20/05/2010
hdp 25 -
Header Line Per ALV group of items in GRID not LIST.
Hello Experts,
My question may seem very basic but i am stuck with it.
I am using ALV Grid function (REUSE_ALV_GRID_DISPLAY) to display my ALV.
Example Case :
I have 10 line items .
1) 2 line items are sports.
2) 2 line items are books.
3) 2 line items are Mobiles.
My ALV displays like this :
No. Object Object Type
1) Ball sports
2) Bat sports
3) Maths Books
4) History Books
5) Nokia Mobiles
6) Samsung Mobiles
And i want it like this :
No. Object
Sports <---- I want this to act as header per line item .
1) Ball
2) Bat
Books
3) Maths
4) History
Mobiles
5) Nokia
6) Samsung.
I.e i need a row stating Object Type IN ALV Grid similar to how we make use of AT NEW EVENT in LIST REPORT.
Thanks in Advance,
Sudeep.
Edited by: Sudeep Yerunkar on Jul 21, 2010 11:40 AMHi,
If GRID is a 'MUST' requirement, then you can try preparing your internal table in the manner you want the output.
Something like this:
- Sort the output internal table.
- Loop on the output int table.
- Use AT NEW object type
- Append Object Type into another internal table
- Then read rest of the records with same object type into another internal table and appending the same.
Not sure about the efficieny but you can try.
BR,
Vishal. -
In my ALV report, I would like to group by Sales Order. How to accomplish this. Thank you
WHEN 'VBELN_VA'.
wa_fieldcatalog-seltext_l = 'Order No.'.
wa_fieldcatalog-reptext_ddic = 'Order No.'.
wa_fieldcatalog-emphasize = 'X'.
wa_fieldcatalog-key = 'X'.
MOVE: wa_fieldcatalog-seltext_l TO wa_fieldcatalog-seltext_m,
wa_fieldcatalog-seltext_l TO wa_fieldcatalog-seltext_s.
ADD 1 TO wa_fieldcatalog-col_pos.I have the following code so far. It gives me error gd_sort is a table without header line and therefore has no component called Fieldname. I cannot add headerline to gd_sort as that will make the program to dump because of mismatch in data type. Any ideas?
gd_sort TYPE slis_t_sortinfo_alv,
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = repid
i_callback_user_command = 'USER_COMMAND'
is_layout = gd_layout
it_fieldcat = fieldcatalog
it_sort = gd_sort
it_events = gt_events
is_print = gd_prntparams
i_save = 'X'
TABLES
t_outtab = i_zopen_alv
EXCEPTIONS
program_error = 1
OTHERS = 2.
FORM build_sort.
gd_sort-fieldname = 'VBELN_VA'.
APPEND gd_sort.
ENDFORM. "build_sort -
On-click on ALV sum line to raise an event
Hello, ladies and gentlemen,
Happy New Year first of all.
I have a following problem: I have an ALV grid and in each line I have an icon, which one can on-click and something happens. That works fine. But now I was challenged to add a sum line which should support the same on-click event, but should process the data of all lines that belong to this SUM group in one batch.
Of course I can put in the "manual sum lines" - define groups that will support these sum lines and then add extra lines into the grid data. Unfortunatelly there is no way of telling which lines will belong to which group. I need the ALV standard summing so any user can define his own groups.
Has anybody ever tried such thing? I am using cl_gui_alv_grid OO ALV.
Thanks for any input,
cheers OttoHi Otto.
You can check the logic below. Please try to disable the sort functionality as done below in the ALV because the subtotals returned by the method get_subtotals is always sorted in ascending order.
report z335_alv_sel.
class lcl definition deferred.
type-pools: slis.
types:begin of t_data,
werks type werks_d,
labst type mard-labst,
end of t_data.
data :i_exclude type ui_functions,
i_fcat type slis_t_fieldcat_alv ,
i_sort type lvc_t_sort,
i_data type table of t_data,
i_cat type lvc_t_fcat,
wa_sort like line of i_sort,
wa_exclude type ui_func,
wa type t_data,
wa_cat type lvc_s_fcat,
cont type ref to cl_gui_custom_container,
grid type ref to cl_gui_alv_grid,
receiver type ref to lcl.
class lcl definition.
public section.
methods handle_click for event double_click of
cl_gui_alv_grid importing e_row
e_column.
endclass. "lcl DEFINITION
class lcl implementation.
method handle_click.
data:val(10) type n,
it type ref to data.
field-symbols: <ft_tab> type standard table,
<fs_tab> type any,
<ff_field> type any.
if e_row+0(1) = 'S'. "Subtotal
val = e_row+23(10).
call method grid->get_subtotals
importing
ep_collect01 = it.
assign it->* to <ft_tab>.
read table <ft_tab> assigning <fs_tab> index val.
if sy-subrc = 0.
assign component 1 of structure <fs_tab> to <ff_field>.
if <ff_field> is assigned.
loop at i_data into wa where werks = <ff_field>.
"Process your block Here
endloop.
endif.
endif.
endif.
endmethod. "handle_click
endclass. "lcl IMPLEMENTATION
start-of-selection.
call screen 100.
module fill_data output.
select werks labst from mard
into corresponding fields of table i_data
up to 1000 rows where labst > 0.
if sy-subrc = 0.
wa_cat-fieldname = 'WERKS'.
append wa_cat to i_cat.
clear wa_cat.
wa_cat-fieldname = 'LABST'.
wa_cat-do_sum = 'X'.
append wa_cat to i_cat.
clear wa_cat.
wa_sort-fieldname = 'WERKS'.
wa_sort-subtot = 'X'.
wa_sort-group = 'X'.
wa_sort-up = 'X'.
append wa_sort to i_sort.
wa_exclude = cl_gui_alv_grid=>mc_fc_sort .
append wa_exclude to i_exclude.
wa_exclude = cl_gui_alv_grid=>mc_fc_sort_asc .
append wa_exclude to i_exclude.
wa_exclude = cl_gui_alv_grid=>mc_fc_sort_dsc .
append wa_exclude to i_exclude.
endif.
endmodule. " fill_data OUTPUT
module display output.
if cont is initial .
create object cont
exporting
container_name = 'CONT1'.
create object grid
exporting
i_parent = cont.
call method grid->set_table_for_first_display
exporting
it_toolbar_excluding = i_exclude
changing
it_outtab = i_data[]
it_sort = i_sort[]
it_fieldcatalog = i_cat[].
create object receiver.
set handler receiver->handle_click for grid.
endif.
endmodule. "DISPLAY OUTPUT -
Hi,
Is it possible to have a heading for each group i have in alv.. ie.. if i give sort for 3 fields. say a , b and c.. and i giv group = 'UL'. but before each group displays i need to display some text. i cud do it using group = '*' and then write in top of page, but my user insists on getting this in a single page. is this possible?
hope I am clear with my requirement..
regards,
suzie
Edited by: Suzie on Dec 4, 2008 11:16 AM
Edited by: Suzie on Dec 4, 2008 6:00 PMREPORT ZBLOCK_ALV.
CONSTANTS :
c_x VALUE 'X'.
Macro definition
DEFINE m_fieldcat.
ls_fieldcat-fieldname = &1.
ls_fieldcat-ref_tabname = &2.
ls_fieldcat-tabname = &3.
append ls_fieldcat to lt_fieldcat.
END-OF-DEFINITION.
DEFINE m_sort.
ls_sort-fieldname = &1.
ls_sort-up = c_x.
append ls_sort to lt_sort.
END-OF-DEFINITION.
TYPE-POOLS: slis. " ALV Global types
TYPES:
1st Table
BEGIN OF ty_kna1,
kunnr TYPE kna1-kunnr, " Customer number
ernam TYPE kna1-ernam, " Name of Person who Created
erdat TYPE kna1-erdat, " Creation date
name1 TYPE kna1-name1, " Name 1 .
END OF ty_kna1,
2nd Table
BEGIN OF ty_mara,
matnr TYPE mara-matnr, " Material number
ernam TYPE mara-ernam, " Name of Person who Created
ersda TYPE mara-ersda, " Creation date
mtart TYPE mara-mtart, " Material type
matkl TYPE mara-matkl, " Material group
END OF ty_mara,
3rd Table
BEGIN OF ty_vbak,
vbeln TYPE vbak-vbeln, " Sales document
vkorg TYPE vbak-vkorg, " Sales organization
vtweg TYPE vbak-vtweg, " Distribution channel
kunnr TYPE vbak-kunnr, " Sold-to party
erdat TYPE vbak-erdat, " Creation date
END OF ty_vbak.
DATA:
gs_layout TYPE slis_layout_alv,
gt_kna1 TYPE TABLE OF ty_kna1,
gt_mara TYPE TABLE OF ty_mara,
gt_vbak TYPE TABLE OF ty_vbak.
SELECTION-SCREEN :
SKIP, BEGIN OF LINE,COMMENT 5(27) v_1 FOR FIELD p_max. "#EC NEEDED
PARAMETERS p_max(2) TYPE n DEFAULT '02' OBLIGATORY.
SELECTION-SCREEN END OF LINE.
INITIALIZATION.
v_1 = 'Maximum of records to read'.
START-OF-SELECTION.
Read data
SELECT kunnr ernam erdat name1
FROM kna1
UP TO p_max ROWS
INTO TABLE gt_kna1.
SELECT matnr ernam ersda mtart matkl
FROM mara
UP TO p_max ROWS
INTO TABLE gt_mara.
SELECT vbeln vkorg vtweg kunnr erdat
FROM vbak
UP TO p_max ROWS
INTO TABLE gt_vbak.
END-OF-SELECTION.
PERFORM f_display_data.
FORM USER_COMMAND *
FORM user_command USING u_ucomm TYPE sy-ucomm
us_selfield TYPE slis_selfield. "#EC CALLED
DATA:
ls_vbak TYPE ty_vbak.
CASE u_ucomm.
WHEN '&IC1'. " Pick
CASE us_selfield-tabname.
WHEN 'GT_MARA'.
WHEN 'GT_KNA1'.
WHEN 'GT_VBAK'.
READ TABLE gt_vbak INDEX us_selfield-tabindex INTO ls_vbak.
IF sy-subrc EQ 0.
SET PARAMETER ID 'AUN' FIELD ls_vbak-vbeln.
CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
ENDIF.
ENDCASE.
ENDCASE.
ENDFORM. " USER_COMMAND
Form f_display_data
FORM f_display_data.
DATA :
ls_fieldcat TYPE slis_fieldcat_alv,
lt_fieldcat TYPE slis_t_fieldcat_alv, " Field catalog
ls_sort TYPE slis_sortinfo_alv,
lt_sort TYPE slis_t_sortinfo_alv, " Sort table
lt_events TYPE slis_t_event,
ls_event TYPE slis_alv_event.
gs_layout-group_change_edit = c_x.
gs_layout-colwidth_optimize = c_x.
gs_layout-zebra = c_x.
gs_layout-detail_popup = c_x.
gs_layout-get_selinfos = c_x.
Build field catalog and sort table
m_fieldcat 'KUNNR' 'KNA1' 'GT_KNA1'.
m_fieldcat 'ERNAM' 'KNA1' 'GT_KNA1'.
m_fieldcat 'ERDAT' 'KNA1' 'GT_KNA1'.
m_fieldcat 'NAME1' 'KNA1' 'GT_KNA1'.
m_sort 'KUNNR'.
Build Event Table
MOVE 'TOP_OF_PAGE' TO ls_event-name.
MOVE 'TOP_OF_PAGE' TO ls_event-form.
APPEND ls_event TO lt_events.
MOVE 'END_OF_LIST' TO ls_event-name.
MOVE 'END_OF_LIST' TO ls_event-form.
APPEND ls_event TO lt_events.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-cprog
i_callback_user_command = 'USER_COMMAND'
it_fieldcat = lt_fieldcat
is_layout = gs_layout
it_events = lt_events
it_sort = lt_sort
i_save = 'A'
TABLES
t_outtab = gt_kna1.
ENDFORM. " F_DISPLAY_DATA
FORM top_of_page *
FORM top_of_page. "#EC CALLED
ULINE.
WRITE : sy-uname, sy-title(56) CENTERED, sy-datum.
ULINE.
ENDFORM. " TOP_OF_PAGE
FORM End_of_list *
FORM end_of_list. "#EC CALLED
DATA :
ls_fieldcat TYPE slis_fieldcat_alv,
lt_fieldcat TYPE slis_t_fieldcat_alv, " Field catalog
ls_sort TYPE slis_sortinfo_alv,
lt_sort TYPE slis_t_sortinfo_alv, " Sort table
lt_events TYPE slis_t_event,
ls_event TYPE slis_alv_event.
Build field catalog and sort table
m_fieldcat 'MATNR' 'MARA' 'GT_MARA'.
m_fieldcat 'ERNAM' 'MARA' 'GT_MARA'.
m_fieldcat 'ERSDA' 'MARA' 'GT_MARA'.
m_fieldcat 'MTART' 'MARA' 'GT_MARA'.
m_fieldcat 'MATKL' 'MARA' 'GT_MARA'.
m_sort 'MATNR'.
Build Event Table
MOVE 'END_OF_LIST' TO ls_event-name.
MOVE 'END_OF_LIST_2' TO ls_event-form.
APPEND ls_event TO lt_events.
gs_layout-list_append = c_x.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-cprog
it_fieldcat = lt_fieldcat
is_layout = gs_layout
it_sort = lt_sort
it_events = lt_events
i_save = 'A'
TABLES
t_outtab = gt_mara.
ENDFORM. " END_OF_LIST
FORM End_of_list_2 *
FORM end_of_list_2. "#EC CALLED
DATA :
ls_fieldcat TYPE slis_fieldcat_alv,
lt_fieldcat TYPE slis_t_fieldcat_alv, " Field catalog
ls_sort TYPE slis_sortinfo_alv,
lt_sort TYPE slis_t_sortinfo_alv, " Sort table
lt_events TYPE slis_t_event,
ls_event TYPE slis_alv_event.
Build field catalog and sort table
m_fieldcat 'VBELN' 'VBAK' 'GT_VBAK'.
m_fieldcat 'VKORG' 'VBAK' 'GT_VBAK'.
m_fieldcat 'VTWEG' 'VBAK' 'GT_VBAK'.
m_fieldcat 'KUNNR' 'VBAK' 'GT_VBAK'.
m_fieldcat 'ERDAT' 'VBAK' 'GT_VBAK'.
m_sort 'VBELN'.
Build Event Table
MOVE 'TOP_OF_PAGE' TO ls_event-name.
MOVE 'TOP_OF_PAGE' TO ls_event-form.
APPEND ls_event TO lt_events.
gs_layout-list_append = c_x.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-cprog
it_fieldcat = lt_fieldcat
is_layout = gs_layout
it_sort = lt_sort
it_events = lt_events
i_save = 'A'
TABLES
t_outtab = gt_vbak.
ENDFORM. " END_OF_LIST_2 -
when F2 is pressed in ALV, a pop-up window shows, giving the details of that table line.
how do I do the same in OO ALV report when F2 or double-click is used.Please find the code:
FORM sub_show_detail USING uw_check TYPE boole_d.
DATA: lt_fcat_main TYPE lvc_t_fcat,
lt_fcat TYPE lvc_t_fcat,
ls_fcat TYPE lvc_s_fcat,
ls_data TYPE lvc_s_deta,
ls_deta TYPE lvc_s_detm,
lw_layo TYPE lvc_s_layo,
lt_deta TYPE lvc_t_detm,
lw_main TYPE zfd0r_invoice_analysis_strc,
lw_count TYPE lvc_index,
lw_title TYPE string.
FIELD-SYMBOLS: <l_fcat> TYPE lvc_s_fcat,
<l_data> TYPE zfd0r_invoice_analysis_strc,
<l_cval> TYPE ANY,
<l_tval> TYPE ANY.
Get the Global Field Catalog.
lt_fcat_main = gt_fieldcat.
Delete entries based on Invoice or F2 Invoice
IF uw_check = abap_true.
DELETE lt_fcat_main WHERE emphasize EQ space
AND fieldname NE 'GERNR'.
lw_title = text-f30.
ELSE.
DELETE lt_fcat_main WHERE emphasize >< space.
lw_title = text-f29.
ENDIF.
Get the Detail Display Fieldcatalog
ls_fcat-fieldname = 'COLUMNTEXT'.
ls_fcat-ref_table = 'LVC_S_DETA'.
ls_fcat-key = abap_true.
ls_fcat-coltext = text-f27.
ls_fcat-outputlen = 20.
APPEND ls_fcat TO lt_fcat.
CLEAR ls_fcat.
ls_fcat-fieldname = 'VALUE'.
ls_fcat-ref_table = 'LVC_S_DETA'.
ls_fcat-coltext = text-f28.
ls_fcat-outputlen = 35.
APPEND ls_fcat TO lt_fcat.
CLEAR ls_fcat.
Define layout
lw_layo-no_toolbar = abap_true.
Fill the Main table
LOOP AT gt_main ASSIGNING <l_data>.
lw_count = lw_count + 1.
DO.
READ TABLE lt_fcat_main ASSIGNING <l_fcat> INDEX sy-index.
End of All Fields -> EXIT
IF sy-subrc >< 0.
EXIT.
ENDIF.
ASSIGN COMPONENT <l_fcat>-fieldname
OF STRUCTURE <l_data> TO <l_cval>.
IF sy-subrc = 0.
ls_data-columntext = <l_fcat>-scrtext_l.
ls_data-value = <l_cval>.
APPEND ls_data TO ls_deta-detailtab.
CLEAR: ls_data.
ENDIF.
ENDDO.
Generate the Index
ls_deta-blockindex = lw_count.
append the display data.
APPEND ls_deta TO lt_deta.
CLEAR: ls_deta.
ENDLOOP.
Call The Item Detail FM.
CALL FUNCTION 'LVC_ITEM_DETAIL'
EXPORTING
i_title = lw_title
it_fieldcatalog = lt_fcat
is_layout = lw_layo
TABLES
t_outtab = lt_deta.
Hope That Helps
Anirban M. -
How can I hide the marker button in an ALV GRID line?
Hi all,
I am switching an old program from ALV LIST to ALV GRID. In the old list, I put a checkbox on each line to abilify the user to mark some lines. However, there are some lines that I don't want the user to select. In the list, I set the field for the box name to "*" (asterisk) and in the list, the checkbox is not input enabled.
Now in the grid, this does not function any more. all lines are markable. How can I deactivate the marker function for some lines?
Greetings
JörgHi,
use the below snippet in your code
DATA: ls_celltab TYPE lvc_s_styl.
REFRESH pt_celltab.
IF p_mode EQ text-103.
*§2a.Use attribute CL_GUI_ALV_GRID=>MC_STYLE_ENABLED to set a cell
to status "editable".
ls_celltab-fieldname = c_character1.
ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
ls_celltab-style2 = cl_gui_alv_grid=>mc_style_f4.
INSERT ls_celltab INTO TABLE pt_celltab.
ls_celltab-fieldname = c_character2.
ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
ls_celltab-style2 = cl_gui_alv_grid=>mc_style_f4.
INSERT ls_celltab INTO TABLE pt_celltab.
ls_celltab-fieldname = c_character3.
ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
ls_celltab-style2 = cl_gui_alv_grid=>mc_style_f4.
INSERT ls_celltab INTO TABLE pt_celltab.
ls_celltab-fieldname = text-107.
ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
ls_celltab-style2 = cl_gui_alv_grid=>mc_style_f4.
INSERT ls_celltab INTO TABLE pt_celltab.
ls_celltab-fieldname = c_selectionid.
ls_celltab-style = cl_gui_alv_grid=>mc_style_disabled.
INSERT ls_celltab INTO TABLE pt_celltab.
Regards -
Grouped Line Chart in Crystal 10
I need some help with a line chart that has 4 lines on it (no problem there) but such that it shows a marker for every record AND is grouped left to right (on the X-Axis) into one of 5 categories. Basically each of the 5 X-Axis groupings can have a different number of points that will display in that section for each line. I've tried to use the "On change of..." setting using the category field and that does exactly what I want EXCEPT the markers/lines only work against summarized data instead plotting each marker and line within the grouping.
If that doesn't make sense, here's what I want the chart to do:
There are 5 levels of a job code that are the grouping I want. In each of those five levels, I want to show 3 lines and 4th line (as markers only) the represent the employees in each level...the lines are their level minimum, midpoint, and maximum and the markers are the actual salaries for each employee. Each of the 5 levels will have a different number of employees.
I've also tried (successfully) to do this with 5 sub-reports side by side so that each sub-report represents one of the groups and has the variable number of employee points/lines in each grouping however this means that I have to use a fixed Y-axis scale for all 5 sub-reports. To accommodate many different groups of jobs, this causes the line ranges to be really compressed so that there is little differentiation between the lines at the low end (minimum to maximum) and larger at the top end.
Basically I would like to find a way to do this with a single chart such that it will auto-scale the Y-axis to best display the data for that chart. Any tricks for this would be appreciated and let me know if you need any clarifications on this...it is a mouthful.The thing is the 5 job codes need to go across the page, side by side so that the users can see the progression from one job level to the next. I'm already grouping on the general or short job code which might be for an Accountant let's say. The person wants to see the 5 levels of Accountant (Entry Level, Account I, Accountant II, Accountant III, and Senior Accountant) jobs side by side with each group having 3 lines (Minimum, Midpoint, and Maximum) and a 4th line (actually showing "markers only" like a scatter chart) for each employee's salary in that job.
The whole page is like a job family (which is referred to as a "Short Job Code") with the each job level within that as groupings. This report actually has over 100 job families (i.e. pages) of up to 5 groupings per page.
As I mentioned, I can get this to work by putting the chart in a sub-report and using that sub-report 5 times across the page. The issue is I can't use automatic Y-axis scaling for them because each one of the 5 could decide to do its own scaling which would defeat the purpose of having them side by side.
I come really close to getting this all on one chart if I add the job level code (i.e. identifies each of the 5 levels on a page) to the top section of the Data tab in the Chart Expert as "On change of.." but then it does not show the markers for each employee's salary, but rather a summary.
My guess is I cannot do this with a single chart but will have to stick with the 5 sub-chart approach, but that is going to be rough since one job page may be in US $ and another job page may be in Yen.
THanks for the help on this. -
Finding Sum of grouped lines / Tables EKKO, EKPO
Hi, am using the following tables:
TABLES: ekko,ekpo.
with Inner Join
select ekkobukrs ekkoebeln ekkoaedat ekkobsart ekkoekgrp ekkolifnr ekkowaers ekkowkurs ekkoernam ekpobrtwr
into CORRESPONDING FIELDS OF TABLE itab from ekko
inner join EKPO on ekPOEBELN = ekkoebeln.
end-OF-SELECTION.
Basically i want to group the result of this SQL statement by Purchasing Doc (ekko~ebeln) and display the
sum of Gross value (ekpo~brtwr) for the line items of each Purchasing Doc.
Note: i want the Purchasing Doc to appear one time only in the report
i have tried the following :
select ekkobukrs ekkoebeln ekkoaedat ekkobsart ekkoekgrp ekkolifnr ekkowaers ekkowkurs ekkoernam sum( ekpobrtwr )
into CORRESPONDING FIELDS OF TABLE itab from ekko
inner join EKPO on ekPOEBELN = ekkoebeln
WHERE ekkobukrs IN S_bukrs AND ekkobsart IN s_bsart
Group By ekkoebeln ekkobukrs ekkoaedat ekkobsart ekkoekgrp ekkolifnr ekkowaers ekkowkurs ekko~ernam.
then loop through the ITAB:
LOOP at itab.
write:/ itab-bukrs under 'Company Code',
itab-ebeln UNDER 'PO-Number',
itab-aedat UNDER 'Date' ,
itab-bsart UNDER 'Doc-Type' ,
itab-ekgrp UNDER 'Purchase-Grp' ,
itab-lifnr UNDER 'Vendor' ,
itab-waers UNDER 'Currency',
itab-wkurs UNDER 'Rate' ,
itab-brtwr under 'Gross Value',
itab-ernam UNDER 'Created By'.
ENDLOOP.
but it is not working with me, am not able to show the result of sum( ekpo~brtwr ) am getting 0 in all lines
thanks a lot for your help" My Full Code.
TABLES: ekko,ekpo,ekbe,rbkp.
data: BEGIN OF itab OCCURS 0, "EKKO TABLE"
inco1 like ekko-inco1,
inco2 like ekko-inco2,
bukrs like ekko-bukrs,
ebeln like ekko-ebeln,
aedat like ekko-aedat,
bsart like ekko-bsart,
ekgrp like ekko-ekgrp,
lifnr like ekko-lifnr,
waers like ekko-waers,
wkurs like ekko-wkurs,
ernam like ekko-ernam,
BRTWR LIKE ekpo-brtwr,
end of itab.
SELECT-OPTIONS : s_bukrs FOR itab-bukrs OBLIGATORY,
s_ebeln for itab-ebeln ,
s_aedat FOR itab-aedat ,
s_bsart for itab-bsart ,
s_ekgrp FOR itab-ekgrp ,
s_lifnr FOR itab-lifnr ,
s_budat FOR jtab-budat ,
s_bewtp for jtab-bewtp .
DATA ProceesITAB LIKE SORTED TABLE OF ITAB WITH UNIQUE KEY TABLE LINE.
AT SELECTION-SCREEN on s_bukrs.
START-OF-SELECTION.
select ekkobukrs ekkoebeln ekkoaedat ekkobsart ekkoekgrp ekkolifnr ekkowaers ekkowkurs ekkoernam ekpobrtwr
into CORRESPONDING FIELDS OF TABLE itab from ekko
inner join EKPO on ekPOEBELN = ekkoebeln.
end-OF-SELECTION.
LOOP at itab.
write:/ itab-bukrs under 'Company Code',
itab-ebeln UNDER 'PO-Number',
itab-aedat UNDER 'Date' ,
itab-bsart UNDER 'Doc-Type' ,
itab-ekgrp UNDER 'Purchase-Grp' ,
itab-lifnr UNDER 'Vendor' ,
itab-waers UNDER 'Currency',
itab-wkurs UNDER 'Rate' ,
itab-brtwr under 'Gross Value',
itab-ernam UNDER 'Created By'.
ENDLOOP.
TOP-OF-PAGE.
write:/70 'Company'.
uline.
skip.
write:/5 'Company Code',25 'PO-Number',40 'Date',55 'Doc-Type',70 'Purchase-Grp',85 'Vendor',100 'Currency',115 'Rate',125 'Created By',
140 'Gross Value'.
ULINE.
SKIP.
Edited by: YasinN on Mar 24, 2010 9:45 AM -
Hi,
is it possible to split a Line in REUSE_ALV_LIST_DISPLAY?
Example Normal:
Line 1: MATNR MAKTX ZEINR ...
I want to have:
Line 1: MATNR MAKTX
Line 2: ZEINR
I don't want to use a Hierachie
thanks for help
Regards, DieterHi,
you can try with the Hierarchial alv list using the Fm <b>REUSE_ALV_HIERSEQ_LIST_DISPLAY</b>, also try to have a look in the Demo program <b>BALVHD01</b>.
Regards
vijay
Maybe you are looking for
-
Firewire 800 port no longer works
my time machine backup for years on my 2.8Ghz iMac Extreme has gone through the FW 800 port to the same WD drive. unfortunately i recently had backup failure issues, but did discover that it still worked through the FW 400 and USB ports (all of which
-
ITunes sync can't find a song but I can
I have a smart playlist that contains 771 songs. One of the songs is titled "Rock And Roll Strategy". In "iTunes Library.xml", it is assigned a track ID of 6121: <key>6121</key> <dict> <key>Track ID</key><integer>6121</integer> <key>Name</key><string
-
I know it can be done, How may I burn my cds and introduce the music to the icloud. I have a windows computer which makes it difficult but not impossible.
-
N8 rebooting all the time when entering programs f...
Hi, i got a nasty problem. My n8 keeps rebooting when i go too the folder where all my programs are... on the c drive there is 127 mb free so no memory shortage problem. I do think it might have to do with a program i installed when this started to
-
X11.app quits with any Keypress or pad movement
This was working a couple days ago. I have no idea what is causiing the problem and rally need help as I need to use X11. When I launch it, either double-click in the Finder or Click on its Dock Icon, I cn see that it is active. Then, if I touch the