Cell tooltip for ALV
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 Patel
Hi,
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
Similar Messages
-
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 -
Hi,
is it possible to add a tooltip (text appearing when mouse is moved over) to a single cell in an ALV grid created with FUNCTION 'REUSE_ALV_GRID_DISPLAY'?
Please restrict your answers to the question, thank you.
Regards,
ClemensHi,
Tool tips are possible only at Column heading level unless you declare your column as a exception column / ICON / SYMBOL columns.
Regards,
Ravi
Note :Please mark the helpful answers
Message was edited by: Ravikumar Allampallam -
Hi All,
I have an abap web dynpro application yje use alv control,
I need to create a tooltip for a cell (not a column) in the alv.
Is it possible?
Thanks,
NaamaHello Sadiq,
1. Create an attribute by name 'Tooltip' in the context node that is passed to the ALV component
2. Populate the data for this attribute based on your requirement
3. write the following code in the INIT method of the view controller./component controller
data lo_cmp_usage type ref to if_wd_component_usage.
data lo_interfacecontroller type ref to iwci_salv_wd_table .
data lr_value type ref to cl_salv_wd_config_table.
"Initialise the used Component .. in the code sample used component name is ALV. replace this accordingly
lo_cmp_usage = wd_this->wd_cpuse_alv( ).
if lo_cmp_usage->has_active_component( ) is initial.
lo_cmp_usage->create_component( ).
endif.
" get the ALV model from the Used Component's interface controller
lo_interfacecontroller = wd_this->wd_cpifc_alv( ).
lr_value = lo_interfacecontroller->get_model( ).
data: lr_column_settings type ref to if_salv_wd_column_settings,
lr_column type ref to cl_salv_wd_column,
lr_column_cell_editor type ref to cl_salv_wd_uie,
lr_input_field type ref to cl_salv_wd_uie_input_field.
"Delete the column that is corresponding to the TOOLTIP attribute
lr_column_settings ?= lr_value.
lr_column_settings->delete_column( 'TOOLTIP' ).
"Retrieve the column for which you want the tooltip
lr_column = lr_column_settings->get_column( <Context attribute name for which you want the tooltip> ).
lr_column_cell_editor = lr_column->get_cell_editor( ).
lr_column_cell_editor->set_tooltip_fieldname( 'TOOLTIP' ).
BR, Saravanan -
How to assign a tooltip for a field in ALV editable grid?
I have to display some instructions ( 50 chars long) for an editable field in alv.
How to do this?
BCALV_DEMO_TOOLTIP tells about assiging tooltip to an icon or symbol.
Thanks,
Ven..Neither of these two example programs help much in regards to tooltips against any field of any row. Both of these examples use tooltips for Icons. I have also been looking for a single example of tooltips usage outside of these two programs, and have found nothing in SAP, or on the internet, so far.
Having said that, I have tried to implement the same method used by the later example, but have not got this to work. What I think we need is an example of this functionality where these Icons are not used!. I believe.
Gary King -
ALV check box in a cell uneditable for already checked entry
Hi all,
I have written program to display ALV with a column having check boxes.
I have requirement to make ALV-chech box in a cell uneditable for some other login for already checked entry.
Please guide me for the same..Hi,
If it is list, try using events and then call it in reuse_alv_grid_display.
Sample code from SDN
**events
REFRESH:IT_EVENTS.
CLEAR:X_EVENTS,IT_EVENTS.
X_EVENTS-NAME = SLIS_EV_END_OF_LIST.
X_EVENTS-FORM = 'MODIFY_LIST'.
APPEND X_EVENTS TO IT_EVENTS.
CLEAR X_EVENTS.
END-OF-SELECTION.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IT_FIELDCAT = IT_FIELDCAT
IT_EVENTS = IT_EVENTS
TABLES
T_OUTTAB = ITAB
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.
FORM MODIFY_LIST.
data: l_lines type i.
describe table itab lines l_lines.
L_LINES = L_LINES + 3.
"because we have 3 lines extra occupied by lables.
"if we have header,i mean top of page add the no.of lines
"how many ever top of page have + 3 for labels.
DO L_LINES TIMES.
read table it_chg with key INDEX = sy-index.
if sy-subrc = 0.
**This code is for reading the out put line
**and modify accordinlg to our requiremnet.
**don't chnage this.
READ LINE SY-INDEX INDEX SY-LSIND.
IF SY-SUBRC = 0.
MODIFY LINE SY-INDEX INDEX SY-LSIND
FIELD FORMAT ITAB-NAME INPUT.
ENDIF.
ENDIF.
ENDDO.
ENDFORM. "MODIFY_LIST -
Ask split long text into two line into same cell for ALV
Dear All,
Is it possible split long text into two line into same cell for ALV display data?
Regards,
Luke
Moderator message: please search for information before asking.
Edited by: Thomas Zloch on Feb 24, 2011 10:12 AMKeep options: Select the paragraph, then CtrlAltK (Mac: CmdOptK, I
think).
If you want the paragraphs in pairs, create two paragraph styles. Style
A has keep options set to start on a new page, and also, its Next Style
is style B.
Style B has no keep options, but it's Next Style is Style A.
Select all the text.
From the flyout menu of the paragraph styles palette, apply Style A
"then next style."
Now all paragraphs will be alternating -- style A, style B, style A, etc.
Now do what I wrote initially, and you'll have pairs of paragraph in
separate text frames. -
Setting new cell variant for an alv table column
Hi,
I want to set a new cell variant for a column. Therefore I did the following steps:
1. Create an object of CL_SALV_WD_CV_STANDARD
2. SET_KEY( 'CELLVAR1 )
3. set_cell_design([..]-goodvalue_medium )
4. SET_EDITOR( lr_alv_input_field )
After that I added the cell variant to the column by using the method "add_cell_variant".
The last step is to call method SET_SELECTED_CELL_VARIANT.
I checked my program by using get_selected_cell_variant( ) and the return string was okay.
But when the table is displayed, the new cell variant isn't working. I defined an input field as the cell editor for my new cell variant but when the table is shown, it is just text - no input possible. In addition to that the selected cell design (goodvalue_medium , step 3) isn't working. So I think the cell variant is not used.
Can you help me?
Thanks & Regards,
HendrikHi
I wonder if you can help me please, I too am having issues implementing ALV cell changes in WDA?
I am basically trying to dynamically change the individual color of a cell (not the entire column or row) dependant on certain criteria. I apologies but find that you are the closest resource for any potential information. Please see screen shot below.
Currently my code is as follows:
see: www.picasaweb.google.co.uk/dave.alexander69/Pictures#5244416971466907938
data: lr_cv TYPE REF TO cl_salv_wd_cv_standard.
loop at table 1 row data
loop at table columns
for the date columns only...
IF <fs_column>-id(4) = 'CELL'.
get and set column header dates from select option user input - done
loop at table 2 row data (table 2 contains date ranges for row concerned)
MOVE: ls_zdata-variance TO lv_variance.
method 1 - as in sap press WD4A -:
lr_cv = cl_wd_table_standard_cell=>new_table_standard_cell(
view = view
variant_key = lv_variance ).
as mentioned...
CREATE OBJECT lr_cv.
lr_cv->set_key( 'VARIANCE' ).
lr_cv->set_cell_design( '09' ).
lr_cv->set_editor( lr_input_field ).
lr_column->add_cell_variant( lr_cv ).
lr_column->set_cell_editor( lr_input_field ).
lr_column->set_sel_cell_variant_fieldname( 'VARIANCE' ).
lr_column->set_cell_design_fieldname( value = 'COLOR_CELL' ).
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 ).
the only way I get cell coloring to work - but this is for entire column?
ls_zdata-color_cell = cl_wd_table_standard_cell=>e_cell_design-one.
MODIFY lt_zdata FROM ls_zdata..
ENDLOOP.
ENDIF.
IF <fs_column>-id = 'COLOR_CELL'.
CALL METHOD lr_column->set_visible( EXPORTING value = '00' ).
ENDIF.
ENDLOOP
ENDLOOP.
As you see I am in the dark a bit regarding cell variants and wonder if you can point me in a better direction.
Many thanks for any help,
Dave Alexander -
Adding ToolTip for individual cell in the table
Hi everybody,
Its urgent. I want to add ToolTip for individual cells. What I have implemented, it show same ToolTip for each cell. I want different ToolTip for individual cell.
My cells are not editable, as i need this.
Pleae help me.
Thanks in Advance.
DawoodzaiHi,
See this demo pasted below-
import java.awt.*;
import javax.swing.*;
public class SimpleTableDemo extends JFrame {
public SimpleTableDemo() {
super("SimpleTableDemo");
Object[][] data = {
{"Mary", "Campione", "Snowboarding", new Integer(5), new Boolean(false)},
{"Alison", "Huml", "Rowing", new Integer(3), new Boolean(true)},
{"Kathy", "Walrath", "Chasing toddlers", new Integer(2), new Boolean(false)},
{"Sharon", "Zakhour", "Speed reading", new Integer(20), new Boolean(true)},
{"Angela", "Lih", "Teaching high school", new Integer(4), new Boolean(false)}
String[] columnNames = {"First Name", "Last Name", "Sport", "# of Years", "Vegetarian"};
final JTable table = new MyTable(data, columnNames);
table.setPreferredScrollableViewportSize(new Dimension(500, 70));
JScrollPane scrollPane = new JScrollPane(table);
getContentPane().add(scrollPane, BorderLayout.CENTER);
public static void main(String[] args) {
SimpleTableDemo frame = new SimpleTableDemo();
frame.pack();
frame.setVisible(true);
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class MyTable extends JTable {
public MyTable(Object[][] rowData, Object[] columnNames) {
super(rowData,columnNames);
public String getToolTipText(MouseEvent e) {
int r = rowAtPoint(e.getPoint());
int c = columnAtPoint(e.getPoint());
return getValueAt(r,c).toString();
} -
I know how to create a tooltip for datagrid and/or its
columns. Is it possible to create a tooltip (or something similar)
for each cell? So whenever the mouse is over a certain cell, a tip
would be shown for that cell that depends on the value of the cell.
Similar functionality can often be seen in web-based database apps:
an Ajax query gets related data from a database on mouseOver.
My need and idea is to
- show a simple text list as a tooltip
- the text would be fetched from a database via a web service
- the fetch would be based on datagrid's (hidden) rowid and
each column's (hidden) column id (which are real database columns)
- the database structure is an n:m relation i.e. one
rowid+colid can refer to several items that are then used in the
tooltip
Use case: A number is displayed in the datagrid. The need is
to display 0-n references related to that specific figure (e.g.
book names, notes etc) in the tooltip. Next cell's tooltip would be
showing different references.
Anybody any ideas or suggestions? Thanks!Hi,
Did you try creating a custom itemRenderer and handling the
mouse events for that item renderer component. There is also a
property called dataTipFunction, please check that too.
Hope this helps. -
Deactivate Tooltips for every column in ALV
Hi Everybody,
how can i deactivate the tooltip for every column in a ALV.
regards,
SidThe logic to set the tooltip goes something like this:
data l_table type ref to cl_salv_wd_config_table.
l_table = l_salv_wd_table->get_model( ).
data l_column type ref to cl_salv_wd_column.
data l_header type ref to cl_salv_wd_column_header.
l_column = l_table->if_salv_wd_column_settings~get_column( 'CREATED_BY' ).
l_header = l_column->get_header( ).
l_header->set_prop_ddic_binding_field(
property = if_salv_wd_c_ddic_binding=>bind_prop_tooltip
value = if_salv_wd_c_ddic_binding=>ddic_bind_none ).
l_header->set_tooltip( ` ` ).
However this logic just sets it for one column at a time. If you want to do all of them then you would need to loop through a listing of the columns and repeat this logic for each one. Instead of using if_salv_wd_column_settingsget_column, you could use the method if_salv_wd_column_settingsget_columns to return an internal table of object instances for each column object defined in the ALV. -
How to display tooltip in ALV GRID CELL?
Hello,
I'm trying to display dynamic tootips for data in ALV GRID Cells.
My ALV Gid Cells content does not display Icon or symbol or Exception but pure data (In my case dates).
Is there a way to do display a toolip that will change dynamicaly according to a rule.
I took a look at the BCALV_DEMO_TOOLTIP program
but it does not answer my expectation since it display
toltip for Icon or symbol or Exception.
Can someone help on this case.
Best regards
HarryHai Harry
icon
value set: SPACE, 'X' 'X' = column contents to be output as an icon.
The caller must consider the printability of icons.
symbol
value set: SPACE, 'X' 'X' = column contents are to be output as a symbol.
The internal output table column must be a valid symbol character.
The caller must consider the printability of symbols.
Symbols can usually be printed, but may not always be output correctly, depending on the printer configuration.
Thanks & regards
Sreenu -
Why this code is not working for alv
Dear
Regards,
i have implemented the same program for ALV which i have used earlier in the reports. but now it is showing no output:
*& Report ZTCT1_ALV2 *
REPORT ztct1_alv2 .
CLASS lcl_event_receiver DEFINITION DEFERRED.
* INCLUDING TABLES.
TABLES: vbrk,
vbrp,
kna1,
t001w,
makt.
* DECLARATION OF INTERNAL TABLES.
DATA: BEGIN OF itab OCCURS 0, "Including the fields of VBRK and VBRP
kunag LIKE vbrk-kunag, "Customer Code
name1 LIKE kna1-name1, "Customer Name
vbeln LIKE vbrk-vbeln, "Invoice #
fkdat LIKE vbrk-fkdat, "Invoice Date
werks LIKE vbrp-werks, "Plant
name2 LIKE t001w-name1,"Plant Description
matnr LIKE vbrp-matnr, "Material #
maktx LIKE makt-maktx, "Material Description
meins LIKE vbrp-meins, "Unit of Measure
fklmg LIKE vbrp-fklmg, "Quantity
netwr LIKE vbrp-netwr, "Amount
END OF itab,
BEGIN OF itnm OCCURS 0, "Including the fields of VBRK and KNA1
kunag LIKE vbrk-kunag, "Customer Code
name1 LIKE kna1-name1, "Customer Name
END OF itnm,
BEGIN OF itpt OCCURS 0, "Including the fields of VBRP and T001W
werks LIKE vbrp-werks, "Plant
name1 LIKE t001w-name1,"Plant Description
END OF itpt,
BEGIN OF itmt OCCURS 0, "Including the fields of VBRP and MAKT
matnr LIKE vbrp-matnr, "Material #
maktx LIKE makt-maktx, "Material description
END OF itmt,
BEGIN OF itsm OCCURS 0,
kunag LIKE kna1-kunnr,
name1 LIKE kna1-name1,
fklmg LIKE vbrp-fklmg,
netwr LIKE vbrp-netwr,
END OF itsm,
ok_code LIKE sy-ucomm,
save_ok LIKE sy-ucomm,
g_max TYPE i VALUE 100,
g_repid LIKE sy-repid,
gs_layout TYPE lvc_s_layo,
g_container TYPE scrfname VALUE 'CUST_CONT',
grid1 TYPE REF TO cl_gui_alv_grid,
g_custom_container TYPE REF TO cl_gui_custom_container,
grid2 TYPE REF TO cl_gui_alv_grid,
gt_sort TYPE lvc_t_sort,
gt_fieldcatalog TYPE lvc_t_fcat,
w_tot_qty LIKE vbrp-fklmg,
w_tot_amt LIKE vbrp-netwr,
* Reference to Dialogbox Container.
dialogbox_container TYPE REF TO cl_gui_dialogbox_container,
* Reference to local class that handles events of GRID1 and
* DIALOGBOX_CONTAINER
event_receiver TYPE REF TO lcl_event_receiver.
* SELECT-OPTIONS
SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN BEGIN OF BLOCK input WITH FRAME TITLE text-000.
SELECT-OPTIONS: s_werks FOR vbrp-werks, "Plant
s_kunag FOR vbrk-kunag, "Customer
s_matnr FOR vbrp-matnr, "Material Number
s_fkdat FOR vbrk-fkdat. "Invoice Date
SELECTION-SCREEN END OF BLOCK input .
SELECTION-SCREEN SKIP 1.
* START-OF-SELECTION
START-OF-SELECTION.
SET SCREEN 100.
* CLEARING INTERNAL TABLES.
CLEAR: itab,
itnm,
itmt,
itpt.
* QUERY FOR JOINING TABLES VBRK AND VBRP
SELECT vbrk~kunag
vbrk~vbeln
vbrk~fkdat
vbrp~werks
vbrp~matnr
vbrp~meins
vbrp~fklmg
vbrp~netwr
INTO CORRESPONDING FIELDS OF TABLE itab
FROM vbrk
INNER JOIN vbrp
ON vbrk~vbeln = vbrp~vbeln
WHERE vbrk~kunag IN s_kunag
AND vbrk~fkdat IN s_fkdat
AND vbrp~matnr IN s_matnr
AND vbrp~werks IN s_werks.
* QUERY FOR JOINING TABLES VBRK AND KNA1
SELECT kna1~kunnr AS kunag
kna1~name1
INTO TABLE itnm
FROM kna1
WHERE kna1~kunnr IN s_kunag.
* QUERY FOR JOINING TABLES VBRP AND T001W
SELECT t001w~werks
t001w~name1
INTO TABLE itpt
FROM t001w
WHERE t001w~werks IN s_werks.
* QUERY FOR JOINING TABLES VBRP AND MAKT
SELECT makt~matnr
makt~maktx
INTO TABLE itmt
FROM makt
WHERE makt~matnr IN s_matnr.
* SORTING INTERNAL TABLES.
SORT itab BY kunag.
* LOOP AT itab.
* CLEAR: itmt, itnm, itpt.
* READ TABLE itnm WITH KEY kunag = itab-kunag.
* READ TABLE itmt WITH KEY matnr = itab-matnr.
* READ TABLE itpt WITH KEY werks = itab-werks.
* itab-name1 = itnm-name1.
* itab-maktx = itmt-maktx.
* itab-name2 = itpt-name1.
* MODIFY itab.
* ENDLOOP.
* PERFORM fieldcatalog_init USING gt_fieldcatalog[] 'KUNAG' 'C' 'Customer Code'.
* PERFORM fieldcatalog_init USING gt_fieldcatalog[] 'NAME1' 'C' 'Customer Name'.
* PERFORM fieldcatalog_init USING gt_fieldcatalog[] 'VBELN' 'C' 'Invoice #'.
* PERFORM fieldcatalog_init USING gt_fieldcatalog[] 'FKDAT' 'DATS' 'Invoice Date'.
* PERFORM fieldcatalog_init USING gt_fieldcatalog[] 'WERKS' 'C' 'Plant'.
* PERFORM fieldcatalog_init USING gt_fieldcatalog[] 'NAME2' 'C' 'Plant Description'.
* PERFORM fieldcatalog_init USING gt_fieldcatalog[] 'MATNR' 'C' 'Material #'.
* PERFORM fieldcatalog_init USING gt_fieldcatalog[] 'MAKTX' 'C' 'Material Description'.
* PERFORM fieldcatalog_init USING gt_fieldcatalog[] 'MEINS' 'C' 'UoM'.
* PERFORM fieldcatalog_init USING gt_fieldcatalog[] 'FKLMG' 'QUAN' 'Quantity'.
* PERFORM fieldcatalog_init USING gt_fieldcatalog[] 'NETWR' 'CURR' 'Amount'.
LOOP AT itab.
CLEAR itsm.
READ TABLE itnm WITH KEY kunag = itab-kunag.
itsm-kunag = itab-kunag.
itsm-name1 = itnm-name1.
itsm-fklmg = itab-fklmg.
itsm-netwr = itab-netwr.
COLLECT itsm.
ENDLOOP.
PERFORM fieldcatalog_init USING gt_fieldcatalog[] 'KUNAG' 'C' 'Customer Code'.
PERFORM fieldcatalog_init USING gt_fieldcatalog[] 'NAME1' 'C' 'Customer Name'.
PERFORM fieldcatalog_init USING gt_fieldcatalog[] 'FKLMG' 'QUAN' 'Quantity'.
PERFORM fieldcatalog_init USING gt_fieldcatalog[] 'NETWR' 'CURR' 'Amount'.
PERFORM sort_build USING gt_sort[].
PERFORM layout_init USING gs_layout.
* LOCAL CLASSES: Definition
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
METHODS:
handle_double_click
FOR EVENT double_click OF cl_gui_alv_grid
IMPORTING e_row e_column,
handle_close
FOR EVENT close OF cl_gui_dialogbox_container
IMPORTING sender.
PRIVATE SECTION.
DATA: dialogbox_status TYPE c. "'X': does exist, SPACE: does not ex.
ENDCLASS. "lcl_event_receiver DEFINITION
* LOCAL CLASSES: Implementation
CLASS lcl_event_receiver IMPLEMENTATION.
* §3.At doubleclick(1): The event DOUBLE_CLICK provides
* parameters of the clicked row and column.
* Use row parameter to select a line of the
* corresponding internal table.
METHOD handle_double_click.
DATA: ls_sm LIKE LINE OF itsm,
wa_itab LIKE ITAB.
* read selected row from internal table gt_sflight
READ TABLE itsm INDEX e_row-index INTO ls_sm.
* §4.At Doubleclick(2): Select booking data
* READ TABLE ITAB WITH KEY KUNAG = LS_SM-KUNAG. .
READ TABLE ITAB INTO WA_ITAB WITH KEY KUNAG = LS_SM-KUNAG.
* §5.At doubleclick(3): Create dialogbox to show detail list
* (if not already existent)
IF dialogbox_status IS INITIAL.
dialogbox_status = 'X'.
PERFORM create_detail_list.
ELSE.
CALL METHOD dialogbox_container->set_visible
EXPORTING
visible = 'X'.
CALL METHOD grid2->refresh_table_display.
ENDIF.
ENDMETHOD. "handle_double_click
METHOD handle_close.
* §6.Handle the CLOSE-button of the dialogbox
* set dialogbox invisible
* (the dialogbox is destroyed outomatically when the user
* switches to another dynpro).
CALL METHOD sender->set_visible
EXPORTING
visible = space.
* In this example closing the dialogbox leads
* to make it invisible. It is also conceivable to destroy it
* and recreate it if the user doubleclicks a line again.
* Displaying a great amount of data has a greater impact on performance.
ENDMETHOD. "handle_close
ENDCLASS. "lcl_event_receiver IMPLEMENTATION
* lcl_event_receiver (Implementation)
*=====================================================================
* FORM EXIT_PROGRAM *
FORM exit_program.
CALL METHOD g_custom_container->free.
CALL METHOD cl_gui_cfw=>flush.
IF sy-subrc NE 0.
* add your handling, for example
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = g_repid
txt2 = sy-subrc
txt1 = 'Error in FLush'(500).
ENDIF.
LEAVE TO SCREEN 0.
ENDFORM. "exit_program
* MODULE PBO_ALV OUTPUT
MODULE pbo_alv OUTPUT.
SET PF-STATUS 'MAIN'.
SET TITLEBAR 'MAIN100'.
g_repid = sy-repid.
IF g_custom_container IS INITIAL.
READ TABLE itsm.
CREATE OBJECT g_custom_container
EXPORTING
container_name = g_container
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5.
IF sy-subrc NE 0.
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = g_repid
txt2 = sy-subrc
txt1 = 'The control could not be created'(510).
ENDIF.
CREATE OBJECT grid1
EXPORTING
i_parent = g_custom_container.
gs_layout-grid_title = 'Invoice Summary'.
CALL METHOD grid1->set_table_for_first_display
EXPORTING
is_layout = gs_layout
CHANGING
it_outtab = itsm[]
it_fieldcatalog = gt_fieldcatalog
it_sort = gt_sort.
CREATE OBJECT event_receiver.
SET HANDLER event_receiver->handle_double_click FOR grid1.
ENDIF.
CALL METHOD cl_gui_control=>set_focus
EXPORTING
control = grid1.
ENDMODULE. "PBO_ALV OUTPUT
* MODULE PAI_ALV INPUT
MODULE pai_alv INPUT.
CALL METHOD cl_gui_cfw=>dispatch.
CASE sy-ucomm.
WHEN 'BACK' OR 'EXIT' OR 'CANCEL'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. "PAI_ALV INPUT
*& Form fieldcatalog_init
* text
* -->LT_FIELDCATtext
* -->VALUE(FIELDtextE)
* -->VALUE(FIELDtextE)
* -->VALUE(FIELDtextT)
FORM fieldcatalog_init USING lt_fieldcatalog TYPE lvc_t_fcat
value(field_name) value(field_type) value(field_text).
DATA: ls_fieldcatalog TYPE lvc_s_fcat.
CLEAR ls_fieldcatalog.
ls_fieldcatalog-fieldname = field_name.
ls_fieldcatalog-datatype = field_type.
ls_fieldcatalog-reptext = field_text.
ls_fieldcatalog-coltext = field_text.
ls_fieldcatalog-seltext = field_text.
ls_fieldcatalog-tooltip = field_text.
APPEND ls_fieldcatalog TO lt_fieldcatalog.
ENDFORM. "fieldcatalog_init
*& Form sort_build
* text
* -->LT_SORT text
FORM sort_build USING lt_sort TYPE lvc_t_sort.
DATA: ls_sort TYPE lvc_s_sort.
ls_sort-fieldname = 'KUNAG'. "Fieldname on which to sort
ls_sort-up = 'X'. "Sort Ascending
APPEND ls_sort TO lt_sort.
ls_sort-fieldname = 'NAME1'. "Fieldname on which to sort
ls_sort-up = 'X'. "Sort Ascending
APPEND ls_sort TO lt_sort.
ENDFORM. "sort_build
*& Form layout_init
* text
* -->LS_LAYOUT text
FORM layout_init USING ls_layout TYPE lvc_s_layo.
ls_layout-zebra = 'X'.
ls_layout-grid_title = 'Customer Details'.
ls_layout-sel_mode = 'A'.
ls_layout-cwidth_opt = 'X'.
ENDFORM. "layout_init
*& Form create_detail_list
* text
* --> p1 text
* <-- p2 text
FORM create_detail_list.
* create dialogbox container as dynpro-instance
* When the user switches to another screen, it is
* destroyed by lifetime mangagement of CFW
CREATE OBJECT dialogbox_container
EXPORTING
top = 150
left = 150
lifetime = cntl_lifetime_dynpro
caption = 'INVOICE DETAILS'(200)
width = 800
height = 200.
CREATE OBJECT grid2
EXPORTING i_parent = dialogbox_container.
* Register ABAP OO event 'CLOSE'. It is not necessary to register this
* event at the frontend (this is done during creation).
SET HANDLER event_receiver->handle_close FOR dialogbox_container.
* display data
gs_layout-grid_title = 'Invoice Details'(100).
CALL METHOD grid2->set_table_for_first_display
EXPORTING
i_structure_name = 'itab'
is_layout = gs_layout
CHANGING
it_outtab = itab[]
it_fieldcatalog = gt_fieldcatalog
it_sort = gt_sort.
CALL METHOD cl_gui_control=>set_focus
EXPORTING
control = grid2.
ENDFORM. " create_detail_list[code][/
code]Hi,
I also copied and pasted the same code check once again by copying this code and create screens by double clicking on 100.
CLASS lcl_event_receiver DEFINITION DEFERRED.
* INCLUDING TABLES.
TABLES: vbrk,
vbrp,
kna1,
t001w,
makt.
* DECLARATION OF INTERNAL TABLES.
DATA: BEGIN OF itab OCCURS 0, "Including the fields of VBRK and VBRP
kunag LIKE vbrk-kunag, "Customer Code
name1 LIKE kna1-name1, "Customer Name
vbeln LIKE vbrk-vbeln, "Invoice #
fkdat LIKE vbrk-fkdat, "Invoice Date
werks LIKE vbrp-werks, "Plant
name2 LIKE t001w-name1,"Plant Description
matnr LIKE vbrp-matnr, "Material #
maktx LIKE makt-maktx, "Material Description
meins LIKE vbrp-meins, "Unit of Measure
fklmg LIKE vbrp-fklmg, "Quantity
netwr LIKE vbrp-netwr, "Amount
END OF itab,
BEGIN OF itnm OCCURS 0, "Including the fields of VBRK and KNA1
kunag LIKE vbrk-kunag, "Customer Code
name1 LIKE kna1-name1, "Customer Name
END OF itnm,
BEGIN OF itpt OCCURS 0, "Including the fields of VBRP and T001W
werks LIKE vbrp-werks, "Plant
name1 LIKE t001w-name1,"Plant Description
END OF itpt,
BEGIN OF itmt OCCURS 0, "Including the fields of VBRP and MAKT
matnr LIKE vbrp-matnr, "Material #
maktx LIKE makt-maktx, "Material description
END OF itmt,
BEGIN OF itsm OCCURS 0,
kunag LIKE kna1-kunnr,
name1 LIKE kna1-name1,
fklmg LIKE vbrp-fklmg,
netwr LIKE vbrp-netwr,
END OF itsm,
ok_code LIKE sy-ucomm,
save_ok LIKE sy-ucomm,
g_max TYPE i VALUE 100,
g_repid LIKE sy-repid,
gs_layout TYPE lvc_s_layo,
g_container TYPE scrfname VALUE 'CUST_CONT',
grid1 TYPE REF TO cl_gui_alv_grid,
g_custom_container TYPE REF TO cl_gui_custom_container,
grid2 TYPE REF TO cl_gui_alv_grid,
gt_sort TYPE lvc_t_sort,
gt_fieldcatalog TYPE lvc_t_fcat,
w_tot_qty LIKE vbrp-fklmg,
w_tot_amt LIKE vbrp-netwr,
* Reference to Dialogbox Container.
dialogbox_container TYPE REF TO cl_gui_dialogbox_container,
* Reference to local class that handles events of GRID1 and
* DIALOGBOX_CONTAINER
event_receiver TYPE REF TO lcl_event_receiver.
* SELECT-OPTIONS
SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN BEGIN OF BLOCK input WITH FRAME TITLE text-000.
SELECT-OPTIONS: s_werks FOR vbrp-werks, "Plant
s_kunag FOR vbrk-kunag, "Customer
s_matnr FOR vbrp-matnr, "Material Number
s_fkdat FOR vbrk-fkdat. "Invoice Date
SELECTION-SCREEN END OF BLOCK input .
SELECTION-SCREEN SKIP 1.
* START-OF-SELECTION
START-OF-SELECTION.
SET SCREEN 100.
* CLEARING INTERNAL TABLES.
CLEAR: itab,
itnm,
itmt,
itpt.
* QUERY FOR JOINING TABLES VBRK AND VBRP
SELECT vbrk~kunag
vbrk~vbeln
vbrk~fkdat
vbrp~werks
vbrp~matnr
vbrp~meins
vbrp~fklmg
vbrp~netwr
INTO CORRESPONDING FIELDS OF TABLE itab
FROM vbrk
INNER JOIN vbrp
ON vbrk~vbeln = vbrp~vbeln
WHERE vbrk~kunag IN s_kunag
AND vbrk~fkdat IN s_fkdat
AND vbrp~matnr IN s_matnr
AND vbrp~werks IN s_werks.
* QUERY FOR JOINING TABLES VBRK AND KNA1
SELECT kna1~kunnr AS kunag
kna1~name1
INTO TABLE itnm
FROM kna1
WHERE kna1~kunnr IN s_kunag.
* QUERY FOR JOINING TABLES VBRP AND T001W
SELECT t001w~werks
t001w~name1
INTO TABLE itpt
FROM t001w
WHERE t001w~werks IN s_werks.
* QUERY FOR JOINING TABLES VBRP AND MAKT
SELECT makt~matnr
makt~maktx
INTO TABLE itmt
FROM makt
WHERE makt~matnr IN s_matnr.
* SORTING INTERNAL TABLES.
SORT itab BY kunag.
LOOP AT itab.
CLEAR itsm.
READ TABLE itnm WITH KEY kunag = itab-kunag.
itsm-kunag = itab-kunag.
itsm-name1 = itnm-name1.
itsm-fklmg = itab-fklmg.
itsm-netwr = itab-netwr.
COLLECT itsm.
ENDLOOP.
* END-OF-SELECTION.
* If not itsm[] is initial.
* CALL SCREEN 100.
* endif.
* LOCAL CLASSES: Definition
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
METHODS:
handle_double_click
FOR EVENT double_click OF cl_gui_alv_grid
IMPORTING e_row e_column,
handle_close
FOR EVENT close OF cl_gui_dialogbox_container
IMPORTING sender.
PRIVATE SECTION.
DATA: dialogbox_status TYPE c. "'X': does exist, SPACE: does not ex
ENDCLASS. "lcl_event_receiver DEFINITION
* LOCAL CLASSES: Implementation
CLASS lcl_event_receiver IMPLEMENTATION.
* §3.At doubleclick(1): The event DOUBLE_CLICK provides
* parameters of the clicked row and column.
* Use row parameter to select a line of the
* corresponding internal table.
METHOD handle_double_click.
DATA: ls_sm LIKE LINE OF itsm,
wa_itab LIKE ITAB.
* read selected row from internal table gt_sflight
READ TABLE itsm INDEX e_row-index INTO ls_sm.
* §4.At Doubleclick(2): Select booking data
* READ TABLE ITAB WITH KEY KUNAG = LS_SM-KUNAG. .
READ TABLE ITAB INTO WA_ITAB WITH KEY KUNAG = LS_SM-KUNAG.
* §5.At doubleclick(3): Create dialogbox to show detail list
* (if not already existent)
IF dialogbox_status IS INITIAL.
dialogbox_status = 'X'.
PERFORM create_detail_list.
ELSE.
CALL METHOD dialogbox_container->set_visible
EXPORTING
visible = 'X'.
CALL METHOD grid2->refresh_table_display.
ENDIF.
ENDMETHOD. "handle_double_click
METHOD handle_close.
* §6.Handle the CLOSE-button of the dialogbox
* set dialogbox invisible
* (the dialogbox is destroyed outomatically when the user
* switches to another dynpro).
CALL METHOD sender->set_visible
EXPORTING
visible = space.
* In this example closing the dialogbox leads
* to make it invisible. It is also conceivable to destroy it
* and recreate it if the user doubleclicks a line again.
* Displaying a great amount of data has a greater impact on
*performance.
ENDMETHOD. "handle_close
ENDCLASS. "lcl_event_receiver IMPLEMENTATION
* lcl_event_receiver (Implementation)
*=====================================================================
* FORM EXIT_PROGRAM *
FORM exit_program.
CALL METHOD g_custom_container->free.
CALL METHOD cl_gui_cfw=>flush.
IF sy-subrc NE 0.
* add your handling, for example
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = g_repid
txt2 = sy-subrc
txt1 = 'Error in FLush'(500).
ENDIF.
LEAVE TO SCREEN 0.
ENDFORM. "exit_program
*& Module STATUS_0100 OUTPUT
* text
module STATUS_0100 output.
SET PF-STATUS 'MAIN'.
SET TITLEBAR 'MAIN100'.
g_repid = sy-repid.
IF g_custom_container IS INITIAL.
READ TABLE itsm.
CREATE OBJECT g_custom_container
EXPORTING
container_name = g_container
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5.
IF sy-subrc NE 0.
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = g_repid
txt2 = sy-subrc
txt1 = 'The control could not be created'(510).
ENDIF.
CREATE OBJECT grid1
EXPORTING
i_parent = g_custom_container.
gs_layout-grid_title = 'Invoice Summary'.
PERFORM fieldcatalog_init USING gt_fieldcatalog[] 'KUNAG' 'C'
'Customer Code'.
PERFORM fieldcatalog_init USING gt_fieldcatalog[] 'NAME1' 'C'
'Customer Name'.
PERFORM fieldcatalog_init USING gt_fieldcatalog[] 'FKLMG' 'QUAN'
'Quantity'.
PERFORM fieldcatalog_init USING gt_fieldcatalog[] 'NETWR' 'CURR'
'Amount'.
PERFORM sort_build USING gt_sort[].
PERFORM layout_init USING gs_layout.
CALL METHOD grid1->set_table_for_first_display
EXPORTING
is_layout = gs_layout
CHANGING
it_outtab = itsm[]
it_fieldcatalog = gt_fieldcatalog
it_sort = gt_sort.
CREATE OBJECT event_receiver.
SET HANDLER event_receiver->handle_double_click FOR grid1.
ENDIF.
CALL METHOD cl_gui_control=>set_focus
EXPORTING
control = grid1.
endmodule. " STATUS_0100 OUTPUT
* MODULE PAI_ALV INPUT
MODULE USER_COMMAND_0100.
CALL METHOD cl_gui_cfw=>dispatch.
CASE sy-ucomm.
WHEN 'BACK' OR 'EXIT' OR 'CANC'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. "PAI_ALV INPUT
*& Form fieldcatalog_init
* text
* -->LT_FIELDCATtext
* -->VALUE(FIELDtextE)
* -->VALUE(FIELDtextE)
* -->VALUE(FIELDtextT)
FORM fieldcatalog_init USING lt_fieldcatalog TYPE lvc_t_fcat
value(field_name) value(field_type)
value(field_text).
DATA: ls_fieldcatalog TYPE lvc_s_fcat.
CLEAR ls_fieldcatalog.
ls_fieldcatalog-fieldname = field_name.
ls_fieldcatalog-datatype = field_type.
ls_fieldcatalog-reptext = field_text.
ls_fieldcatalog-coltext = field_text.
ls_fieldcatalog-seltext = field_text.
ls_fieldcatalog-tooltip = field_text.
APPEND ls_fieldcatalog TO lt_fieldcatalog.
ENDFORM. "fieldcatalog_init
*& Form sort_build
* text
* -->LT_SORT text
FORM sort_build USING lt_sort TYPE lvc_t_sort.
DATA: ls_sort TYPE lvc_s_sort.
ls_sort-fieldname = 'KUNAG'. "Fieldname on which to sort
ls_sort-up = 'X'. "Sort Ascending
APPEND ls_sort TO lt_sort.
ls_sort-fieldname = 'NAME1'. "Fieldname on which to sort
ls_sort-up = 'X'. "Sort Ascending
APPEND ls_sort TO lt_sort.
ENDFORM. "sort_build
*& Form layout_init
* text
* -->LS_LAYOUT text
FORM layout_init USING ls_layout TYPE lvc_s_layo.
ls_layout-zebra = 'X'.
ls_layout-grid_title = 'Customer Details'.
ls_layout-sel_mode = 'A'.
ls_layout-cwidth_opt = 'X'.
ENDFORM. "layout_init
*& Form create_detail_list
* text
* --> p1 text
* <-- p2 text
FORM create_detail_list.
* create dialogbox container as dynpro-instance
* When the user switches to another screen, it is
* destroyed by lifetime mangagement of CFW
CREATE OBJECT dialogbox_container
EXPORTING
top = 150
left = 150
lifetime = cntl_lifetime_dynpro
caption = 'INVOICE DETAILS'(200)
width = 800
height = 200.
CREATE OBJECT grid2
EXPORTING i_parent = dialogbox_container.
* Register ABAP OO event 'CLOSE'. It is not necessary to register this
* event at the frontend (this is done during creation).
SET HANDLER event_receiver->handle_close FOR dialogbox_container.
* display data
gs_layout-grid_title = 'Invoice Details'(100).
CALL METHOD grid2->set_table_for_first_display
EXPORTING
i_structure_name = 'itab'
is_layout = gs_layout
CHANGING
it_outtab = itab[]
it_fieldcatalog = gt_fieldcatalog
it_sort = gt_sort.
CALL METHOD cl_gui_control=>set_focus
EXPORTING
control = grid2.
ENDFORM. " create_detail_list
Nothing wrong in the code i am able to see the output with five records and the pop-up screen on double clicking a value.
Kindly close the thread or revert back -
Is there a way to have tooltips for every column in a TableView?
Hi there!
I found in documentation that any node and control can show a tooltip ( http://docs.oracle.com/javafx/2/api/javafx/scene/control/Tooltip.html ) but I can't get tooltips to work for TableColumn (a column from TableView).
Do you have any idea how could I have tooltips for each column of the table view?TableColumn's are neither controls nor nodes, so you can neither set nor install tooltips on them.
You can use cellfactories to set tooltips on cells generated from the factories.
You can use css style lookups (node.lookup function) to get access to table nodes (such as the headers) after the tableview has been displayed on a stage and then manipulate the displayed nodes to add tooltips. It's not a great approach, but it is the only approach I know at the moment that would work. -
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.
Maybe you are looking for
-
Error: Cannot open project file
Does that error message mean I am trying to open a project file that was created with a version of FCP that is later than what I operate with? Also, where did the FCP FAQ section go? PowerMac G4 desky 867MHz 1GB RAM Mac OS X (10.2.x) FCP 3.0.4
-
ABAP MDM Connection Pool concept? Slow Performance in call
Hi, I'm playing around with the MDM ABAP API, and I found the performance a bit disappointing. I followed the guide "How To identify master data records using SAP MDM 5.5 ABAP API's" and wrote a test program. The program makes a connection, triggers
-
hi to all, i developed a report for sending mails to the corresponding email ids.in this i wrote select-options: s_manif for sood-objnam no intervals. if we did not enter any distribution list name it will automatically go to the consignee. my requir
-
I can delete this window, but it keeps recurring, sometimes within 5 - 10 seconds.
-
All audio disappears after exporting to .mov file
I'm creating a short 'montage' piece, and all audio is muted except for a song which I added into the timeline. I've tried exporting it several times, even replacing the source file for the song, but nothing seems to work. The audio is visible and pl