Selected rows in ALV to a file .txt
Hi all, I need to generate a File (.txt) from the selected rows of an alv.
Please, i need if you can help me with that. I have to especify the name of the file with "concatenate" and inside the file, the data must be separated with ' ; '
Thanks in advance.
JCO
Hi
First separate the data of the selected lines in the ALV output into an internal table
then download the data from that ITAb into a file separated by the separator( string using GUI_DOWNLOAD or some other fun module
Regards
Anji
Similar Messages
-
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 -
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 -
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. -
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.
-
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. -
To get selected rows from alv output which is prepared with funciton module
Hi ,
I have a program which is prepared ALV with funciton modules.
Now i have to get selected rows(more than one).
Can i use method CL_GUI_ALV_GRID -> get_selected_rows.
or any other way to get selected rows.
thanks,
shylaUnder the callback subroutine ( u have passed them in I_CALLBACK_USER_COMMAND of ur function module) - u do like this -
DATA : ref1 TYPE REF TO cl_gui_alv_grid,
t_selcted_rows type LVC_T_ROID.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING e_grid = ref1.
call method ref1->get_selected_rows
importing ET_ROW_NO = t_selected_rows.
Hope this solves ur problem. -
I am fairly new to Macro and VBA in Excel. I am trying to reduce the amount of work involved in a task that is performed often in our office. Currently, the task involves using 2 separate Excel files. One file is a tracking sheet and the second is the document
that gets sent out to the client. The second document has all the same information that is inserted into the tracking sheet. What I would like to do is have the information that is in one row on the tracking sheet populate into a new excel file that is created
automatically from an existing template.
I have been able to make this partially work. What I have been able to achieve is have the cell that is selected in the tracking sheet (the description field) copy into the new file that is created from the template that is on our server.
Sub NewRFI()
' NewRFI Macro
MsgBox Selection.Address(ReferenceStyle:=xlA1, _
RowAbsolute:=False, ColumnAbsolute:=False)
Selection.Copy
Workbooks.Add Template:= _
"template file path goes here"
Range("C14").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Range("C14").Select
Application.CutCopyMode = False
End Sub
What I need to do is get the rest of the information from that same row in the tracking sheet to copy to the new file as well. The other information includes the document number (one cell to the left of the selected cell), who it is from (one cell to the
right of the selected cell), and the date (two cells to the right of the selected cell). As stated, this information is all in the same row on the tracking sheet. Each piece of information needs to be copied to a certain cell in the new file and I do not want
the source formatting to be copied to the new file.
Ideally, I would like it to operate like so: select the first cell in the row (in this case would be the document number field). Then click a button to run the macro that will then copy the information from that row in the tracking sheet to specific cells
in the new file that is created from the template.
This process will save us from having to either manually copy and paste the information into the new file or re-type the same information that is already in the tracking sheet.
This is probably a simple thing to do but it would be great if anybody had some insight on this issue. Thanks in advance!Try code like the following. You will have to change the target cells (D25, F1 and H4) to the ones you want, I just used some arbitrary cells as example.
Sub NewRFI()
Dim rngCell As Range
Set rngCell = ActiveCell
MsgBox Selection.Address(ReferenceStyle:=xlA1, _
RowAbsolute:=False, ColumnAbsolute:=False)
Workbooks.Add Template:="template file path goes here"
Range("C14").Value = rngCell.Value
' Change the target cells as needed
Range("D25").Value = rngCell.Offset(0, -1).Value
Range("F1").Value = rngCell.Offset(0, 1).Value
Range("H4").Value = rngCell.Offset(0, 2).Value
End Sub
Regards, Hans Vogelaar (http://www.eileenslounge.com) -
Displaying the selected rows in ALV Grid output
Hi Experts,
I am developing one interactive ALV Grid report where user can process the selected records/rows from the ALV Grid output.
for displaying the ALV Grid, I have used the class CL_GUI_ALV_GRID class. I am working on ECC 6.0 system.
when I select any records/rows from output and then press any Application Toolbar button, PAI and then PBO modules of the screen gets executed as per the normal flow.
however After PBO, when same ALV output comes, all the selected/highlighted rows appear as unselected, that means I want to retain the ALV
rows selection during the round trip.
please advise.
Regards,
JageshHi,
Feiyun Wu is correct.
Get_selected_rows and set_selected_rows are the methods to be used .
Some code:
Note the sequence of code:
FORM set_gui_alv_grid_1 .
DATA: wa_layout TYPE lvc_s_layo ,
wa_print TYPE lvc_s_prnt .
DATA: it_sort TYPE lvc_t_sort ,
wa_sort TYPE LINE OF lvc_t_sort .
DATA: it_fieldcatalog TYPE lvc_t_fcat.
IF gui_custom_container_1 IS INITIAL .
CREATE OBJECT gui_custom_container_1
EXPORTING
container_name = 'GUI_CUSTOM_CONTAINER_1'
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
OTHERS = 6 .
IF sy-subrc <> 0.
ENDIF.
PERFORM get_field_catalog
USING gc_log_group_1
CHANGING it_fieldcatalog .
CREATE OBJECT gui_alv_grid_1
EXPORTING i_parent = gui_custom_container_1.
CREATE OBJECT ob_event_receiver_1
EXPORTING log_group = gc_log_group_1 .
* registers the event handlers
SET HANDLER ob_event_receiver_1->handle_toolbar FOR gui_alv_grid_1 .
SET HANDLER ob_event_receiver_1->handle_user_command FOR gui_alv_grid_1 .
SET HANDLER ob_event_receiver_1->print_top_of_page FOR gui_alv_grid_1 .
SET HANDLER ob_event_receiver_1->hotspot_click FOR gui_alv_grid_1 .
wa_layout-cwidth_opt = abap_true .
* wa_layout-excp_fname = gc_excp_fname .
* wa_layout-ctab_fname = gc_ctab_fname.
* wa_layout-excp_led = abap_true .
CALL METHOD gui_alv_grid_1->set_table_for_first_display
EXPORTING
is_layout = wa_layout
is_print = wa_print
i_save = 'A'
is_variant = gs_disvariant_1
CHANGING
it_sort = it_sort
it_fieldcatalog = it_fieldcatalog
it_outtab = it_alv_grid_1.
ELSE .
CALL METHOD gui_alv_grid_1->refresh_table_display.
* Restore selections
CALL METHOD gui_alv_grid_1->set_selected_rows
EXPORTING
it_index_rows = ob_event_receiver_1->it_rows.
* Restore position
CALL METHOD gui_alv_grid_1->set_scroll_info_via_id
EXPORTING
is_col_info = ob_event_receiver_1->wa_col
is_row_no = ob_event_receiver_1->wa_roid.
ENDIF.
ENDFORM . "set_gui_alv_grid_1
Regards. -
How to Calculate sum for the selected rows in ALV gird using custom button
Hi I am trying to implement an ALV Grid display where the user can select few rows in the output and if he click on some custom button he should get the sum for only those rows.
Can anyone give me some idea regarding this.
Thanks in advanceWhile building the fieldcatalog for amount field use gt_fieldcat-do_sum = 'X'. And use the below for doc type sorting and subtotal.
* ALV data declarations
data: it_sortcat type slis_sortinfo_alv occurs 1,
wa_sort like line of it_sortcat.
perform build_sortcat.
*& Form build_sortcat
* Build Sort catalog
FORM build_sortcat .
wa_sort-spos = 1.
wa_sort-fieldname = 'EBELN'.
wa_sort-SUBTOT = 'X'. "subtotals any totals column by this field
* gd_sortcat-tabname
APPEND wa_sort TO it_sortcat.
wa_sort-spos = 2.
wa_sort-fieldname = 'EBELP'.
* gd_sortcat-tabname
APPEND wa_sort TO it_sortcat.
ENDFORM. " build_sortcat
call function 'REUSE_ALV_LIST_DISPLAY'
exporting
i_callback_program = gd_repid
i_callback_top_of_page = 'TOP-OF-PAGE'
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
it_sort = it_sortcat
i_save = 'X'
tables
t_outtab = it_ekko
exceptions
program_error = 1
others = 2.
Regards,
Chandru -
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 PMHi 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
Maybe you are looking for
-
"error while trying to access the service"
I am trying to convert a pdf file to an excel file. I get a completely unhelpful message that says "error while trying to access the service" . What does this mean and how do i fix it?
-
I am running Snow Leopard and have my old files isolated in a new folder on the laptop, but I want to restore the old settings, programas, etc. from the Time Machine. TM is currently backing up the new HD as if it were a new computer.
-
Need to find 'Main Reference Object' field in idoc CRMXIF_ORDER_SAVE_M02
Hi experts, pic link: http://img56.imageshack.us/my.php?image=screenhunter001fv3.jpg I cant find "Main Ref. Object" field in Idoc CRMXIF_ORDER_SAVE_M02... It is under Service Order created in tcode CRMD_ORDER... Service Order -> Transaction Data -> O
-
Any suggestions - my iPhoto Album won't upload, it gets about 10% into the 'upload' stage as just crashes. It is quite a large album - 50 pages could this be the problem, and if so what is the approximate limit for an Album
-
SMS_SITE_SYSTEM_STATUS_SUMMARIZE - Error
Hi, I´m having this warnings and erros in my SCCM, this is a new installation on SCCM and the SCCM computer account has admin permissions at the SQL Server. Has anyone seen this? Warnings and Erros: SMS_SITE_SYSTEM_STATUS_SUMMARIZE - Error Microsoft