Hiding a column in an ALV Grid
Hi ,
I want to hide a column in an ALV grid and I am doing it as such.However it doesn't work.
data : gw_fieldcat type lvc_s_fcat,
gt_fieldcat type lvc_t_fcat.
perform build_grid1 changing gt_fieldcat.
form build_grid1 changing p_gt_ss.
gw_fieldcat-fieldname = 'UKURS'.
gw_fieldcat-scrtext_m = 'Exchange rate'.
gw_fieldcat-no_out = 'X'.
gw_fieldcat-col_pos = 9.
APPEND gw_fieldcat TO gt_fieldcat.
endform.
Kindly suggest.
Hi,
As per code it looks good..check in the debugging corresponding to the field 'UKURS is no_out has value X in the fieldcatalog.
Similar Messages
-
Hiding few columns before displaying alv grid output
Hi All,
I struck up at hiding few columns before displaying alv output. I have used used FM: REUSE_ALV_GRID_DISPLAY. By using this i am displaying 29 fields to the output. But before displaying the output i want to hide few columns among them, and also those fields have to be avialable for further selection by the user by using layout.
Kindly help me in this,
Regards
Srinivas KHi,
In field catalog set NO_OUT='X' for all the columns you want to hide. They will be available when changing layout for ALV, so you can show them at any time.
Regards
Marcin -
Hiding a column in the ALV in a webdynpro component(standrad one)
Hi,
i have an requirement of hiding a column inside a ALV output of a web dynpro component which is a standrad one. please help me finding the way to do the same.
thanks,
selvakumar M.data: l_ref_usage type ref to if_wd_component_usage.
l_ref_usage = wd_this->wd_CpUse_Alv( ).
if l_ref_usage->has_active_component( ) = abap_false.
l_ref_usage->create_component( ).
endif.
DATA: l_ref_INTERFACECONTROLLER TYPE REF TO IWCI_SALV_WD_TABLE .
l_ref_INTERFACECONTROLLER = wd_This->wd_CpIfc_Alv( ).
data:
l_VALUE type ref to Cl_Salv_Wd_Config_Table.
l_VALUE = l_ref_INTERFACECONTROLLER->Get_Model(
data: lr_column type ref to CL_SALV_WD_COLUMN.
lr_column =
l_value->IF_SALV_WD_COLUMN_SETTINGS~GET_COLUMN( 'CARRID' ).
lr_column->set_visible( CL_WD_UIELEMENT=>E_VISIBLE-NONE ).
Abhi -
How to disable sorting for some columns in a ALV GRID?
Hi i have requirement where I have to disable sorting for some columns in a ALV GRID. i am using REUSE_ALV_GRID_DISPLAY function module.
Can anybody help me. how to acieve this? Any code snippets will really be appreciated.Hi,
I have tried this but not completely successful. I think this can be done using the OOPS method.
DATA: it_event_exit TYPE slis_t_event_exit.
DATA: w_exit TYPE slis_event_exit.
w_exit-ucomm = '&ODN'.
w_exit-before = 'X'.
CLEAR w_exit-after.
APPEND w_exit TO it_event_exit.
w_exit-ucomm = '&OUP'.
w_exit-before = 'X'.
CLEAR w_exit-after.
APPEND w_exit TO it_event_exit.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = w_repid
i_callback_top_of_page = 'ALV_TOP_OF_PAGE'
i_callback_html_top_of_page = 'ALV_HTML_TOP_OF_PAGE'
i_callback_user_command = 'USER_COMMAND' <- User command form
is_layout = wm_layout
it_fieldcat = wt_fieldcat
it_events = i_events
it_event_exit = it_event_exit <- Need to fill
it_sort = wt_sort
i_default = 'X'
Now you can capture this events in the user command
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
IF r_ucomm = '&OUP' and rs_selfield-SEL_TAB_FIELD = 'Your field name'.
ENDIF.
ENDFORM. "user_command
In this form you will get the function code in 'r_ucomm' and the field selected for sorting in 'rs_selfield-SEL_TAB_FIELD'. But reseting 'r_ucomm' will not work.
May be somebody else can give some help on this.
But this will work if you follow the oop method.
Please see this document for more info.
http://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/an easy reference for alv grid control.pdf
Thanks
Vinod -
All the columns of an alv grid report are not downloading in excel in 1 lin
Hi All,
I have some 60 columns in my alv grid report and user can download the report using list->export->localfile->spreadsheet.
What the issue is that all the columns are not downloading in one line, instead they split in two rows.
Please help.
Regards,
Neha Patelhi,
just use this procedure it will solve your problem:
Firstly export the data to memory using the FM LIST_FROM_MEMORY.
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = t_listobject
EXCEPTIONS
not_found = 1
OTHERS = 2.
IF sy-subrc 0.
MESSAGE e000(su) WITH text-001.
ENDIF.
then i converted it into ASCII using LIST_TO_ASCI,
CALL FUNCTION 'LIST_TO_ASCI'
TABLES
listasci = t_xlstab
listobject = t_listobject
EXCEPTIONS
empty_list = 1
list_index_invalid = 2
OTHERS = 3.
IF sy-subrc NE 0.
MESSAGE e003(yuksdbfzs).
ENDIF.
This gives the data in ASCII format separated by '|' and the header has '-', dashes. If you use this internal table directly without any proccesing in SO_NEW_DOCUMENT_ATT_SEND_API1, then you will not get a good excel sheet attachment. To overcome this limitation, i used cl_abap_char_utilities=>newline and cl_abap_char_utilities=>horizontal_tab to add horizontal and vertical tabs to the internal table, replacing all occurences of '|' with
cl_abap_char_utilities=>horizontal_tab.
Set the doc_type as 'XLS', create the body and header using the packing_list and pass the data to be downloaded to SO_NEW_DOCUMENT_ATT_SEND_API1 as contents_bin.
This will create an excel attachment.
Sample code for formatting the data for the attachment in excel format.
u2022 Format the data for excel file download
LOOP AT t_xlstab INTO wa_xlstab .
DESCRIBE TABLE t_xlstab LINES lw_cnt.
CLEAR lw_sytabix.
lw_sytabix = sy-tabix.
u2022 If not new line then replace '|' by tabs
IF NOT wa_xlstab EQ cl_abap_char_utilities=>newline.
REPLACE ALL OCCURRENCES OF '|' IN wa_xlstab
WITH cl_abap_char_utilities=>horizontal_tab.
MODIFY t_xlstab FROM wa_xlstab .
CLEAR wa_xlstab.
wa_xlstab = cl_abap_char_utilities=>newline.
IF lw_cnt NE 0 .
lw_sytabix = lw_sytabix + 1.
u2022 Insert new line for the excel data
INSERT wa_xlstab INTO t_xlstab INDEX lw_sytabix.
lw_cnt = lw_cnt - 1.
ENDIF.
CLEAR wa_xlstab.
ENDIF.
ENDLOOP.
Sample code for creating attachment and sending mail:
FORM send_mail .
u2022 Define the attachment format
lw_doc_type = 'XLS'.
u2022 Create the document which is to be sent
lwa_doc_chng-obj_name = 'List'.
lwa_doc_chng-obj_descr = w_subject. "Subject
lwa_doc_chng-obj_langu = sy-langu.
u2022 Fill the document data and get size of message
LOOP AT t_message.
lt_objtxt = t_message-line.
APPEND lt_objtxt.
ENDLOOP.
DESCRIBE TABLE lt_objtxt LINES lw_tab_lines.
IF lw_tab_lines GT 0.
READ TABLE lt_objtxt INDEX lw_tab_lines.
lwa_doc_chng-doc_size = ( lw_tab_lines - 1 ) * 255 + STRLEN( lt_objtxt ).
lwa_doc_chng-obj_langu = sy-langu.
lwa_doc_chng-sensitivty = 'F'.
ELSE.
lwa_doc_chng-doc_size = 0.
ENDIF.
u2022 Fill Packing List For the body of e-mail
lt_packing_list-head_start = 1.
lt_packing_list-head_num = 0.
lt_packing_list-body_start = 1.
lt_packing_list-body_num = lw_tab_lines.
lt_packing_list-doc_type = 'RAW'.
APPEND lt_packing_list.
u2022 Create the attachment (the list itself)
DESCRIBE TABLE t_xlstab LINES lw_tab_lines.
u2022 Fill the fields of the packing_list for creating the attachment:
lt_packing_list-transf_bin = 'X'.
lt_packing_list-head_start = 1.
lt_packing_list-head_num = 0.
lt_packing_list-body_start = 1.
lt_packing_list-body_num = lw_tab_lines.
lt_packing_list-doc_type = lw_doc_type.
lt_packing_list-obj_name = 'Attach'.
lt_packing_list-obj_descr = w_docdesc.
lt_packing_list-doc_size = lw_tab_lines * 255.
APPEND lt_packing_list.
u2022 Fill the mail recipient list
lt_reclist-rec_type = 'U'.
LOOP AT t_recipient_list.
lt_reclist-receiver = t_recipient_list-address.
APPEND lt_reclist.
ENDLOOP.
u2022 Finally send E-Mail
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = lwa_doc_chng
put_in_outbox = 'X'
commit_work = 'X'
IMPORTING
sent_to_all = lw_sent_to_all
TABLES
packing_list = lt_packing_list
object_header = lt_objhead
contents_bin = t_xlstab
contents_txt = lt_objtxt
receivers = lt_reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
Hope it will help you
Regards
Rahul sharma -
How to switch off column coloring of alv grid printouts?
Hello World!
Is there any possibility (a customizing option or a parameter) to switch off cell/column coloring of alv grid printouts?
It is very useful to see colored columns in screens, but they are darkened in printouts. How to avoid it?
Thanks and regards,
VladimirHi,
You can have different layouts for a ALV report and each layout the look and feel can be different.
So, the manual activity is the user will have to switch to the B/W layout before printing. I am not sure if you have enabled the LAYOUT option for the user to change it by himself.
I hope I am able to get across my point.
If you are using OO ALV control, you can dynamically change the layout using set_frontend_layout method. The user can also change the layout --
choose Change layout or Settings ® Layout ® Change.
The Change Layout dialog box shows you which columns are currently displayed and which additional columns can be displayed.
Regards,
Ravi
Note - Please mark the helpful answers
Message was edited by: Ravikumar Allampallam -
Regarding column editing in alv grid
hi experts,
i m using alv grid display for my report layout what i want that after the output dispaly when the user will select my customized button "change the amount column" then after pressing this my amount column will become editable and user can put there new aount for this i have used this codes but it is not working plz help me to sort out this,
for u here is my code.
FORM DISPLAY_LIST .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-cprog
is_layout = i_layout
it_fieldcat = i_fieldtab
i_grid_title = 'Production Incentive Details'
I_CALLBACK_PF_STATUS_SET = 'SET_PFSTATUS'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
it_events = global_events
TABLES
t_outtab = itab_final
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " DISPLAY_LIST
*& Form SET_PFSTATUS
text
-->RT_EXTAB text
FORM SET_PFSTATUS USING rt_extab TYPE slis_t_extab..
SET PF-STATUS 'ZPINCENTIVE' .
EXCLUDING rt_extab..
ENDFORM. " CREATE_PFSTATUS
*& Form user_command
text
-->R_UCOMM text
-->RS_SELFIELD text
form user_command using r_ucomm like sy-ucomm
rs_selfield type slis_selfield.
case r_ucomm.
*BREAK-POINT.
when '&CHANGED'. "for change the amount button.
read table i_fieldtab into s_fieldtab with key FIELDNAME = 'AMOUNT'.
if sy-subrc = 0.
move:sy-tabix to index,
'X' to s_fieldtab-edit.
modify:i_fieldtab index index from s_fieldtab.
clear:s_fieldtab.
endif.solved by own
-
Total, Subtotal of a hidden column in an ALV grid
I have a requirement for an ALV grid where I have to use a custom formula for a column's total and subtotal.
This value is a function of another column which is hidden (No_out = 'X').
I am unable to access the total and subtotal of this hidden column . I am able to access this only when I unhide the column in the field catalog.
THis is how I access the total and subtotal of the GRID. I use oops ALV of the class CL_GUI_ALV_GIRD.
call method o_grid->get_subtotals
importing
ep_collect00 = total
ep_collect01 = subto.
assign total->* to <ftotal>.
assign subto->* to <fsubto>.
I thought I would manipulate <ftotal>-mycolumn and <fsubto>-mycolumn . But both these are functions of a hidden column
and <ftotal>-hiddencolumn and <fsubto>-hiddencolumn is always empty unless I unhide them. I cannot display these columns to users as they are just logical columns of a dynamic internal table I have built. :-sHI,i have the same issue, how did you solve it?
Regards. -
Scroll text in ALV column using OO ALV grid
Hi All,
I have displayed ALV grid on the screen which has four columns. One of the columns is a text field with text255 domain. This Column is also editable. I have following problem and need help;
The column for some reason displays only 130 chars. I tried to set the output length in field cat to 255 still no difference. My custom container width is equivalent to max screen width of 255.
I also tried to crunch the other three columns to display as much characters as needed so that I am left with enough space for the last column which is comments but still it displays on 130 characters. And thoughts on why this is happening.
Thanks,
YogeetaHi,
The ALV will only let you show 130 characters. You could use 2 columns to display the text.
Martin -
Highlight the column in the ALV grid only for few entries!
Hi all,
I am using the FM "REUSE_ALV_GRID_DISPLAY" to dsplay the o/p of my report in ALV grid.
Now i need to highlight 1 particluar column for only some entries(row) based on the value of the column which is to be highlighted.
Can anyone tell me the steps to do so??Please make search thru this form you can find lot of threads
For example
https://forums.sdn.sap.com/search.jspa?threadID=&q=alvANDcellANDcolor+&objID=f50&dateRange=all&numResults=15
a® -
Disabling push button column cell on alv grid control (OOABAP)
Hello All,
I have a requirement where I need to add one column as pushbutton in alv grid display. I have done that and it's triggering button_click event also. The problem here is that I want the few <b>push button cells</b> of that column to be disbaled (depending on my requirement). I tried using a internal table lvc_t_styl and adding a field of same lvc_t_styl in my main internal table. This works for all other fields (e.g disbaling checkbox in alv grid and other editable fields) but not for push buttons. My exact requirement is that I want some of the <b>cells of pushbutton column to be grayed out (made inactive)</b>. Can anyone tell me how to do that. Thanks.
Note:Helpful answers will be duly rewarded.
nullHi,
I had the same problem.
what I did I just added the cl_gui_alv_grid=>mc_style_button at each row of the data table instead of adding it at the field catalog level.
Hope this solve your problem.
Thanks,
Harish -
Mark fields (columns) in editable ALV Grid as mandatory
Hi,
could you please help me to set up a column in an editable alv grid as mandatory? I had a look in several references and also did not find anything in the fieldcatalog structure.
Best regards,
FabianHello Fabian
Here is some coding to explain what I meant.
*& Report ZUS_SDN_ALV_ERROR_LOG
REPORT zus_sdn_alv_error_log.
DATA:
er_data_changed TYPE REF TO cl_alv_changed_data_protocol.
START-OF-SELECTION.
* Dynpro is empty (contains no elements)
CALL SCREEN '0100'.
END-OF-SELECTION.
*& Module PBO_0100 OUTPUT
* text
MODULE pbo_0100 OUTPUT.
* Event DATA_CHANGED was fired due to changes in the editable ALV grid
IF ( er_data_changed IS BOUND ).
* User did not change any values
ELSE.
CREATE OBJECT er_data_changed
* EXPORTING
* I_CONTAINER =
* I_CALLING_ALV = <your ALV grid instance>
ENDIF.
* That is how your code probably looks like
* LOOP AT gt_outtab INTO gs_outtab.
* IF ( gs_outtab-obligatory IS INITIAL ).
* CALL METHOD go_alvlog->add_protocol_entry
* EXPORTING
* i_msgid = '00'
* i_msgty = 'E'
* i_msgno = '398'
* I_MSGV1 = 'Field OBLIGATORY must not be empty'
** I_MSGV2 =
** I_MSGV3 =
** I_MSGV4 =
* i_fieldname = 'OBLIGATORY'
** I_ROW_ID =
* I_TABIX = syst-tabix
* ENDIF.
* ENDLOOP.
* Generate a protocol for testing purposes
DO 5 TIMES.
CALL METHOD er_data_changed->add_protocol_entry
EXPORTING
i_msgid = '00'
i_msgty = 'E'
i_msgno = '398'
i_msgv1 = 'Field OBLIGATORY must not be empty'
* I_MSGV2 =
* I_MSGV3 =
* I_MSGV4 =
i_fieldname = 'OBLIGATORY'
i_row_id = syst-index
i_tabix = syst-index
ENDDO.
CALL METHOD er_data_changed->display_protocol
* EXPORTING
* I_CONTAINER =
ENDMODULE. " PBO_0100 OUTPUT
Please note that this report dumps as soon as you close the log popup. However, this will not happen within your event handler method.
Regards
Uwe -
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.. -
How to divide 2 columns totals in ALv grid
Hi All,
i developed alv report & displayed totals. now i need to divide those totals and display as another column total.
anyone please suggest.
col1 col2 col3
tot1 tot2 tot3
tot3 = tot2 / tot1.
thanks,Hi,
For this, in HTML_TOP_OF_PAGE or TOP_OF_PAGE first you need to get global reference variable for GRID
for getting reference call FM GET_GLOBALS_FROM_SLVC_FULLSCR.
By using this reference call method GET_SUBTOTALS it will get the all total into Internal Table .
Using Field Symbols u can calculate. Still u have any problem i will help u further .
Regards,
Ravindra. -
Hiding a column Attribute in the Grid Control in a DAC form.
Hi,
My RowsetInfo has a Image AttributeInfo and other kinds of AttributeInfo.I wanted to display the image in a seperate area in the form.The remaining Attributes would come in form as a detail grid.
However, since I bind the Grid control to my rowsetInfo, and also since my rowsetinfo has an image AttributeInfo, I see an Image column there(which ofcourse contains references to these Image objects!!).
I would want to hide this column in the grid.How do I go about it?Do I need to create a seperate rowsetinfo for the Image controlor there is a workaround for this?
Any ideas??
--SandeepHi,
Going through the previous discussions in this forum, I had also tried the following :
JTable table = detailGrid.getTable();
TableColumnModel tableColumnModel =
table.getColumnModel();
table.removeColumn(tableColumnModel.
getColumn(1));
This doesnot seem to work.I get the following exception:
java.lang.ArrayIndexOutOfBoundsException: 1 >= 0
java.lang.Object java.util.Vector.elementAt(int)
javax.swing.table.TableColumn
javax.swing.table.DefaultTableColumnModel.getColumn(int)
void DAC2Package.DAC2Frame.jbInit()
void DAC2Package.DAC2Frame.<init>()
void DAC2Package.DAC2Application.<init>()
void DAC2Package.DAC2Application.main(java.lang.String[])
Since I have quite a few number of columns in the GridControl, I shouldnot be getting this
exception in the first place.
Also, I donot understand why
tableColumnModel.getColumnCount() prints zero in the console.
Thanks in advance,
Sandeep
null
Maybe you are looking for
-
In win 7 multi touch screen on Pavilion dv3 2370ee is not working unable to find drivers in HP
I restored the Laptop and the Touch screen stopped functioning completely I have tried all the available drivers on HP but the Touch screen is not functional, I am running windows 7 64bit Home eddition, In HP Assistance there is no Driver updates fo
-
Apple's multicam workaround is bogus?
On Pogue's blog, Apple supposedly gave this as a workaround for multicam editing: Apple intends to restore this feature in an update, calling it "a top priority." Until it does, here's a stopgap facsimile of multicam editing: If you drag two clips in
-
I need to restore my iphone but itunes can't connect to it because of my password which I can't input becasue it has no service and needs to be restored. what can I do to restore it? Is there a way to input the password?
-
Doubt in Generic data sources for hierarchy & text
Hi All, I have a couple of doubts as mentioned below. 1 . Why we canu2019t generate generic data source for hierarchy? 2. While creating Generic datasource for text there is one more option is available i.e. "Extraction from domain" what is do
-
IRecruitment new Functionality in R12.1
Can anyone share a Presentation of the coming new functionality in iRecruitment release 12.1? Thanks