About event handler
hi
i am trying to develop a event handler for all the attributes of a resource that when user is modified is attributes. he need get a notification that paritcular attribute or u r data is modified..
actually i have seen that they have return adapter for each attribute but dont want so many adapters to be writtten so i want to develop a event handler for that scenario... please provide the sample code so that i can modifie or re coding it....
thanks
avinash
Hi,
I had created one dissconnected resource and one application form for it... the user had filled the form of that resource and submitted and when he want to update the form once again the event handler should be tirrger and paritcular attribute should be update and he had to send email notification that attribute is changed...
here is once thing that if he had change numberof attributes at a time but we have to send only one email notification for all the attributes...
regards
avinash
Similar Messages
-
Question on program structure about event handling in nested JPanels in GUI
Hi All,
I'm currently writing a GUI app with a wizard included in the app. I have one class that acts as a template for each of the panels in the wizard. That class contains a JPanel called contentsPanel that I intend to put the specific contents into. I also want the panel contents to be modular so I have a couple of classes for different things, e.g. name and address panel, etc. these panels will contain checkboxes and the like that I want to event listeneres to watch out for. Whats the best way of implementing event handling for panel within panel structure? E.g for the the checkbox example,would it be a good idea to have an accessor method that returns the check book object from the innerclass/panel and use an addListener() method on the returned object in the top level class/panel. Or is it better to have the event listeners for those objects in the same class? I would appreciate some insight into this?
Regards!MyMainClass.main(new String[] { "the", "arguments" });
// or, if you defined your main to use varags (i.e. as "public static void main(String... args)") then you can just use
MyMainClass.main("the", "arguments");But you should really extract your functionality out of the main method into meaningful classes and methods and just use those from both your console code and your GUI code. -
About Event Handling in user Defined Form (In Addon)
Hi Every One,
Can Anyone Give Me Notes On EventHandling in forms That are Disgened using Sdk UIAPI .Like Button event ,application event, menuevent... etc with saple code
Regards
SrinivasHi Sura,
Hope this helps. C# sample code.
// SAP MANAGE UI API 2005 SDK Sample
// File: CatchingEvents.cs
// Copyright (c) SAP MANAGE
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
// PARTICULAR PURPOSE.
// BEFORE STARTING:
// 1. Add reference to the "SAP Business One UI API"
// 2. Insert the development connection string to the "Command line argument"
// 1.
// a. Project->Add Reference...
// b. select the "SAP Business One UI API 2005" From the COM folder
// 2.
// a. Project->Properties...
// b. choose Configuration Properties folder (place the arrow on Debugging)
// c. place the following connection string in the 'Command line arguments' field
// 0030002C0030002C00530041005000420044005F00440061007400650076002C0050004C006F006D0056004900490056
using System;
using System.Windows.Forms;
class CatchingEvents {
// This parameter will use us to manipulate the
// SAP Business One Application
private SAPbouiCOM.Application SBO_Application;
private void SetApplication() {
// Use an SboGuiApi object to establish connection
// with the SAP Business One application and return an
// initialized appliction object
SAPbouiCOM.SboGuiApi SboGuiApi = null;
string sConnectionString = null;
SboGuiApi = new SAPbouiCOM.SboGuiApi();
// by following the steps specified above, the following
// statment should be suficient for either development or run mode
sConnectionString = System.Convert.ToString( Environment.GetCommandLineArgs().GetValue( 1 ) );
// connect to a running SBO Application
SboGuiApi.Connect( sConnectionString );
// get an initialized application object
SBO_Application = SboGuiApi.GetApplication( -1 );
public CatchingEvents() {
// set SBO_Application with an initialized application object
SetApplication();
// events handled by SBO_Application_AppEvent
SBO_Application.AppEvent += new SAPbouiCOM._IApplicationEvents_AppEventEventHandler( SBO_Application_AppEvent );
// events handled by SBO_Application_MenuEvent
SBO_Application.MenuEvent += new SAPbouiCOM._IApplicationEvents_MenuEventEventHandler( SBO_Application_MenuEvent );
// events handled by SBO_Application_ItemEvent
SBO_Application.ItemEvent += new SAPbouiCOM._IApplicationEvents_ItemEventEventHandler( SBO_Application_ItemEvent );
// events handled by SBO_Application_ProgressBarEvent
SBO_Application.ProgressBarEvent += new SAPbouiCOM._IApplicationEvents_ProgressBarEventEventHandler( SBO_Application_ProgressBarEvent );
// events handled by SBO_Application_StatusBarEvent
SBO_Application.StatusBarEvent += new SAPbouiCOM._IApplicationEvents_StatusBarEventEventHandler( SBO_Application_StatusBarEvent );
private void SBO_Application_AppEvent( SAPbouiCOM.BoAppEventTypes EventType ) {
// the following are the events sent by the application
// (Ignore aet_ServerTermination)
// in order to implement your own code upon each of the events
// place you code instead of the matching message box statement
switch ( EventType ) {
case SAPbouiCOM.BoAppEventTypes.aet_ShutDown:
SBO_Application.MessageBox( "A Shut Down Event has been caught" + Environment.NewLine + "Terminating Add On...", 1, "Ok", "", "" );
// Take care of terminating your AddOn application
System.Windows.Forms.Application.Exit();
break;
case SAPbouiCOM.BoAppEventTypes.aet_CompanyChanged:
SBO_Application.MessageBox( "A Company Change Event has been caught", 1, "Ok", "", "" );
// Check the new company name, if your add on was not meant for
// the new company terminate your AddOn
// If SBO_Application.Company.Name Is Not "Company1" then
// Close
// End If
break;
case SAPbouiCOM.BoAppEventTypes.aet_LanguageChanged:
SBO_Application.MessageBox( "A Languge Change Event has been caught", 1, "Ok", "", "" );
break;
private void SBO_Application_MenuEvent( ref SAPbouiCOM.MenuEvent pVal, out bool BubbleEvent ) {
// in order to activate your own forms instead of SAP Business One system forms
// process the menu event by your self
// change BubbleEvent to False so that SAP Business One won't process it
BubbleEvent = true;
if ( pVal.BeforeAction == true ) {
SBO_Application.SetStatusBarMessage( "Menu item: " + pVal.MenuUID + " sent an event BEFORE SAP Business One processes it.", SAPbouiCOM.BoMessageTime.bmt_Long, true );
// to stop SAP Business One from processing this event
// unmark the following statement
// BubbleEvent = False
else {
SBO_Application.SetStatusBarMessage( "Menu item: " + pVal.MenuUID + " sent an event AFTER SAP Business One processes it.", SAPbouiCOM.BoMessageTime.bmt_Long, true );
private void SBO_Application_ItemEvent( string FormUID, ref SAPbouiCOM.ItemEvent pVal, out bool BubbleEvent ) {
// BubbleEvent sets the behavior of SAP Business One.
// False means that the application will not continue processing this event.
BubbleEvent = true;
if ( pVal.FormType != 0 ) {
// the message box form type is 0
// I chose not to deal with events triggered by a message box
// every event will open a message box with the event
// name and the form UID how sent it
SAPbouiCOM.BoEventTypes EventEnum = 0;
EventEnum = pVal.EventType;
// To prevent an endless loop of MessageBoxes,
// we'll not notify et_FORM_ACTIVATE and et_FORM_LOAD events
if ( ( EventEnum != SAPbouiCOM.BoEventTypes.et_FORM_ACTIVATE ) & ( EventEnum != SAPbouiCOM.BoEventTypes.et_FORM_LOAD ) ) {
SBO_Application.MessageBox( "An " + EventEnum.ToString() + " has been sent by a form with the unique ID: " + FormUID, 1, "Ok", "", "" );
private void SBO_Application_ProgressBarEvent( ref SAPbouiCOM.ProgressBarEvent pVal, out bool BubbleEvent) {
SAPbouiCOM.BoProgressBarEventTypes EventEnum = 0;
EventEnum = pVal.EventType;
BubbleEvent = true;
SBO_Application.MessageBox( "The event " + EventEnum.ToString() + " has been sent", 1, "Ok", "", "" );
private void SBO_Application_StatusBarEvent( string Text, SAPbouiCOM.BoStatusBarMessageType MessageType ) {
SBO_Application.MessageBox( @"Status bar event with message: """ + Text + @""" has been sent", 1, "Ok", "", "" );
Regards,
Jay. -
Question about event handling in JComponents
I have often found it useful to create a component that acts as an event handler for events the component generates itself. For example, a panel that listens for focus events that effect it and handle these events internally. (See below).
My question is: Can this practice cause synchronization issues or any other type of problem that I need to watch out for? Is it good/bad or neither. Are there any issues I should be aware of?
Thanks in advance for the help.
Example:
public class qPanel extends JPanel implements FocusListener
public qPanel () {
super.addFocusListener(this);
public void focusGained(FocusEvent e) {
//Do stuff
public void focusLost(FocusEvent e) {
//Do stuff
}Hi,
Handling events this way is completely fine and saves on number of classes. Only thing you may want to watch out for is that the handler methods have to be public. This means that someone could use your component and call one of the methods. For example, I could write:
panel.focusGained(new FocusEvent(....))
when it's not really gaining focus. So, if you're writing this component for re-use you might want to be aware of this.
An alternative:
Use a single internal class to handle all events. It can then delegate to private methods of your component. Example:
class MyEventHandler implements FocusListener, MouseListener, etc... {
public void focusGained(FocusEvent fe) {
doFocusGained(fe);
public void mousePressed(MouseEvent me) {
doMousePressed(me);
Then your component could have:
private void doFocusGained(FocusEvent fe) {
private void doMousePressed(MouseEvent me) {
etc...
Just ideas :)
Thanks!
Shannon Hickey (Swing Team)
I have often found it useful to create a component
that acts as an event handler for events the component
generates itself. For example, a panel that listens
for focus events that effect it and handle these
events internally. (See below).
My question is: Can this practice cause
synchronization issues or any other type of problem
that I need to watch out for? Is it good/bad or
neither. Are there any issues I should be aware of?
Thanks in advance for the help.
Example:
public class qPanel extends JPanel implements
FocusListener
public qPanel () {
super.addFocusListener(this);
public void focusGained(FocusEvent e) {
//Do stuff
public void focusLost(FocusEvent e) {
//Do stuff -
Question about event handling in a button
I recently coded a console version of my java program (just outputs stuff into the system console and a logger). I am now adding a simple GUI with a set of buttons to start and stop the program. In order to do this, do I just copy paste the main function contents of the console version of my code into the button's event handlers or is there a way I can just run the main class? I was googling for Class loading in java but I'm not sure if this is what I should be looking at... Can someone please help me out?
MyMainClass.main(new String[] { "the", "arguments" });
// or, if you defined your main to use varags (i.e. as "public static void main(String... args)") then you can just use
MyMainClass.main("the", "arguments");But you should really extract your functionality out of the main method into meaningful classes and methods and just use those from both your console code and your GUI code. -
Problem about event handling or dispatching
I created a JFrame with a JButton in it. A keyListener is add to the jframe.
Key events can be catched if JDK1.3.1_08 is employed. However, it doesn't work if JDK1.4.1_02 is empolyed. Can anyone tell me the problem? Thanks a lot!
The following is the source code:
public class drawa extends JFrame implements KeyListener
public static void main(String[] args) {
drawa frame = new drawa();
public drawa() {
super("drawa");
Container c=getContentPane();
c.setLayout(null);
JButton jb=new JButton("L");
jb.setSize(80,40);
c.add(jb);
addKeyListener(this);
setSize(500,450);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setVisible(true);
public void keyPressed(KeyEvent evt){
System.out.println("a");
public void keyTyped(KeyEvent evt){}
public void keyReleased(KeyEvent evt){}Your frame must return true for isFocusable ().
Kind regards,
Levi -
Hi
I am using jdev11.1.1.5.0
I created a search page in jspx page
I put there a inputText in which user enter a value and there is a command button named search which perform search operation which is defined in backing.
Now I want to add a listener that after entering value into input text component user press enter and search should be perform properly
How can I do the same.?
ThanksHi Arun
Thanks for your solution but i need something else
I already have a separate method for search.
and i do not want to filter table on input time
My need is when user have entered the search value in inputtext after that either by pressing enter key by keyboard or by pressing search button on screen ,search should be performed -
Hi...
I would like to know about event handler txn code: "crmv_event"
Can any one educate me about this ? How is this functionality used.?
Any example ?
Regards,
sanjanahi sanjana
CRMV_EVENT t code is used to establish the vents from background
since you are a functional consultant you must know that for any action to trigger in foreground there must be an event which actually triggers the event
there are many events to establish that event ,this is just one of the way
here using the calling options you can sopecify that whatever event you are trying to establish ,you are doing it for what application
technically whenever event is created or triggered it alwaays do that from the class,that is known as event handler class
so if we say in the definition of the event handler method, event parameter sender is imported. You can access this parameter at any ABAP Objects event although it is not listed as an event parameter in the Class Builder. This parameter imports a reference to the instance that has triggered the event. This reference can then be used directly to call methods of this instance.
to say in functional lingo the event which we have just created using the t code can be used to trigger the action in appliocation in which we have tried to call that event
that mean the event once established will flow throught teh entire structure everytime it is being called,
this way we decides the timings of the actions in the background of which we have created that event
hope i clear ur doubt
best regards
ashish -
Use event handler programmatically
Hello, I use the Labview 8.2.1 and I would like to ask something about event handler.
I have some buttons and I use an event handler to perform their tasks. The buttons are used only with the mouse and not programmatically.
Now, I want to use a button programmatically without pressing it. I didn't find how to do this, so I created a boolean variable and I added to the event handler of a button a second "Event Specifier" of that boolean variable with the event "value change".
I assumed that it would work, but it does not, that is, the event handler is not used when the value of the boolean variable changes.
How can I solve it?
Thank you in advance.
Solved!
Go to Solution.Write to the Value(Sgnl) property node of the variable you want to change. This will set off an event programatically.
- tbob
Inventor of the WORM Global -
Hi Everybody,
I have a question about event handling and I am just wondering if I can do the following with JSF.
I have two HTML dropdown lists A and B. When ever a value changes in list A, based on the selected value, list B has to be populated. Is it possible to do with JSF? Can you guys give me pointers where some code samples may be available?
Cheers!
KrishTake a look at the JSF Value-Changed Listener sections
-
UIX event handler + struts
Hi,
I'm using UIX + struts in jdev10g and im getting problems trying to handle a simple action binding event like the "Next" operation. Below is a short example of what im trying to do.
Test.uix
<submitButton text="Next" model="${bindings.Next}" id="Next2" event="next"/>
<event name="next" source="Next2">
<invoke method="doIt" javaType="oracle.jbo.uicli.binding.JUCtrlActionBinding"
instance="${bindings.Next}"/>
</event>
testAction.java
public void onNext(DataActionContext ctx)
if (ctx.getEventActionBinding() != null)
ctx.getEventActionBinding().doIt();
If i run the code above i can see that it executes ctx.getEventActionBinding().doIt(); but the action binding never gets executed, and this efect is the same for other actions like create,previous etc...
Another thing that calls my attention is that every time i drag a operation from the DataControl Palette the event name is always "action"
<submitButton text="First" model="${bindings.First}"
id="First0" event="action"/>
So how is the correct way to handle events in the UIX + Struts?????
Please i need a help on this one!!!!!
Tanks,
Eduardo M. SassoFirst of all tanks for the help.
But what i want to do is to subclass the DataForwardAction for my DataPage and let the struts controller handle the event, just like the documentation says...
About Event Handling in Applications Using Oracle ADF, UIX, and Struts
http://helponline.oracle.com/jdeveloper/help?topic=adf_auixadfevents_html
If i try to do the same thing using jsp it works great...
This is problem is getting me nuts!!! it looks to me that this problem is very easy to solve but i just cant see the solution....
tanks again -
Site
Hello everyone. I get an error in my chrome cosole, what can I do about this?
I dont have this problem in all browsers, just in chrome, and in some versions of Firefox.
The problem occurs when I click any label in the iframe (see website, speaks for itself).
line 5838 window.console.log("Javascript error in event handler! Event Type = " + eventType);
does anyone know how to fix this?
And why do I only have this problem in some browsers?I basically want the labels in the Iframe to make the parent page animate to a specific anchor tag.
ps. This is what I posted on the jquery forum as well:
I tried to do this by letting the iframe .trigger a .click to a button on the .parent page.
I did this in two ways.
one: the click is triggerd in (/by) the iframe
two: the click is triggerd by a script in the parent window, that script is launched by the iframe
Here's the thing:
this is what one of the <a>'s that the iframe will click looks like:
<a class="nonblock nontext anim_swing" id="u185" href="index.html#contact"><!-- simple frame --></a>
The code is generated by adobe muse which has a function to smoothly scroll to a location on the page, and I am guessing the "anim_swing" class takes care of that.
I would like the colorful labels in the iframe to do the same thing as the <a> above.
and it works in some browsers on some computers but somehow not on all of them (with method two the adblocker doesn't seem to be an issue ).
I also tried to let the parent page scroll directly with the jquery .scrollto function. That did not work either (see the jquery forum). -
Beginners Questions about Multiple JPanels in JFrame and event handling
I am a newbie with SWING, and even a newerbie in Event Handling. So here goes.
I am writing a maze program. I am placing a maze JPanel (MazePanel) at the center of a JFrame, and a JPanel of buttons (ButtonPanel) on the SOUTH pane. I want the buttons to be able to re-randomize the maze, solve the maze, and also ouput statistics (for percolation theory purposes). I have the backbone all done already, I am just creating the GUI now. I am just figuring out EventHandlers and such through the tutorials, but I have a question. I am adding an ActionListener to the buttons which are on the ButtonPanel which are on JFrame (SOUTH) Panel. But who do I make the ActionListener--Basically the one doing the work when the button is pressed. Do I make the JFrame the ActionListener or the MazePanel the ActionListener. I need something which has access to the maze data (the backbone), and which can call the Maze.randomize() function. I'm trying to make a good design and not just slop too.
Also I was wondering if I do this
JButton.addActionListener(MazePanel), and lets say public MazePanel implments ActionListenerdoesn't adding this whole big object to another object (namely the button actionlistener) seem really inefficient? And how does something that is nested in a JPanel on JFrame x get information from something nested in another JPanel on a JFrame x.
Basically how is the Buttons going to talk to the maze when the maze is so far away?I'm not an expert, but here's what I'd do....
You already have your business logic (the Maze classes), you said. I'm assuming you have some kind of public interface to this business logic. I would create a new class like "MazeGui" that extends JFrame, and then create the GUI using this class. Add buttons and panels as needed to get it to look the way you want. Then for each button that does a specific thing, add an anonymous ActionListener class to it and put whatever code you need inside the ActionListener that accesses the business logic classes and does what it needs to.
This is the idea, though my code is totally unchecked and won't compile:
import deadseasquirrels.mazestuff.*;
public class MazeGui extends JFrame {
JPanel buttonPanel = new JPanel();
JPanel mazePanel = new JPanel();
JButton randomizeB = new JButton();
JButton solveB = new JButton();
JButton statsB = new JButton();
// create instanc(es) of your Maze business logic class(es)
myMaze = new MazeClass();
// add the components to the MazeGui content pane
Component cp = getContentPane();
cp.add(); // this doesn't do anything, but in your code you'd add
// all of your components to the MazeGui's contentpane
randomizeB.addActionListener(new ActionListener {
void actionPerformed() {
Maze newMaze = myMaze.getRandomMazeLayout();
mazePanel.setContents(newMaze); // this is not a real method!
// it's just to give you the idea
// of how to manipulate the JPanel
// representing your Maze diagram,
// you will probably be changing a
// subcomponent of the JPanel
solveB.addActionListener(new ActionListener {
void actionPerformed() {
Solution mySolution = myMaze.getSolution();
mazePanel.setContents(mySolution); // again, this is not a real
// method but it shows you how
// the ActionListener can
// access your GUI
// repeat with any other buttons you need
public static void main(String[] args) {
MazeGui mg = new MazeGui();
mg.setVisible(true);
// etc...
} -
About CL_GUI_ALV_GRID's event-handling & PAI/PBO
Hi, all,
I met a problem when using CL_GUI_ALV_GRID's event-handling.
I created a simple event-handling-class with an event-handling-method for DOUBLE-CLICK event of CL_GUI_ALV_GRID. And the event-handling-method, only makes some changes to the contents of itab to be shown in ALV_GRID.
The problem is: In my idea, after event-dispatch and event-handling in PAI, subsequent PBO will be called. Since SET_TABLE_FOR_FIRST_DISPLAY is called in PBO, I would saw the changed itab shown. BUT, I saw the contents of the itab remaining unchanged.
* PAI module, DISPATCH the event
CASE OK_CODE.
WHEN OTHERS.
CALL METHOD cl_gui_cfw=>dispatch.
ENDCASE.
I debugged, and found that, after event-handling-method, PBO module doesn't execute.
That's my wondering, after the preceding PAI, shouldn't the subsequent PBO appear? OR is event-handling different from other user actions?
Many thanks.Hi,
for double click you need explicit handler ,
just check it.
REPORT ZTEST1234 MESSAGE-ID ZZ .
DATA: G_GRID TYPE REF TO CL_GUI_ALV_GRID, "First
G_GRID1 TYPE REF TO CL_GUI_ALV_GRID. "Second
DATA: L_VALID TYPE C,
V_FLAG,
V_DATA_CHANGE,
V_ROW TYPE LVC_S_ROW,
V_COLUMN TYPE LVC_S_COL,
V_ROW_NUM TYPE LVC_S_ROID.
DATA: OK_CODE LIKE SY-UCOMM,
SAVE_OK LIKE SY-UCOMM,
G_CONTAINER1 TYPE SCRFNAME VALUE 'TEST', "First Container
G_CONTAINER2 TYPE SCRFNAME VALUE 'TEST1',"Second container
GS_LAYOUT TYPE LVC_S_LAYO.
DATA:BEGIN OF ITAB OCCURS 0,
VBELN LIKE LIKP-VBELN,
POSNR LIKE LIPS-POSNR,
LFDAT like lips-vfdat,
BOX(1),
HANDLE_STYLE TYPE LVC_T_STYL,
END OF ITAB.
* CLASS lcl_event_handler DEFINITION
CLASS LCL_EVENT_HANDLER DEFINITION .
PUBLIC SECTION .
METHODS:
**Hot spot Handler
HANDLE_HOTSPOT_CLICK FOR EVENT HOTSPOT_CLICK OF CL_GUI_ALV_GRID
IMPORTING E_ROW_ID E_COLUMN_ID ES_ROW_NO,
**Handler to Check the Data Change
HANDLE_DATA_CHANGED FOR EVENT DATA_CHANGED
OF CL_GUI_ALV_GRID
IMPORTING ER_DATA_CHANGED
E_ONF4
E_ONF4_BEFORE
E_ONF4_AFTER,
**Double Click Handler
HANDLE_DOUBLE_CLICK FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID
IMPORTING E_ROW E_COLUMN ES_ROW_NO.
ENDCLASS. "lcl_event_handler DEFINITION
* CLASS lcl_event_handler IMPLEMENTATION
CLASS LCL_EVENT_HANDLER IMPLEMENTATION.
*Handle Hotspot Click
METHOD HANDLE_HOTSPOT_CLICK .
CLEAR: V_ROW,V_COLUMN,V_ROW_NUM.
V_ROW = E_ROW_ID.
V_COLUMN = E_COLUMN_ID.
V_ROW_NUM = ES_ROW_NO.
MESSAGE I000 WITH V_ROW 'clicked'.
ENDMETHOD. "lcl_event_handler
*Handle Double Click
METHOD HANDLE_DOUBLE_CLICK.
CLEAR: V_ROW,V_COLUMN,V_ROW_NUM.
V_ROW = E_ROW.
V_COLUMN = E_COLUMN.
V_ROW_NUM = ES_ROW_NO.
IF E_COLUMN = 'VBELN'.
SET PARAMETER ID 'VL' FIELD ITAB-VBELN.
CALL TRANSACTION 'VL03N' AND SKIP FIRST SCREEN.
ENDIF.
IF E_COLUMN = 'POSNR'.
MESSAGE I000 WITH 'Click on POSNR row number ' E_ROW.
"with this row num you can get the data
ENDIF.
ENDMETHOD. "handle_double_click
**Handle Data Change
METHOD HANDLE_DATA_CHANGED.
CALL METHOD G_GRID->REFRESH_TABLE_DISPLAY
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.
ENDMETHOD. "HANDLE_DATA_CHANGED
ENDCLASS. "LCL_EVENT_HANDLER IMPLEMENTATION
*& Global Definitions
DATA: G_CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,"Container1
G_HANDLER TYPE REF TO LCL_EVENT_HANDLER, "handler
G_CUSTOM_CONTAINER1 TYPE REF TO CL_GUI_CUSTOM_CONTAINER. "Container2
*- Fieldcatalog for First and second Report
DATA: IT_FIELDCAT TYPE LVC_T_FCAT,
X_FIELDCAT TYPE LVC_S_FCAT,
LS_VARI TYPE DISVARIANT.
* START-OF_SELECTION
START-OF-SELECTION.
SELECT VBELN
POSNR
FROM LIPS
UP TO 20 ROWS
INTO CORRESPONDING FIELDS OF TABLE ITAB.
END-OF-SELECTION.
IF NOT ITAB[] IS INITIAL.
CALL SCREEN 100.
ELSE.
MESSAGE I002 WITH 'NO DATA FOR THE SELECTION'(004).
ENDIF.
*& Form CREATE_AND_INIT_ALV
* text
FORM CREATE_AND_INIT_ALV .
DATA: LT_EXCLUDE TYPE UI_FUNCTIONS.
"First Grid
CREATE OBJECT G_CUSTOM_CONTAINER
EXPORTING CONTAINER_NAME = G_CONTAINER1.
CREATE OBJECT G_GRID
EXPORTING I_PARENT = G_CUSTOM_CONTAINER.
"Second Grid
CREATE OBJECT G_CUSTOM_CONTAINER1
EXPORTING CONTAINER_NAME = G_CONTAINER2.
CREATE OBJECT G_GRID1
EXPORTING I_PARENT = G_CUSTOM_CONTAINER1.
* Set a titlebar for the grid control
CLEAR GS_LAYOUT.
GS_LAYOUT-GRID_TITLE = TEXT-003.
GS_LAYOUT-ZEBRA = SPACE.
GS_LAYOUT-CWIDTH_OPT = 'X'.
GS_LAYOUT-NO_ROWMARK = 'X'.
GS_LAYOUT-BOX_FNAME = 'BOX'.
GS_LAYOUT-CTAB_FNAME = 'CELLCOLOR'.
GS_LAYOUT-STYLEFNAME = 'HANDLE_STYLE'.
CALL METHOD G_GRID->REGISTER_EDIT_EVENT
EXPORTING
I_EVENT_ID = CL_GUI_ALV_GRID=>MC_EVT_MODIFIED.
CREATE OBJECT G_HANDLER.
SET HANDLER G_HANDLER->HANDLE_DOUBLE_CLICK FOR G_GRID.
* SET HANDLER G_HANDLER->HANDLE_HOTSPOT_CLICK FOR G_GRID.
SET HANDLER G_HANDLER->HANDLE_DATA_CHANGED FOR G_GRID.
data: ls_outatb like line of itab,
v_index type sy-tabix.
DATA: LS_EDIT TYPE LVC_S_STYL,
LT_EDIT TYPE LVC_T_STYL.
LOOP AT ITAB INTO ls_outatb WHERE POSNR = '000010'.
V_INDEX = SY-TABIX.
LS_EDIT-FIELDNAME = 'VBELN'.
LS_EDIT-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_DISABLED.
LS_EDIT-STYLE2 = SPACE.
LS_EDIT-STYLE3 = SPACE.
LS_EDIT-STYLE4 = SPACE.
LS_EDIT-MAXLEN = 8.
INSERT LS_EDIT INTO TABLE LT_EDIT.
INSERT LINES OF LT_EDIT INTO TABLE ls_outatb-handle_style.
MODIFY ITAB INDEX V_INDEX FROM ls_outatb TRANSPORTING
HANDLE_STYLE.
ENDLOOP.
* setting focus for created grid control
CALL METHOD CL_GUI_CONTROL=>SET_FOCUS
EXPORTING
CONTROL = G_GRID.
* Build fieldcat and set editable for date and reason code
* edit enabled. Assign a handle for the dropdown listbox.
PERFORM BUILD_FIELDCAT.
* Optionally restrict generic functions to 'change only'.
* (The user shall not be able to add new lines).
PERFORM EXCLUDE_TB_FUNCTIONS CHANGING LT_EXCLUDE.
**Vaiant to save the layout
LS_VARI-REPORT = SY-REPID.
LS_VARI-HANDLE = SPACE.
LS_VARI-LOG_GROUP = SPACE.
LS_VARI-USERNAME = SPACE.
LS_VARI-VARIANT = SPACE.
LS_VARI-TEXT = SPACE.
LS_VARI-DEPENDVARS = SPACE.
CALL METHOD G_GRID->REGISTER_EDIT_EVENT
EXPORTING
I_EVENT_ID = CL_GUI_ALV_GRID=>MC_EVT_MODIFIED.
**Calling the Method for ALV output for First Grid
CALL METHOD G_GRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
IT_TOOLBAR_EXCLUDING = LT_EXCLUDE
IS_VARIANT = LS_VARI
IS_LAYOUT = GS_LAYOUT
I_SAVE = 'A'
CHANGING
IT_FIELDCATALOG = IT_FIELDCAT
IT_OUTTAB = ITAB[].
**Calling the Method for ALV output for Second Grid
CALL METHOD G_GRID1->SET_TABLE_FOR_FIRST_DISPLAY
* EXPORTING
* IT_TOOLBAR_EXCLUDING = LT_EXCLUDE
CHANGING
IT_FIELDCATALOG = IT_FIELDCAT
IT_OUTTAB = ITAB[].
* Set editable cells to ready for input initially
CALL METHOD G_GRID->SET_READY_FOR_INPUT
EXPORTING
I_READY_FOR_INPUT = 1.
ENDFORM. "CREATE_AND_INIT_ALV
*& Form EXCLUDE_TB_FUNCTIONS
* text
* -->PT_EXCLUDE text
FORM EXCLUDE_TB_FUNCTIONS CHANGING PT_EXCLUDE TYPE UI_FUNCTIONS.
* Only allow to change data not to create new entries (exclude
* generic functions).
DATA LS_EXCLUDE TYPE UI_FUNC.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_COPY_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_DELETE_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_APPEND_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_INSERT_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_MOVE_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_COPY.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_CUT.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_PASTE.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_PASTE_NEW_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_UNDO.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
ENDFORM. " EXCLUDE_TB_FUNCTIONS
*& Form build_fieldcat
* Fieldcatalog
FORM BUILD_FIELDCAT .
DATA: L_POS TYPE I.
L_POS = L_POS + 1.
X_FIELDCAT-SCRTEXT_M = 'Delivery'(024).
X_FIELDCAT-FIELDNAME = 'VBELN'.
X_FIELDCAT-TABNAME = 'ITAB'.
X_FIELDCAT-COL_POS = L_POS.
X_FIELDCAT-NO_ZERO = 'X'.
X_FIELDCAT-EDIT = 'X'.
X_FIELDCAT-OUTPUTLEN = '10'.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
L_POS = L_POS + 1.
X_FIELDCAT-SCRTEXT_M = 'Item'(025).
X_FIELDCAT-FIELDNAME = 'POSNR'.
X_FIELDCAT-TABNAME = 'ITAB'.
X_FIELDCAT-COL_POS = L_POS.
X_FIELDCAT-OUTPUTLEN = '5'.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
L_POS = L_POS + 1.
X_FIELDCAT-SCRTEXT_M = 'Del Date'(015).
X_FIELDCAT-FIELDNAME = 'LFDAT'.
X_FIELDCAT-TABNAME = 'ITAB'.
X_FIELDCAT-COL_POS = L_POS.
X_FIELDCAT-OUTPUTLEN = '10'.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
L_POS = L_POS + 1.
ENDFORM. " build_fieldcat
*& Module STATUS_0100 OUTPUT
* text
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'MAIN100'.
SET TITLEBAR 'MAIN100'.
IF G_CUSTOM_CONTAINER IS INITIAL.
**Initializing the grid and calling the fm to Display the O/P
PERFORM CREATE_AND_INIT_ALV.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
* text
MODULE USER_COMMAND_0100 INPUT.
CASE SY-UCOMM.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
Regards
vijay -
Event Handling in labview with arrays as event data
Hey folks,
I have a Labview Application which uses a dll to read Ethernet data. The setup is such that, when the dll has fresh data it sends out an event to the Labview Application so that the fresh data can be displayed.
However i have only managed to get this event based mechanism to send out a single structure at a time. Hence if there are 10 fresh data values, i need to send out 10 events (each event structure contains the parameter name, parameter value, unit and time stamp). It would be more efficient to send out an array of structures in a sigle shot.
I have tried this but Labview keeps crashing saying that an error was encountered and Labview needs to close along with an access violation message. I did a lot of online searching and found some LV code for event handling but not come accross any implementation which uses arrays as evend data. Is this supoorted? And if so is there any example vi that can be shared so that i get some knowledge about this.
Many Thanks in adavance,
Abel.I also gave a try by using a variant as the event data type instead of the cluster which contains the array of floats. I converted the cluster into a variant and used that to create the user event reference. Followed the same logic while decoding the dats.
But still the crash.... Here is the windbg output...
ModLoad: 07580000 075b7000 C:\Program Files\National Instruments\LabVIEW 2012\resource\lvalarms.dll
ModLoad: 0ca90000 0cb72000 C:\Program Files\National Instruments\LabVIEW 2012\resource\mesa.dll
ModLoad: 0c7f0000 0c7f9000 C:\Program Files\National Instruments\LabVIEW 2012\resource\lvuste.dll
ModLoad: 35000000 3509b000 C:\Program Files\National Instruments\Shared\TDMS\tdms.dll
ModLoad: 0c860000 0c87c000 D:\SapphireViewer\dll\SapphireClientDll.dll
ModLoad: 0e240000 0e2c7000 C:\WINDOWS\WinSxS\x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.6195_x-ww_44262b86\MSVCP80.dll
ModLoad: 0e2d0000 0e36b000 C:\WINDOWS\WinSxS\x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.6195_x-ww_44262b86\MSVCR80.dll
(1cb0.1a34): Access violation - code c0000005 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
eax=0e47f8b4 ebx=051f0040 ecx=051f0040 edx=061e5764 esi=22820840 edi=07b10040
eip=03c2050c esp=0e47f5cc ebp=0e47f810 iopl=0 nv up ei pl nz na po nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00010202
*** ERROR: Symbol file could not be found. Defaulted to export symbols for C:\Program Files\National Instruments\LabVIEW 2012\resource\tdcore_12_0.dll -
tdcore_12_0!LvVariant:etContents+0xac:
03c2050c 837e3100 cmp dword ptr [esi+31h],0 ds:0023:22820871=????????
I cannot really tell whats going on. Looking for some pointers.
Regards,
Abel.
Maybe you are looking for
-
Error while querying ADF form by saved criteria - MDS activated project
Hi, I have a project with MDS activated through database. I'm able to save the customized query criteria and retrieve in the session the criteria is created. But if I log off the session and open another session, I only see the saved criteria name in
-
PDF files not being displayed correctly, instead I get a blank screen with some sort of small pinned icon in the centre. It was working fine until today HELP!
-
How do I get custom ringtone off my iPhone and into iTunes
I recently reformatted my laptop and now I need to get my ringtones off my iphone and into itunes so I can back them up but when i check sync tones, iTunes is telling me it will erase all tones on my iPhone 4 and replace with tones on current iTunes
-
Hello. It can be a iPhone4 accessories for the one with pictures and other things are transferred wirelessly to a TV? Thank you
-
What is the log_checkpoint_interval?
Hi what is meant by : log_checkpoint_interval parameter in setting the 10g DB archivelog mode on unix ? what does it depend on? Thanks and regards