Multiple events handled in a case, variant type newval
Hi!
I use an event case structure, and one case handles two value change events. One is a button's, the other is a cluster of controls'.
I would like to distinguish, whether the source was the button, or one of the controls in the cluster, but i get back the new-val and old-val in a variant type.
How could i get the appropriate values back?
Thanks
Solved!
Go to Solution.
For this, you would use the "ctlref" event terminal, not the "newval".
If you only have two controls, create a control reference for one and compare it with the ctlref event terminal. If they are equal, that was the control, else the other one. Place the terminal of both controls inside the event to get the values of each.
(If you have more than two controls, create an array of control references and use "search array" for the ctrlref output)
If your controls have unique names, you could also use the ctlref to get the control label, for example.
LabVIEW Champion . Do more with less code and in less time .
Similar Messages
-
Hey,
This is probably a really stupid question but is there a way
to declare an event handle on an Actions layer that handles
multiple events?
For example, both of these are equivalent:
// on button
on (rollOut)
// on action layer
btnTest.onRollOut = function()
// on button
on(rollOut, releaseOutside)
// on action layerbtnTest.onRollOut = btnTest.onReleaseOutside = function(){
} -
Multiple event-handling threads?
I am writing a Java program that will launch other Java programs within the same JVM. This feature is for an RAD IDE that currently uses Runtime.exec.
The main problem is that the launcher is an IDE that will try to launch Swing applications within the same JVM. If a badly-written program traps the event-handling thread, it will bring the whole IDE down. The IDE's "Kill" button wont even work.
Is there any way to tell the JVM to use different event-handling threads for my application? Alternatively, does anybody know of any obscure functions I could use to maybe cause the event-handling thread to delegate processing to another one of my own threads? Ugly hacks are welcome.After I first posted this question, I've taken a look at the java.awt.EventQueue class. The API provides an easy way to use your own EventQueue that could possibly dispatch events with multiple threads. If you make sure that you only use one thread at a time for each virtual JVM, I don't think that there will be any thread issues (unless there are any assumptions in AWT/Swing code about there only being one thread).
About the load time being 0.5 seconds. I'm sure it'll improve, but a failed load only loads and links a minimum number of classes. I wrote a program that runs the java compiler from com.sun.tools.javac.Main and it looks like the load time is about 1.75 seconds. Since the compile time itself is usually under a second for around 2000 lines of code, this kind of makes a difference (500MHz P3, by the way). This load time will probably be even greater for Swing applications.
When you're lauching a big program it may not matter much but the load time really kills Java's ability to create a quick command-line tool (not that it's best-suited for such a tool anyway, but it would be nice to have that barrier removed).
The biggest problem with creating a lightweight JVM right now is probably the stupid File class. Even if you change "user.dir" in the system properties, many File methods still resolve relative to the original "user.dir". Though many other problems exist, this is the one that really kills it because of the pervasiveness of the File class. -
hi ,
Please can i have the soultion for the problem which i am facing.
My page is consists of the table where a single column is defined as MessageInputText.
The data is accepted int and validited by PPR on the InputText.( i.e either by tabbing out the inputtext or by clicking the mouse outside the text box. )
But in the rare senario when the user inputs the data and immediately clicks on the save or cancel button without tabbing out , the button functionality is not handled, as PPR is only activated.
Can i know how to make the system recoginize to handle both the events simultanously.
regards
lakshmiRead "PPR Event Queuing" topic in PPR chapter of devguide.
This is what it has to say
PPR Event Queuing
By default, when a PPR event fires, all subsequent events on the page are ignored. So, for example, assume you have a text input field configured to fire a PPR event when the user leaves, and you also have a submit button on the page. The user makes a change to the data in the text input field, and then uses her mouse to select the submit button. In this case, the text field's PPR event fires and the button click is ignored.
If you want to change this behavior so the first event generated after the PPR event is processed immediately after the PPR event response is received (so the subsequent event is sent in a separate request), add the following code to your page's controller:
import oracle.apps.fnd.framework.webui.beans.OABodyBean;
import oracle.apps.fnd.framework.webui.OAWebBeanConstants;
public void processRequest(OAPageContext pageContext, OAWebBean webBean)
super.processRequest(pageContext, webBean);
OAWebBean body = pageContext.getRootWebBean();
if (body instanceof OABodyBean)
body.setAttributeValue(OAWebBeanConstants.FIRST_CLICK_PASSED_ATTR, Boolean.TRUE);
With this code, the button click described in the example above would no longer be ignored.
Thanks
Tapash -
Can I have multiple event structures with the same event cases?
Hello,
I'm doing an application that reproduces the front panel of the HP6675A power supply. To achieve this, I have done a state machine with different states
(initialize, measures, voltage, current, ocp, ov, store, recall, etc). In each state, should have an event structure that catches the events of the buttons, like for example: if the current state is the Voltage mode and the user press the current button the next state will be the Current mode. For this in each state of the state machine should be the same event structure with the same events.
My problem is that the Vi doesn't work properly when I have multiple event structures with the same event cases. There are some possibily to do this, and how? Or is impossible to have multiple events? I have been reading some posts, but I don't find solutions.
Any help is appreciated.
Thank you very much.
Solved!
Go to Solution.natasftw wrote:
Or as others mentioned, make two parallel loops. In one loop, have your state machine. In the other, have just the Event Handler. Pass the events from the handler to the state machine by way of queues.
A proper state machine will not need the second loop. The "Wait For Event" or "Idle" state (whatever you want to call it) is all you really need in order to catch the user button presses. The setup is almost there. Maybe add a shift register to keep track of which state to go to in the case of a timeout on the Event Structure.
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines -
Is it possible to handle multiple events using Jscript for a button in Apex
Hi,
I've application wherein in one of the pages for a button, I need to trigger 2 events as: 1. redirect to a new page upon 'click' of the button
2. display a set of values on 'mouse over' that button.
I'm able to handle both separately, but not in one button. I would like to know if there is any limitation in Apex that we cant handle multiple events? Currently I've put a text item near the button, and called the Jscript for mouse over event in that as a temporary workaround. Can someone let me know if this is feasible? If not any other alternative to handle this?
Thanks in advance,
gsachidhHi Gsachidh,
well interesting problem you're facinng. Indeed, it can't be specified using the 'Button Attributes' So we have to come up with an workaround.
A quick en dirty solution would be to specify it with the 'Optional URL Redirect options'. In a normal button, with processing on same page, this would be 'no target'. but in case of additional things to be done this can be used, using an target URL. I used this many times, in example with popUp windows for refreshing the caller object when changes are made. In your case we have to add next to the href an onmouseover event. this can be done with;
Target set to => URL
URL - target => javascript:doSubmit('<button_name>');" onMouseOver="javascript:showTooltip('tooltip');"
Here the " is the key, letting ApEx know the target (href) is doSubmit('<button_name>'), just like when no target would be specified and adding a new javascript event; onMouseOver.
Although this is a dirty solution in my opinion, it is the best i could come up with. I have another idea in how to do this, that is by adding this event dynamically with javascript with an addEvent. But i don't have an example at the moment for this scenario.
Simon
Message was edited by:
S1M0N -
I am playing with the template where an event structure takes note of user inputs and a main state machine is then used to respond to these inputs. When I only monitor one control I use the 'NewVal' output to read out the changed value. But when I monitor multiple objects with a single case I also have to associate the readout with the correct owner. After some tinkering I was able to extract the label property and use a case to assign them. Are there better ways of doing this? For example maybe there is a way to connect the label text directly to the 'bundle by name'?
Also this should be easy to accomplish by simply creating local variables of the objects and read from them, but I got the impression that the use of global and local variables is now strongly discouraged?
Thanks for any suggestions!
Attachments:
Untitled.png 39 KBWell, I don't really like these theroretical discussions. Can you attach a simplified version of some of your code?
There are many other ways to identify the particular control. You could for example search an array of references for the value of the "ctlref" event data node. This would make the code much more robust (your code will fail for example if you (or some other programmer updating your code in a few years!) notices a mispelling and edits the label without also changing the case structure cases).
LabVIEW Champion . Do more with less code and in less time . -
Javascript error in event handler event type = timeline
Hi,
I have a small EdgeAnimate projekt with version 1.5.0 and the local export works fine... I must include the package at a CMS and I update all paths to absolute paths and all files are loading...
but I the animation dont play - I see at the javascript console the follow output
javascript error in event handler event type = timeline edge.1.5.0.min.js:143
Springender Punkt: Rettungswagen - Der springende Punkt
I dont found any solution... :-((Hi Scott,
I have gone through your shared composition created in older verion of Edge.
If you open the older composition html page in browser, there already have some of the error messages in the console as you mentioned above like
Javascript error in event handler! Event Type = timeline.
And as you said with the latest Edge, when you upgrade the old composition, some new error messages gets added to the existing ones.
As in the latest Edge, the whole of runtime has been shake-up, some of the attributes has been removed and are added in different way.
Example: To access timelines of a symbol:
Old way: sym.timelines['Default Timeline']
New way: sym.data[sym.name].timeline
You need to make some modifications in index_edgeActions.js file like:
1. Search & Replace "timelines['Default Timeline']" with "data[sym.name].timeline"
2. And in the code taken from EdgeCommons.js, replace "getVariable("symbolSelector")" with "_variables["symbolSelector"]".
Hope, these changes will remove the new JS issues you mentioned.
hth,
Vivekuma -
I'm doing a little edge project (now in beta version) for my girlfriend (she hates the code), with examples of the animate() method and other functions like setInteval(), but when I run I get the following error in Chrome console:
Javascript error in event handler! Event Type = element [edge.2.0.0.min.js:162]
But this library is global for all projects, how is possible that trigger an error?
Example here:
https://app.box.com/s/m7nof4al6597gfn47jlu
Thanks.you dont need to import java ease !!
it's already included in edge animate, remove that yepnope completely your problem will gone
Zaxist -
How to use multiple Screen Event Handling on JavaFX
Hi,
Its appreciate , if any one assist me on Event Handling on JavaFX with multiple scene with single stage.
Thanks
BiswajitI think is this usefull for you. . .
http://forums.sun.com/thread.jspa?threadID=5359128&tstart=30
Regards,
Rams. -
I hear people saying do not use multiple event cases.
is this in reference to multiple event cases in the same loop?
is it ok to use 1 event structure per parallel loop?
what happens if you have two parallel loops reacting to the same event?
- James
Using LV 2012 on Windows 7 64 bitJames R wrote:
I hear people saying do not use multiple event cases.
Who are these people??! There is nothing wrong with an event structure containing multiple event cases.
James R wrote:
is this in reference to multiple event cases in the same loop?
Yes, you should only have one event structure per loop, but that event structure can have multiple cases.
James R wrote:
is it ok to use 1 event structure per parallel loop?
Yes. What makes you think otherwise?
James R wrote:
what happens if you have two parallel loops reacting to the same event?
Nothing unusual. They will both fire whenever that associated event occurs. No problem!
LabVIEW Champion . Do more with less code and in less time . -
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...
} -
Multiple JComboBox Event Handling Problem
Hi, guys
I am a newbie in Java. I need to create three JComboBox, say date, month and year and a JButton "submit". After I select the entries from the three JComboBox, I click the "search" button to display something in terms of the information I selected, but I have no idea how to write the actionPerformed( ActionEvent evt) to deal with the problem. Can anyone give me some hint?
Any help would be appreciated.If you are asking how to write a basic event handler for when your button is pressed, RTM.
http://java.sun.com/docs/books/tutorial/uiswing/events/index.html -
hi experts,
event double click.
when double click on vbeln it should go to va03 transaction . how would i do that in oops alv.hai,
you can go through code below .
*& Report Z_CLARIFY *
REPORT Z_CLARIFY .
DATA: G_GRID TYPE REF TO CL_GUI_ALV_GRID.
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: IT_ROW_NO TYPE LVC_T_ROID,
X_ROW_NO TYPE LVC_S_ROID.
DATA:BEGIN OF ITAB OCCURS 0,
VBELN LIKE LIKP-VBELN,
POSNR LIKE LIPS-POSNR,
CELLCOLOR TYPE LVC_T_SCOL, "required for color
DROP(10),
END OF ITAB.
*The Below Definitions Must.....
DATA:
Reference to document
DG_DYNDOC_ID TYPE REF TO CL_DD_DOCUMENT,
Reference to split container
DG_SPLITTER TYPE REF TO CL_GUI_SPLITTER_CONTAINER,
Reference to grid container
DG_PARENT_GRID TYPE REF TO CL_GUI_CONTAINER,
Reference to html container
DG_HTML_CNTRL TYPE REF TO CL_GUI_HTML_VIEWER,
Reference to html container
DG_PARENT_HTML TYPE REF TO CL_GUI_CONTAINER.
"up to here
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,
**Double Click Handler
HANDLE_DOUBLE_CLICK FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID
IMPORTING E_ROW E_COLUMN ES_ROW_NO,
TOP_OF_PAGE FOR EVENT TOP_OF_PAGE "event handler
OF CL_GUI_ALV_GRID
IMPORTING E_DYNDOC_ID.
END_OF_LIST FOR EVENT end_of_list "event handler
OF CL_GUI_ALV_GRID
IMPORTING E_DYNDOC_ID.
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'.
CLEAR IT_ROW_NO[].
X_ROW_NO-ROW_ID = V_ROW.
APPEND X_ROW_NO TO IT_ROW_NO .
CALL METHOD G_GRID->SET_SELECTED_ROWS
EXPORTING
IT_ROW_NO = IT_ROW_NO.
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'.
SET PARAMETER ID 'VL' FIELD ITAB-VBELN.
CALL TRANSACTION 'VL03N' AND SKIP FIRST SCREEN."
ENDIF.
ENDMETHOD. "handle_double_click
METHOD END_OF_LIST. "implementation
Top-of-page event
PERFORM EVENT_TOP_OF_PAGE USING DG_DYNDOC_ID.
ENDMETHOD. "top_of_page
METHOD TOP_OF_PAGE. "implementation
Top-of-page event
PERFORM EVENT_TOP_OF_PAGE USING DG_DYNDOC_ID.
ENDMETHOD. "top_of_page
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
DATA: OK_CODE LIKE SY-UCOMM,
SAVE_OK LIKE SY-UCOMM,
G_CONTAINER1 TYPE SCRFNAME VALUE 'TEST',
GS_LAYOUT TYPE LVC_S_LAYO.
data: v_lines type i.
data: v_line(3) type c.
*- 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.
describe table itab lines v_lines.
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.
"attention.....from here
"split your container here...into two parts
"create the container
CREATE OBJECT G_CUSTOM_CONTAINER
EXPORTING CONTAINER_NAME = 'SCR100_CUST'.
"this is for top of page
Create TOP-Document
CREATE OBJECT DG_DYNDOC_ID
EXPORTING STYLE = 'ALV_GRID'.
Create Splitter for custom_container
CREATE OBJECT DG_SPLITTER
EXPORTING PARENT = G_CUSTOM_CONTAINER
ROWS = 2
COLUMNS = 1.
Split the custom_container to two containers and move the reference
to receiving containers g_parent_html and g_parent_grid
"i am allocating the space for grid and top of page
CALL METHOD DG_SPLITTER->GET_CONTAINER
EXPORTING
ROW = 1
COLUMN = 1
RECEIVING
CONTAINER = DG_PARENT_HTML.
CALL METHOD DG_SPLITTER->GET_CONTAINER
EXPORTING
ROW = 2
COLUMN = 1
RECEIVING
CONTAINER = DG_PARENT_GRID.
CALL METHOD DG_SPLITTER->GET_CONTAINER
EXPORTING
ROW = 2
COLUMN = 1
RECEIVING
CONTAINER = DG_PARENT_HTML.
CALL METHOD DG_SPLITTER->GET_CONTAINER
EXPORTING
ROW = 1
COLUMN = 1
RECEIVING
CONTAINER = DG_PARENT_GRID.
"you can set the height of it
Set height for g_parent_html
CALL METHOD DG_SPLITTER->SET_ROW_HEIGHT
EXPORTING
ID = 1
HEIGHT = 5.
"from here as usual..you need to specify parent as splitter part
"which we alloted for grid
CREATE OBJECT G_GRID
EXPORTING I_PARENT = DG_PARENT_GRID.
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-CTAB_FNAME = 'CELLCOLOR'.
CALL METHOD G_GRID->REGISTER_EDIT_EVENT
EXPORTING
I_EVENT_ID = CL_GUI_ALV_GRID=>MC_EVT_ENTER.
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->END_OF_LIST FOR G_GRID.
SET HANDLER G_HANDLER->TOP_OF_PAGE FOR G_GRID.
DATA: LS_CELLCOLOR TYPE LVC_S_SCOL. "required for color
DATA: L_INDEX TYPE SY-TABIX.
"Here i am changing the color of line 1,5,10...
"so you can change the color of font conditionally
LOOP AT ITAB.
L_INDEX = SY-TABIX.
IF L_INDEX = 1 OR L_INDEX = 5 OR L_INDEX = 10.
LS_CELLCOLOR-FNAME = 'VBELN'.
LS_CELLCOLOR-COLOR-COL = '6'.
LS_CELLCOLOR-COLOR-INT = '0'.
LS_CELLCOLOR-COLOR-INV = '1'.
APPEND LS_CELLCOLOR TO ITAB-CELLCOLOR.
MODIFY ITAB INDEX L_INDEX TRANSPORTING CELLCOLOR.
LS_CELLCOLOR-FNAME = 'POSNR'.
LS_CELLCOLOR-COLOR-COL = '6'.
LS_CELLCOLOR-COLOR-INT = '0'.
LS_CELLCOLOR-COLOR-INV = '1'.
APPEND LS_CELLCOLOR TO ITAB-CELLCOLOR.
MODIFY ITAB INDEX L_INDEX TRANSPORTING CELLCOLOR.
ENDIF.
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.
PERFORM SET_DRDN_TABLE.
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.
**Calling the Method for ALV output
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[].
"do these..{
Initializing document
CALL METHOD DG_DYNDOC_ID->INITIALIZE_DOCUMENT.
Processing events
CALL METHOD G_GRID->LIST_PROCESSING_EVENTS
EXPORTING
I_EVENT_NAME = 'TOP_OF_PAGE'
I_DYNDOC_ID = DG_DYNDOC_ID.
"end }
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 = 'IT_FINAL'.
X_FIELDCAT-COL_POS = L_POS.
X_FIELDCAT-NO_ZERO = 'X'.
X_FIELDCAT-OUTPUTLEN = '10'.
X_FIELDCAT-HOTSPOT = 'X'.
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 = 'IT_FINAL'.
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 = 'Drop'(025).
X_FIELDCAT-FIELDNAME = 'DROP'.
X_FIELDCAT-TABNAME = 'IT_FINAL'.
X_FIELDCAT-COL_POS = L_POS.
X_FIELDCAT-OUTPUTLEN = '5'.
X_FIELDCAT-EDIT = 'X'.
X_FIELDCAT-DRDN_HNDL = '1'.
X_FIELDCAT-DRDN_ALIAS = 'X'.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
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
there are many such examples
goto->se38->type bcalv* and press f4, u can see many examples.
Reward points if helpful.
Thanks and regards
Swetha Singh. -
LIST output and event handling in OO ALV and
Hi,
I am creating an ALV Report.
How can i Display the Grid as a List. I am abke to change the view from the first grid that is created. but i need to show it as a list output from beginning.
Also i have created a hotspot in and it works when the ALV is displayed in Grid Format but it does not work when i switch the view to list output.
Any suggestions.
Regards,
Tarun Bahal*& Report ZFI_TRIAL_BALANCE
REPORT zfi_trial_balance LINE-SIZE 275 LINE-COUNT 3(2) NO STANDARD PAGE HEADING.
TABLES: bseg.
TYPES: BEGIN OF ty_bkpf ,
bukrs TYPE bkpf-bukrs,
belnr TYPE bkpf-belnr,
gjahr TYPE bkpf-gjahr,
budat TYPE bkpf-budat,
END OF ty_bkpf.
TYPES: BEGIN OF ty_bseg ,
bukrs TYPE bseg-bukrs,
belnr TYPE bseg-belnr,
gjahr TYPE bseg-gjahr,
hkont TYPE bseg-hkont,
END OF ty_bseg.
TYPES: BEGIN OF ty_bank,
hkont TYPE bseg-hkont,
txt50 TYPE skat-txt50,
open_dmbtr_dr TYPE p,
open_dmbtr_cr TYPE p,
trans_dmbtr_dr TYPE p,
trans_dmbtr_cr TYPE p,
close_dmbtr_dr TYPE p,
close_dmbtr_cr TYPE p,
END OF ty_bank.
TYPES: BEGIN OF ty_breakup,
bukrs TYPE bseg-bukrs,
blart TYPE bkpf-blart,
belnr TYPE bseg-belnr,
budat TYPE bkpf-budat,
umskz TYPE bseg-umskz,
rebzg TYPE bseg-rebzg,
lifnr TYPE bseg-lifnr,
kunnr TYPE bseg-kunnr,
name1 TYPE lfa1-name1,
dmbtr TYPE p,
END OF ty_breakup.
INITIALIZATION.
* CLASS handler DEFINITION
CLASS handler DEFINITION.
PUBLIC SECTION .
METHODS:handle_hotspot_click "handler definition for hotspot_click
FOR EVENT hotspot_click OF cl_gui_alv_grid
IMPORTING e_row_id
e_column_id
es_row_no,
handle_top_of_page
FOR EVENT print_top_of_page OF cl_gui_alv_grid
IMPORTING table_index,
handle_subtotal_text
FOR EVENT subtotal_text OF cl_gui_alv_grid
IMPORTING es_subtottxt_info
ep_subtot_line
e_event_data.
ENDCLASS. "handler DEFINITION
* CLASS handler IMPLEMENTATION
CLASS handler IMPLEMENTATION.
METHOD handle_hotspot_click. "handler implementation for hotspot_click
PERFORM handle_hotspot_click USING e_row_id
e_column_id
es_row_no .
ENDMETHOD. "handle_hotspot_click
METHOD handle_top_of_page.
PERFORM handle_print_top_of_page.
ENDMETHOD. "handle_hotspot_click
METHOD handle_subtotal_text.
PERFORM handle_subtotal_text USING es_subtottxt_info
ep_subtot_line
e_event_data.
ENDMETHOD. "Subtotal_text
ENDCLASS. "handler IMPLEMENTATION
DATA: i_set_values TYPE TABLE OF rgsb4,
wa_set_values LIKE LINE OF i_set_values,
l_dmbtr TYPE dmbtr,
l_dmbtr2 TYPE dmbtr,
l_dmbtr3 TYPE dmbtr,
l_dmbtr4 TYPE dmbtr,
l_dmbtr_total TYPE dmbtr,
l_shkzg TYPE shkzg,
i_bkpf TYPE STANDARD TABLE OF ty_bkpf,
i_bseg TYPE STANDARD TABLE OF ty_bseg,
i_bank TYPE STANDARD TABLE OF ty_bank,
i_breakup TYPE STANDARD TABLE OF ty_breakup,
wa_bkpf LIKE LINE OF i_bkpf,
wa_bseg LIKE LINE OF i_bseg,
wa_bank LIKE LINE OF i_bank,
wa_breakup LIKE LINE OF i_breakup,
ok_code TYPE sy-ucomm,
save_ok TYPE sy-ucomm,
l_ktopl TYPE ktopl.
DATA: gr_alvgrid TYPE REF TO cl_gui_alv_grid,
gr_alvgrid_0200 TYPE REF TO cl_gui_alv_grid,
gr_ccontainer TYPE REF TO cl_gui_custom_container,
gr_ccontainer_0200 TYPE REF TO cl_gui_custom_container,
gt_fieldcat TYPE lvc_t_fcat,
gs_layout TYPE lvc_s_layo,
gt_sort TYPE lvc_t_sort,
gt_roid TYPE lvc_t_roid,
gt_exclude TYPE ui_functions,
g_scrstatus TYPE i,
gs_variant TYPE disvariant,
o_handler TYPE REF TO handler.
CONSTANTS: c_doctype(22) TYPE c VALUE 'ZINFITR01_TRIALBALANCE'.
DATA gs_stbl TYPE lvc_s_stbl.
SELECTION-SCREEN: BEGIN OF BLOCK block1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: l_date FOR sy-datum.
PARAMETERS : l_bukrs TYPE bukrs,
l_segent TYPE fb_segment.
SELECTION-SCREEN: END OF BLOCK block1.
START-OF-SELECTION.
gs_stbl-row = 'X'.
gs_stbl-col = 'X'.
CALL FUNCTION 'G_SET_GET_ALL_VALUES'
EXPORTING
setnr = c_doctype
table = 'SKA1'
class = '0000'
TABLES
set_values = i_set_values
EXCEPTIONS
set_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.
CLEAR i_bank.
LOOP AT i_set_values INTO wa_set_values.
CLEAR: l_dmbtr, l_dmbtr2, l_dmbtr3, l_dmbtr4, i_bkpf, i_bseg.
wa_bank-hkont = wa_set_values-from.
SELECT bukrs belnr budat gjahr FROM bkpf
INTO CORRESPONDING FIELDS OF TABLE i_bkpf
WHERE bukrs = l_bukrs
AND budat < l_date-low.
LOOP AT i_bkpf INTO wa_bkpf.
SELECT dmbtr shkzg FROM bseg INTO (l_dmbtr, l_shkzg)
WHERE bukrs = wa_bkpf-bukrs
AND belnr = wa_bkpf-belnr
AND gjahr = wa_bkpf-gjahr
AND hkont = wa_set_values-from.
IF l_shkzg = 'S'.
l_dmbtr2 = l_dmbtr2 + l_dmbtr.
ELSE.
l_dmbtr2 = l_dmbtr2 - l_dmbtr.
ENDIF.
CLEAR: l_dmbtr, l_shkzg.
ENDSELECT.
ENDLOOP.
IF l_dmbtr2 > 0.
wa_bank-open_dmbtr_dr = l_dmbtr2.
ELSE.
wa_bank-open_dmbtr_cr = l_dmbtr2.
ENDIF.
CLEAR: l_dmbtr, i_bkpf, i_bseg.
SELECT bukrs belnr budat gjahr FROM bkpf
INTO CORRESPONDING FIELDS OF TABLE i_bkpf
WHERE bukrs = l_bukrs
AND budat IN l_date.
LOOP AT i_bkpf INTO wa_bkpf.
SELECT dmbtr shkzg FROM bseg INTO (l_dmbtr, l_shkzg)
WHERE bukrs = wa_bkpf-bukrs
AND belnr = wa_bkpf-belnr
AND gjahr = wa_bkpf-gjahr
AND hkont = wa_set_values-from.
IF l_shkzg = 'S'.
l_dmbtr3 = l_dmbtr3 + l_dmbtr.
ELSE.
l_dmbtr4 = l_dmbtr4 - l_dmbtr.
ENDIF.
CLEAR: l_dmbtr, l_shkzg.
ENDSELECT.
ENDLOOP.
* IF l_dmbtr3 > 0.
wa_bank-trans_dmbtr_dr = l_dmbtr3.
* ELSE.
wa_bank-trans_dmbtr_cr = l_dmbtr4.
* ENDIF.
l_dmbtr = l_dmbtr2 + l_dmbtr3 + l_dmbtr4.
IF l_dmbtr > 0.
wa_bank-close_dmbtr_dr = l_dmbtr.
ELSE.
wa_bank-close_dmbtr_cr = l_dmbtr.
ENDIF.
CLEAR: l_dmbtr.
SELECT SINGLE ktopl FROM t001 INTO l_ktopl WHERE bukrs = l_bukrs.
SELECT SINGLE txt50 FROM skat INTO wa_bank-txt50
WHERE spras = sy-langu "( SELECT spras FROM t002 WHERE laiso = sy-langu )
AND ktopl = l_ktopl
AND saknr = wa_set_values-from.
APPEND wa_bank TO i_bank.
CLEAR wa_bank.
ENDLOOP.
LOOP AT i_bank INTO wa_bank.
* IF wa_bank-open_dmbtr_cr < 0.
wa_bank-open_dmbtr_cr = wa_bank-open_dmbtr_cr * -1.
* ENDIF.
* IF wa_bank-trans_dmbtr_cr < 0.
wa_bank-trans_dmbtr_cr = wa_bank-trans_dmbtr_cr * -1.
* ENDIF.
* IF wa_bank-close_dmbtr_cr < 0.
wa_bank-close_dmbtr_cr = wa_bank-close_dmbtr_cr * -1.
* ENDIF.
MODIFY i_bank FROM wa_bank.
ENDLOOP.
SORT i_bank ASCENDING BY hkont.
END-OF-SELECTION.
* SET SCREEN 100.
CALL SCREEN 100.
*& Module STATUS_0100 OUTPUT
* text
MODULE status_0100 OUTPUT.
SET PF-STATUS 'STATUS01'.
SET TITLEBAR 'TITLE1'.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module save_ok INPUT
* text
MODULE save_ok INPUT.
save_ok = ok_code.
CLEAR ok_code.
ENDMODULE. " save_ok INPUT
*& Module create_alv OUTPUT
* text
MODULE create_alv OUTPUT.
IF gr_alvgrid IS INITIAL.
CREATE OBJECT gr_ccontainer
EXPORTING
* PARENT =
container_name = 'CUSTOM_CONTAINER'
repid = sy-repid
dynnr = '0100'
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
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 OBJECT gr_alvgrid
EXPORTING
i_parent = gr_ccontainer
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
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.
PERFORM prepare_field_catalog CHANGING gt_fieldcat .
PERFORM prepare_layout CHANGING gs_layout .
PERFORM prepare_sort CHANGING gt_sort.
gs_variant-report = sy-repid.
gs_variant-variant = 'ABC'.
gs_variant-handle = '1'.
* IF sy-dynnr = '0100'.
CALL METHOD gr_alvgrid->set_table_for_first_display
EXPORTING
* I_BUFFER_ACTIVE =
* I_BYPASSING_BUFFER =
* I_CONSISTENCY_CHECK =
* I_STRUCTURE_NAME =
* is_variant = gs_variant
* i_save = 'A'
* i_default = 'X'
is_layout = gs_layout
* IS_PRINT =
* IT_SPECIAL_GROUPS =
* IT_TOOLBAR_EXCLUDING =
* IT_HYPERLINK =
* IT_ALV_GRAPHICS =
* IT_EXCEPT_QINFO =
* IR_SALV_ADAPTER =
CHANGING
it_outtab = i_bank
it_fieldcatalog = gt_fieldcat
* it_sort = gt_sort
* IT_FILTER =
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ELSE.
CALL METHOD gr_alvgrid->refresh_table_display
EXPORTING
is_stable = gs_stbl
* i_soft_refresh = 'X'
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.
ENDIF.
CREATE OBJECT o_handler.
SET HANDLER o_handler->handle_hotspot_click FOR gr_alvgrid.
SET HANDLER o_handler->handle_top_of_page FOR gr_alvgrid.
SET HANDLER o_handler->handle_subtotal_text FOR gr_alvgrid.
* ENDIF.
ENDMODULE. " create_alv OUTPUT
*& Form prepare_field_catalog
* text
* <--P_GT_FIELDCAT text
FORM prepare_field_catalog CHANGING pt_fieldcat TYPE lvc_t_fcat.
DATA: ls_fcat TYPE lvc_s_fcat.
CLEAR pt_fieldcat.
CLEAR gt_fieldcat.
* IF sy-dynnr = '0100'.
ls_fcat-fieldname = 'HKONT' .
ls_fcat-ref_field = 'HKONT'.
ls_fcat-inttype = 'C' .
ls_fcat-outputlen = '15' .
ls_fcat-ref_table = 'BSEG' .
ls_fcat-coltext = 'G/L Account' .
ls_fcat-seltext = 'G/L Account' .
ls_fcat-hotspot = 'X'.
APPEND ls_fcat TO pt_fieldcat.
CLEAR ls_fcat.
ls_fcat-fieldname = 'TXT50' .
ls_fcat-ref_field = 'TXT50'.
ls_fcat-inttype = 'C' .
ls_fcat-outputlen = '20' .
ls_fcat-ref_table = 'SKAT' .
ls_fcat-coltext = 'Description' .
ls_fcat-seltext = 'Description' .
APPEND ls_fcat TO pt_fieldcat.
CLEAR ls_fcat.
ls_fcat-fieldname = 'OPEN_DMBTR_DR' .
ls_fcat-ref_field = 'DMBTR'.
ls_fcat-inttype = 'NUMC' .
ls_fcat-outputlen = '20' .
ls_fcat-ref_table = 'BSEG'.
ls_fcat-coltext = 'Opening Balance: Debit' .
ls_fcat-seltext = 'Opening Balance: Debit'.
ls_fcat-no_sign = 'X'.
ls_fcat-do_sum = 'X'.
APPEND ls_fcat TO pt_fieldcat.
CLEAR ls_fcat.
ls_fcat-fieldname = 'OPEN_DMBTR_CR' .
ls_fcat-ref_field = 'DMBTR'.
ls_fcat-inttype = 'NUMC' .
ls_fcat-outputlen = '20' .
ls_fcat-ref_table = 'BSEG'.
ls_fcat-coltext = 'Opening Balance: Credit' .
ls_fcat-seltext = 'Opening Balance: Credit'.
ls_fcat-no_sign = 'X'.
ls_fcat-do_sum = 'X'.
APPEND ls_fcat TO pt_fieldcat.
CLEAR ls_fcat.
ls_fcat-fieldname = 'TRANS_DMBTR_DR' .
ls_fcat-ref_field = 'DMBTR'.
ls_fcat-inttype = 'NUMC' .
ls_fcat-outputlen = '20' .
ls_fcat-ref_table = 'BSEG'.
ls_fcat-coltext = 'Trans Balance: Debit' .
ls_fcat-seltext = 'Trans Balance: Debit'.
ls_fcat-no_sign = 'X'.
ls_fcat-do_sum = 'X'.
APPEND ls_fcat TO pt_fieldcat.
CLEAR ls_fcat.
ls_fcat-fieldname = 'TRANS_DMBTR_CR' .
ls_fcat-ref_field = 'DMBTR'.
ls_fcat-inttype = 'NUMC' .
ls_fcat-outputlen = '20' .
ls_fcat-ref_table = 'BSEG'.
ls_fcat-coltext = 'Trans Balance: Credit' .
ls_fcat-seltext = 'Trans Balance: Credit'.
ls_fcat-no_sign = 'X'.
ls_fcat-do_sum = 'X'.
APPEND ls_fcat TO pt_fieldcat.
CLEAR ls_fcat.
ls_fcat-fieldname = 'CLOSE_DMBTR_DR' .
ls_fcat-ref_field = 'DMBTR'.
ls_fcat-inttype = 'NUMC' .
ls_fcat-outputlen = '20' .
ls_fcat-ref_table = 'BSEG'.
ls_fcat-coltext = 'Closing Balance: Debit' .
ls_fcat-seltext = 'Closing Balance: Debit'.
ls_fcat-no_sign = 'X'.
ls_fcat-do_sum = 'X'.
APPEND ls_fcat TO pt_fieldcat.
CLEAR ls_fcat.
ls_fcat-fieldname = 'CLOSE_DMBTR_CR' .
ls_fcat-ref_field = 'DMBTR'.
ls_fcat-inttype = 'NUMC' .
ls_fcat-outputlen = '20' .
ls_fcat-ref_table = 'BSEG'.
ls_fcat-coltext = 'Closing Balance: Credit' .
ls_fcat-seltext = 'Closing Balance: Credit'.
ls_fcat-no_sign = 'X'.
ls_fcat-do_sum = 'X'.
APPEND ls_fcat TO pt_fieldcat.
CLEAR ls_fcat.
* ELSE.
* ENDIF.
ENDFORM. " prepare_field_catalog
*& Form prepare_layout
* text
* <--P_GS_LAYOUT text
FORM prepare_layout CHANGING ps_layout TYPE lvc_s_layo.
DATA l_title(50) TYPE c.
CONCATENATE 'Trial Balance: ' l_date-low+6(2) '-' l_date-low+4(2) '-'l_date-low(4) ' to ' l_date-high+6(2) '-' l_date-high+4(2) '-'l_date-high(4) INTO l_title RESPECTING BLANKS.
* ps_layout-zebra = 'X' .
ps_layout-grid_title = l_title.
ps_layout-cwidth_opt = 'X' .
ps_layout-sel_mode = 'A'.
* ps_layout-no_toolbar = 'X'.
ps_layout-no_headers = 'X'.
ps_layout-frontend = 'L'.
ENDFORM. " prepare_layout
*& Module USER_COMMAND_0100 INPUT
* text
MODULE user_command_0100 INPUT.
CASE save_ok.
WHEN 'BACK'.
SET SCREEN 0.
LEAVE SCREEN.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form prepare_sort
* text
* <--P_GT_SORT text
FORM prepare_sort CHANGING pt_sort TYPE lvc_t_sort.
CLEAR: pt_sort, gt_sort.
DATA ls_sort TYPE lvc_s_sort .
IF sy-dynnr = '0100'.
ls_sort-spos = '1' .
ls_sort-fieldname = 'HKONT' .
ls_sort-up = 'X' . "A to Z
ls_sort-down = space .
APPEND ls_sort TO pt_sort .
ELSE.
ls_sort-spos = '1' .
ls_sort-fieldname = 'BELNR' .
ls_sort-up = 'X' . "A to Z
ls_sort-down = space .
APPEND ls_sort TO pt_sort .
* ls_sort-spos = '2' .
* ls_sort-fieldname = 'BELNR' .
** ls_sort-up = 'X' . "A to Z
** ls_sort-down = space .
* ls_sort-subtot = 'X'.
* APPEND ls_sort TO pt_sort .
ENDIF.
ENDFORM. " prepare_sort
*& Form handle_hotspot_click
* text
* -->P_E_ROW_ID text
* -->P_E_COLUMN_ID text
* -->P_ES_ROW_NO text
FORM handle_hotspot_click USING i_row_id TYPE lvc_s_row
i_column_id TYPE lvc_s_col
is_row_no TYPE lvc_s_roid.
CLEAR: wa_bank, i_breakup.
READ TABLE i_bank INTO wa_bank INDEX is_row_no-row_id.
*TYPES: BEGIN OF ty_breakup,
* bukrs TYPE bseg-bukrs,
* blart TYPE bkpf-blart,
* belnr TYPE bseg-belnr,
* budat TYPE bkpf-budat,
* umskz TYPE bseg-umskz,
* rebzg TYPE bseg-rebzg,
* lifnr TYPE bseg-lifnr,
* name1 TYPE lfa1-name1,
* dmbtr TYPE p,
* END OF ty_breakup.
SELECT bukrs belnr budat gjahr FROM bkpf
INTO CORRESPONDING FIELDS OF TABLE i_bkpf
WHERE bukrs = l_bukrs
AND budat IN l_date.
LOOP AT i_bkpf INTO wa_bkpf.
SELECT bukrs belnr umskz rebzg lifnr kunnr dmbtr shkzg FROM bseg
INTO (wa_breakup-bukrs, wa_breakup-belnr, wa_breakup-umskz, wa_breakup-rebzg, wa_breakup-lifnr, wa_breakup-kunnr, wa_breakup-dmbtr, l_shkzg)
WHERE bukrs = l_bukrs
AND belnr = wa_bkpf-belnr
AND gjahr = wa_bkpf-gjahr
AND hkont = wa_bank-hkont.
SELECT SINGLE blart budat FROM bkpf INTO (wa_breakup-blart, wa_breakup-budat)
WHERE bukrs = l_bukrs
AND belnr = wa_bkpf-belnr
AND gjahr = wa_bkpf-gjahr.
IF wa_breakup-lifnr IS NOT INITIAL.
SELECT SINGLE name1 FROM lfa1 INTO wa_breakup-name1
WHERE lifnr = wa_breakup-lifnr.
ELSE.
SELECT SINGLE name1 FROM kna1 INTO wa_breakup-name1
WHERE lifnr = wa_breakup-kunnr.
wa_breakup-lifnr = wa_breakup-kunnr.
ENDIF.
ENDSELECT.
IF l_shkzg = 'H'.
wa_breakup-dmbtr = wa_breakup-dmbtr * -1.
ENDIF.
IF wa_breakup IS NOT INITIAL.
APPEND wa_breakup TO i_breakup.
ENDIF.
CLEAR wa_breakup.
ENDLOOP.
SET SCREEN 200.
LEAVE SCREEN.
ENDFORM. " handle_hotspot_click
*& Module STATUS_0200 OUTPUT
* text
MODULE status_0200 OUTPUT.
SET PF-STATUS 'STATUS01'.
SET TITLEBAR 'TITLE2'.
ENDMODULE. " STATUS_0200 OUTPUT
*& Module USER_COMMAND_0200 INPUT
* text
MODULE user_command_0200 INPUT.
CASE save_ok.
WHEN 'BACK'.
* CLEAR: gr_alvgrid, gr_ccontainer.
SET SCREEN 100.
LEAVE SCREEN .
ENDCASE.
ENDMODULE. " USER_COMMAND_0200 INPUT
*& Module create_alv_0200 OUTPUT
* text
MODULE create_alv_0200 OUTPUT.
IF gr_alvgrid_0200 IS INITIAL.
CREATE OBJECT gr_ccontainer_0200
EXPORTING
* PARENT =
container_name = 'CUSTOM_CONTAINER'
repid = sy-repid
dynnr = '0200'
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
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 OBJECT gr_alvgrid_0200
EXPORTING
i_parent = gr_ccontainer_0200
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
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.
PERFORM prepare_field_catalog_0200 CHANGING gt_fieldcat .
* PERFORM prepare_layout CHANGING gs_layout .
PERFORM prepare_sort CHANGING gt_sort.
CALL METHOD gr_alvgrid_0200->set_table_for_first_display
EXPORTING
* I_BUFFER_ACTIVE =
* I_BYPASSING_BUFFER =
* I_CONSISTENCY_CHECK =
* I_STRUCTURE_NAME =
* IS_VARIANT =
* I_SAVE =
* I_DEFAULT = 'X'
is_layout = gs_layout
* IS_PRINT =
* IT_SPECIAL_GROUPS =
* IT_TOOLBAR_EXCLUDING =
* IT_HYPERLINK =
* IT_ALV_GRAPHICS =
* IT_EXCEPT_QINFO =
* IR_SALV_ADAPTER =
CHANGING
it_outtab = i_breakup
it_fieldcatalog = gt_fieldcat
it_sort = gt_sort
* IT_FILTER =
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ELSE.
CALL METHOD gr_alvgrid_0200->refresh_table_display
EXPORTING
is_stable = gs_stbl
* i_soft_refresh = 'X'
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.
ENDIF.
* SET SCREEN 100.
ENDMODULE. " create_alv_0200 OUTPUT
*& Form prepare_field_catalog_0200
* text
* <--P_GT_FIELDCAT text
FORM prepare_field_catalog_0200 CHANGING pt_fieldcat TYPE lvc_t_fcat.
DATA: ls_fcat TYPE lvc_s_fcat.
CLEAR: pt_fieldcat, gs_layout.
ls_fcat-fieldname = 'BUKRS' .
ls_fcat-ref_field = 'BUKRS'.
ls_fcat-inttype = 'c' .
ls_fcat-outputlen = '5' .
ls_fcat-ref_table = 'BSEG'.
ls_fcat-coltext = 'Co' .
ls_fcat-seltext = 'Company Code'.
APPEND ls_fcat TO pt_fieldcat.
CLEAR ls_fcat.
ls_fcat-fieldname = 'BLART' .
ls_fcat-ref_field = 'BLART'.
ls_fcat-inttype = 'c' .
ls_fcat-outputlen = '5' .
ls_fcat-ref_table = 'BKPF'.
ls_fcat-coltext = 'Doc Typ' .
ls_fcat-seltext = 'Document Type'.
APPEND ls_fcat TO pt_fieldcat.
CLEAR ls_fcat.
ls_fcat-fieldname = 'BELNR' .
ls_fcat-ref_field = 'BELNR'.
ls_fcat-inttype = 'NUMC' .
ls_fcat-outputlen = '12' .
ls_fcat-ref_table = 'BSEG'.
ls_fcat-coltext = 'Doc Num' .
ls_fcat-seltext = 'Document Number'.
APPEND ls_fcat TO pt_fieldcat.
CLEAR ls_fcat.
ls_fcat-fieldname = 'BUDAT' .
ls_fcat-ref_field = 'BUDAT'.
ls_fcat-inttype = 'DATS' .
ls_fcat-outputlen = '13' .
ls_fcat-ref_table = 'BKPF'.
ls_fcat-coltext = 'G/L Date' .
ls_fcat-seltext = 'G/L Posting Date'.
APPEND ls_fcat TO pt_fieldcat.
CLEAR ls_fcat.
ls_fcat-fieldname = 'UMSKZ' .
ls_fcat-ref_field = 'UMSKZ'.
ls_fcat-inttype = 'C' .
ls_fcat-outputlen = '5' .
ls_fcat-ref_table = 'BSEG'.
ls_fcat-coltext = 'G/L Indicator' .
ls_fcat-seltext = 'Special G/L Indicator'.
APPEND ls_fcat TO pt_fieldcat.
CLEAR ls_fcat.
ls_fcat-fieldname = 'REBZG' .
ls_fcat-ref_field = 'REBZG'.
ls_fcat-inttype = 'C' .
ls_fcat-outputlen = '13' .
ls_fcat-ref_table = 'BSEG'.
ls_fcat-coltext = 'Reference' .
ls_fcat-seltext = 'Invoice Number'.
APPEND ls_fcat TO pt_fieldcat.
CLEAR ls_fcat.
ls_fcat-fieldname = 'LIFNR' .
ls_fcat-ref_field = 'LIFNR'.
ls_fcat-inttype = 'NUMC' .
ls_fcat-outputlen = '13' .
ls_fcat-ref_table = 'LFA1'.
ls_fcat-coltext = 'Vendor/Customer' .
ls_fcat-seltext = 'Vendor/Customer Number'.
APPEND ls_fcat TO pt_fieldcat.
CLEAR ls_fcat.
ls_fcat-fieldname = 'NAME1' .
ls_fcat-ref_field = 'NAME1'.
ls_fcat-inttype = 'C' .
ls_fcat-outputlen = '50' .
ls_fcat-ref_table = 'LFA1'.
ls_fcat-coltext = 'Description' .
ls_fcat-seltext = 'Description'.
APPEND ls_fcat TO pt_fieldcat.
CLEAR ls_fcat.
ls_fcat-fieldname = 'DMBTR' .
ls_fcat-ref_field = 'DMBTR'.
ls_fcat-inttype = 'NUMC' .
ls_fcat-outputlen = '25' .
ls_fcat-ref_table = 'BSEG'.
ls_fcat-coltext = 'Amount' .
ls_fcat-seltext = 'Amount'.
ls_fcat-no_sign = 'X'.
ls_fcat-do_sum = 'X'.
APPEND ls_fcat TO pt_fieldcat.
CLEAR ls_fcat.
ENDFORM. " prepare_field_catalog_0200
*& Form handle_print_top_of_page
* text
* --> p1 text
* <-- p2 text
FORM handle_print_top_of_page .
WRITE: sy-uline.
WRITE: /(255)'Tecnimont ICB' CENTERED.
WRITE: /(255)'Trial Balance' CENTERED.
WRITE: 'Trial Balance for ', l_bukrs, ': From Period - ', l_date-low, 'To Period - ', l_date-high. "LEFT-JUSTIFIED .
WRITE: /.
WRITE: / sy-uline.
FORMAT COLOR 1.
WRITE: sy-vline, AT 2(59)'Account Code and Name'CENTERED, AT 60 sy-vline, AT 61(45) 'Opening Balance' CENTERED, AT 107 sy-vline, AT 108(41) 'Transactions' CENTERED , AT 150 sy-vline, AT 155(41) 'Closing Balance' CENTERED, AT 197 sy-vline.
FORMAT COLOR 4.
WRITE: sy-vline,'GL Account'LEFT-JUSTIFIED, AT 16(50)'Description'CENTERED, AT 60 sy-vline, AT 61(23) 'Debits'CENTERED, AT 85(23) 'Credits.'CENTERED, AT 107 sy-vline, AT 108(23) 'Debits'CENTERED, AT 128(23)'Credits'CENTERED, AT 150 sy-vline, AT 151(23)
'Debits'CENTERED, AT 174(23) 'Credits'CENTERED, AT 197 sy-vline.
FORMAT COLOR OFF.
* WRITE: sy-uline.
ENDFORM. " handle_print_top_of_page
*& Form handle_subtotal_text
* text
* --> p1 text
* <-- p2 text
FORM handle_subtotal_text USING es_subtottxt_info TYPE lvc_s_stxt
ep_subtot_line TYPE REF TO data
e_event_data TYPE REF TO
cl_alv_event_data.
DATA l_bank LIKE wa_bank.
FIELD-SYMBOLS: <fs1> STRUCTURE wa_bank DEFAULT l_bank,
<fs2>.
IF es_subtottxt_info-criteria = 'TXT50'.
ASSIGN ep_subtot_line->* TO <fs1>.
ASSIGN e_event_data->m_data->* TO <fs2>.
CONCATENATE es_subtottxt_info-keyword 'Grand Summary: '
INTO <fs2>.
ENDIF.
ENDFORM. " handle_subtotal_text
This is the Code............... this code creates a Grid and not list and hotspot event wors on grid and not on list.
Regards,
Tarun Bahal
Maybe you are looking for
-
KanaaN Mini DisplayPort to HDMI doesn't work on 2013 MBA but does for 2011 Air?
This cable has worked well with my wife's 2011 air for ouputing audio and video through our Onkyo receiver: http://www.amazon.co.uk/KanaaN-Mini-...pr_product_top However, I can't get it to work on my new 2013 Air. My Air's display will flash like oth
-
Need help creating message in HTML Standard Editor Item
Hi, I have a requirement in which from page 1 using javascript I have to create a message with link into the HTML Editor Item on the different page on different application. everything works fine except when i compose a message which has a link eg. h
-
M-Audio Studiophile AV 40 vs. klipsch promedia 2.1
I'm looking for some new computer speakers, and these both seem like a good choice. I want a huge amount of bass, but i will use them mostly for listening to music so I want clear highs and mids, and I can't decide which would be better for listening
-
Application for time sheet in HR abap
Hi all, please tell me what is the application and output type for time sheet in HR ABAP. and also tell me step by step procedure how to work on HR forms Regards, Srinivas.
-
How to pass the encoding through the PostMethod of HttpClient
Greetings to all, I am having component that sends data to another component using PostMethod of HttpClient(org.apache.commons.httpclient.HttpClient) . I want to send the type of encoding used in one component to the other component. Is there any way