Two dynamic ALV grid
Hi experts,
I am having a dynamic ALV grid. How to create a new grid(second grid) in the same page with different values?
Thanks&Regards,
vino
Add 2 view containers, create 2 different usages of AVL component and embed the view of these 2 alv components in 2 view containers..
Hope this helps
manas dua
Similar Messages
-
Create deep structure to disable some cells in Dynamic ALV GRID
Hi,
I want to disable some cells in a Dynamic ALV Grid before calling "SET_tABLE_Display" Method.
I check the BCALV_EDIT_02, where some cells are grayed out by assign the CL_GUI_ALV_GRID-MC_STYLE_DISABLED to the field name.
But I want the same using Field symbol.
I'm creating Dynamic table and dynamic structure based on the Dynamic field catalog.
Example: <FT_TAB> TYPE STANDARD TABLE,
<FS_TAB> TYPE ANY,
DATA: INT_TAB is my dynamic table values.
For the INT_TAB internal table, I created dynamic Structure and dynamic field symbol table.
LOOP AT INT_TAB.
ASSIGN COMPONENT 'MATNR' OF STRUCTURE <FS_TAB> TO <F_VALUE>
<F_VALUE> = INT_TAB-MATNR.
APPEND <FS_TAB> TO <FT_TAB>
"Here is the problem occurs, I want to grayed out the MATNR value based on some condition.
ENDLOOP.
I would like to set the 'MATNR' value to be grayed out by passing the CL_GUI_ALV_GRID-MC_STYLE_DISABLED.
and update into <FT_TAB>( <FT_TAB> structure will have 2 structures)
Finally the fieldsymbol should have two structure ( <F_TAB> = DYNAMIC STRUCTURE + LVC_S_STYLE )
Display alv grid by passing <FT_TAB> to set_table_display method.
Thanks in advance,
Kumar.Hi,
I am not sure whether I really understand your request. Let me try to help.
> Example: <FT_TAB> TYPE STANDARD TABLE,
> <FS_TAB> TYPE ANY,
>
> DATA: INT_TAB is my dynamic table values.
>
>
> LOOP AT INT_TAB.
> ASSIGN COMPONENT 'MATNR' OF STRUCTURE <FS_TAB> TO <F_VALUE>
> <F_VALUE> = INT_TAB-MATNR.
> APPEND <FS_TAB> TO <FT_TAB>
Here <FT_TAB> must already be assigned to some internal table with a given (dynamic) structure. Did this happen before this piece of code?
What I would do is to create a dynamic table (see documentation to CREATE DATA) with MATNR and the STYLE field (LVC_T_STYL). See the documentation for CREATE DATA - creation of internal tables. When collection the field descriptions for that internal table I would also build the field catalogue for the ALV.
Then assign <FT_TAB> to that newly created internal table, <FS_TAB> to a newly created structure (same as a table line).
Move the MATNR to component 1 (or component 'MATNR') of the table and fill the style table according to your needs. Then insert the <FS_TAB> into <FT_TAB>.
Finally call the ALV SET_TABLE... method with your dynamic table and your field catalogue.
Regards,
Gerd Rother -
Dynamic ALV Grid is not displaying !!
Hi all,
I am trying to create dynamic alv grids and upto five levels(five grids) out put is displaying fine without any problem. But when I try to display the 6th grid, the program is going into infinite loop and getting timed out. Even I tried to increse the height of the grid even though it is not displaying.
Please correct me if any thing is wrong in below code.
*1st Level grid
IF <table1> IS ASSIGNED AND <table1> IS NOT INITIAL.
CREATE OBJECT ob_split1
EXPORTING
parent = ob_custom
orientation = cl_gui_easy_splitter_container=>orientation_vertical.
PERFORM set_split_height USING ob_split1 '20'.
CREATE OBJECT ob_grid1
EXPORTING
i_parent = ob_split1->top_left_container.
ELSE.
CREATE OBJECT ob_split1
EXPORTING
parent = ob_custom
orientation = cl_gui_easy_splitter_container=>orientation_vertical.
PERFORM set_split_height USING ob_split1 '0'.
ENDIF.
*2nd Level grid
IF <table2> IS ASSIGNED AND <table2> IS NOT INITIAL.
CREATE OBJECT ob_split2
EXPORTING
parent = ob_split1->bottom_right_container
orientation = cl_gui_easy_splitter_container=>orientation_vertical.
PERFORM set_split_height USING ob_split2 '20'.
CREATE OBJECT ob_grid2
EXPORTING
i_parent = ob_split2->top_left_container.
ELSE.
CREATE OBJECT ob_split2
EXPORTING
parent = ob_split1->bottom_right_container
orientation = cl_gui_easy_splitter_container=>orientation_vertical.
PERFORM set_split_height USING ob_split2 '0'.
ENDIF.
(Created 3rd,4th,5th same like above).
*6th Level grid
IF <table6> IS ASSIGNED AND <table6> IS NOT INITIAL.
CREATE OBJECT ob_split6
EXPORTING
parent = ob_split5->bottom_right_container
orientation = cl_gui_easy_splitter_container=>orientation_vertical.
PERFORM set_split_height USING ob_split6 '20'.
CREATE OBJECT ob_grid6
EXPORTING
i_parent = ob_split6->top_left_container.
ELSE.
CREATE OBJECT ob_split6
EXPORTING
parent = ob_split5->bottom_right_container
orientation = cl_gui_easy_splitter_container=>orientation_vertical.
PERFORM set_split_height USING ob_split6 '0'.
ENDIF.
Appreciated your reply. Please let me know for additional info.
Thanks,
Ranjith.
Edited by: Thomas Zloch on Dec 8, 2010 5:44 PM - please use code tagsHi romanch,
defining the field catalog you must reference all currency fields to the respective currency key field (type CUKY).
<alv_fieldcat>-cfieldname = 'HWAER'.
This is sample for alv output of a currency field. The alv structure has a field HWAER which carries the currency key, e.g. USD or so.
Obviously you do not provide a cutrrency key for your values. If they are initial (zero), ALV will not display them as 0,00 but leave the field empty if the reference too currency key is not established.
If you define a DDIC structure for the ALV output this refernce is enforced. You can pass the DDIC structure name to the ALV and don not have to create the field catalog manually.
Regards,
Clemens -
Radio button in dynamic ALV grid
Hi guys!
I want to implement a dynamical ALV grid with a radiobutton in the first column.
when clicking a button, or processing the program i want to get the information of the selected row and perform other things....
Can someone help me with a code example for this, or just tell me where i can find the necessary information`?
regards
thomasHi,
I dont understand why you need Radio button, If you use REUSE_ALV_GRID_DISPLAY the output grid will by default allow you to select only one row.
see the program - BCALV_FULLSCREEN_DEMO for more information -
How to validate the columns in dynamic alv grid
Hi Friends,
I want to validatethe value of all the columens (min 1 and max 40) which i create dynamically in alv grid.
value must be between 0 and 1 only.
Please help ,, need urgently.method handle_data_changed.
data: ls_good type lvc_s_modi,
li_diff type i,
value type p DECIMALS 3,
old_value type p DECIMALS 3,
lw_outtab1 type gt_tab.
clear value.
loop at er_data_changed->mt_good_cells into ls_good.
value = ls_good-value.
old_value = ls_good-value.
if value lt 0 or value gt 1.
MESSAGE 'Value is out of range' TYPE 'I'.
Read table gt_outtab1 into lw_outtab1 index ls_good-row_id .
perform show_alv.
clear ls_good.
ENDIF.
ENDCASE.
ENDLOOP.
I again created the table.. actually data is not changed in the internal table but still it shows the changed value in the alv grid. even in build the table again and call the refersh alv grid method.. -
Dynamic ALV GRID screen in a class? Possible?
I have created a class(I have done it locally as to be able to use it for mutiple clients) that I include in programs that I want to implement the alv grid for using the FM approach. Doing this allows me to easily implement the ALV quickly. However, I am wanting to use the OO ALV grid approach since there is more flexibility and control doing it this way. But I do not want to have to create a screen for every program that I want to do this for, I would like to just have a method in my existing class that would call a screen and then be able to control it like normal. I know that screens can not be called from a method so I was thinking of doing something similiar to another post using a FM to call the screen. I realize that this could be complicated because certain methods for the ALV GRID are called in the PBO/PAI events. Any help or suggestions would be appreciated.
Note: I am on 6.20 and have searched all over the web before posting.
Thanks.Yes, i have written a function module which calls a generice ALV grid in a dialog box. Everything about the ALV grid is encapsulated in a function module. In this case, all I need to do is send this function module a fieldcatalog and the data, that's about it. Doing this may limit the functionality of event handling or you would just have to handle everything by doing more code for it.. This function module is very simple, not a whole lot to it. You could do something like this only instead of using a model dialog box, you would throw a regular dynpro.
function z_popup_with_alvgrid.
*"*"Global interface:
*" IMPORTING
*" REFERENCE(ENDPOS_COL) TYPE I DEFAULT 90
*" REFERENCE(ENDPOS_ROW) TYPE I DEFAULT 22
*" REFERENCE(STARTPOS_COL) TYPE I DEFAULT 10
*" REFERENCE(STARTPOS_ROW) TYPE I DEFAULT 2
*" REFERENCE(TEXTLINE1) TYPE C OPTIONAL
*" REFERENCE(TEXTLINE2) TYPE C OPTIONAL
*" REFERENCE(TEXTLINE3) TYPE C OPTIONAL
*" REFERENCE(TEXTLINE4) TYPE C OPTIONAL
*" REFERENCE(TITLE) TYPE C OPTIONAL
*" REFERENCE(FIELDCAT) TYPE LVC_T_FCAT
*" TABLES
*" I_ALV
call screen 0200 starting at startpos_col
startpos_row
ending at endpos_col
endpos_row.
endfunction.
* Module STATUS_0200 OUTPUT
module status_0200 output.
set pf-status '0200'.
set titlebar '0200' with title.
data: alv_container type ref to cl_gui_custom_container.
data: alv_grid type ref to cl_gui_alv_grid.
data: xfieldcat type lvc_t_fcat.
xfieldcat = fieldcat.
* Create Controls
create object:
alv_container
exporting
container_name = 'ALV_CONTAINER',
alv_grid
exporting
i_parent = alv_container.
* Set grid for first display
call method alv_grid->set_table_for_first_display(
exporting
i_structure_name = 'I_ALV'
changing
it_outtab = i_alv[]
it_fieldcatalog = xfieldcat[] ).
endmodule.
* Module USER_COMMAND_0100 INPUT
module user_command_0200 input.
case sy-ucomm.
when 'CONTINUE' or 'CANCEL'.
set screen 0.
leave screen.
endcase.
endmodule.
Regards,
Rich Heilman -
Hi experts,
I have a ALV Grid display, for example I selected 2 rows out of 5 from the display ALV, then I have a footer which contains: number of line items selected : v_no_lines. The v_no_lines is the number of rows selected from the display ALV which is 2. The total number of line items selected should be displayed on the bottom section of the ALV Grid.DATA:wf_data TYPE REF TO data,
wf_str TYPE REF TO data.
DATA: wf_alv TYPE REF TO cl_salv_table.
FIELD-SYMBOLS:<fs_tab> TYPE STANDARD TABLE,
<fs_line> TYPE ANY,
<fs_f> TYPE ANY,
<fs_t> TYPE ANY..
CALL FUNCTION 'CLAF_CLASSIFICATION_OF_OBJECTS'
EXPORTING
class = 'ENG-DATA-METALS'
classtext = ' '
classtype = 'Z03'
features = 'X'
language = sy-langu
object = '338127-1'
objecttable = 'MARA' "tcla-obtab
key_date = sy-datum
initial_charact = ' '
change_service_clf = ' '
inherited_char = ' '
change_number = ' '
TABLES
t_class = i_sclass[]
t_objectdata = i_object[]
EXCEPTIONS
no_classification = 1
no_classtypes = 2
invalid_class_type = 3
OTHERS = 4.
CHECK sy-subrc = 0.
lines = LINES( i_object ). -
Two ALV Grid in the same screeen
Hi,
I have created a module pool with a screen.
In this screen I have defined two customer objects and I dipslay two different ALV grid.
DATA: grid_1 TYPE REF TO cl_gui_alv_grid,
grid_2 TYPE REF TO cl_gui_alv_grid.
When the user puts the values into the field in both lists and pushes "enter", the program gets the input value by method
"get_selected_rows". It works only for the list where there is the cursor.
I need to read the value of each list at the same moment.
Thanks in advance
Marco*& Report Z7CC_ALV_OOPS_TWO_ALV_SCREENS *
report z7cc_alv_oops_two_alv_screens .
* TEMP DECLARATION TYPE DECLARATIONS
* Structure for Sales Order
types: begin of y_vbak ,
vbeln type vbeln_va ,
end of y_vbak ,
* Structure for Sales Order Details.
begin of y_vbap ,
vbeln type vbeln_va ,
posnr type posnr_va ,
matnr type matnr ,
charg type charg_d ,
arktx type arktx ,
end of y_vbap ,
*& Structure of line item ----------
begin of y_po_item,
ebeln type ekko-ebeln, " PO NUMBER
ebelp type ekpo-ebelp, "LINE ITEM
matnr like ekpo-matnr, " Material Number
netpr like ekpo-netpr, " Price per unit.
menge like ekpo-menge, " Purchase order quantity.
netwr like ekpo-netwr, " Net order in Purchase order currency
meins like ekpo-meins, " UOM
end of y_po_item.
data: t_y_po_item type standard table of y_po_item.
data: w_container_1 type ref to cl_gui_container .
data: t_vbap type standard table of y_vbap.
*--------- END OF TEMP DECLARATION ------------
data: ok_code like sy-ucomm.
*-- Global data definitions for ALV
*--- ALV Grid instance reference
data gr_alvgrid type ref to cl_gui_alv_grid .
*--- Name of the custom control added on the screen
data gc_custom_control_name type scrfname value 'Z7CC_ALV2' .
*--- Custom container instance reference
data gr_ccontainer type ref to cl_gui_custom_container .
*--- Field catalog table
data gt_fieldcat type lvc_t_fcat .
data gt_fieldcat_2 type lvc_t_fcat .
*--- Layout structure
data gs_layout type lvc_s_layo .
*&------- DECLARATION FOR THE NEXT SCREEN ------------------
*--- ALV Grid instance reference
data gr_alvgrid_2 type ref to cl_gui_alv_grid .
*--- Name of the custom control added on the screen-----------
data gc_custom_control_name_2 type scrfname value 'Z7CC_ALV' .
*--- Custom container instance reference
data gr_ccontainer_2 type ref to cl_gui_custom_container .
*Declare your internal table which is supposed to hold the list data.
*&Lets name it gt_list.
*Here is an example declaration.
*--- Internal table holding list data
data begin of gt_list occurs 0.
data matnr like mara-matnr.
data maktx like makt-maktx.
data end of gt_list .
data: begin of gt_list_2 occurs 0.
include structure z7cc_po_header.
data: linecolor(4) type c, "Color for corresponding line
end of gt_list_2.
data: t_gt_list_2 type standard table of z7cc_po_header.
*----- CLASS DECLARATION ------
* FIELD-SYMBOLS
field-symbols <fs_vbap> type y_vbap.
field-symbols <fs_gt_list_2> type z7cc_po_header.
class lcl_event_receiver definition deferred.
data w_event_receiver type ref to lcl_event_receiver.
* Creating a class definition for handling events on the ALV Grid.
class lcl_event_receiver definition.
public section.
methods: handle_top_of_page for event top_of_page
of cl_gui_alv_grid
importing e_dyndoc_id,
handle_hotspot_click for event hotspot_click
of cl_gui_alv_grid
importing e_row_id,
handle_toolbar_event for event toolbar
of cl_gui_alv_grid
importing e_object,
handle_user_command for event user_command
of cl_gui_alv_grid
importing e_ucomm.
endclass. "lcl_event_receiver DEFINATION
* Implementing the Class for handling events on the ALV Grid.
class lcl_event_receiver implementation.
method handle_top_of_page.
perform show_top_of_page using e_dyndoc_id w_container_1.
endmethod. "handle_top_of_page
method handle_hotspot_click.
perform show_hotspot_click_details using e_row_id.
endmethod. "lcl_event_receiver
method handle_toolbar_event.
perform create_alv_toolbar using e_object.
endmethod. "handle_toolbar_event
method handle_user_command.
perform handle_user_command using e_ucomm.
endmethod. "handle_user_command
endclass. "lcl_event_receiver IMPLEMENTATION
data: w_grid type ref to cl_gui_alv_grid .
*-------- END OF CLASS DECLARATION -------------
start-of-selection.
perform populate_table.
call screen 100.
*& Module STATUS_0100 OUTPUT
* text
module status_0100 output.
set pf-status 'Z7CC_ALV1'.
* SET TITLEBAR 'xxx'.
endmodule. " STATUS_0100 OUTPUT
*& Module DISPLAY_ALV OUTPUT
* text
module display_alv output.
perform display_alv.
endmodule. " DISPLAY_ALV OUTPUT
*& Form POPULATE_TABLE
* text
* --> p1 text
* <-- p2 text
form populate_table .
select ebeln ebelp matnr netpr menge netwr meins into corresponding fields of table t_y_po_item
from ekpo.
select ekko~ebeln ekko~bukrs ekko~aedat ekko~ernam
ekko~lifnr ekko~zterm ekko~angnr into corresponding fields of
table t_gt_list_2 from ekko .
endform. " POPULATE_TABLE
*& Form DISPLAY_ALV
* text
* --> p1 text
* <-- p2 text
form display_alv .
if gr_alvgrid is initial .
perform create_first_obj_container.
*&----------- ONE MORE CONTROL ON THE SCREEN-------------------
perform create_second_obj_container.
" DISPLAY_ALV
* Creating ALV Grid instance
perform create_first_alvgrid.
perform create_second_alvgrid.
* PERFORM FIELD_CATALOG. " CREATE A FIELD CATALOG.
perform field_cat changing gt_fieldcat.
perform field_cat_1 changing gt_fieldcat_2.
*----Here will be additional preparations
*--e.g. initial sorting criteria, initial filtering criteria, excluding
*--functions
perform call_mthd_display_both_grid.
*&--------- create a field catalog.------------
perform event_handling.
else.
*&-----------CALL ALV GRID REFRESH TABLE DISPLAY
perform call_mthd_alv_refresh.
endif.
endform. "DISPLAY_ALV
*& Module USER_COMMAND_0100 INPUT
* text
module user_command_0100 input.
endmodule. " USER_COMMAND_0100 INPUT
*& Form EXIT_PROGRAM
* text
* --> p1 text
* <-- p2 text
form exit_program .
leave program.
endform. " EXIT_PROGRAM
*& Module PAI INPUT
* text
module pai input.
case ok_code.
when '&EXT'.
perform exit_program.
when others.
* do nothing
endcase.
clear ok_code.
endmodule. " PAI INPUT
*& Form CREATE_FIRST_OBJ_CONTAINER
* text
* --> p1 text
* <-- p2 text
form create_first_obj_container .
create object gr_ccontainer
exporting
container_name = gc_custom_control_name
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. " CREATE_FIRST_OBJ_CONTAINER
*&---------------------------------------- -
ABAP Query - ALV Grid Calculation
Can anybody tell me whether in ABAP Query when you execute the Query in SQ01 its shows the report in ALV Grid format. In ALV Grid format there are some standard calculation are available like
TOtal
Mean value
Minmum
Maximum
Count
The above calculation can be done for each column.
My Query is it possible to put our own simple calculation
through some coding for overall summation fields instead of this std. calculation.
Example : Unrestricted moved Qty Summation divided by INspection lot qty summation * 100
The output of this calculation is called First pass yield.
This calculation i done for each line item by creating a Additional field with ABAP coding.The overall meanvalue calcualtion of this addtional fields column is not suits the customer expectation.They want the calculation to be done by the system like what i had explained in the example.Hi,
Here is a code for a single grid.
In the screen layout,make a custom container (Icon with C ) and name it in Capital letters as CONTAINER.The code below in bold letters is what exactly you want.I ve given a small example on how to use ALV:
REPORT SAMPLE.
DATA: alv type ref to cl_gui_alv_GRID,
cont type ref to cl_gui_custom_container,
itab_spfli type table of spfli.
START-OF-SELECTION.
select * from spfli into table itab_spfli.
call screen 100.
END-OF-SELECTION.
*& Module STATUS_0100 OUTPUT
text
MODULE STATUS_0100 OUTPUT.
seT PF-STATUS 'GUI'.
SET TITLEBAR 'xxx'.
if cont is initial.
CREATE OBJECT cont
EXPORTING
CONTAINER_NAME = 'CONTAINER'.
CREATE OBJECT ALV
EXPORTING
I_PARENT = CONT.
CALL METHOD ALV->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
I_STRUCTURE_NAME = 'SPFLI'
CHANGING
IT_OUTTAB = itab_spfli
Now for your requirement,you can create two custom containers in the screen layout and two different alv grid instances.ie:
DATA: alv1 type ref to cl_gui_alv_GRID,
cont1 type ref to cl_gui_custom_container
alv2 type ref to cl_gui_alv_GRID,
cont2 type ref to cl_gui_custom_container.
To select data from first grid,you can use events on double_click and fetch information and then display it in the second grid.
<b>SOME MATERIAL REGARDING ALV:</b>
www.abap4.it/download/ALV.pdf <b>(very useful)</b>
http://www.sapdevelopment.co.uk/reporting/alvhome.htm
<b>-->download the PDF from following link.</b>
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVALV/BCSRVALV.pdf
http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_color.htm
<b>SAMPLE PROGRAMS IN ALV:</b>http://www.geocities.com/victorav15/sapr3/abap_ood.html#d_grid
<b>DEMO PROGRAMS IN ALV:</b>BCALV*
Regards,
Beejal
**Reward if this helps -
Hi Experts,
i have one requirement. i need to Develop Alvgrid in one Screen.in the Same Screen another Grid.in First i need to Display Summary information.if we Double Click on First Grid of line Detail output of paricular contract.How to Acheive using classes.
plz send me the material Regarding this.and give me Some examples.How to approach.
Thanks,
Venkat.Hi,
Here is a code for a single grid.
In the screen layout,make a custom container (Icon with C ) and name it in Capital letters as CONTAINER.The code below in bold letters is what exactly you want.I ve given a small example on how to use ALV:
REPORT SAMPLE.
DATA: alv type ref to cl_gui_alv_GRID,
cont type ref to cl_gui_custom_container,
itab_spfli type table of spfli.
START-OF-SELECTION.
select * from spfli into table itab_spfli.
call screen 100.
END-OF-SELECTION.
*& Module STATUS_0100 OUTPUT
text
MODULE STATUS_0100 OUTPUT.
seT PF-STATUS 'GUI'.
SET TITLEBAR 'xxx'.
if cont is initial.
CREATE OBJECT cont
EXPORTING
CONTAINER_NAME = 'CONTAINER'.
CREATE OBJECT ALV
EXPORTING
I_PARENT = CONT.
CALL METHOD ALV->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
I_STRUCTURE_NAME = 'SPFLI'
CHANGING
IT_OUTTAB = itab_spfli
Now for your requirement,you can create two custom containers in the screen layout and two different alv grid instances.ie:
DATA: alv1 type ref to cl_gui_alv_GRID,
cont1 type ref to cl_gui_custom_container
alv2 type ref to cl_gui_alv_GRID,
cont2 type ref to cl_gui_custom_container.
To select data from first grid,you can use events on double_click and fetch information and then display it in the second grid.
<b>SOME MATERIAL REGARDING ALV:</b>
www.abap4.it/download/ALV.pdf <b>(very useful)</b>
http://www.sapdevelopment.co.uk/reporting/alvhome.htm
<b>-->download the PDF from following link.</b>
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVALV/BCSRVALV.pdf
http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_color.htm
<b>SAMPLE PROGRAMS IN ALV:</b>http://www.geocities.com/victorav15/sapr3/abap_ood.html#d_grid
<b>DEMO PROGRAMS IN ALV:</b>BCALV*
Regards,
Beejal
**Reward if this helps -
User Command in Dynamic ALV Display
Hi,
I have an requirement where i'm displaying Dynamic ALV grid by calling the method by passing the field Symbol in it_outtab parameter:
CALL METHOD cl_gui_alv_grid->set_table_for_first_display
For this i'm creating a custom container in my screen container
CREATE OBJECT cl_gui_custom_container
EXPORTING container_name = lv_container.
Now in the output every record is having a checkbox in the end.Now if the user check this checkbox n clicks on push button(added in Application toolbar) then this record should be kept and rest all the records should be deleted.
This can be done if an internal table is passed to the method as the field symbol doesnt hold any data after the output is displayed.
Is there any solution where this can be made possible.
Thanks in advance.
Sheetaltry this ..
before displaying ALV , store all the data in the fieldsymbol into another internal table
then display ALV with field symbol
after u click the pushbutton , get the seleted rows into another table using get_selected rows,
now again call CALL METHOD cl_gui_alv_grid->set_table_for_first_display
and give the new selected rows of internal table and refresh the grid -
Need to display two ALV GRIDs in a single screen
Hi,
I have a question, i'm using version 4.6. I want to display 2 ALVs in a single screen or by calling.
Step 1 : The internal table (which holds the data for the ALVs has to be populated before calling ALV1 or ALV2)
Step 2 : Display In a single report
ALV1 report (Editable ,Has to be a GRID)
ALV2 report (Non Editable, Has to be a GRID)
(or)
Step 1 : The internal table (which holds the data for the ALVs has to be populated before calling ALV1 or ALV2)
Step 2 :
ALV1 report (Editable ,Has to be a GRID, with a custom button to call ALV2 hiding the ALV1 ie not visible to user)
ALV2 report (Non Editable ,Has to be a GRID, with a custom button to call ALV1 hiding the ALV2 ie not visible to user)
Please help me <b><REMOVED BY MODERATOR></b>
Message was edited by:
Alvaro Tejada GalindoHi
ABAP List Viewer
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
The common features of report are column alignment, sorting, filtering, subtotals, totals etc. To implement these, a lot of coding and logic is to be put. To avoid that we can use a concept called ABAP List Viewer (ALV).
This helps us to implement all the features mentioned very effectively.
Using ALV, We can have three types of reports:
1. Simple Report
2. Block Report
3. Hierarchical Sequential Report
There are some function modules which will enable to produce the above reports without much effort.
All the definitions of internal tables, structures and constants are declared in a type-pool called SLIS.
1. SIMPLE REPORT.
The important function modules are
a. Reuse_alv_list_display
b. Reuse_alv_fieldcatalog_merge
c. Reuse_alv_events_get
d. Reuse_alv_commentary_write
e. Reuse_alv_grid_display
A. REUSE_ALV_LIST_DISPLAY : This is the function module which prints the data.
The important parameters are :
I. Export :
i. I_callback_program : report id
ii. I_callback_pf_status_set : routine where a user can set his own pf status or change the functionality of the existing pf status
iii. I_callback_user_command : routine where the function codes are handled
iv. I_structure name : name of the dictionary table
v. Is_layout : structure to set the layout of the report
vi. It_fieldcat : internal table with the list of all fields and their attributes which are to be printed (this table can be populated automatically by the function module REUSE_ALV_FIELDCATALOG_MERGE
vii. It_events : internal table with a list of all possible events of ALV and their corresponding form names.
II. Tables :
i. t_outtab : internal table with the data to be output
B. REUSE_ALV_FIELDCATALOG_MERGE : This function module is used to populate a fieldcatalog which is essential to display the data in ALV. If the output data is from a single dictionary table and all the columns are selected, then we need not exclusively create the field catalog. Its enough to mention the table name as a parameter(I_structure name) in the REUSE_ALV_LIST_DISPLAY. But in other cases we need to create it.
The Important Parameters are :
I. Export :
i. I_program_name : report id
ii. I_internal_tabname : the internal output table
iii. I_inclname : include or the report name where all the dynamic forms are handled.
II Changing
ct_fieldcat : an internal table with the type SLIS_T_FIELDCAT_ALV which is
declared in the type pool SLIS.
C. REUSE_ALV_EVENTS_GET : Returns table of possible events for a list type
Parameters :
I. Import :
Et_Events : The event table is returned with all possible CALLBACK events
for the specified list type (column 'NAME'). For events to be processed by Callback, their 'FORM' field must be filled. If the field is initialized, the event is ignored. The entry can be read from the event table, the field 'FORM' filled and the entry modified using constants from the type pool SALV.
II. Export :
I_List_type :
0 = simple list REUSE_ALV_LIST_DISPLAY
1 = hierarchcal-sequential list REUSE_ALV_HIERSEQ_LIST_DISPLAY
2 = simple block list REUSE_ALV_BLOCK_LIST_APPEND
3 = hierarchical-sequential block list
REUSE_ALV_BLOCK_LIST_HS_APPEND
D. REUSE_ALV_COMMENTARY_WRITE : This is used in the Top-of-page event to print the headings and other comments for the list.
Parameters :
I. it_list_commentary : internal table with the headings of the type slis_t_listheader.
This internal table has three fields :
Typ : H header, S selection , A - action
Key : only when typ is S.
Info : the text to be printed
E. REUSE_ALV_GRID_DISPLAY : A new function in 4.6 version, to display the results in grid rather than as a preview.
Parameters : same as reuse_alv_list_display
This is an example for simple list.
2. BLOCK REPORT
This is used to have multiple lists continuously.
The important functions used in this report are:
A. REUSE_ALV_BLOCK_LIST_INIT
B. REUSE_ALV_BLOCK_LIST_APPEND
C. REUSE_ALV_BLOCK_LIST_HS_APPEND
D. REUSE_ALV_BLOCK_LIST_DISPLAY
A. REUSE_ALV_BLOCK_LIST_INIT
Parameters:
I. I_CALLBACK_PROGRAM
II. I_CALLBACK_PF_STATUS_SET
III. I_CALLBACK_USER_COMMAND
This function module is used to set the default gui status etc.
B. REUSE_ALV_BLOCK_LIST_APPEND
Parameters :
Export :
I. is_layout : layout settings for block
II. it_fieldcat : field catalog
III. i_tabname : internal table name with output data
IV. it_events : internal table with all possible events
Tables :
i. t_outtab : internal table with output data.
This function module adds the data to the block.
Repeat this function for all the different blocks to be displayed one after the other.
C. REUSE_ALV_BLOCK_LIST_HS_APPEND
This function module is used for hierarchical sequential blocks.
D. REUSE_ALV_BLOCK_LIST_DISPLAY
Parameters : All the parameters are optional.
This function module display the list with data appended by the above function.
Here the functions REUSE_ALV_FIELDCATALOG_MERGE, REUSE_ALV_EVENTS_GET, REUSE_ALV_COMMENTARY_WRITE can be used.
3. Hierarchical reports :
Hierarchical sequential list output.
The function module is
A. REUSE_ALV_HIERSEQ_LIST_DISPLAY
Parameters:
I. Export:
i. I_CALLBACK_PROGRAM
ii. I_CALLBACK_PF_STATUS_SET
iii. I_CALLBACK_USER_COMMAND
iv. IS_LAYOUT
v. IT_FIELDCAT
vi. IT_EVENTS
vii. i_tabname_header : Name of the internal table in the program containing the
output data of the highest hierarchy level.
viii. i_tabname_item : Name of the internal table in the program containing the
output data of the lowest hierarchy level.
ix. is_keyinfo : This structure contains the header and item table field
names which link the two tables (shared key).
II. Tables
i. t_outtab_header : Header table with data to be output
ii. t_outtab_item : Name of the internal table in the program containing the
output data of the lowest hierarchy level.
slis_t_fieldcat_alv : This internal table contains the field attributes. This internal table can be populated automatically by using REUSE_ALV_FIELDCATALOG_MERGE.
Important Attributes :
A. col_pos : position of the column
B. fieldname : internal fieldname
C. tabname : internal table name
D. ref_fieldname : fieldname (dictionary)
E. ref_tabname : table (dictionary)
F. key(1) : column with key-color
G. icon(1) : icon
H. symbol(1) : symbol
I. checkbox(1) : checkbox
J. just(1) : (R)ight (L)eft (C)ent.
K. do_sum(1) : sum up
L. no_out(1) : (O)blig.(X)no out
M. outputlen : output length
N. seltext_l : long key word
O. seltext_m : middle key word
P. seltext_s : short key word
Q. reptext_ddic : heading (ddic)
R. ddictxt(1) : (S)hort (M)iddle (L)ong
S. datatype : datatype
T. hotspot(1) : hotspot
Regards
Anji -
How can I get the selected rows from two ALV grids at the same time?
I have a program that uses two ALV grids in one dialog screen. I'm using the OO ALV model (SALV* classes).
The user can select any number of rows from each grid. Then, when a toolbar pushbutton is pressed, I'd have to retrieve the selected rows from both grids and start some processing with these rows.
It is no problem to assign event handlers to both grids, and use the CL_SALV_TABLE->GET_SELECTIONS and CL_SALV_SELECTIONS->GET_SELECTED_ROWS methods to find out which rows were marked by the user. Trouble is, this only works when I raise an event in each grid separately, for instance via an own function that I added to the grid's toolbar. So, I can only see the selected rows of the same grid where such an event was raised.
If I try to do this in the PBO of the dialog screen (that contains the two grids), the result of CL_SALV_SELECTIONS->GET_SELECTED_ROWS will be empty, as the program does not recognize the marked entries in the grids. Also, an event for grid1 does not see the selected rows from grid2 either.
As it is right now, I can have an own button in both grid's toolbar, select the rows, click on the extra button in each grid (this will tell me what entries were selected per grid). Then, I'd have to click on a third button (the one in the dialog screen's toolbar), and process the selected rows from both grids.
How can I select the rows, then click on just one button, and process the marked entries from both grids?
Is it somehow possible to raise an event belonging to each grid programmatically, so that then the corresponding CL_SALV_SELECTIONS->GET_SELECTED_ROWS will work?
Thanks.Hello Tamas ,
If I try to do this in the PBO of the dialog screen (that contains the two grids), the result of CL_SALV_SELECTIONS->GET_SELECTED_ROWS will be empty, as the program does not recognize the marked entries in the grids. Also, an event for grid1 does not see the selected rows from grid2 either.--->
is it possible to have a check box in each grid & get the selected lines in PAI of the screen ?
regards
prabhu -
Taking download into excel from ALV Grid - header is printing in two lines
Hi All,
I have a scenario where I am taking the download from ALV grid to an excel sheet. Now the header of the ALV (column names) is appearing in two lines in the downloaded excel sheet while items (records of the ALV table) are getting displayed in a single line.
This download is taken from the standard download to local file (spreadsheet) button provided by SAP for ALVs.
I am using function module "Reuse_alv_grid_display" for the purpose.
Can somebody provide an idea how I can avoid the header printing in two lines and keep the length as it is.
Thanks in Advance,
ChandanHi..
1. Pass header name in internal table appned first line.
2. after that pass u r data .
3. Use FM. WS_DOWNLOAD
Salil ......
Edited by: salil chavan on Nov 26, 2008 11:07 AM -
How to download only some fields(dynamically) from alv grid layouts
I have ALV grid list.
I have layouts for selecting sets of fields dynamically.
If I select a particular layout, I want to download only those fields into an Excel sheet.
If I select another layout, I want to download only fields of that layout , into an Excel sheet.
Can u plz write examples.
NarendraHello ,
Here it is.
FIELD-SYMBOLS <FS> TYPE ANY.
DATA: GR_ATTACHMENT TYPE Z48S3_ATTACHMENT,
GT_ATTACHMENT TYPE Z48S3_ATTACHMENT_TAB,
L_F_TITLE TYPE SO_OBJ_DES,
L_R_FIELDCAT LIKE LINE OF GT_FIELDCAT,
L_F_FIELD LIKE L_R_FIELDCAT-FIELDNAME,
L_F_EMAILID TYPE Z48S3_RECEIVER,
L_F_FIRST TYPE C.
IF SY-SYSID EQ G_C_DEV_SYSTEM OR
SY-SYSID EQ G_C_QUA_SYSTEM.
CONCATENATE SY-SYSID '/' SY-MANDT ':' INTO L_F_TITLE.
CONDENSE L_F_TITLE.
CONCATENATE L_F_TITLE SY-TITLE INTO L_F_TITLE SEPARATED BY SPACE.
ELSE.
L_F_TITLE = SY-TITLE.
ENDIF.
G_R_VARIANT-REPORT = SY-REPID.
G_R_VARIANT-VARIANT = P_VARIAN.
CALL FUNCTION 'REUSE_ALV_VARIANT_SELECT'
EXPORTING
I_DIALOG = 'N'
I_USER_SPECIFIC = 'A'
I_DEFAULT = 'X'
IT_DEFAULT_FIELDCAT = G_T_FIELDCAT
I_LAYOUT = GR_LAYOUT
IMPORTING
ET_FIELDCAT = G_T_FIELDCAT
ES_LAYOUT = GR_LAYOUT
CHANGING
CS_VARIANT = G_R_VARIANT
EXCEPTIONS
ERROR_MESSAGE = 4
OTHERS = 4.
SORT G_T_FIELDCAT BY COL_POS.
PERFORM CREATE_EXCEL_ATTM_HEADING_ROW TABLES GT_ATTACHMENT
G_T_FIELDCAT.
LOOP AT G_T_ALVLIST.
L_F_FIRST = 'X'.
LOOP AT G_T_FIELDCAT INTO L_R_FIELDCAT WHERE NO_OUT IS INITIAL.
CLEAR GR_ATTACHMENT-XNEWLINE.
IF NOT L_F_FIRST IS INITIAL.
GR_ATTACHMENT-XNEWLINE = 'X'.
CLEAR L_F_FIRST.
ENDIF.
CLEAR L_F_FIELD.
CONCATENATE 'G_T_ALVLIST-' L_R_FIELDCAT-FIELDNAME
INTO L_F_FIELD.
CONDENSE L_F_FIELD.
ASSIGN (L_F_FIELD) TO <FS>.
WRITE <FS> TO GR_ATTACHMENT-FIELDVALUE.
UNASSIGN <FS>.
APPEND GR_ATTACHMENT TO GT_ATTACHMENT.
ENDLOOP.
ENDLOOP.
Regards,
Vasanth
Maybe you are looking for
-
Changing The Text Color In a Radio Button Component
Hi, I'm using a background in my frame , so I need to know how to change the color of the Radio Button Component. I tried using the Property Inspector , but in that the color option is disabled. The Flash version I'm using is Flash 8. Kindly provide
-
MBP lagging, browsers not loading pages
I have a MBP (late 2011), 2.4 GHz, 4 GB, 500GB ST9500325ASG Media, OS 10.9.5. A few days ago Safari started lagging (wheel of death), google pages would not load, and could not connect to google drive/mail. Only after a restart things would work norm
-
Can jmf control 4 ports input from falcon plus framegrabber card?
Hihi, I am not sure if the jmf can be used to control or stream video from a frame grabber card with 4 ports? this is falcon plus card from ids-imaging. can some one help me to solve my doubt? thanks.
-
Discoverer Plus connecting error
Dear All, I installed O9iAS release 2 BI installation type successfully but when i tried to invoke discoverer plus for the first time i got the following error : CORBA protocol error : Failed to connect to session <server_name>OracleDiscoverer sessio
-
Subcontracting ISSUE(any standared is available)
HI All Im doing subcontracting process.Im facing 2 problems here im not finding any SAP std to restrict this 2..plz give help how to do.. 1)Im doing MB1B(541 MOV TYPE) With respect to PO number.vendor automatically fetches from PO,but system allows t