Update cell in the grid
hello,
I use a Grid to display a SQL query and I need to update the manual way
a field in the grid for each row
It is a calculation (sale price - purchase price) / purchase price
I can not find the code in VB to do this
Thank you
Hi,
you can use this code:
oGrid.DataTable.SetValue(colname, rowindex, newvalue)
Bye.
Similar Messages
-
The grid layout and different cell sizes
Hi all
is it possible to use a grid layout but specify the height of each cell in the grid
lets say i have a grid 2x5
label1 | TextBox
label2 | ComboBox
label3 | TextBox
label 4 | checkbox1
checkbox2
checkbox3
label 5 | TextBox
the above is how i want it to work but it is appearing like this
label1 | TextBox
label2 | ComboBox
label3 | TextBox
label 4 | checkbox1
checkbox2
checkbox3
label 5 | TextBox
and i assume this is because the grid cell with the checkboxes in is setting the height for all the other cells
so i want to say basically all cells equal say 20 pixels but label 4 and checkbox cells to equal say 50 pixels
can this be done?is it possible to use a grid layout but specify the
height of each cell in the gridNo. Use GridBagLayout. -
Update cell Sprite in DataGrid
Hi,
I have a datagrid with a LOT of sprites (1700 circles, squares, and triangles) that I created in an itemRenderer in Actionscript using Peter Ent's excellent tutorial on custom item renderers. http://www.adobe.com/devnet/flex/articles/itemrenderers_pt5_03.html. Therefore, the Sprites inherit from UIComponent.
I need to dynamically update a few of these sprites based on new data I pull down from the server once per minute.
A full-page refresh is to be avoided since it takes 3-4 seconds to load and is disruptive to the user experience.
Getting the row/column # from the datagrid's itemClick event is dead simple, but I don't see my Sprite when I look at the data using the debugger.
What is the syntax to retrieve a given cell's Sprite from the application? Also, once I have that Sprite, how do I update/replace a Sprite only in that cell?
Please help.
Thanks!!!You're right, it isn't adding rows.
I'm not sure what you mean by 'all the sprites are chosen based on the data object and that old existing sprites get removed or re-purposed'.
I have 3 grids, but for the sake of simplicity will focus on just 1.
There are 39 rows and 15 columns. Each has a Sprite. At the moment, each column has its own custom ItemRenderer since there are data tags unique to each. I've noticed that the whole Object is passed in, so I *could* have one ginormous class to create Sprites for all 15 columns of a row at once, but (1) it didn't work to put that ItemRenderer at the datagrid level versus the individual column level and (2) I'm not sure which is more efficient.
Anyway, back to the most pressing problem: how to update Sprites in the grid from data updates.
Here is the code for the custom Item Renderer:
package utilities
import flash.display.Sprite;
import mx.controls.ToolTip;
import mx.controls.listClasses.IListItemRenderer;
import mx.core.UIComponent;
import mx.events.FlexEvent;
public class Drop1Renderer extends UIComponent implements IListItemRenderer
public function Drop1Renderer()
super();
height=20;
width=16;
// Internal variable for property
private var _data:Object;
// Make it bindable
[Bindable("dataChange")]
// Define the getter
public function get data():Object
return _data;
//define the setter
public function set data(value:Object):void
_data = value;
invalidateProperties();
dispatchEvent(new FlexEvent(FlexEvent.DATA_CHANGE));
if (value.deviceType1 != "Null")
var mySprite:Sprite = new Sprite();
mySprite.cacheAsBitmap=false;
buttonMode=true;
var uic:UIComponent = new UIComponent();
mySprite.graphics.beginFill(value.deviceColor1);
var triangleHeight:Number = 12;
switch (value.deviceType1)
case "Circle":
mySprite.graphics.lineStyle(1,0x000000, .5);
mySprite.graphics.drawCircle(8, 9, 5);
break;
case "CircleBlue":
mySprite.graphics.lineStyle(2,0x0000DD, .9);
mySprite.graphics.drawCircle(8, 9, 5);
break;
case "TriangleRed":
mySprite.graphics.lineStyle(2,0xFF0000, .9);
mySprite.graphics.moveTo((triangleHeight/2)+2, 3);
mySprite.graphics.lineTo(triangleHeight+2, triangleHeight+1);
mySprite.graphics.lineTo(2, triangleHeight+1);
mySprite.graphics.lineTo((triangleHeight/2)+2, 3);
break;
case "Triangle":
mySprite.graphics.lineStyle(1,0x000000, .5);
mySprite.graphics.moveTo((triangleHeight/2)+2, 3);
mySprite.graphics.lineTo(triangleHeight+2, triangleHeight+1);
mySprite.graphics.lineTo(2, triangleHeight+1);
mySprite.graphics.lineTo((triangleHeight/2)+2, 3);
break;
case "TriangleBlue":
mySprite.graphics.lineStyle(2,0x0000DD, .9);
mySprite.graphics.moveTo((triangleHeight/2)+2, 3);
mySprite.graphics.lineTo(triangleHeight+2, triangleHeight+1);
mySprite.graphics.lineTo(2, triangleHeight+1);
mySprite.graphics.lineTo((triangleHeight/2)+2, 3);
break;
case "Rect":
mySprite.graphics.lineStyle(1,0x000000, .5);
mySprite.graphics.drawRect(3, 4, 10, 10);
break;
case "RectBlue":
mySprite.graphics.lineStyle(2,0x0000DD, .9);
mySprite.graphics.drawRect(3, 4, 10, 10);
break;
case "RectOrange":
mySprite.graphics.lineStyle(2,0xFFA500, .9);
mySprite.graphics.drawRect(3, 4, 10, 10);
break;
case "Ellipse":
mySprite.graphics.lineStyle(1,0x000000, .7);
mySprite.graphics.drawEllipse(2, 5, 12, 6);
break;
default:
mySprite.graphics.drawCircle(8, 9, 5);
uic.addChild(mySprite);
this.addChild(uic);
uic.toolTip = "Howdy there!";
override protected function createChildren() : void
super.createChildren();
override protected function commitProperties() : void
super.commitProperties();
override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
super.updateDisplayList(unscaledWidth, unscaledHeight); -
Referencing cells in a grid layout
I am adding an extended component to a container with a GridLayout, in this case a 10x10 grid. Is it possible to reference an individual cell of the grid?
Why would you want to "reference" a particular cell in the grid? Wouldn't you just access the component in the cell?
If you're really trying to add negative (empty) space in your grid, you should use a GridBagLayout instead. You get much more control over the layout, particularly when you're dealing with a resizable frame. -
I have updated my iphone 5 with IOS7. Now there is an update 7.0.2 on my cell and the size of update file is showing around 21.0 MB. I tried to update it ITunes but it seems it is downloading the entire IOS. Is there any separate update for the same or I have to download the entire IOS again?
Well when you download the update with iTunes it will always download the whole new version (in your case 7.0.2) even if its just an bug fix. If you already have 7.0 download the update over-the-air.
You already wrote that the update is only 21 MB, so its not the whole firmware package of 7.0.2 you get with iTunes. -
Formula Row/Col Custom Heading not appearing on the Grid Cell in FR Studio
I'm building reports using Financial Reporting Studio Software.
When i insert the formula row/column and give a custon heading, it is not reflecting on the GRID. The cell still shows blank.
What should i do ? is this a bug?Which version of EPM you have is it 11.1.2 or 11.1.2.1 don't see fR studio > about it will show 11.1.2 if it is 11.1.2.1 then try 11.1.2.1.128 patch.
because there is bug 14617522 - CUSTOM HEADINGS FOR THE ROWS BELOW THE TEMPLATE DISAPPEARS
Infact try with latest 11.1.2.1 patch that is 133.
Edited by: Neeraj Lahoti on Jun 3, 2013 9:45 PM -
Hide the value of certain cells in ALV GRID
Hello Gurus,
i need to hide the value or show a icon instead ib certain cells in the ALV GRID for the users that don't have the corresponding rights. Can anyone help?
Regards,
Ioan Constantin.Check this example, you'll need to adjust it to your authority object to run it.
TYPES: BEGIN OF t_alv,
mandt TYPE s_mandt,
carrid TYPE s_carr_id,
connid TYPE s_conn_id,
fldate TYPE s_date,
price TYPE s_price,
currency TYPE s_currcode,
planetype TYPE s_planetye,
seatsmax TYPE s_seatsmax,
seatsocc TYPE s_seatsocc,
paymentsum TYPE s_sum,
seatsmax_b TYPE s_smax_b,
seatsocc_b TYPE s_socc_b,
seatsmax_f TYPE s_smax_f,
seatsocc_f TYPE s_socc_f,
planetype2 TYPE s_planetye,
END OF t_alv.
DATA: go_alv TYPE REF TO cl_gui_alv_grid,
gt_sflight TYPE TABLE OF sflight,
gt_alv TYPE STANDARD TABLE OF t_alv,
wa_fl TYPE sflight,
wa_fl2 TYPE t_alv,
gt_fieldcat TYPE lvc_t_fcat,
wa_fcat TYPE lvc_s_fcat.
FIELD-SYMBOLS <gs_fcat> TYPE lvc_s_fcat.
SELECTION-SCREEN BEGIN OF SCREEN 1001.
SELECTION-SCREEN END OF SCREEN 1001.
START-OF-SELECTION.
SELECT * FROM sflight INTO TABLE gt_sflight.
LOOP AT gt_sflight INTO wa_fl.
wa_fl2 = wa_fl.
IF sy-tabix <> 5.
wa_fl2-planetype2 = wa_fl2-planetype.
ENDIF.
APPEND wa_fl2 TO gt_alv.
ENDLOOP.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'SFLIGHT'
CHANGING
ct_fieldcat = gt_fieldcat.
LOOP AT gt_fieldcat ASSIGNING <gs_fcat>.
wa_fcat = <gs_fcat>.
IF wa_fcat-fieldname = 'PLANETYPE'.
wa_fcat-fieldname = 'PLANETYPE2'.
wa_fcat-col_pos = 7.
AUTHORITY-CHECK OBJECT 'ZPERMISO16'
ID 'ZPERMI' FIELD '01'.
IF sy-subrc = 0.
wa_fcat-tech = 'X'.
wa_fcat-no_out = 'X'.
ELSE.
<gs_fcat>-tech = 'X'.
<gs_fcat>-no_out = 'X'.
ENDIF.
APPEND wa_fcat TO gt_fieldcat.
ENDIF.
ENDLOOP.
CREATE OBJECT go_alv
EXPORTING
i_parent = cl_gui_container=>screen0.
CALL METHOD go_alv->set_table_for_first_display
CHANGING
it_outtab = gt_alv
it_fieldcatalog = gt_fieldcat .
CALL SELECTION-SCREEN 1001. -
How do I show and/or update image info in the Grid view?
Somehow, all the info that was showing in my grid view, in Lightroom 5.6, disappeared. How do I view info for each grid image, on the grid and how do I update or change what info is viewable?
Ctrl/Cmd-J
-
Help with updating the grid(CONNECT 4)
Hi, this a small portion of my connect 4 game program. I have a problem with updating the grid. During the game, whenever I enter a column number for the first time, the program works properly. But when i try to give the same column for the second time, the chip falls in the same row instead of going to the second row. Can anybody help me write the method that will do this.
This is the method that switches the chip's value(By the way discard the variable 'turn' because that works properly, it is used in another method):
//Method 2: Updates the matrix
public static void UpdateMatrix (char location, char turn)
c.println (location);
switch (location)
case '1':
matrix [5] [0] = turn;
break;
case '2':
matrix [5] [1] = turn;
break;
case '3':
matrix [5] [2] = turn;
break;
case '4':
matrix [5] [3] = turn;
break;
case '5':
matrix [5] [4] = turn;
break;
case '6':
matrix [5] [5] = turn;
break;
case '7':
matrix [5] [6] = turn;
break;
} //End Method 2Can anybody describe me how to write a method or write a method that will tell the computer to assign the chip to the next row. You an edit my method if u want to. THANX A LOT!!!HERE IS THE METHODS SO FAR!
//Method 3: Checks if assigned place for the chip has a chip there already
public static void emptyspot (int column, int row)
for (row = 5 ; row >= 0 ; row--)
for (column = 0 ; column <= 6 ; column++)
if (matrix [row] [column] == 'X' || matrix [row] [column] == 'O')
row--;
}I AM GETTING AN ERROR!!! AT THE BOTTOM OF MY PROGRAM! SOMEBODY HELP!
Message was edited by:
Taufiq -
WPF: how to make the grid column edtiable base on cell content?
our WPF application uses DataGrid.
One grid column we need base on cell has value or not to decide if make the cell editable.
If cell is empty, not editable. If cell is not empty, make it editable.
The cell is bind to a class. We try to make property to bind to the
DataGridTextColumn
IsReadOnly property
public bool IsSampleIdFieldReadOnly { get { return string.IsNullOrEmpty(_sampleId); } }
DataGridTextColumn MinWidth="120"
Binding="{Binding SampleId}"
IsReadOnly="{Binding IsSampleIdFieldReadOnly}"
Header="Sample ID" />
However all cells in the column are editable.
how to achieve that? Thx!
JaneCI guess that will apply to the whole column rather than specific cells and you need a cellstyle.
You could try something like:
<DataGridTextColumn Binding="{Binding SampleId}" Header="Sample Id">
<DataGridTextColumn.CellStyle>
<Style TargetType="DataGridCell">
<Style.Triggers>
<DataTrigger Binding="{Binding IsSampleIdFieldReadOnly}" Value="true">
<Setter Property="IsReadOnly" Value="true" />
</DataTrigger>
</Style.Triggers>
I'm afraid I don't have enough time to test it as I'm off out drinking shortly.
Hope that helps.
Recent Technet articles:
Property List Editing ;
Dynamic XAML -
If I can no longer use a grid button, how can I go about making music precisely? This can be a pain if I have to drag the mouse around left and right to get the right rhythms. This would defeat the whole purpose of upgrading to the latest Garageband. I wish I had the older version if the grid button is gone.
The visible grid is automatic - it will depend on the zoom slider setting and is no longer as versatile as in the previous version.
And you can set an automatic Time Quantize in the Track Editor.
Turn the Tracks area grid on or off
Choose Edit > Snap to Grid. -
Scroll bar to the CELL in the screen
Hi All,
Having a table with four fields ,
1.Text id,
2.Text type
3.Short Text
4.Long Text.
when display the records into the GRID, for the long text cell i need scrollbar to b there to that window.
How i can provide scrollbar for cell long text.
Regards,
MadhaviHi Uwe,
Thanks for the reply.
see the table which i need to update from the GRID.
Table ZPFT_TEXT with the following fields
Language X(3) SAP language code (NED, FRA, GER, ENG,)
Text type X(4) Information type
Text ID 9(4) ID in given information type
Text X(35) Description
Bigtext (occurs 15) X(80) Long description
Now you suggest how to handle this and let me know is there is any standard example in this scenario.
Regards,
Madhavi -
Display only cell in ALV Grid in OO
Hi Folks,
Hope someone can help me with this little issue. I have a series of columns in my ALV grid that are editable, but I need to a) make some of the cells on specific lines uneditable and b) display time based fields on this line as blank (presently they shoe 00:00:00).
For problem a) I have set the layout style frame as 'cellstyles'
es_layout-stylefname = 'CELLSTYLES'.
I have also set the edit flag in the field catalog for the individual columns to 'X' eg
WHEN 'CUSTTS_DATE_N'.
ls_fieldcat-edit = 'X'.
And coded:
gwa_stylerow-fieldname = 'CUSTTS_DATE_N'.
gwa_stylerow-style = cl_gui_alv_grid=>mc_style_disabled.
APPEND gwa_stylerow TO gt_stylerow.
wa_delivery_list-cellstyle[] = gt_stylerow[].
APPEND wa_delivery_list TO it_delivery_list.
Yet, the ALV cells are still being displayed as editable. Can't for the life of me figure out what's missing. The only other thought I had around this is that the wa_delivery_list-cellstyle table is being set in the data extraction code, before the ALV grid is built, and that the cell formats are being overwritten/on not being called by the field catalog entries. Any thoughts on how to make these fields/cells display only when the ALV is first displayed would be greatly appreciated.
As for option b) I'm clueless, as the cell style commands are not being picked up (see problem a.). Again any thoughts would be appreciated, and points will be rewarded for solutions/suggestions that lead to solutions.
Cheers,
Stephen KeamHello Stephen
I have created a simple report ZUS_SDN_ALV_EDITABLE_1B which shows how to use editability on cell level.
The crucial parts of the coding for your requirements are shown below, followed by the entire report.
READ TABLE gt_fcat INTO ls_fcat
WITH KEY fieldname = 'UPTIM'.
IF ( syst-subrc = 0 ).
DELETE gt_fcat INDEX syst-tabix.
ls_fcat-no_zero = abap_true. " suppresses 00:00:00
INSERT ls_fcat INTO gt_fcat INDEX 7.
ENDIF.
*& Form SET_CELL_EDITABLE
* text
* --> p1 text
* <-- p2 text
FORM set_cell_editable .
* define local data
DATA: ld_idx TYPE i,
ls_outtab TYPE ty_s_outtab,
ls_style TYPE lvc_s_styl.
LOOP AT gt_outtab INTO ls_outtab.
ld_idx = syst-tabix.
REFRESH: ls_outtab-celltab.
" NOTE: if you change the year of column ERDAT to 2008 then two columns will become non-editable
IF ( ls_outtab-erdat+0(4) = '2008' ).
CLEAR: ls_style.
ls_style-fieldname = 'UPDAT'.
ls_style-style = cl_gui_alv_grid=>mc_style_disabled.
INSERT ls_style INTO TABLE ls_outtab-celltab.
CLEAR: ls_style.
ls_style-fieldname = 'UPTIM'.
ls_style-style = cl_gui_alv_grid=>mc_style_disabled.
INSERT ls_style INTO TABLE ls_outtab-celltab.
ELSE.
ENDIF.
MODIFY gt_outtab FROM ls_outtab INDEX ld_idx
TRANSPORTING celltab.
ENDLOOP.
ENDFORM. " SET_CELL_EDITABLE
*& Report ZUS_SDN_ALV_EDITABLE
*& Thread: Display only cell in ALV Grid in OO
*& <a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="765083"></a>
* Flow logic of screen '100' (no elements, ok-code => gd_okcode ):
**PROCESS BEFORE OUTPUT.
** MODULE STATUS_0100.
**PROCESS AFTER INPUT.
** MODULE USER_COMMAND_0100.
*& GUI-Status: ok-codes BACK, EXIT, CANC
REPORT zus_sdn_alv_editable_1b.
TYPE-POOLS: abap.
CONSTANTS:
gc_tabname TYPE tabname VALUE 'KNB1'.
TYPES: BEGIN OF ty_s_outtab.
INCLUDE TYPE knb1 AS knb1.
TYPES: celltab TYPE lvc_t_styl.
TYPES: END OF ty_s_outtab.
TYPES: ty_t_outtab TYPE STANDARD TABLE OF ty_s_outtab
WITH DEFAULT KEY.
DATA:
gd_okcode TYPE ui_func,
gd_repid TYPE syst-repid,
gt_fcat TYPE lvc_t_fcat,
gs_layout TYPE lvc_s_layo,
gs_variant TYPE disvariant,
go_docking TYPE REF TO cl_gui_docking_container,
go_grid TYPE REF TO cl_gui_alv_grid.
DATA:
gs_outtab TYPE ty_s_outtab,
gt_outtab TYPE ty_t_outtab,
gt_outtab_pbo TYPE ty_t_outtab.
DATA:
gd_answer TYPE c.
* CLASS lcl_eventhandler DEFINITION
CLASS lcl_eventhandler DEFINITION.
PUBLIC SECTION.
CLASS-METHODS:
handle_data_changed
FOR EVENT data_changed OF cl_gui_alv_grid
IMPORTING er_data_changed.
ENDCLASS. "lcl_eventhandler DEFINITION
* CLASS lcl_eventhandler IMPLEMENTATION
CLASS lcl_eventhandler IMPLEMENTATION.
METHOD handle_data_changed.
" Just trigger PAI followed by PBO
CALL METHOD cl_gui_cfw=>set_new_ok_code
EXPORTING
new_code = 'REFRESH'
* IMPORTING
* rc =
ENDMETHOD. "handle_data_changed
ENDCLASS. "lcl_eventhandler IMPLEMENTATION
START-OF-SELECTION.
SELECT * FROM (gc_tabname) INTO CORRESPONDING FIELDS
OF TABLE gt_outtab UP TO 99 ROWS.
gt_outtab_pbo = gt_outtab. " set PBO data
PERFORM init_controls.
* ok-code field = GD_OKCODE
CALL SCREEN '0100'.
END-OF-SELECTION.
*& Form INIT_CONTROLS
* text
* --> p1 text
* <-- p2 text
FORM init_controls .
* Create docking container
CREATE OBJECT go_docking
EXPORTING
parent = cl_gui_container=>screen0
ratio = 90
EXCEPTIONS
OTHERS = 6.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Create ALV grid
CREATE OBJECT go_grid
EXPORTING
i_parent = go_docking
EXCEPTIONS
OTHERS = 5.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
" NOTE: not required
* set handler:
* lcl_eventhandler=>handle_data_changed for go_grid.
* Build fieldcatalog and set hotspot for field KUNNR
PERFORM build_fieldcatalog.
PERFORM set_layout_and_variant.
PERFORM set_cell_editable.
*§3.Optionally register ENTER to raise event DATA_CHANGED.
* (Per default the user may check data by using the check icon).
CALL METHOD go_grid->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_enter.
SET HANDLER: lcl_eventhandler=>handle_data_changed FOR go_grid.
* Display data
CALL METHOD go_grid->set_table_for_first_display
EXPORTING
is_layout = gs_layout
is_variant = gs_variant
i_save = 'A'
CHANGING
it_outtab = gt_outtab
it_fieldcatalog = gt_fcat
EXCEPTIONS
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.
* NOTE:
* Documenation of I_SAVE ("An Easy Reference for ALV Grid Control")
*I_SAVE
*Determines the options available to the user for saving a layout:
*? 'X': global saving only
*? 'U': user-specific saving only
*? 'A': corresponds to 'X' and 'U'
*? SPACE: no saving
* Link the docking container to the target dynpro
gd_repid = syst-repid.
CALL METHOD go_docking->link
EXPORTING
repid = gd_repid
dynnr = '0100'
* CONTAINER =
EXCEPTIONS
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.
ENDFORM. " INIT_CONTROLS
*& Module STATUS_0100 OUTPUT
* text
MODULE status_0100 OUTPUT.
SET PF-STATUS 'STATUS_0100'.
* SET TITLEBAR 'xxx'.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
* text
MODULE user_command_0100 INPUT.
" NOTE: retrieve changed data from frontend (grid control) into
" the backend (itab in ABAP)
go_grid->check_changed_data( ).
CASE gd_okcode.
WHEN 'BACK' OR
'EXIT' OR
'CANC'.
SET SCREEN 0. LEAVE SCREEN.
WHEN 'REFRESH'.
PERFORM set_cell_editable.
" NOTE: Refresh required
CALL METHOD go_grid->refresh_table_display
* EXPORTING
* is_stable =
* i_soft_refresh =
* 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.
WHEN 'SAVE'.
IF ( gt_outtab = gt_outtab_pbo ).
MESSAGE 'No data changed' TYPE 'S'.
ELSE.
CLEAR: gd_answer.
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
* TITLEBAR = ' '
* DIAGNOSE_OBJECT = ' '
text_question = 'Save data?'
* TEXT_BUTTON_1 = 'Ja'(001)
* ICON_BUTTON_1 = ' '
* TEXT_BUTTON_2 = 'Nein'(002)
* ICON_BUTTON_2 = ' '
* DEFAULT_BUTTON = '1'
* DISPLAY_CANCEL_BUTTON = 'X'
* USERDEFINED_F1_HELP = ' '
* START_COLUMN = 25
* START_ROW = 6
* POPUP_TYPE =
* IV_QUICKINFO_BUTTON_1 = ' '
* IV_QUICKINFO_BUTTON_2 = ' '
IMPORTING
answer = gd_answer
* TABLES
* PARAMETER =
EXCEPTIONS
text_not_found = 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.
IF ( gd_answer = '1' ). " yes
MESSAGE 'Data successfully saved' TYPE 'S'.
gt_outtab_pbo = gt_outtab. " update PBO data !!!
ELSE.
MESSAGE 'Action cancelled by user' TYPE 'S'.
ENDIF.
ENDIF.
WHEN OTHERS.
ENDCASE.
CLEAR: gd_okcode.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form BUILD_FIELDCATALOG
* text
* --> p1 text
* <-- p2 text
FORM build_fieldcatalog .
* define local data
DATA:
ls_fcat TYPE lvc_s_fcat.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
* I_BUFFER_ACTIVE =
i_structure_name = gc_tabname
* I_CLIENT_NEVER_DISPLAY = 'X'
* I_BYPASSING_BUFFER =
* I_INTERNAL_TABNAME =
CHANGING
ct_fieldcat = gt_fcat
EXCEPTIONS
inconsistent_interface = 1
program_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.
ls_fcat-edit = abap_true.
MODIFY gt_fcat FROM ls_fcat
TRANSPORTING edit
WHERE ( key NE abap_true ).
READ TABLE gt_fcat INTO ls_fcat
WITH KEY fieldname = 'UPTIM'.
IF ( syst-subrc = 0 ).
DELETE gt_fcat INDEX syst-tabix.
ls_fcat-no_zero = abap_true. " suppresses 00:00:00
INSERT ls_fcat INTO gt_fcat INDEX 7.
ENDIF.
READ TABLE gt_fcat INTO ls_fcat
WITH KEY fieldname = 'UPDAT'.
IF ( syst-subrc = 0 ).
DELETE gt_fcat INDEX syst-tabix.
INSERT ls_fcat INTO gt_fcat INDEX 7.
ENDIF.
LOOP AT gt_fcat INTO ls_fcat.
ls_fcat-col_pos = syst-tabix.
MODIFY gt_fcat FROM ls_fcat INDEX syst-tabix.
IF ( syst-tabix > 10 ).
DELETE gt_fcat INDEX syst-tabix.
ENDIF.
ENDLOOP.
ENDFORM. " BUILD_FIELDCATALOG
*& Form SET_LAYOUT_AND_VARIANT
* text
* --> p1 text
* <-- p2 text
FORM set_layout_and_variant .
CLEAR: gs_layout,
gs_variant.
gs_layout-cwidth_opt = abap_true.
gs_layout-zebra = abap_true.
*§3.Provide the fieldname of the celltab field by using field
* STYLEFNAME of the layout structure.
gs_layout-stylefname = 'CELLTAB'.
gs_variant-report = syst-repid.
gs_variant-handle = 'GRID'.
ENDFORM. " SET_LAYOUT_AND_VARIANT
*& Form SET_CELL_EDITABLE
* text
* --> p1 text
* <-- p2 text
FORM set_cell_editable .
* define local data
DATA: ld_idx TYPE i,
ls_outtab TYPE ty_s_outtab,
ls_style TYPE lvc_s_styl.
LOOP AT gt_outtab INTO ls_outtab.
ld_idx = syst-tabix.
REFRESH: ls_outtab-celltab.
IF ( ls_outtab-erdat+0(4) = '2008' ).
CLEAR: ls_style.
ls_style-fieldname = 'UPDAT'.
ls_style-style = cl_gui_alv_grid=>mc_style_disabled.
INSERT ls_style INTO TABLE ls_outtab-celltab.
CLEAR: ls_style.
ls_style-fieldname = 'UPTIM'.
ls_style-style = cl_gui_alv_grid=>mc_style_disabled.
INSERT ls_style INTO TABLE ls_outtab-celltab.
ELSE.
ENDIF.
MODIFY gt_outtab FROM ls_outtab INDEX ld_idx
TRANSPORTING celltab.
ENDLOOP.
ENDFORM. " SET_CELL_EDITABLE
Regards
Uwe -
Input the data in to the grid without saving it to the database
<PRE lang=jsp id=pre2 style="MARGIN-TOP: 0px" nd="109"><%@ taglib uri="/WEB-INF/tags/datagrid.tld" prefix="grd" %>
<%@ page import="java.sql.Connection" %>
<%@ page import="java.sql.DriverManager" %>
<%@ page import="java.sql.SQLException" %>
<%@ page import="com.freeware.gridtag.*" %>
<%
int intCurr = 1;
int intSortOrd = 0;
String strTmp = null;
String strSQL = null;
String strSortCol = null;
String strSortOrd = "ASC";
boolean blnSortAsc = true;
strSQL = "SELECT CLICORPORATION, CLICLIENT, CLIDESCRIPTION, " +
"CLIENABLED, CLIUPDSTAMP FROM CLIENTMASTER ";
Connection objCnn = null;
Class objDrvCls = null;
objDrvCls = Class.forName("oracle.jdbc.driver.OracleDriver");
objCnn = DriverManager.getConnection("<A class=iAs style="FONT-WEIGHT: normal; FONT-SIZE: 100%; PADDING-BOTTOM: 1px; COLOR: darkgreen; BORDER-BOTTOM: darkgreen 0.07em solid; BACKGROUND-COLOR: transparent; TEXT-DECORATION: underline" href="#" target=_blank itxtdid="3346226">jdbc</A>:oracle:thin:@Host:port:sid",
"cashincpri", "cashincpri");
if (objDrvCls != null) objDrvCls = null;
strTmp = request.getParameter("txtCurr");
try
if (strTmp != null)
intCurr = Integer.parseInt(strTmp);
catch (NumberFormatException NFEx)
strSortCol = request.getParameter("txtSortCol");
strSortOrd = request.getParameter("txtSortAsc");
if (strSortCol == null) strSortCol = "CLICLIENT";
if (strSortOrd == null) strSortOrd = "ASC";
blnSortAsc = (strSortOrd.equals("ASC"));
%>
<html>
<head>
<title>Grid Tag Demonstration</title>
<link REL="StyleSheet" HREF="css/GridStyle.css">
<script LANGUAGE="javascript">
function doNavigate(pstrWhere, pintTot)
var strTmp;
var intPg;
strTmp = document.frmMain.txtCurr.value;
intPg = parseInt(strTmp);
if (isNaN(intPg)) intPg = 1;
if ((pstrWhere == 'F' || pstrWhere == 'P') && intPg == 1)
alert("You are already viewing first page!");
return;
else if ((pstrWhere == 'N' || pstrWhere == 'L') && intPg == pintTot)
alert("You are already viewing last page!");
return;
if (pstrWhere == 'F')
intPg = 1;
else if (pstrWhere == 'P')
intPg = intPg - 1;
else if (pstrWhere == 'N')
intPg = intPg + 1;
else if (pstrWhere == 'L')
intPg = pintTot;
if (intPg < 1) intPg = 1;
if (intPg > pintTot) intPg = pintTot;
document.frmMain.txtCurr.value = intPg;
document.frmMain.submit();
function doSort(pstrFld, pstrOrd)
document.frmMain.txtSortCol.value = pstrFld;
document.frmMain.txtSortAsc.value = pstrOrd;
document.frmMain.submit();
</script>
</head>
<body>
<h2>Grid Example</h2>
<form NAME="frmMain" METHOD="post">
<grd:dbgrid id="tblStat" name="tblStat" width="100" pageSize="10"
currentPage="<%=intCurr%>" border="0" cellSpacing="1" cellPadding="2"
dataMember="<%=strSQL%>" dataSource="<%=objCnn%>" cssClass="gridTable">
<grd:gridpager imgFirst="images/First.gif" imgPrevious="images/Previous.gif"
imgNext="images/Next.gif" imgLast="images/Last.gif"/>
<grd:gridsorter sortColumn="<%=strSortCol%>" sortAscending="<%=blnSortAsc%>"/>
<grd:rownumcolumn headerText="#" width="5" HAlign="right"/>
<grd:imagecolumn headerText="" width="5" HAlign="center"
imageSrc="images/Edit.gif"
linkUrl="javascript:doEdit('{CLICORPORATION}', '{CLICLIENT}')"
imageBorder="0" imageWidth="16" imageHeight="16"
alterText="Click to edit"/>
<grd:textcolumn dataField="CLICLIENT" headerText="Client"
width="10" sortable="true"/>
<grd:textcolumn dataField="CLIDESCRIPTION" headerText="Description"
width="50" sortable="true"/>
<grd:decodecolumn dataField="CLIENABLED" headerText="Enabled" width="10"
decodeValues="Y,N" displayValues="Yes,No" valueSeperator=","/>
<grd:datecolumn dataField="CLIUPDSTAMP" headerText="Last Updated"
dataFormat="dd/MM/yyyy HH:mm:ss" width="20"/>
</grd:dbgrid>
<input TYPE="hidden" NAME="txtCurr" VALUE="<%=intCurr%>">
<input TYPE="hidden" NAME="txtSortCol" VALUE="<%=strSortCol%>">
<input TYPE="hidden" NAME="txtSortAsc" VALUE="<%=strSortOrd%>">
</form>
</body>
</html>
<%
try
if (objCnn != null)
objCnn.close();
catch (SQLException SQLExIgnore)
if (objCnn != null) objCnn = null;
%>
</PRE>
by using this code we will get the gide.
but the problem is when we are inserting the new record after click to save the record first saves the data in the Db and then it appears on the grid.
Is it possible to do reverse of the above :
first it comes to the grid and then after click to save it save to the database.
please help me
Regards,
imranHi Yamini,
What do you mean by without query region here? Do you wish to implement the complete search/result functionality without using the Query page? Or your question already answered. Kindly confirm.
Regards
Sumit -
One thing I am finding a little awkward; Adding data in the grid. It would be nice to be able to use tab to get to the next cell. At present it just highlights the cell and typing doesn't do anything until the cell is clicked. Equally hitting return I would expect it to give me a new blank row. I would like to be able to add a couple of rows of data without resorting to using the mouse at each turn.
Very good initial impressions though.Yes we should do this as it's what everyone will expect from Excel.
-kris
Maybe you are looking for
-
Hi Everyone, I am working with MRP creating schedule lines automatically, I need way to have firming indicator for the schedule lines that created out of MRP. I have checked the forums and did some research, all mentioned about the time zones Firm zo
-
Material Description in different language
Hi Expertsl We have to show material description on the label. As of now the label description is displaying in English. Material description is also maintained in a language calledd 'Z1'. So the present requirement is as below 1. If the material des
-
Custom report sorting + pagination
Hi, We have a classic Apex report which can be sorted by three different columns. These columns are indexed, so that with a first_rows(n) hint the first page of rows are fetched quickly, even though the entire result set has > 5 billion rows. We need
-
TS1702 My iphone cannot connect to itunes
My iphone cannot connect to itunes store
-
Problem with AIR 2 Native Process?
I had installed Adobe AIR 1 before and Flex Builder 3.0 (licensed) on a Windows Vista machine. Now i have installed AIR 2 framework (without uninstalling AIR 1, assuming that it will update that). I m trying to write a small code to use AIR 2 Native