Delete Selected rows in ALV display
Hi everyone,
I have a requirement where in my output display, I will have 3 buttons, like Select all, Deselect all and Delete selected.
For Select all and Deselect all I am able to write code and they are working fine. But for Delete selected I am not getting
its actual functionality in the output.
Please help me in this and provide some part of code which can fulfill this.
Regards.
Moderator Message: FAQ. Explore the already given answers and search the forum and the web for more.
Edited by: kishan P on Sep 15, 2010 12:45 PM
Hi Dieter,
I think the problem is smwhr else...Delete is a stanard functionality in the ALV Grid and would not fire your own code...
@Latha: I guess the row is getting deleted but your functionality is not working..If that is right then follow this approach:
When u delete a row it doesnot call your event handler and hence your code is not executed...You have to implement the toolbar event for this...In the toolbar event put a breakpoint and see the sy-ucomm for delete...you will then have to manually change this standard delete sy-ucomm to your custom sy-ucomm...
The code in the handle_toolbar method would be somthing like this
loop at mt-toolbar.
if sy-ucomm = standarad delete code
replace with your own custom code for exapmle 'DELETE'.
endif.
endloop.
Once you have done this then the Delete row would fire your own code for delete event...
Hope this helps...
Regards,
Sitakant
Similar Messages
-
How to set selected row in alv display?
Hi,
How do I select some particular row in alv - say at first display i want to highlight 4th row. How can i do that?
Thanks,
Sheeltry to use method set_selected_rows just after method for first display.
-
How to get column value of a selected row of ALV
Hello ,
I have application POWL POWL_UI_COMP uses another component POWL_TABLE_COMP.
This POWL_TABLE_COMP uses SALV_WD_TABLE.
I want to select value of ORDER id and it need to be passed whenever user selects a display order button(Which is self defined function generated in POWL_TABLE_COMP) . I am calling a display order on action of this display button(http://nap60.nalco.one.net:8042/sap/bc/webdynpro/sap/mt_order_app?IV_ACTIVITYTYPE=A&IV_EQUIPMENT=aaaa&IV_ORDERID=90001511&IV_ORDERTYPE=STD&IV_QMNUM=00&IV_TPLNR=00)
ORDERID is one column value of selected row of ALV table.
So please can you suggest , how to read ORDERID and pass it to the self defined function..
thanks in advance,
SharadaAnoop,
I have plcaed this code in event handler of on_lead_select.
Its giving error the element doesnt exist.
static_attributes should give me row data but it's giving short dump saying
Pl can you suggest.
data: set_of_element type WDR_CONTEXT_ELEMENT_SET,
element1 type ref to IF_WD_CONTEXT_ELEMENT,
result type POWL_CRESULT_STY,
table_helper type ref to CL_POWL_TABLE_HELPER,
context_node type ref to IF_WD_CONTEXT_NODE,
lt_selected_elements TYPE wdr_context_element_set,
static_attributes type ref to data.
table_helper = wd_comp_controller->mr_table_helper.
context_node = table_helper->get_data_node( ).
context_node = wd_comp_controller->mr_table_helper->get_data_node( ).
context_node->get_static_attributes( exporting index = r_param->index
importing static_attributes = static_attributes ).
thanks,
Sharada -
To add/delete the rows in ALV report outpout
Hi,
Is there any way by which we can add/delete the rows in ALV report output.
Thanks
AnkulHi,
Try out this way:
data: i_modified TYPE STANDARD TABLE OF mara,"For getting modified rows
w_modified TYPE mara.
CASE e_ucomm.
WHEN 'EDIT'.
perform save_database.
CALL METHOD ref_GRID->REFRESH_TABLE_DISPLAY.
ENDCASE.
FORM SAVE_DATABASE .
data: i_selected_rows TYPE lvc_t_row, "Selected Rows
w_selected_rows TYPE lvc_s_row.
* Getting the selected rows index
CALL METHOD ref_grid->get_selected_rows
IMPORTING et_index_rows = i_selected_rows.
* Through the index capturing the values of selected rows
LOOP AT i_selected_rows INTO w_selected_rows.
READ TABLE it_tab INTO wa_it_tab INDEX w_selected_rows-index.
IF sy-subrc EQ 0.
MOVE-CORRESPONDING wa_it_tab TO w_modified.
APPEND w_modified TO i_modified.
ENDIF.
ENDLOOP.
MODIFY mara FROM TABLE i_modified.
Thanks,
Krishna -
How to delete selected row in table control
Hi all,
here is my coding for deleting selected row.
But it is not working correctly.
I am not able to delete seleced row.
If i press delete button it automatically delete from beginning instead of selected rows.
Can anyone can help me plz...
CONTROLS rowdeleting TYPE TABLEVIEW USING SCREEN 100.
TABLES zdetails.
data : begin of itab occurs 0,
NAME TYPE ZDETAILS-NAME,
ADDRES TYPE ZDETAILS-ADDRES,
CONTACTNO TYPE ZDETAILS-CONTACTNO,
INIT TYPE C,
end of itab .
DATA OK_CODE LIKE SY-UCOMM.
CALL SCREEN 100.
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'BACK'.
IF ITAB-INIT IS INITIAL.
SELECT NAME ADDRES CONTACTNO FROM ZDETAILS
INTO CORRESPONDING FIELDS OF TABLE ITAB.
DESCRIBE TABLE ITAB LINES rowdeleting-LINES.
ITAB-INIT = 'X'.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
MODULE CHANGE_SDYN_CONN OUTPUT.
READ TABLE itab INTO ZDETAILS INDEX rowdeleting-current_line.
ENDMODULE. " CHANGE_SDYN_CONN OUTPUT
MODULE READ_TABLE_CONTROL INPUT.
IF ITAB-INIT = 'X' AND OK_CODE = 'DELETE'.
DELETE ITAB index rowdeleting-current_line ."FROM ZDETAILS.
DESCRIBE TABLE ITAB LINES rowdeleting-LINES.
ENDIF.
ENDMODULE. " READ_TABLE_CONTROL INPUT
MODULE USER_COMMAND_0100 INPUT.
CASE OK_CODE.
WHEN 'BACK'.
LEAVE PROGRAM.
WHEN 'DELETE'.
IF ITAB-INIT = 'X' AND OK_code = 'DELETE'.
DELETE ITAB index rowdeleting-current_line .
ENDIF.
ENDCASE.
ENDMODULE.
regards ,
ranjith.Hi,
Check the following code:
CONTROLS TABLE_CONTROL TYPE TABLEVIEW USING SCREEN 100.
TABLES SDYN_SDW4.
DATA SDYN_ITAB LIKE STANDARD TABLE OF SDYN_SDW4.
DATA INIT.
DATA OK_CODE LIKE SY-UCOMM.
DATA SAVE_OK LIKE SY-UCOMM.
DATA MARK.
DATA COL TYPE CXTAB_COLUMN.
CALL SCREEN 100.
*& Module STATUS_0100 OUTPUT
text
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'GRUND'.
SET TITLEBAR '100'.
IF INIT IS INITIAL.
Datenbeschaffung
SELECT CARRID CONNID CITYFROM AIRPFROM CITYTO AIRPTO DEPTIME ARRTIME
DISTANCE DISTID
FROM SPFLI
INTO CORRESPONDING FIELDS OF TABLE SDYN_ITAB.
DESCRIBE TABLE SDYN_ITAB LINES TABLE_CONTROL-LINES.
INIT = 'X'.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module FILL_TABLE_CONTROL OUTPUT
text
MODULE CHANGE_SDYN_CONN OUTPUT.
you can change the content of current table control line via
sdyn_conn
READ TABLE sdyn_itab INTO sdyn_conn INDEX table_control-current_line.
ENDMODULE. " FILL_TABLE_CONTROL OUTPUT
*& Module READ_TABLE_CONTROL INPUT
text
MODULE READ_TABLE_CONTROL INPUT.
Check input values
IF MARK = 'X' AND SAVE_OK = 'DELETE'.
DELETE TABLE SDYN_ITAB FROM sdyn_sdw4.
DESCRIBE TABLE SDYN_ITAB LINES TABLE_CONTROL-LINES.
ENDIF.
ENDMODULE. " READ_TABLE_CONTROL INPUT
*& Module USER_COMMAND_0100 INPUT
text
MODULE USER_COMMAND_0100 INPUT.
SAVE_OK = OK_CODE.
CLEAR OK_CODE.
CASE SAVE_OK.
WHEN 'SORT'.
DATA: FLDNAME(100),HELP(100).
READ TABLE TABLE_CONTROL-COLS INTO COL WITH KEY SELECTED = 'X'.
SPLIT COL-SCREEN-NAME AT '-' INTO HELP FLDNAME.
SORT SDYN_ITAB BY (FLDNAME).
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Module EXIT INPUT
text
MODULE EXIT INPUT.
LEAVE PROGRAM.
ENDMODULE. " EXIT INPUT
Regards,
Bhaskar -
HOW CAN I HAVE THE NUMBER OF SELECTED ROWS IN ALV GRID?
HI.
HOW CAN I HAVE THE NUMBER OF SELECTED ROWS IN ALV GRID????
GABRY =)You need to use
data : grid1 type ref to cl_gui_alv_grid.
call method grid1->get_selected_rows
importing
et_index_rows = i_sel_alvrows[].
a® -
How to Edit selected row in ALV
Hi Experts,
I new to webdynpro ABAP. How to Edit the entire selected row in ALV. Please suggest?
Thanks in advance.Hi,
I guess you have created the node as dynamic and also set this to the ALV..
1. Have you created READ_ONLY attribute of type wdy_boolean inside the node to which the ALV is bound..If not create it first and set the default value for this readonly as abap_true...ie X.
2. Got the contents in the internal table.
bind the table to the node..
3.Instantiate the ALV.
4. Now get teh column refrences of this ALV using the cl_salv_wd_config_table..and for columns
use the cell editor type as cl_salv_wd_uie_input_field...
loop through the column references and for all refrences create an object of type Input field and inside this class
use the method set_read_only_field_name ( 'READ_ONLY' ).
For the table settings if_salv_wd_table_settings of cl_salv_wd-config_table.. set the read only mode as abap_false..
5 create the custom button in the ALV using the cl_salv_wd_fe_button..
6 In this go for the events ON_FUCNTION and inside this method..do the coding
7 .Initially the table will be set to non editable..
In the button handler....
Get the refernece of this node to which the ALV is bound.....
lr_node = wd_context->get_child_node( 'VBAK' ). "dynamic node name
lv_index = lr_node->get_lead_selection_index ( ).
loop at it_table into ls_table.
if sy-tabix eq lv_index.
ls_table-read_only = abap_false. "editable
else.
ls_table-read_only = abap_true. "non editable
endif.
modify table
endloop.
lr_node->bind_table( lt_table ).
If you have any doutbs just refer the previous thread posted on the same..
You can follow the above steps to acheive thjs..
Regards,
Lekha.
Edited by: Lekha on Dec 17, 2009 6:10 PM -
NEW DEBUGGER: How to delete selected rows is one shot
Hi Specialists,
I have a small question. While debugging a program I have an internal table having 300 records .
Now I wish to delete 290 records during debugger session in one shot instead of choosing 1 by one.
Is there way I can select & do .
I searched but could not locate "SELECT ALL " button.
-Abhinav.Hello here is one example
please follow this formula.
here selection is in terms of
itab-mblnr = itab1-lfbnr.
itab-zeile = itab1-lfpos . "
and system delete selected row of itab using
"DELETE TABLE itab FROM itab."
IF sy-subrc = 0.
itab-mblnr = itab1-lfbnr.
itab-zeile = itab1-lfpos .
DELETE TABLE itab FROM itab.
endif.
Edited by: riten patel on Feb 12, 2010 11:33 AM -
How to delete particular row in ALV list display
Hi All,
My requirement is :
I am displaying ouput using lav list dispplay befor the first colomn i am displaying check box. i defined my own pf status here . in pf status i have 3 buttons .
1 select all
2 deselect all
3 delete.
First two options are working fine when i click select all it is selecting all the rown in a program(selectiong all the check boxex) like working fine for deselecting all.
3 optioin Delete when i click delete option it has to delete partcular row in a list display and at the same time this entry should delete from the table. this is my requirement. for the third point(delete) option i dont have any logic. anybody can suggest me or send me the sameple code. i am sending my code below.if possible please modify the code and resend it to me.
type-pools : slis.
tables : zuser_secobjects.
data : t_header1 like zuser_secobjects.
data : begin of it_secobjects occurs 0.
include structure t_header1.
*data : box,
input(1) type c,
data : checkbox type c,
flag type c,
end of it_secobjects.
data : wa_ita like line of it_secobjects.
*data : it_secobjects like zuser_secobjects occurs 0 with header line.
data : i_field type slis_t_fieldcat_alv with header line.
data : w_field like line of i_field.
data : i_sort type slis_t_sortinfo_alv.
data : w_sort like line of i_sort.
data : it_filt1 type slis_t_filter_alv with header line.
data:
i_tabname type tabname,
i_repid like sy-repid,
is_lout type slis_layout_alv.
data : it_filt type slis_t_filter_alv with header line,
it_evts type slis_t_event with header line.
DATA : is_vari type disvariant.
constants : c_default_vari value 'X',
c_save_vari value 'U',
c_checkfield type slis_fieldname value 'ACTION',
c_f2code type sy-ucomm value '&ETA'.
data : chk_box type slis_fieldname.
selection-screen: begin of block b1 with frame title text-t01.
parameters : p_appln type zuser_secobjects-appln.
parameters : p_user type usr02-bname, "zuser_secobjects-appln_user,
p_partnr type zuser_secobjects-appln_partner,
p_ptype type zuser_secobjects-partner_type default '02',
p_upostn type zuser_secobjects-user_position,
p_sdate like likp-erdat default sy-datum,
p_edate(10) default '12/31/9999',
p_revnum type zuser_secobjects-revnum,
p_cted type zuser_secobjects-created_by,
p_cdate type zuser_secobjects-creation_date,
p_ctime type zuser_secobjects-creation_time,
p_chnby type zuser_secobjects-changed_by,
p_cdate1 type zuser_secobjects-changed_date,
p_ctime1 type zuser_secobjects-changed_time.
selection-screen: end of block b1.
form user_command using p_ucomm like sy-ucomm
rs_selfield type slis_selfield.
*DATA : it_filt type slis_t_filter_alv with header line.
case p_ucomm.
when 'SELECT_ALL'. " SELALL is the FCODE of ur push button
loop at it_secobjects into wa_ita.
wa_ita-checkbox = 'X'.
modify it_secobjects from wa_ita.
endloop.
rs_selfield-refresh = 'X'. "<- ADD THIS
when 'DESLCT_ALL'.
loop at it_secobjects into wa_ita.
wa_ita-checkbox = ' '.
modify it_secobjects from wa_ita.
endloop.
rs_selfield-refresh = 'X'. "<- ADD THIS
is_lout-f2code = c_f2code.
is_lout-box_fieldname = c_checkfield.
is_lout-get_selinfos = 'X'.
is_lout-detail_popup = 'X'.
is_lout-detail_initial_lines = 'X'.
when 'HIDE_DEL'.
rs_selfield-exit = 'X'.
it_filt-fieldname = 'ACTION'.
it_filt-tabname = '1'.
it_filt-valuf = 'X'.
it_filt-intlen = '1'.
it_filt-inttype = 'C'.
it_filt-datatype = 'CHAR'.
it_filt-valuf_int = 'X'.
it_filt-sign0 = 'E'.
it_filt-optio = 'EQ'.
if it_filt[] is initial.
append it_filt.
else.
modify it_filt index 1.
endif.
perform display using i_object.
PERForm ALV_LIST_DISPLAY.
WHEN 'SHOW_DEL'.
rs_selfield-exit = 'X'.
free it_filt.
PERForm ALV_LIST_DISPLAY.
when 'SAVE1'.
select * from zuser_secobjects where
appln = zuser_secobjects-appln
and appln_partner = zuser_secobjects-appln_partner
and partner_type = zuser_secobjects-partner_type
and start_date = zuser_secobjects-start_date
and end_date = zuser_secobjects-end_date.
endselect.
if sy-subrc eq 0.
message e000(ZV) with 'Duplicate Entry'.
endif.
endcase.
endform.
*& Form delete
form delete.
data : begin of is_secobjects occurs 0.
include structure zuser_secobjects.
data : checkbox type c.
data : end of is_secobjects.
is_secobjects-checkbox = 'X'.
modify is_secobjects
from it_secobjects
transporting checkbox
where checkbox = 'X'.
endform.
*& Form get_data
form get_data.
select * from zuser_secobjects
into table it_secobjects.
endform. " get_data
*& Form prepare_fieldcatalog
text
--> p1 text
<-- p2 text
form prepare_fieldcatalog.
clear: w_field,i_field.
refresh:i_field.
i_field-key = 'X'.
i_field-col_pos = 1.
i_field-ddictxt = 'S'.
i_field-seltext_s = '@11@'.
i_field-checkbox = 'X'.
i_field-input = 'X'.
i_field-fieldname = 'HEADER'.
i_field-outputlen = 0.
append i_field.
clear i_field.
w_field-fieldname = 'APPLN'.
w_field-tabname = 'IT_SECOBJECTS'.
w_field-seltext_l = text-m01.
w_field-outputlen = '10'.
w_field-col_pos = 1.
append w_field to i_field.
clear w_field.
w_field-fieldname = 'APPLN_USER'.
w_field-tabname = 'IT_SECOBJECTS'.
w_field-just = 'C'.
w_field-seltext_l = text-m02.
w_field-outputlen = '7'.
w_field-col_pos = 2.
append w_field to i_field.
clear w_field.
endform. " prepare_fieldcatalog
*& Form ALV_LIST_DISPLAY
text
--> p1 text
<-- p2 text
form alv_list_display.
i_repid = sy-repid.
is_lout-box_fieldname = 'CHECKBOX'.
it_filt-fieldname = 'ACTION'.
call function 'REUSE_ALV_LIST_DISPLAY'
exporting
i_callback_program = i_repid
i_callback_pf_status_set = 'PF_STATUS_SET'
i_callback_user_command = 'USER_COMMAND'
is_layout = is_lout
it_fieldcat = i_field[]
it_filter = it_filt[]
it_events = it_evts[]
i_default = c_default_vari
i_save = c_save_vari
is_variant = is_vari
tables
t_outtab = it_secobjects.
endform. " ALV_LIST_DISPLAY
*& Form display
text
-->P_I_OBJECT text
form display using object.
case object.
ENDCASE.
endform. " display
thanks,
maheedhar.tHI
In my program checkbox(before the record is displayed)
I used following lines to display checkbox .
i_field-key = 'X'.
i_field-col_pos = 1.
i_field-ddictxt = 'S'.
i_field-seltext_s = '@11@'.
i_field-checkbox = 'X'. <- Using this command i am getting checkbox
i_field-input = 'X'.
when i select this checkbox i press delete option then this entry will remove from internal table and refresh the screen and at the same time i will click on save button this ztable has to update according to that action.
this is my requirement.
thanks,
maheedhar. -
How To Edit Selected Row In ALV Table
Hello Experts,
In My Webdynpro Application, I am displaying records from database table into an ALV Table.
I want to edit only selected record from ALV table.
Please Suggest How to achieve this.
Thanks,
PratibhaThe link given above is for the UI element 'Table' and does not pertain to ALV.
To Make an ALV Editable on lead selection for that particular lead selected row.
1. The ALV should be made lead selectable, when initializing
2. The ON_LEAD_SELECT function should be invoked.
3. Withing this function the index has to be retrieved to know which row was selected.
4. Based on the index retrived all the columns have to pass FALSE to read_only in the column properties.
Regards,
Pramod -
How to detect a selected row in ALV GRID
Hi,
Can anyone tell me how to detect and catch an event when a row is selected in an ALV GRID?
I would like to catch such event when the end user presses Ctrl + Shif + Space bar.
Thank you and best regards.
Hassane.Hi,
Use this wiki link, to have a checkbox with all the records in ALV Grid and to process those selected records at a user command, as per the requirement.
https://www.sdn.sap.com/irj/scn/wiki?path=/display/snippets/alv%252bgrid%252bdisplay%252bwith%252bcheckbox%252bto%252bprocess%252bselected%252brecords%252bat%252bruntime
Hope this solves your problem.
Thanks & Regards,
Tarun Gambhir -
Getting selected rows in ALV grid output
Hi All,
As per my requirement, in the ALV output i have 3 push buttons (Display, Edit and Print).
Using the below code, I am trying to get the selected rows from the output.
CALL METHOD ob_grid->check_changed_data
CHANGING
c_refresh = w_x.
CALL METHOD ob_grid->get_selected_rows
IMPORTING
et_index_rows = is_rows.
When I execute the code wid Display/Edit push buttons it is working fine as long as Print button is not used.
If I use the Print button and then try to select any other push button, I am not getting the entries in is_rows internal table.
Kindly help me.
Thanks in Advance.Would your user actually select a row if they wanted simply to print? I don't see that you're checking to see if the user actually selected a row ( after et_index_rows = is_rows, need to be sure is_rows is not initial (zero)). Debug should show you exactly what is happening in the situation you described.
-
Hi,
I have used SALV_WD_TABLE as component reuse to display an ALV on my web dynpro application. But the problem is when it is displayed the first row is by defaut selected. If I try to click on any other row it is not getting selected and the first row is still selected.
I checked the context node which I used for mapping to data node of SALV_WD_TABLE . The cardinality is 0..n and selection is 0..1. Again while instantiating the ALV class in the view I din't use any set_selection method to define selection in ALV.
So, I need your help to know what is the reason that is not allowing me to select any other row other than the first row. Also I want to how to program the change in lead selection in the ALV. I mean how to understand when user selects another row and I need to know the row number.
Thanks,
MainakHi SSK,
Sorry for being late to reply. Please find below the steps to follow for your requirement -
1. Enable ON_CELL_ACTION event for the ALV
You can follow the link for the coding. But make sure not to write the code in WDDOMODIFY method. Instead you write the code in WDDOINIT method.
How to trigger the event ON_CELL_ACTION in ALV - Web Dynpro ABAP - SCN Wiki
2. Now in the view methods tab define a event handler for this event
create a new entry in method tab and choose method type as event handler and for the event you choose the ON_CELL_ACTION event of your ALV interface controller via F4 value help.
3. Now in this method created in step 2, you will get the value of the column in variable R_PARAM->ATTRIBUTE. That means, if you press enter in columnn 'USER_NAME' then this variable will contain this column name. Then the sample coding would be -
case R_PARAM->attribute.
when 'USER_NAME'.
* Populate the first name and last name in the corresponding context node element
endcase. -
Colouring a row in alv display
Hi,
Can we colour one row dynamically(depending on input data) in alv display? If possible how?
Thank you.Hi,
<b>Refer the code below and reward points if it helps.</b>
REPORT zcuitest_alv_07.
* Use of colours in ALV grid (cell, line and column) *
* Table
TABLES : mara.
* Type
TYPES : BEGIN OF ty_mara,
matnr LIKE mara-matnr,
matkl LIKE mara-matkl,
counter(4) TYPE n,
free_text(15) TYPE c,
color_line(4) TYPE c, " Line color
color_cell TYPE lvc_t_scol, " Cell color
END OF ty_mara.
* Structures
DATA : wa_mara TYPE ty_mara,
wa_fieldcat TYPE lvc_s_fcat,
is_layout TYPE lvc_s_layo,
wa_color TYPE lvc_s_scol.
* Internal table
DATA : it_mara TYPE STANDARD TABLE OF ty_mara,
it_fieldcat TYPE STANDARD TABLE OF lvc_s_fcat,
it_color TYPE TABLE OF lvc_s_scol.
* Variables
DATA : okcode LIKE sy-ucomm,
w_alv_grid TYPE REF TO cl_gui_alv_grid,
w_docking_container TYPE REF TO cl_gui_docking_container.
PARAMETERS : p_column AS CHECKBOX,
p_line AS CHECKBOX,
p_cell AS CHECKBOX.
START-OF-SELECTION.
PERFORM get_data.
END-OF-SELECTION.
PERFORM fill_catalog.
PERFORM fill_layout.
CALL SCREEN 2000.
*& Module status_2000 OUTPUT
* text
MODULE status_2000 OUTPUT.
SET PF-STATUS '2000'.
ENDMODULE. " status_2000 OUTPUT
*& Module user_command_2000 INPUT
* text
MODULE user_command_2000 INPUT.
DATA : w_okcode LIKE sy-ucomm.
MOVE okcode TO w_okcode.
CLEAR okcode.
CASE w_okcode.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " user_command_2000 INPUT
*& Module alv_grid OUTPUT
* text
MODULE alv_grid OUTPUT.
IF w_docking_container IS INITIAL.
PERFORM create_objects.
PERFORM display_alv_grid.
ENDIF.
ENDMODULE. " alv_grid OUTPUT
*& Form create_objects
* text
* --> p1 text
* <-- p2 text
FORM create_objects.
* Ratio must be included in [5..95]
CREATE OBJECT w_docking_container
EXPORTING
ratio = 95
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
others = 6.
CREATE OBJECT w_alv_grid
EXPORTING
i_parent = w_docking_container.
ENDFORM. " create_objects
*& Form display_alv_grid
* text
* --> p1 text
* <-- p2 text
FORM display_alv_grid.
CALL METHOD w_alv_grid->set_table_for_first_display
EXPORTING
is_layout = is_layout
CHANGING
it_outtab = it_mara
it_fieldcatalog = it_fieldcat
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
ENDFORM. " display_alv_grid
*& Form get_data
* text
* --> p1 text
* <-- p2 text
FORM get_data.
SELECT * FROM mara UP TO 5 ROWS.
CLEAR : wa_mara-color_line, wa_mara-color_cell.
MOVE-CORRESPONDING mara TO wa_mara.
ADD 1 TO wa_mara-counter.
MOVE 'Blabla' TO wa_mara-free_text.
IF wa_mara-counter = '0002'
AND p_line = 'X'.
* Color line
MOVE 'C410' TO wa_mara-color_line.
ELSEIF wa_mara-counter = '0004'
AND p_cell = 'X'.
* Color cell
MOVE 'FREE_TEXT' TO wa_color-fname.
MOVE '5' TO wa_color-color-col.
MOVE '1' TO wa_color-color-int.
MOVE '1' TO wa_color-color-inv.
APPEND wa_color TO it_color.
wa_mara-color_cell[] = it_color[].
ENDIF.
APPEND wa_mara TO it_mara.
ENDSELECT.
ENDFORM. " get_data
*& Form fill_catalog
* text
* --> p1 text
* <-- p2 text
FORM fill_catalog.
* Colour code : *
* Colour is a 4-char field where : *
* - 1st char = C (color property) *
* - 2nd char = color code (from 0 to 7) *
* 0 = background color *
* 1 = blue *
* 2 = gray *
* 3 = yellow *
* 4 = blue/gray *
* 5 = green *
* 6 = red *
* 7 = orange *
* - 3rd char = intensified (0=off, 1=on) *
* - 4th char = inverse display (0=off, 1=on) *
* Colour overwriting priority : *
* 1. Line *
* 2. Cell *
* 3. Column *
DATA : w_position TYPE i VALUE '1'.
CLEAR wa_fieldcat.
MOVE w_position TO wa_fieldcat-col_pos.
MOVE 'MATNR' TO wa_fieldcat-fieldname.
MOVE 'MARA' TO wa_fieldcat-ref_table.
MOVE 'MATNR' TO wa_fieldcat-ref_field.
APPEND wa_fieldcat TO it_fieldcat.
ADD 1 TO w_position.
CLEAR wa_fieldcat.
MOVE w_position TO wa_fieldcat-col_pos.
MOVE 'MATKL' TO wa_fieldcat-fieldname.
MOVE 'MARA' TO wa_fieldcat-ref_table.
MOVE 'MATKL' TO wa_fieldcat-ref_field.
* Color column
IF p_column = 'X'.
MOVE 'C610' TO wa_fieldcat-emphasize.
ENDIF.
APPEND wa_fieldcat TO it_fieldcat.
ADD 1 TO w_position.
CLEAR wa_fieldcat.
MOVE w_position TO wa_fieldcat-col_pos.
MOVE 'COUNTER' TO wa_fieldcat-fieldname.
MOVE 'N' TO wa_fieldcat-inttype.
MOVE '4' TO wa_fieldcat-intlen.
MOVE 'Counter' TO wa_fieldcat-coltext.
APPEND wa_fieldcat TO it_fieldcat.
ADD 1 TO w_position.
CLEAR wa_fieldcat.
MOVE w_position TO wa_fieldcat-col_pos.
MOVE 'FREE_TEXT' TO wa_fieldcat-fieldname.
MOVE 'C' TO wa_fieldcat-inttype.
MOVE '20' TO wa_fieldcat-intlen.
MOVE 'Text' TO wa_fieldcat-coltext.
APPEND wa_fieldcat TO it_fieldcat.
ENDFORM. " fill_catalog
*& Form fill_layout
* text
* --> p1 text
* <-- p2 text
FORM fill_layout.
* Field that identify color line in internal table
MOVE 'COLOR_LINE' TO is_layout-info_fname.
* Field that identify cell color in inetrnal table
MOVE 'COLOR_CELL' TO is_layout-ctab_fname.
ENDFORM. " fill_layout
<b>Flow logic code</b>
Code:
PROCESS BEFORE OUTPUT.
MODULE status_2000.
MODULE alv_grid.
PROCESS AFTER INPUT.
MODULE user_command_2000. -
Selecting rows in ALV Grid using Classes
I am displaying the output in ALV grid format.
Now i am using cl_gui_alv_grid->Get_selected_ROWS to get the row index selected by User and on clicking a button it will take us to another screen which will hold the values of the selected row.
Problem Faced: But when we again go back to the first screen and select another row or same rows and click this button the selected rows index remains initial, that value is not getting captured.
I cleared the parameters and refershed grid also.
But the problem is not yet solved.
Please Give me the solution.
Regards,
Balaji.Hi Lavanya,
I did debugging also.
First time Get_Selected_rows is working fine.
But Second time it is failed.
Maybe you are looking for
-
Help me Please.. I can log on to the Apple website to manage my account and all the information is correct, but I get "Your Apple ID has been disabled" when I try to get something from App Store on my iPad3 I'm from poland. Thx Balbi
-
Premiere Elements cause problems with Windows Media Center while streaming to TV.
I was having the following problem: The audio from the streaming process of a recorded TV show on my HP computer to the remote receivers, a Sony Blu-ray player and/or a Sony Streaming Player, results in the loss of audio signal at exactly 30 seconds
-
Uploading Photos in MySpace or Webshots.
I have looked on your bulletin board - just don't see the answer I am looking for yet, so I will post a new TOPIC on this subject and see if it gets an answer I have a NEW iMac 10-5 leopard - but its not reacting correctly with two sites I use freque
-
Report material & Invoice rate
Dear All . Where can i get the report for Material & and at what rate invoice is booked at MIRO invoice verification?. Regards
-
Terms of sale says following in finnish: "VAIN SUOMESSA iTunes Music Storen tuotteita on saatavilla vain Suomessa. Jos asiakas ei ole Suomessa, hän ei saa käyttää tai yrittää käyttää palvelua. iTunes voi teknologian avulla varmentaa tämän ehdon nouda