Do not allow to sort some columns in Alv Grid
Dear friends,
Please help me.
I want to tell to the method set_table_for_first_display - make one of the columns not sortable. Let's say the column name is "My Icon".
What I mean with that is:
when User will highlight column "My icon" and then click on sort buttons in the toolbar - no sort will happen on this column.
I was trying to identify a field in lvc_s_sort which would say "do not sort this column". Is there any?
Or the only way to accomplish my task is to make sort buttons in the toolbar disable if column "My Icon" is clicked?
gt_sort TYPE lvc_t_sort.
CALL METHOD grid1->set_table_for_first_display
EXPORTING i_structure_name = 'IT'
is_layout = gs_layout
is_print = gs_print
CHANGING it_outtab = it
it_fieldcatalog = gt_fcat
it_sort = gt_sort
Thank you,
Tatyana.
Got a solution for ya, but you have to handle it thru coding. So you will need to handle an event from your ALV grid.
First thing is that you need a local class as your event handler, copy and paste this code. Here we are using the name ALV_GRID for your alv object
data: alv_grid type ref to cl_gui_alv_grid.
* CLASS lcl_event_receiver DEFINITION
class lcl_event_receiver definition.
public section.
methods handle_user_command
for event before_user_command of cl_gui_alv_grid
importing e_ucomm.
private section.
endclass.
* CLASS lCL_EVENT_RECEIVER IMPLEMENTATION
class lcl_event_receiver implementation.
method handle_user_command.
data: icols type lvc_t_col,
xcols like line of icols.
* Get the currently selected column
call method alv_grid->get_selected_columns
importing
et_index_columns = icols.
read table icols into xcols index 1.
* If the selected column is not one that should be sorted
check xcols-fieldname = 'MATNR'. "<-- Whatever columns that you don't want to allow sorting on.
* Now check the function code, if sort ascending or descending, then give message
check e_ucomm = cl_gui_alv_grid=>mc_fc_sort_asc
or e_ucomm = cl_gui_alv_grid=>mc_fc_sort_dsc.
message i001(00) with 'Can not sort on this column'.
* Now set the UCOMM as if the user didn't click anything.
call method alv_grid->set_user_command( space ).
endmethod.
endclass.
data: event_receiver type ref to lcl_event_receiver.
Also, you will need to set the event hanlder after calling the SET_TABLE_FOR_FIRST_DISPLAY.
call method alv_grid->set_table_for_first_display
changing
it_outtab = i_alv[]
it_fieldcatalog = ifc[].
* Set the handler for ALV grid
create object event_receiver.
set handler event_receiver->handle_user_command for alv_grid.
Just tested this, and works quite well.
Regards,
Rich Heilman
Similar Messages
-
SQL*Loader-971: parallel load option not allowed when loading lob columns
Hi,
I am trying to load a table, which has a VARRAY column, using DIRECT=TRUE and PARALLEL=TRUE through
Sql *Loader 10.2.0.4.0
OS: Sun Solaris 10 SPARC 64-bit,
Database: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0
The following error recieved:
SQL*Loader-971: parallel load option not allowed when loading lob columns
Please help me to resolve..
Thanks and regrds
Anjiuser8836881 wrote:
Hi,
I am trying to load a table, which has a VARRAY column, using DIRECT=TRUE and PARALLEL=TRUE through
Sql *Loader 10.2.0.4.0
OS: Sun Solaris 10 SPARC 64-bit,
Database: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0
The following error recieved:
SQL*Loader-971: parallel load option not allowed when loading lob columns
Please help me to resolve..
Thanks and regrds
Anjihttp://tinyurl.com/yhxdhnt -
Maximum number of character we can print in a column uing ALV grid display
Hi frnds,
My requirment is to print 500 charcter data in a column using ALV grid display.
Could any body tell me is it possible and the maximum character it can i print in a column using ALV grid dispaly.
Regards,
SandipanHi Sandipan,
refer notes 857823, 910300 and 959775. All these say there is a limitation of 128 characters.
857823 - ALV grid: Strings with a maximum of 128 characters
Symptom
Entries in cells of the type CHAR or string are truncated after 128
characters in the SAP GUI.
also refer,
ALV Grid Control (cl_gui_alv_grid), function module (Full-screen) Grid
(Reuse_alv_grid_display, SAPLSLVC_FULLSCREEN), SAPGUI, back end, front end
Cause and Prerequisites
The data table that is sent to the front end only allows character values
with the length 128.
Solution
This is the standard system behavior and cannot be changed. -
Want to display more than 300 charcters in a column using ALV grid display
Hi Guru's,
I am trying to display more than 500 charcters in a column using alv grid display but it in the output it is showing only 128 characters. Can you help me to display all the characters in particular column Or is there any limitation in maximum of no of charcters for a column?
Thanks,
Radha.Hi Paurl,
Define a work area say
wa_layout type slis_layout_alv.
then fill this work area as
wa_layout-zebra = X
wa_layout-colwidth_optimize = X.
wa_layout-max_linesize = 300.
Then in FM 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
is_layout = wa_layout
etc.
you provided this for the field which is displayed in alv grid will have more than 128 characters.
from this code i want,how it refers to particular field.
when i mentioned field catalog-OUTPUTLEN = '300'.
it is not displayed the field morethan 128 characters.
it only displays 128 characters.
please provide me clear and breif information with suitable code.
i am trying what your sending but it is not displayed more than 128 characters.
if you don't mind please spend for me some time for this and
give me clear and breif information with suitable code.
Thanks & Regards,
Radhakrishna. -
Hi Everyone,
I would like to know how to hide a column in alv grid. Is there any specific field to set in the field catalog.
Thanks in advance,
Prabs.Hello friends,
I am using the following lines of code, but invisible of my column ( message ) is not working, would be nice if some one can give me any tip.
Field-symbols: <lfs_fieldcat> TYPE lvc_s_fcat.
LOOP AT pt_fieldcat ASSIGNING <lfs_fieldcat>.
CASE <lfs_fieldcat>-fieldname.
WHEN 'DUMMY'.
<lfs_fieldcat>-coltext = 'Message'.
<lfs_fieldcat>-no_out = 'X'.
ENDCASE.
ENDLOOP.
I have also set the field catalog to no_out = 'X'.
PS: Do I need to append the field catalog to internal table ??
I am using the function
CALL METHOD lalv->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING I_STRUCTURE_NAME = 'abc'
IS_LAYOUT = ps_layout
CHANGING IT_OUTTAB = xyz.
Do I have to implicit set the field catalog in ps_layout ?? -
How to hide selection column from alv grid
hi
i want to hide selection columns form alv grid.. how can i do it.. Is there any fm for that?
regards
palakHi,
the ALV Grid Control allows you to directly hide key columns with NO_OUT (field KEY_SEL is not used).
Field name:NO_OUT
Comp. type:LVC_NOOUT
Dtype(length):Char(1)
SPACE, 'X'
If you set this field, you hide the relevant column in the list. Nevertheless, the column is available in the field selection and can be interactively selected by the user as a display field. The ALV displays the contents of hidden fields on the detail screen for a row in the grid control.
Regards,
Neenu.
Edited by: Neenu Jose on Oct 21, 2008 10:46 AM -
Hide a Column in ALV Grid Output
Hi,
I want to hide a column in ALV Grid Output through program.
I am using lwa_fieldcat-NO_OUT = 'X'. to hide the column in output but it is not working, column in not hided in the output.
Kindly suggest.It should work..
see the code :
d_fieldcat_wa-fieldname = 'MATNR'.
d_fieldcat_wa-seltext_l = 'material number'.
d_fieldcat_wa-no_out = 'X'. * hide particular field
append d_fieldcat_wa to d_fieldcat.
clear d_fieldcat_wa.
if not please paste your code here.
Thanks
Seshu -
Disable re-order columns in ALV Grid
Hi,
I want to disable the option of move/re-order of columns in ALV grid.
Ex: My grid is displaying 5 fields in the order F1, F2, F3, F4 & F5. I can move the columns by dragging then on their header so I can change the fields order to F2, F3, F1, F4 & F5. I want to disable this option of re-arranging the columns in the ALV grid.
Its not related FIX_COLUMN in field catalog.
Thanks & Regards,
Adithya M.Hi Hima,
FIX_COLUMN is is used to fix the respective columns from moving when horizontal scroll bar is moved.
I want to disable re-arranging of columns, i.e, after displaying the grid the user should not be able to re-arrange/drag the column from one position to other.
Thanks & Regards,
Adithya M -
How to Display Sub-Columns using ALV Grid
Hi ,
Could someone tell me how to display sub-columns under a parent column using ALV Grid. Do we have any standard Program which has this scenario. Please let me know.
Thanks,
Abaper.
Message was edited by:
ABAP'eryou can check all with <b>BCALV* or RSDEMO*</b> in SE38 for all Std
check below
BCALV_DND_01 Drag ALV Row to Tree Folder
BCALV_DND_02 Drag Icons from Tree to Rows of the Grid
BCALV_GRID_DND_TREE ALV Grid: Drag and Drop with ALV Tree
BCALV_GRID_DND_TREE_SIMPLE ALV GRID: Drag and drop with ALV tree (simple)
BCALV_TEST_COLUMN_TREE Program BCALV_TEST_COLUMN_TREE
Rewards if useful............
Minal -
How to insert the checkbox as a separate column in alv grid display
Hi
How to insert the checkboxes as a separate column in alv grid display with using the reuse_alv_fieldcatlog_mege.
example
matnr maktx ersda checkbox
10 books 28/03/2009 checkbox
Thanks
chinnuHi,
Check the following code.
TYPE-POOLS: slis.
TYPES:
BEGIN OF ty_output,
chk TYPE c,
number TYPE i,
name(20) TYPE c,
END OF ty_output.
DATA: gt_output TYPE STANDARD TABLE OF ty_output,
gs_output TYPE ty_output.
DATA: wa_layout TYPE slis_layout_alv.
DATA: it_fieldcatalog TYPE slis_t_fieldcat_alv,
After you populate the data, build the field catlog like shown below.
wa_fieldcatalog TYPE slis_fieldcat_alv.
wa_fieldcatalog-fieldname = 'CHK'.
wa_fieldcatalog-outputlen = '3'.
wa_fieldcatalog-col_pos = '1'.
wa_fieldcatalog-seltext_m = 'CHK'.
wa_fieldcatalog-checkbox = 'X'.
wa_fieldcatalog-edit = 'X'.
APPEND wa_fieldcatalog TO it_fieldcatalog.
wa_fieldcatalog-fieldname = 'NUMBER'.
wa_fieldcatalog-outputlen = '10'.
wa_fieldcatalog-col_pos = '2'.
wa_fieldcatalog-seltext_m = 'NUMBER'.
APPEND wa_fieldcatalog TO it_fieldcatalog.
CLEAR wa_fieldcatalog.
wa_fieldcatalog-fieldname = 'NAME'.
wa_fieldcatalog-outputlen = '10'.
wa_fieldcatalog-col_pos = '3'.
wa_fieldcatalog-seltext_m = 'NAME'.
APPEND wa_fieldcatalog TO it_fieldcatalog.
CLEAR wa_fieldcatalog.
wa_layout-box_fieldname = 'CHK' .
wa_layout-box_tabname = 'GT_OUTPUT' .
Now call the FM
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = ' '
* I_BUFFER_ACTIVE = ' '
i_callback_program = sy-repid
i_callback_pf_status_set = 'PF_STATUS'
i_callback_user_command = 'USER_COMMAND_GRID'
* I_CALLBACK_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_END_OF_LIST = ' '
* I_STRUCTURE_NAME =
* I_BACKGROUND_ID = ' '
* I_GRID_TITLE =
* I_GRID_SETTINGS =
is_layout = wa_layout
it_fieldcat = it_fieldcatalog
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS =
* IT_SORT =
* IT_FILTER =
* IS_SEL_HIDE =
* I_DEFAULT = 'X'
* I_SAVE = ' '
* IS_VARIANT =
* IT_EVENTS =
* IT_EVENT_EXIT =
* IS_PRINT =
* IS_REPREP_ID =
* I_SCREEN_START_COLUMN = 0
* I_SCREEN_START_LINE = 0
* I_SCREEN_END_COLUMN = 0
* I_SCREEN_END_LINE = 0
* IT_ALV_GRAPHICS =
* IT_HYPERLINK =
* IT_ADD_FIELDCAT =
* IT_EXCEPT_QINFO =
* I_HTML_HEIGHT_TOP =
* I_HTML_HEIGHT_END =
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = gt_output
* 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. -
Hide some columns in alv if no values are present for that columns ..
Hi all,
This looks like a wierd requirement ..In my ALV report, i am displaying around 30 fields. Among those , based on the input ,data will not be there for some of the columns .. In the output we want to hide those columns
eg:
Matnr Descr Column3 Column4
Mat1 Des1 (No data) sfsfs
Mat2 Des2 (No data) (No data)
The required output is :
Matnr Descr Column4
Mat1 Des1 sfsfs
Mat2 Des2 (No data)
How to do this in the most simplest / right way?
Hope my question is clear .
Thanking you in advance,
ShankarHi shankara,
1. In the output we want to hide those columns
For this,
a) first we have to know/detect by looping the table/logic
that which fields contain no data / are to be hidden
b) after that we have to use the field catalogue properties.
c) We have to loop at the fieldcatalogue,
and set the value fieldcat-NO_OUT = 'X'.
for those fields.
(In this manner, those fields/columns won't be shown)
regards,
amit m. -
Hotspot click for only some rows in ALV grid for a particular column ?
Hi there,
In ALV grid, we can make Hotspot enable for all rows in a specified column
by specifying in the fieldcatalog with Hotspot attribute set as true.
But I want to enable Hotspot only for certain rows in the particular column. I tried with MC_STYLE4_LINK , but I didnt got the required result.
So , how could I achieve that in ALV grid.
Points would be rewarded for helpful answers.
Regards,
Anil .Hi,
You can do it for a column. Please refer to the code snippet below,
DATA : it_fcat TYPE lvc_t_fcat,
wa_fcat LIKE LINE OF it_fcat.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
I_BUFFER_ACTIVE =
i_structure_name = 'SMMW_ALERTS_ICON_S'
I_CLIENT_NEVER_DISPLAY = 'X'
I_BYPASSING_BUFFER =
I_INTERNAL_TABNAME =
CHANGING
ct_fieldcat = it_fcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3
LOOP AT it_fcat INTO wa_fcat.
IF wa_fcat-fieldname = 'STATUS'.
wa_fcat-hotspot = 'X'.
MODIFY it_fcat FROM wa_fcat.
CLEAR wa_fcat.
ENDIF.
ENDLOOP.
CALL METHOD l_obj_alv_grid->set_table_for_first_display
EXPORTING
i_structure_name = 'SMMW_ALERTS_ICON_S'
CHANGING
it_outtab = lt_alerts_st
it_fieldcatalog = it_fcat.
In the above replace the structure 'SMMW_ALERTS_ICON_S' with your structure and column 'STATUS' with your desired column.
Hope this helps,
Regards,
Vinodh -
Hiding columns in ALV Grid output
Hi all,
Please find below my piece of code. I want to hide couple of columns in the grid output. Could you please tell me how to achieve it.
DATA: gr_alv TYPE REF TO cl_salv_table,
lr_display TYPE REF TO cl_salv_display_settings,
lr_columns TYPE REF TO cl_salv_columns_table,
lr_column TYPE REF TO cl_salv_column_table,
lr_functions TYPE REF TO cl_salv_functions_list,
lr_sorts TYPE REF TO cl_salv_sorts,
lr_print TYPE REF TO cl_salv_print,
lr_column_f TYPE REF TO cl_salv_columns,
gr_error TYPE REF TO cx_salv_not_found ,
lr_event TYPE REF TO cl_salv_events_table,
lr_handler TYPE REF TO znew_gc_event_handler,
lr_layout TYPE REF TO cl_salv_layout.
DATA: key TYPE salv_s_layout_key,
gr_msg TYPE string.
TRY.
* Create ALV instance - use CALL METHOD since this is a static method
CALL METHOD cl_salv_table=>factory
IMPORTING
r_salv_table = gr_alv
CHANGING
t_table = lt_to_header.
lr_display = gr_alv->get_display_settings( ).
lr_display->set_list_header( text-ttl ).
* Get functions object and then set all the functions to be allowed
lr_functions = gr_alv->get_functions( ).
lr_functions->set_all( ).
DATA: lv_field TYPE lvc_fname.
* Get column settings object and then optimize the column widths to the
* data
lr_columns = gr_alv->get_columns( ).
lr_columns->set_optimize( ).
*--- set column header for custom field Todays Date
TRY.
lr_column ?= lr_columns->get_column( 'ZZDATE' ).
lr_column->set_output_length('12').
lr_column->set_long_text( 'Todays Date' ).
CATCH cx_salv_not_found INTO gr_error.
gr_msg = gr_error->get_text( ).
MESSAGE gr_msg TYPE 'I'.
ENDTRY.
*--- set column header for custom field Age of Open
TRY.
lr_column ?= lr_columns->get_column( 'ZZ_AGE_OF_OPEN' ).
lr_column->set_output_length('12').
lr_column->set_long_text( 'Age of Open' ).
CATCH cx_salv_not_found INTO gr_error.
gr_msg = gr_error->get_text( ).
MESSAGE gr_msg TYPE 'I'.
ENDTRY.
*--- set column header for custom field Age when Confirmed
TRY.
lr_column ?= lr_columns->get_column( 'ZZ_AGE_CONFIRMED' ).
lr_column->set_output_length('18').
lr_column->set_long_text( 'Age when Confirmed' ).
CATCH cx_salv_not_found INTO gr_error.
gr_msg = gr_error->get_text( ).
MESSAGE gr_msg TYPE 'I'.
ENDTRY.
lr_event = gr_alv->get_event( ).
CREATE OBJECT lr_handler.
SET HANDLER: lr_handler->on_double_click FOR lr_event.
*... Set Sort
lr_sorts = gr_alv->get_sorts( ).
* " Optimize the column widths for printing.
lr_print = gr_alv->get_print( ).
lr_print->set_print_parameters_enabled( value = 'X' ).
lr_print->set_column_optimization( value = 'X' ).
*--- This code is to get the layout,save the layout and display the
* layout
lr_layout = gr_alv->get_layout( ).
key-report = sy-repid.
lr_layout->set_key( key ).
lr_layout->set_save_restriction( cl_salv_layout=>restrict_none )
DATA: init_layout TYPE slis_vari.
init_layout = p_layout.
lr_layout->set_initial_layout( init_layout ).
*--- display report
gr_alv->display( ).
CATCH cx_salv_msg.
WRITE: 'Error displaying grid! - cx_salv_msg'.
CATCH cx_salv_not_found.
WRITE: 'Error displaying grid! - cx_salv_not_found'.
CATCH cx_salv_data_error.
WRITE: 'Error displaying grid! - cx_salv_data_error'.
CATCH cx_salv_existing.
WRITE: 'Error displaying grid! - cx_salv_existing'.
ENDTRY.
Thanks,
SalilHI
THIS IS THE LOGIC
SELECTION-SCREEN BEGIN OF BLOCK charly
WITH FRAME TITLE text-100.
PARAMETERS: rb_dis RADIOBUTTON GROUP rb DEFAULT 'X'
USER-COMMAND ucomm ,
rb_hid RADIOBUTTON GROUP rb .
P_DEL TYPE VBAK-VKGRP .
SELECTION-SCREEN END OF BLOCK charly.
*SELECTION sCREEN FOR PO TABLE
SELECTION-SCREEN BEGIN OF BLOCK b2
WITH FRAME TITLE v_text.
SELECT-OPTIONS : s_xblnr FOR zmshub-xblnr MODIF ID gr2,
s_bstkd FOR zmshub-bstkd MODIF ID gr2,
s_posex FOR zmshub-posex_e MODIF ID gr2,
s_kdmat FOR zmshub-kdmat MODIF ID gr2.
PARAMETERS : p_upload LIKE ibipparms-path LENGTH 90 MODIF ID gr3 ,
p_down LIKE ibipparms-path DEFAULT 'C:\output_log.txt'
MODIF ID gr3.
SELECTION-SCREEN END OF BLOCK b2.
*SELECTION sCREEN FOR DOWNLOADING
SELECTION-SCREEN BEGIN OF BLOCK b4
WITH FRAME TITLE text-105.
PARAMETERS :
rb_n_d_f RADIOBUTTON GROUP rb1 DEFAULT 'X' ,
rb_ftp RADIOBUTTON GROUP rb1 ,
p_f_n TYPE c LENGTH 25 DEFAULT 'FILE NAME .TXT',
rb_ws_d RADIOBUTTON GROUP rb1 ,
p_dw_f_n TYPE c LENGTH 25 DEFAULT 'C:
TEMP\FILE.TXT',
rb_op_ds RADIOBUTTON GROUP rb1 ,
p_log_p LIKE filename-pathintern DEFAULT 'ZHKWEB01',
p_pa_fn LIKE rlgrap-filename MODIF ID gr1
DEFAULT '//SOME-DIR/FILE.TXT',
rb_ob_dw RADIOBUTTON GROUP rb1,
p_file LIKE filename-pathintern "logical path
DEFAULT 'ZHKWEB01', "name
p_fname LIKE rlgrap-filename MODIF ID gr1 "path &
*filename
DEFAULT text-t02, "/some-dir/file.txt
p_f_name TYPE c LENGTH 25 DEFAULT
SOME-SERVERNAME\SOME-DIR\SOME-FILE.TXT'.
SELECTION-SCREEN END OF BLOCK b4.
AT SELECTION-SCREEN OUTPUT.
IF NOT rb_dis IS INITIAL.
LOOP AT SCREEN.
IF screen-group1 = 'GR3'.
screen-invisible = 1.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ELSE.
LOOP AT SCREEN.
IF screen-group1 = 'GR2'.
screen-invisible = 0.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF. -
Hi Folks,
can any body please give some input on the follwoing.
i want to display material created by and material
created on for each material based on material selection
from selction screen dynamically.
like s_mat = 1, 2,3.
o/p must be
mat1 |creted by | creted on| mat2 |creted by | creted on|mat3 |creted by | creted on|
like if iam inputting 3 materials i need 3*3 = 9 columns in my alv grid o/p.
I have alreaady searched SDN I am not gettting any thing related to my requirement, please post some sample caode as I am new ot OOABAP.
Thanks,
Shwetha.
Moderator message : Not enough re-search before posting, specification dumping not allowed. Thread locked.
Edited by: Vinod Kumar on Nov 24, 2011 1:31 PMmethod 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.. -
Hiding a column in ALV GRID function module if it doesnt have data
Hi ,
I am using alv grid function module, in output i dont want to display the fields which dont have datawe dont know which column has no data..... we have to do it dynamically
This code does that dynamically, Here the field2 & Fiels4 are not displayed.
TYPE-POOLS:slis,abap.
TYPES:BEGIN OF ty_stru,
field1 TYPE c,field2 TYPE c,field3 TYPE c,field4 TYPE c,
END OF ty_stru.
DATA:itab TYPE TABLE OF ty_stru,
wa_stru TYPE ty_stru,
lv_repid TYPE sy-repid,
wa_fieldcat TYPE slis_fieldcat_alv,
it_fieldcat TYPE TABLE OF slis_fieldcat_alv,
it_details TYPE abap_compdescr_tab,
wa_components TYPE abap_compdescr,
lf_ref_descr TYPE REF TO cl_abap_structdescr,
lv_field TYPE abap_compname.
FIELD-SYMBOLS:<fs> TYPE ANY,
<fs1> TYPE ANY.
lf_ref_descr ?= cl_abap_typedescr=>describe_by_data( wa_stru ).
it_details[] = lf_ref_descr->components[].
wa_stru-field1 = 'A'.wa_stru-field3 = 'C'.APPEND wa_stru TO itab.
wa_stru-field1 = 'X'.wa_stru-field3 = 'Y'.APPEND wa_stru TO itab.
IF NOT itab[] IS INITIAL.
LOOP AT it_details INTO wa_components.
ASSIGN wa_components-name TO <fs>.
CHECK sy-subrc = 0.
SORT itab BY (<fs>) DESCENDING.
CONCATENATE 'WA_STRU' '-' <fs> INTO lv_field .
ASSIGN (lv_field) TO <fs1>.
CHECK sy-subrc = 0.
READ TABLE itab INTO wa_stru INDEX 1 TRANSPORTING (<fs>).
IF sy-subrc = 0 AND ( NOT <fs1> IS INITIAL ).
wa_fieldcat-fieldname = wa_components-name.
wa_fieldcat-seltext_m = wa_components-name.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
ENDIF.
ENDLOOP.
lv_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = lv_repid
it_fieldcat = it_fieldcat[]
TABLES
t_outtab = itab[].
ENDIF.
Maybe you are looking for
-
*Im getting frustrated !* Specs: I just bought an airport extreme (802.11n) Mac os X 10.5.4 & Windows Vista I want to connect the airport wirelessly to my mac and some other wireless devices but also connect it through my D-link DSL-302G internet mod
-
Hi, In my page I have 2 iViews - an MDM ResultSet iView and a web dynpro iView. In MDM ResultSet iView I have created a custom EPCF record event. The web dynpro application includes an iframe the source of which is another MDM ResultSet iview. The w
-
At some point during my editing the code completion system got screwed up. This has also caused the "Go to Definition" feature (holding CTRL key and hovering mouse over element where you want to see the definition for) to work incorrectly - see scree
-
Hi All, I am new to Business Process Management(BPM) can anyone tell me What is BPM? and the business scenario actual use of BPM and provide me any useful material on this. Thanks, Rahul. Edited by: rahul.girmaji on Dec 22, 2011 7:27 PM
-
Color Checker Passport W/Elements 12 No/Yes? Light Room?
Yes, I'm at it again with my seemingly endless questions, sorry. Probably buying, ( no, defintely if compatible,) the X-Rite Color Checker Passport program. I am having difficulty ascertaining definitevly, if the Color Checker program will be FULLY