Cell allignement in alv
hi,
i need to right allign the cell contents of a column in alv.
can any1 suggest how to do dat?
points will b rewarded....
HI,
In your fieldcat use this,
FORM Z_FIELDCAT USING P_I_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
DATA: I_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
*VBAK-VELN
I_FIELDCAT-COL_POS = '1'. " POSITION OF THE COLUMN.
I_FIELDCAT-FIELDNAME = 'VBELN'. " FIELD FOR WHICH CATALOG ID FILLED.
I_FIELDCAT-TABNAME = 'IT_FINAL'. " INTERNAL TABLE TO WHICH THE FIELD BELONGS TO.
I_FIELDCAT-KEY = 'X'. " SO THAT THIS FIELD IS NOT SCROLLABLE AND HIDDABLE.
<b> I_FIELDCAT-JUST = 'C'. " (R)ight (L)eft (C)ent.</b>
I_FIELDCAT-LZERO = 'X'. " OUTPUT WITH LEADING ZEROS.
I_FIELDCAT-SELTEXT_L = 'SALES ORDER'. " LONG TEXT FOR HEADER.
I_FIELDCAT-OUTPUTLEN = 15. " SET THE OUTPUT LENGTH.
I_FIELDCAT-REF_TABNAME = 'VBAK'. " FOR F1 & F4 HELP AS REFERNCED TO THE DDIC TABLE.
APPEND I_FIELDCAT TO P_I_FIELDCAT.
Reagrds,
Pritha.
Similar Messages
-
Problem in cell content of alv grid ...
hi all,
i want to get the cell content of alv grid in the handle method of event data_changed of cl_gui_alv_grid,
i using the following code ...
METHOD on_data_changed.
DATA : lv_value(30) TYPE c.
CALL METHOD ER_DATA_CHANGED->GET_CELL_VALUE
EXPORTING
I_ROW_ID = 3
I_TABIX =
I_FIELDNAME = 'cname' "" my column table
IMPORTING
E_VALUE = lv_value.
MESSAGE lv_value TYPE 'I'.
ENDMETHOD.
endclass.
but i cant get the value of cell content
Edited by: parashuram on Oct 21, 2011 3:49 PMTry this way
method handle_data_changed.
perform handle_data_changed using er_data_changed.
endmethod.
form handle_data_changed using p_data_changed type ref to
cl_alv_changed_data_protocol.
data: ls_mod_cell type lvc_s_modi,
lv_value_dni type lvc_value.
loop at p_data_changed->mt_mod_cells into ls_mod_cell.
call method p_data_changed->get_cell_value
exporting
i_row_id = ls_mod_cell-row_id
i_fieldname = 'FINI_SUST' <== Your field
importing
e_value = lv_value_dni .
endloop.
endform. -
Hi All
I would be greatful if someone could please help...
I am still attempting to get cells painted within a WDA ALV grid display.
I have tried to use the method stated in the WDA sap press book - but this method is for use with TABLE element and I am using a ViewContainerUIElement for my table. There are mentions of wonderful ways to color cells in a list display - but I cannot understand how this can be achieved. I currently have this working appart from the numeric numbers of the design being set into the relavant column cell.
If anyone could help that would be great...
Please see: http://picasaweb.google.co.uk/dave.alexander69/Pictures#5244800978549492338
LOOP AT lt_zdata INTO ls_zdata.
lv_index = sy-tabix.
* set column values
* loop at row data and set colour attributes of individual cells
LOOP AT lt_columns ASSIGNING <fs_column>.
lr_col_header = <fs_column>-r_column->get_header( ).
lr_col_header->set_ddic_binding_field( ).
CREATE OBJECT lr_input_field EXPORTING value_fieldname = <fs_column>-id.
lr_column = lr_column_settings->get_column( <fs_column>-id ).
* for the date columns only...
IF <fs_column>-id(4) = 'CELL'.
* get and set column dates from select option user input
READ TABLE lt_dates INTO ls_dates INDEX 1.
IF lt_dates IS INITIAL.
lr_col_header->set_text( 'Date' ).
ELSE.
ls_dates-low = ls_dates-low + lv_incr_date.
MOVE ls_dates-low+2(2) TO lv_for_col_date+6(2). "Year
MOVE ls_dates-low+4(2) TO lv_for_col_date+3(2). "Month
MOVE ls_dates-low+6(2) TO lv_for_col_date(2). "Day
MOVE lv_for_col_date TO lv_col_date.
lr_col_header->set_text( lv_col_date ).
lv_incr_date = lv_incr_date + 7.
ENDIF.
LOOP AT lt_orgdata_dates INTO ls_orgdata_dates
WHERE crew = ls_zdata-crew
AND position = ls_zdata-position
AND name = ls_zdata-person
AND trip_arr >= ls_dates-low
AND trip_dep <= ls_dates-low.
* column heading settings
lr_field = lr_table->if_salv_wd_field_settings~get_field( <fs_column>-id ).
lr_field->if_salv_wd_sort~set_sort_allowed( abap_false ).
* trying to set cell variants ?@#??!!???
* lr_cv = lr_column->set_key( ls_zdata-variance ).
* lr_cv->set_editor( lr_input_field ).
* lr_cv->set_cell_design( value = '01').
* lr_column->add_cell_variant( lr_cv ).
* current method of seeting the cell colors... (but puts value in cell!)
FIELD-SYMBOLS: <fs> TYPE data.
lr_column->set_cell_design_fieldname( value = <fs_column>-id ).
ASSIGN COMPONENT <fs_column>-id OF STRUCTURE ls_zdata TO <fs>.
WRITE: CL_WD_TABLE_COLUMN=>e_cell_design-one TO <fs>.
MODIFY lt_zdata FROM ls_zdata. " INDEX lv_index.
ENDLOOP.
ENDIF.
Kind Regards
Dave AlexanderHi check this code to set cell colors for ALV grid.
Take a context attribute with type WDUI_TABLE_CELL_DESIGN.
Here i am populating colors based on some condition.Check the loop of the internal table.
method get_flight_details .
data:node_flights type ref to if_wd_context_node,
it_flights type sflight_tab1,
ls_flights type sflight,
it_final type if_componentcontroller=>elements_flights,
ls_final type if_componentcontroller=>element_flights.
select * from sflight into table it_flights
up to 100 rows.
node_flights = wd_context->get_child_node( 'FLIGHTS' ).
loop at it_flights into ls_flights.
move-corresponding ls_flights to ls_final.
if ls_final-price = '185.00'.
ls_final-readonly = abap_true.
ls_final-celldesign =
cl_wd_table_column=>e_cell_design-badvalue_light.
else.
ls_final-readonly = ' '.
ls_final-celldesign =
cl_wd_table_column=>e_cell_design-goodvalue_light.
endif.
append ls_final to it_final.
endloop.
node_flights->bind_table(
new_items = it_final
set_initial_elements = abap_true
* INDEX = INDEX
data: l_ref_cmp_usage type ref to if_wd_component_usage.
l_ref_cmp_usage = wd_this->wd_cpuse_alv( ).
if l_ref_cmp_usage->has_active_component( ) is initial.
l_ref_cmp_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(
* Make Price column editable
data:l_column type ref to cl_salv_wd_column,
l_column1 type ref to cl_salv_wd_column,
lr_input type ref to cl_salv_wd_uie_input_field,
l_input1 type ref to cl_salv_wd_uie_input_field.
l_column = l_value->if_salv_wd_column_settings~get_column( 'PRICE' ).
create object lr_input
exporting
value_fieldname = 'PRICE'
l_column->set_cell_editor( value = lr_input ).
* to make some cells non editable
lr_input->set_read_only_fieldname( value = 'READONLY' ).
l_value->if_salv_wd_column_settings~delete_column( id = 'READONLY' )
*Set the table Editable
l_value->if_salv_wd_table_settings~set_read_only( value = abap_false ).
*Give colors to cells
l_column1 = l_value->if_salv_wd_column_settings~get_column( 'CARRID' ).
l_column1->set_cell_design_fieldname( value = 'CELLDESIGN' ).
l_value->if_salv_wd_column_settings~delete_column( id = 'CELLDESIGN' )
endmethod.
Thanks
Suman -
Vertical Alignment in the cell of a ALV webdynpro
HI Experts,
As per my requirement i have created an ALV in webdynpro, which has several columns few of the columns have check boxes and few have input fields.
Now, if I look at my ALV output i observed in the cell which are input fields all the data is bottom aligned but in the other cells the check boxes are top aligned . ( The vertical alignment i am talking about is with respect to each cell ).
I didnot fins any property either in the ALV or as even in a ordinary table where i can play around with the vertical alignment in a cell.
Do you think we can change the alignment in cell of a ALV? if so how?
Thanks in Advance!!_Go to "Provide Pages Feedback" in the "Pages" menu_, describe what you wish.
Then, cross your fingers, and wait _at least_ for iWork'11
Yvan KOENIG (VALLAURIS, France) samedi 13 mars 2010 23:31:06 -
How to make cell editable in ALV
Hello all,
I have following scenario.
I am using ALV_GRID_DISPLAY.
I have 5 field on output screen say A , B , C , D , E.
In field A i have check box.
In field B i have number like 0 ,1 , 2 , 3 ,4 ,5.
My problem is whenever i get value of field A as 0 i want to make my only check box of that row editable.
So can anyone help me.
Thanks in advance
SachinHi Sachin,
REPORT zalv_editf4display.*Type pools for alv
TYPE-POOLS : slis.*structure for t582a tbale
TYPES : BEGIN OF ty_table,
infty TYPE infty,
pnnnn TYPE pnnnn_d,
zrmkz TYPE dzrmkz,
zeitb TYPE dzeitb,
dname TYPE dianm,
davo TYPE davo,
davoe TYPE davoe,
END OF ty_table.*Structure for infotype text
TYPES : BEGIN OF ty_itext,
infty TYPE infty,
itext TYPE intxt,
sprsl TYPE sprsl,
END OF ty_itext.*Structure for output display
TYPES : BEGIN OF ty_output,
infty TYPE infty,
itext TYPE intxt,
pnnnn TYPE pnnnn_d,
zrmkz TYPE dzrmkz,
zeitb TYPE dzeitb,
dname TYPE dianm,
davo TYPE davo,
davoe TYPE davoe,
END OF ty_output.*internal table and work area declarations
DATA : it_table TYPE STANDARD TABLE OF ty_table INITIAL SIZE 0,
it_output TYPE STANDARD TABLE OF ty_output INITIAL SIZE 0,
it_pbo TYPE STANDARD TABLE OF ty_output INITIAL SIZE 0,
it_ittext TYPE STANDARD TABLE OF ty_itext INITIAL SIZE 0,
wa_table TYPE ty_table,
wa_output TYPE ty_output,
wa_ittext TYPE ty_itext.*Data declarations for dropdown lists for f4
DATA: it_dropdown TYPE lvc_t_drop,
ty_dropdown TYPE lvc_s_drop,
*data declaration for refreshing of alv
stable TYPE lvc_s_stbl.*Global variable declaration
DATA: gstring TYPE c.
*Data declarations for ALV
DATA: c_ccont TYPE REF TO cl_gui_custom_container, "Custom container object
c_alvgd TYPE REF TO cl_gui_alv_grid, "ALV grid object
it_fcat TYPE lvc_t_fcat, "Field catalogue
it_layout TYPE lvc_s_layo. "Layout*ok code declaration
DATA:
ok_code TYPE ui_func.
initialization eventINITIALIZATION.start of selection event
START-OF-SELECTION.*select the infotypes maintained
SELECT infty
pnnnn
zrmkz
zeitb
dname
davo
davoe
FROM t582a UP TO 10 ROWS
INTO CORRESPONDING FIELDS OF TABLE it_table.* *Select the infotype texts
IF it_table[] IS NOT INITIAL.
SELECT itext
infty
sprsl
FROM t582s
INTO CORRESPONDING FIELDS OF TABLE it_ittext
FOR ALL ENTRIES IN it_table
WHERE infty = it_table-infty
AND sprsl = 'E'.
ENDIF.
*Apppending the data to the internal table of ALV output
LOOP AT it_table INTO wa_table. wa_output-infty = wa_table-infty.
wa_output-pnnnn = wa_table-pnnnn.
wa_output-zrmkz = wa_table-zrmkz.
wa_output-zeitb = wa_table-zeitb.
wa_output-dname = wa_table-dname.
wa_output-davo = wa_table-davo.
wa_output-davoe = wa_table-davoe.* For texts READ TABLE it_ittext INTO wa_ittext WITH KEY infty = wa_table-infty.
wa_output-itext = wa_ittext-itext.
APPEND wa_output TO it_output.
CLEAR wa_output. ENDLOOP.* Calling the ALV screen with custom container CALL SCREEN 0600.*On this statement double click it takes you to the screen painter SE51.
*Enter the attributes
*Create a Custom container and name it CCONT and OK code as OK_CODE.
*Save check and Activate the screen painter.
*Now a normal screen with number 600 is created which holds the ALV grid.
PBO of the actual screen ,
Here we can give a title and customized menus
*create 2 buttons with function code 'SAVE' and 'EXIT'.
GIVE A SUITABLE TITLE&---------------------------------------------------------------------
*& Module STATUS_0600 OUTPUT
text
MODULE status_0600 OUTPUT.
SET PF-STATUS 'DISP'.
SET TITLEBAR 'ALVF4'.
ENDMODULE. " STATUS_0600 OUTPUT
calling the PBO module ALV_GRID.
*& Module PBO OUTPUT
text
MODULE pbo OUTPUT.*Creating objects of the container
CREATE OBJECT c_ccont
EXPORTING
container_name = 'CCONT'.* create object for alv grid
create object c_alvgd
exporting
i_parent = c_ccont.* SET field for ALV
PERFORM alv_build_fieldcat.* Set ALV attributes FOR LAYOUT
PERFORM alv_report_layout.
CHECK NOT c_alvgd IS INITIAL.* Call ALV GRID CALL METHOD c_alvgd->set_table_for_first_display
EXPORTING
is_layout = it_layout
i_save = 'A'
CHANGING
it_outtab = it_output
it_fieldcatalog = it_fcat
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.ENDMODULE. " PBO OUTPUT&----
*& Form alv_build_fieldcat
text
<--P_IT_FCAT text
*subroutine to build fieldcatFORM alv_build_fieldcat. DATA lv_fldcat TYPE lvc_s_fcat.
CLEAR lv_fldcat. lv_fldcat-row_pos = '1'.
lv_fldcat-col_pos = '1'.
lv_fldcat-fieldname = 'INFTY'.
lv_fldcat-tabname = 'IT_OUTPUT'.
lv_fldcat-outputlen = 8.
lv_fldcat-scrtext_m = 'Infotype'.
lv_fldcat-icon = 'X'.
APPEND lv_fldcat TO it_fcat.
CLEAR lv_fldcat. lv_fldcat-row_pos = '1'.
lv_fldcat-col_pos = '2'.
lv_fldcat-fieldname = 'PNNNN'.
lv_fldcat-tabname = 'IT_OUTPUT'.
lv_fldcat-outputlen = 15.
lv_fldcat-scrtext_m = 'Structure'.
lv_fldcat-icon = ''.
APPEND lv_fldcat TO it_fcat.
CLEAR lv_fldcat. lv_fldcat-row_pos = '1'.
lv_fldcat-col_pos = '3'.
lv_fldcat-fieldname = 'ITEXT'.
lv_fldcat-tabname = 'IT_OUTPUT'.
lv_fldcat-outputlen = 60.
lv_fldcat-scrtext_m = 'Description'.
lv_fldcat-icon = ''.
APPEND lv_fldcat TO it_fcat.
CLEAR lv_fldcat.
lv_fldcat-row_pos = '1'.
lv_fldcat-col_pos = '5'.
lv_fldcat-fieldname = 'ZRMKZ'.
lv_fldcat-tabname = 'IT_OUTPUT'.
lv_fldcat-outputlen = 1.
lv_fldcat-scrtext_m = 'PERIOD'.
lv_fldcat-icon = ''.
APPEND lv_fldcat TO it_fcat.
CLEAR lv_fldcat. lv_fldcat-row_pos = '1'.
lv_fldcat-col_pos = '6'.
lv_fldcat-fieldname = 'ZEITB'.
lv_fldcat-tabname = 'IT_OUTPUT'.
lv_fldcat-outputlen = 5.
lv_fldcat-scrtext_m = 'Time constraint'.
lv_fldcat-edit = 'X'.
*To avail the existing F4 help these are to
*be given in the field catalogue
lv_fldcat-f4availabl = 'X'.
lv_fldcat-ref_table = 'T582A'.
lv_fldcat-ref_field = 'ZEITB'. APPEND lv_fldcat TO it_fcat.
CLEAR lv_fldcat. lv_fldcat-row_pos = '1'.
lv_fldcat-col_pos = '7'.
lv_fldcat-fieldname = 'DNAME'.
lv_fldcat-tabname = 'IT_OUTPUT'.
lv_fldcat-outputlen = 15.
lv_fldcat-scrtext_m = 'Dialogmodule'.
lv_fldcat-icon = ''.
APPEND lv_fldcat TO it_fcat.
CLEAR lv_fldcat. lv_fldcat-row_pos = '1'.
lv_fldcat-col_pos = '8'.
lv_fldcat-fieldname = 'DAVO'.
lv_fldcat-tabname = 'IT_OUTPUT'.
lv_fldcat-outputlen = 15.
lv_fldcat-scrtext_m = 'Start'.
lv_fldcat-edit = 'X'.
APPEND lv_fldcat TO it_fcat.
CLEAR lv_fldcat. lv_fldcat-row_pos = '1'.
lv_fldcat-col_pos = '9'.
lv_fldcat-fieldname = 'DAVOE'.
lv_fldcat-tabname = 'IT_OUTPUT'.
lv_fldcat-outputlen = 15.
lv_fldcat-scrtext_m = 'End'.
lv_fldcat-icon = ''.
APPEND lv_fldcat TO it_fcat.
CLEAR lv_fldcat.
*To create drop down for the field 'DAVO'
with our own f4 help
ty_dropdown-handle = '1'.
ty_dropdown-value = ' '.
APPEND ty_dropdown TO it_dropdown.
ty_dropdown-handle = '1'.
ty_dropdown-value = '1'.
APPEND ty_dropdown TO it_dropdown.
ty_dropdown-handle = '1'.
ty_dropdown-value = '2'.
APPEND ty_dropdown TO it_dropdown.
ty_dropdown-handle = '1'.
ty_dropdown-value = '3'.
APPEND ty_dropdown TO it_dropdown. CALL METHOD c_alvgd->set_drop_down_table
EXPORTING
it_drop_down = it_dropdown.
LOOP AT it_fcat INTO lv_fldcat.
CASE lv_fldcat-fieldname.
To assign dropdown in the fieldcataogue
WHEN 'DAVO'.
lv_fldcat-drdn_hndl = '1'.
lv_fldcat-outputlen = 15.
MODIFY it_fcat FROM lv_fldcat.
ENDCASE.
ENDLOOP.ENDFORM. " alv_build_fieldcat&----
*& Form alv_report_layout
text
<--P_IT_LAYOUT text
*Subroutine for setting alv layout
FORM alv_report_layout.
it_layout-cwidth_opt = 'X'.
it_layout-col_opt = 'X'.
it_layout-zebra = 'X'.ENDFORM. " alv_report_layout* PAI module of the screen created. In case we use an interactive ALV or
*for additional functionalities we can create OK codes
*and based on the user command we can do the coding.
*& Module PAI INPUT
text
MODULE pai INPUT.*To change the existing values and refresh the grid
*And only values in the dropdown or in the default
*F4 can be given , else no action takes place for the dropdown
*and error is thrown for the default F4 help and font changes to red
and on still saving, value is not changed c_alvgd->check_changed_data( ).Based on the user input
*When user clicks 'SAVE;
CASE ok_code. WHEN 'SAVE'.*A pop up is called to confirm the saving of changed data
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
titlebar = 'SAVING DATA'
text_question = 'Continue?'
icon_button_1 = 'icon_booking_ok'
IMPORTING
answer = gstring
EXCEPTIONS
text_not_found = 1
OTHERS = 2.
IF sy-subrc NE 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.*When the User clicks 'YES'
IF ( gstring = '1' ).
MESSAGE 'Saved' TYPE 'S'.
*Now the changed data is stored in the it_pbo internal table
it_pbo = it_output.
*Subroutine to display the ALV with changed data.
PERFORM redisplay.
ELSE.
*When user clicks NO or Cancel
MESSAGE 'Not Saved' TYPE 'S'.
ENDIF.
**When the user clicks the 'EXIT; he is out
WHEN 'EXIT'.
LEAVE PROGRAM.
ENDCASE. CLEAR: ok_code.ENDMODULE. " PAI INPUT
*& Form REDISPLAY
text
--> p1 text
<-- p2 text
FORM redisplay .*Cells of the alv are made non editable after entering OK to save CALL METHOD c_alvgd->set_ready_for_input
EXPORTING
i_ready_for_input = 0.*Row and column of the alv are refreshed after changing values stable-row = 'X'.
stable-col = 'X'.*REfreshed ALV display with the changed values
*This ALV is non editable and contains new values
CALL METHOD c_alvgd->refresh_table_display
EXPORTING
is_stable = stable
EXCEPTIONS
finished = 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. " REDISPLAY
Regards,
Flavya -
Colour a particular cell dynamically in ALV
Hi,
What class and method to be used to colour a particular cell dynamically in ALV?
Thanks,
Ronita.U can use the below class to colour a particular cell dynamically in ALV:
class:cl_gui_alv_grid
See below code. It definitely helps u.
Provide Reward Points...:-)
types : begin of ty. include structure MARA.
types : rowcolor(4) TYPE c,
end of ty.
data : itab type standard table of ty,"Output Internal table
i_fieldcat type standard table of lvc_s_fcat,"Field catalog
wa type ty,
w_variant type disvariant,
w_layout TYPE lvc_s_layo,"Layout structure
o_docking type ref to cl_gui_docking_container,"Docking Container
o_grid type ref to cl_gui_alv_grid."Grid
select * from mara into corresponding fields of table itab up to 10 rows.
call screen 9000.
*& Module STATUS_9000 OUTPUT
text
module STATUS_9000 output. if o_docking is initial.
SET PF-STATUS 'ZSTATUS'. "GUI Status
SET TITLEBAR 'ZTITLE'. "TitleCreating Docking Container
CREATE OBJECT o_docking
EXPORTING
RATIO = '95'.
IF sy-subrc eq 0.Creating Grid
CREATE OBJECT o_grid
EXPORTING
i_parent = o_docking.
ENDIF.Filling the fieldcatalog table
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
I_STRUCTURE_NAME = 'MARA'
CHANGING
ct_fieldcat = i_fieldcat
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3.
w_variant-report = sy-repid.Setting layout
w_layout-info_fname = 'ROWCOLOR'."For row coloringColouring a row
CLEAR wa.
READ TABLE itab INTO wa INDEX 3.
IF sy-subrc EQ 0.
wa-rowcolor = 'C311'.
MODIFY itab FROM wa TRANSPORTING rowcolor WHERE matnr = wa-matnr.
ENDIF.Displaying the output
CALL METHOD o_grid->set_table_for_first_display
EXPORTING
IS_VARIANT = w_variant
I_SAVE = 'A'
is_layout = w_layout
CHANGING
it_outtab = itab
IT_FIELDCATALOG = i_fieldcat
EXCEPTIONS
INVALID_PARAMETER_COMBINATION = 1
PROGRAM_ERROR = 2
TOO_MANY_LINES = 3
others = 4.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.endif.endmodule. " STATUS_9000 OUTPUT
*& Module USER_COMMAND_9000 INPUT
PAI
module USER_COMMAND_9000 input.
data lv_ucomm type sy-ucomm.
lv_ucomm = sy-ucomm.
CASE lv_ucomm.
WHEN 'CANCEl' OR 'EXIT'.
perform free_objects.
LEAVE PROGRAM.
when 'BACK'.
perform free_objects.
set screen '0'.
leave screen.
ENDCASE.
endmodule. " USER_COMMAND_9000 INPUT
*& Form free_objects
Free Objects
form free_objects .
CALL METHOD o_grid->free
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
others = 3.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL METHOD o_docking->free
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
others = 3.
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. " free_objects
Provide Reward Points...:-) -
Hello experts,
I am new to ALV development. I have created an ALV grid report which displays data fetching from DDIC tables.
I want to display tooltip for each individual cell of the ALV, I know about using field category property SELTEXT_M but its used for entire column tooltip. My requirement is to display tooltip for individual cell in the grid.
Please provide me simple explanation to use tooltip for cell in ALV.
Simple example code would be appreciated.
Thanks in advance.
Regards,
Viral PatelHi,
If you are using OOPS ALV then, there is a field available in the field catalogue : TOOLTIP which you can use to display the tooltip for the column header.
try this:
wa_fcat-TOOLTIP = '-tooltip--'.
I hope it helps you.
Thanks & Regards,
Radhika -
How to remove the orange default color of the first cell in an ALV report
Hello all,
I have coded an ALV grid report (in ABAP object) and when I execute it, I saw that the first cell containing data, in the top left corner of the ALV grid is always colored in orange by default. This bothers me because I have colored this cell in green (if I select an other line in my grid, I can clearly see that my top left cell is colored in green).
Does anyone knows how to "desactivate" this orange default color ?
Thanks for your answer.
Best regards
Cyril S.Thanks Uwe and Rainer,
Unfortunately, I tried what you mentioned both and nothing works.
As you said, it seems mandatory that a cell must be selected by default in an ALV grid.
That's a pity because this "ugly orange" hides my beautiful green color.
I will answer my customer that it is not possible. That's all.
Thank you for your help. I did appreciate.
Best regards
Cyril S. -
How to set a single cell editable in alv Webdynpro Abap
I am trying to edit a single cell on lead selection. here the steps i did to achive this.
1. I added a Attribute READ_ONLY inside my node of type WDY_BOOLEAN.
2. i am conditionally making this Attribute - READ_ONLY = 'X'.
3. i am binding my node with new values.
4. for ALV here is the code i have added.
DATA :lo_cmp_usage TYPE REF TO if_wd_component_usage,
lr_column TYPE REF TO cl_salv_wd_column,
lr_table_settings TYPE REF TO if_salv_wd_table_settings,
lt_columns TYPE salv_wd_t_column_ref,
ls_columns TYPE salv_wd_s_column_ref,
lr_input_field TYPE REF TO cl_salv_wd_uie_input_field,
lo_interfacecontroller TYPE REF TO iwci_salv_wd_table ,
lv_value TYPE REF TO cl_salv_wd_config_table.
*Taking reference of the Component Usage
lo_cmp_usage = wd_this->wd_cpuse_cu_alv( ).
IF lo_cmp_usage->has_active_component( ) IS INITIAL.
lo_cmp_usage->create_component( ).
ENDIF.
lo_interfacecontroller = wd_this->wd_cpifc_cu_alv( ).
lv_value = lo_interfacecontroller->get_model( ).
CALL METHOD lv_value->if_salv_wd_column_settings~get_columns
RECEIVING
value = lt_columns.
LOOP AT lt_columns INTO ls_columns.
lr_column = ls_columns-r_column.
CASE ls_columns-id.
WHEN 'USR_ACT_RT'.
CREATE OBJECT lr_input_field
EXPORTING
value_fieldname = ls_columns-id.
lr_column->set_cell_editor( value = lr_input_field ).
lr_input_field->set_read_only_fieldname( value = 'READ_ONLY' ).
ENDCASE.
ENDLOOP.
lr_table_settings ?= lv_value.
lr_table_settings->set_read_only( abap_false ).
lv_value->if_salv_wd_column_settings~delete_column( id = 'READ_ONLY' ).
but instead of changing the particular cell where i have marked READ_ONLY = 'X' it is changing whole column 'USR_ACT_RT' data as editable .
If anybody can please help ASAPHi Tashi,
Thanks for your reply,i have did the same way u are doing here for setting the READ_ONLY Attribute conditionally.
here is my code for setting the read only attribute .
IF NOT lo_nd_nd_cost_rate IS INITIAL.
lo_nd_nd_cost_rate->get_static_attributes_table( IMPORTING table = lt_nd_cost_rate ).
ENDIF.
IF NOT lo_el_nd_cost_rate IS INITIAL.
* get all declared attributes
lo_el_nd_cost_rate->get_static_attributes(
IMPORTING
static_attributes = ls_nd_cost_rate_sel ).
ENDIF.
lv_datum = sy-datum.
lv_month = lv_datum+4(2).
** @TODO handle non existant child
LOOP AT lt_nd_cost_rate INTO ls_nd_cost_rate WHERE quarter = ls_nd_cost_rate_sel-quarter.
IF ls_nd_cost_rate-quarter = 'Q1'.
IF ( lv_month EQ '01' OR lv_month EQ '02' OR lv_month EQ '03' ).
ls_nd_cost_rate-read_only = 'X'.
ELSE.
ls_nd_cost_rate-read_only = ''.
* report message
CALL METHOD lo_message_manager->report_warning
EXPORTING
message_text = lv_text.
ENDIF.
ELSEIF ls_nd_cost_rate-quarter = 'Q2'.
IF ( lv_month EQ '04' OR lv_month EQ '05' OR lv_month EQ '06' ).
ls_nd_cost_rate-read_only = 'X'.
ELSE.
ls_nd_cost_rate-read_only = ''.
* report message
CALL METHOD lo_message_manager->report_warning
EXPORTING
message_text = lv_text.
ENDIF.
ELSEIF ls_nd_cost_rate-quarter = 'Q3'.
IF ( lv_month EQ '07' OR lv_month EQ '08' OR lv_month EQ '09' ).
ls_nd_cost_rate-read_only = 'X'.
ELSE.
ls_nd_cost_rate-read_only = ''.
* report message
CALL METHOD lo_message_manager->report_warning
EXPORTING
message_text = lv_text.
ENDIF.
ELSEIF ls_nd_cost_rate-quarter = 'Q4'.
IF ( lv_month EQ '10' OR lv_month EQ '11' OR lv_month EQ '12' ).
ls_nd_cost_rate-read_only = 'X'.
ELSE.
ls_nd_cost_rate-read_only = ''.
* report message
CALL METHOD lo_message_manager->report_warning
EXPORTING
message_text = lv_text.
ENDIF.
ENDIF.
MODIFY lt_nd_cost_rate FROM ls_nd_cost_rate INDEX sy-tabix TRANSPORTING read_only .
CLEAR ls_nd_cost_rate.
ENDLOOP.
lo_nd_nd_cost_rate->bind_table( lt_nd_cost_rate ).
please see in the below sceen shot the last two cells are editable in the User Actual Rate Column whlie the selected rows cell is not editable. Please revert if u have any input for same. -
Editable / Non editable input field CELL (individually) on ALV dynamically
Hi again,
I need more help with an issue.
I have an ALV table with three columns that is necessary put values into input field cell editors, but these cells should be editable or not depending of business logic. I've got make editable or non in entire ROW LEVEL (method set_read_only_fieldname( 'READ_ONLY' )., but ¿how can I set editable or non at individual cells?
Any idea to do that?
Regards
Edited by: vanbelal on Mar 24, 2010 3:33 PMCan you paste any example source code?
I don't know how can I bind enabled property dynamically to individual CELL, I'm setting properties to whole column.
lt_columns = lr_column_settings->get_columns( ).
LOOP AT lt_columns INTO ls_columns.
if ls_columns-id = 'COLUMN1' or 'COLUMN2' or 'COLUMN3'.
CREATE OBJECT lr_input_field
EXPORTING
value_fieldname = ls_columns-id.
ls_columns-r_column->set_cell_editor( lr_input_field ).
Should I put business logic here? how can I set enabled or not on CELL, at this point I'm processing whole column!!
lr_input_field->set_enabled( abap_true ).
endif.
ENDLOOP.
Edited by: vanbelal on Mar 24, 2010 4:12 PM -
SAP GUI Java 7.10 rev 5: Copy cells content from ALV does not work (OSX)
Hi all,
I'm trying rev 5 for OSX. ALV aesthetics is really great but: copy cells content is not possible anymore.
Nothing happens with command+C.
I cannot copy anymore just a part of the cell content.
Trying all possible key combinations, something is copied with Ctrl+C. When I paste it, the pasted content is something like this:
(0100),RID(),CID(),RIDN(0),E(true),RO(false),CTL(-1) (0000012338),RID(),CID(),RIDN(0),E(true),RO(false),CTL(-1) (),RID(),CID(),RIDN(0),E(true),RO(false),CTL(-1) (),RID(),CID(),RIDN(0),E(true),RO(false),CTL(-1) (),RID(),CID(),RIDN(0),E(true),RO(false),CTL(-1) (),RID(),CID(),RIDN(0),E(true),RO(false),CTL(-1)
where "0000012338" is the content I wanted to copy.
Any suggestion?
Thanks,
LorenzoHello Lorenzo,
thanks for the feedback. We are working on it and if all goes well, a solution will be provided with 7.10 rev 6.
Best regards
Rolf-Martin -
How to change the content of a cell in an ALV-List?
Hi,
knows anybody a way to change the cell-content in an ALV-List?
In my case, I want to give the user the posibility to click on a pecific cell
in the list and change in an edit-mode or similar else!?
Thanks for your ideas!Get the existing field catalog using the method cl_gui_alv_grid->get_frontend_fieldcatalog. Change the edit property in the field catalog and refresh it using the method cl_gui_alv_grid->set_frontend_fieldcatalog.
Hope this helps.
Regards,
Nithya -
Hi!!
I'm doing an ALV, and I need to compare two cells. Only one of them could be inform.
I used this code:
CLASS lcl_event_hadler DEFINITION
CLASS lcl_event_handler DEFINITION.
PUBLIC SECTION.
METHODS:
handle_data_changed
FOR EVENT data_changed OF cl_gui_alv_grid
IMPORTING er_data_changed.
ENDCLASS. "lcl_event_handler DEFINITION
CLASS lcl_event_handler IMPLEMENTATION
CLASS lcl_event_handler IMPLEMENTATION.
METHOD handle_data_changed
METHOD handle_data_changed.
PERFORM handle_data_changed USING er_data_changed.
ENDMETHOD. "handle_data_changed
ENDCLASS. "lcl_event_handler IMPLEMENTATION
*& Form HANDLE_DATA_CHANGED
text
-->P_ER_DATA_CHANGED text
FORM handle_data_changed USING ir_data_changed
TYPE REF TO
cl_alv_changed_data_protocol.
DATA: ls_mod_cell TYPE lvc_s_modi,
lv_value TYPE lvc_value,
lv_value1 TYPE lvc_value.
SORT ir_data_changed->mt_mod_cells." BY row_id.
LOOP AT ir_data_changed->mt_mod_cells
INTO ls_mod_cell
WHERE fieldname = 'CELL2'.
CALL METHOD ir_data_changed->get_cell_value
EXPORTING
i_row_id = ls_mod_cell-row_id
i_fieldname = 'CELL2'
IMPORTING
e_value = lv_value1.
ENDLOOP.
LOOP AT ir_data_changed->mt_mod_cells
INTO ls_mod_cell
WHERE fieldname = 'CELL1'.
IF it_prueba-clase IS INITIAL.
CALL METHOD ir_data_changed->modify_cell
EXPORTING
i_row_id = ls_mod_cell-row_id
i_fieldname = ls_mod_cell-fieldname
i_value = campo_prueba.
ENDIF.
CALL METHOD ir_data_changed->get_cell_value
EXPORTING
i_row_id = ls_mod_cell-row_id
i_fieldname = 'CELL1'
IMPORTING
e_value = lv_value.
IF lv_value = lv_value1.
CALL METHOD ir_data_changed->add_protocol_entry
EXPORTING
i_msgid = 'SU'
i_msgno = '000'
i_msgty = 'E'
i_msgv1 = 'Only one cell '
i_fieldname = ls_mod_cell-fieldname
i_row_id = ls_mod_cell-row_id.
ENDIF.
ENDLOOP.
ENDFORM. " HANDLE_DATA_CHANGED
With this code, i can check only one time the cells. If I clear cell2 press enter, and then I write in cell2 again it code doesn't work.
How can i do it with other method?
Thanks in advanceHead Crab wrote:
Tuesdays 1st 2nd 3rd 4th 5th MB
Jan 4, 2011 7 14 21 28 36 32
Jan 11, 2011 5 15 25 28 38 16
Jan 18, 2011 2 17 25 28 38 25
Okay, say the above is my table, how do I compare two cells in a row for two numbers? Say I wanted to find out if row A2 contained a 7 and a 28?
"A2" is an address for a single cell, not a row. Its current content, assuming no empty rows above or empty columns left of what's shown, is "Jan 4, 2011". Perhaps you mean Row 2, or the range B2:G2.
Assuming that you want to know 'if' (or 'how many times') two specific numbers occur in the range of cells from column B to column G in a single row, COUNTIF is the function you want.
Place the two target numbers into cell I1 and J1.
Enter the formula below into I2:
=COUNTIF($B2:$G2,I$1)
Fill the formula right into J2, then fill both down to row 4.
You'll get a count of the occurrences of each number.
If you want only a "Yes" (both numbers appear in the range) or "No" (neither of the numbers appear, or one appears but not the other), use this variation (in I2 or J2):
=IF(AND(COUNTIF($B2:$G2,I$1)>0,COUNTIF($B2:$G2,J$1)>0),"Yes","No")
Regards,
Barry -
Create dynamic internal table with deep structure;cell coloring dynamic ALV
Hi,
My requirement is to do cell colouring for a dynamic ALV.
So I am creating a dynamic internal table using the following method.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = i_fieldcatalog[]
IMPORTING
ep_table = i_output.
But how do I define field COLORS which should be again an internal table ?
Is there any other way for cell colouring?
Putting my problem in another way:
How do I create a dynamic internal table with one field as another internal table.
Quick replies are highly appreciated.
Thanks,
Nisha Vengal.halo Nisha
Before building the display table . you can add the field in the feild catalog right . This display table gets generated from the field catalog right
1 Create a global structute say ZEXTEND_FIELDCAT
2 Have fields like STYLE type lvc_t_styl
COLOR type LVC_T_SCOL.
3 Now you have to extend ur fieldcatalog
l_fieldcat-fieldname = COLOR'.
l_fieldcat-ref_field = 'COLOR'.
l_fieldcat-ref_table = 'ZEXTEND_FIELDCAT'.
APPEND l_fieldcat TO lt_field_catalog.
CLEAR l_fieldcat. -
Hello gurus.
Please help me with merging cells.
I need to merge some cells in alv grid. To create grid i use reuse_alv FM. For example it is needed to merge all cells in several rows. What should i do ? I think that there should be some manipulations with fieldcatalog but i don't know the correct ones.
Thanks.
regards,
alex.If you would like to merge cells, meaning that you want to hide repeating values in a certain column, then you can simply sort by that column.
report zrich_0004
no standard page heading.
type-pools slis.
data: fieldcat type slis_t_fieldcat_alv.
data: sort type slis_t_sortinfo_alv.
data: begin of ivbap occurs 0,
vbeln type vbap-vbeln,
kunnr type vbak-kunnr,
vkorg type vbak-vkorg,
netwr type vbap-netwr,
end of ivbap.
* Selection Screen
start-of-selection.
select vbak~vbeln vbak~kunnr vbak~vkorg vbap~netpr
into table ivbap
from vbak
inner join vbap
on vbak~vbeln = vbap~vbeln
up to 100 rows.
perform write_report.
* WRITE_REPORT
form write_report.
data: tmp_sort type line of slis_t_sortinfo_alv.
data: fc_tmp type slis_fieldcat_alv .
* Build feildcat
clear fc_tmp. refresh fieldcat.
fc_tmp-reptext_ddic = 'Sales Org'.
fc_tmp-fieldname = 'VKORG'.
fc_tmp-tabname = 'IVBAP'.
fc_tmp-outputlen = '4'.
append fc_tmp to fieldcat.
clear fc_tmp.
fc_tmp-reptext_ddic = 'Customer'.
fc_tmp-fieldname = 'KUNNR'.
fc_tmp-tabname = 'IVBAP'.
fc_tmp-outputlen = '10'.
append fc_tmp to fieldcat.
clear fc_tmp.
fc_tmp-reptext_ddic = 'SD DOC'.
fc_tmp-fieldname = 'VBELN'.
fc_tmp-tabname = 'IVBAP'.
fc_tmp-outputlen = '10'.
append fc_tmp to fieldcat.
clear fc_tmp.
fc_tmp-reptext_ddic = 'Net'.
fc_tmp-fieldname = 'NETWR'.
fc_tmp-tabname = 'IVBAP'.
fc_tmp-outputlen = '15'.
fc_tmp-datatype = 'QUAN'.
append fc_tmp to fieldcat.
* Build sort table
clear sort. refresh sort.
clear tmp_sort.
tmp_sort-fieldname = 'VKORG'.
tmp_sort-tabname = 'IALV'.
tmp_sort-up = 'X'.
append tmp_sort to sort.
* CALL ABAP LIST VIEWER (ALV)
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
it_sort = sort
it_fieldcat = fieldcat
tables
t_outtab = ivbap.
endform.
Regards,
Rich Heilman
Maybe you are looking for
-
Time delay while printing PO Report with "watermark"
Hi XMLP Gurus, I have to again resort to you guys for help. Hope I will find it. I have added a watermark to the PO Report RTF template and it is taking too much time (almost 3 mins) to print the output. With out a print option the report is running
-
Is there a way to use osx to encrypt all the hard drives in the system and not just part of the osx drive?
-
Is it possible to change date format in Web Dynpro?
Hi, I have an input field that is mapped to a context data type of date. It is showing me the data in the format of "mm/dd/yyyy". Is it possible for me to change this format to "dd/mm/yyyy"? I know it is possible to alter the Regional Setting in a W
-
Hi all, I am sorry but I seem to not find any where else to ask this question so I have it here. Apple do have the Federal employee store that provides special price for federal employee but when I go there I do not see any discount price for ipad 2.
-
Hi everybody, I've tried to follow the instructions to establish a connection with MDMat this address : [http://wiki.sdn.sap.com/wiki/display/SAPMDM/Connectivity-BI-MDM+Integration] When I test the connection, an error message appears : "Language inf