Add a button in javabean class
hi how can i have an add button in my class, i what an action listener in my class which will allow me to have a button to add a record in my javabean,i what to have createInsert button,how can i create that in my class.am not yet connect to database i just what to have structure ready,than when databse ready can link my variables,but for now i what createinsert button where i can create a record
my class is
Edited by: ADF007 on 2012/09/21 4:24 PM
Edited by: ADF007 on 2012/09/21 4:53 PM
Edited by: ADF007 on 2012/09/21 5:04 PM
Edited by: ADF007 on 2012/09/21 5:08 PM
Edited by: ADF007 on 2012/09/25 4:16 PM
how can i make my method to accept parameter am ,not able to view your video
public String addperson(ResPersonBean ineap){
System.out.println("Add new Person" + ineap.getusername() + ineap.getSurName() + ineap.getIdNumber() + ineap.getEmail() + ineap.TelNumber + ineap.getOwnership() + ineap.getAccountOfficer());
return " = new value" + ineap.getusername() + ineap.getSurName() + ineap.getIdNumber() + ineap.getEmail() + ineap.TelNumber + ineap.getOwnership() + ineap.getAccountOfficer();
}at the moment am geting <Utils> <buildFacesMessage> ADF: Adding the following JSF error message: java.lang.NullPointerException
java.lang.NullPointerException
error at the moment i just drag and drop the method and do edit action binding->values->variables->bindings->addperson->currentRow->DataProvider. i gues the error is because i did not return anything
this is what i have done drag and drop addperson method->edit action binding->value->variables->ResPersonBeanIterator->currentRow->dataprovider,when i click addperson i get this Add new Person [email protected],which is the information i already hard coded how can i get another row to add new record
Edited by: ADF112 on 2012/09/28 9:59 AM
Edited by: ADF112 on 2012/10/02 8:24 AM
Similar Messages
-
How to add push button in alv display with out class or method
Hai,
How to add push buttons in out put screen of ALV (tool bar) with out using classes or methods .I want to know using normal ALV .
Thanks in advance .
kiranYou should post your question in the ABAP forum.
ABAP Development -
How to add a button on the ALV LIST pop up
Hi ,
Can any one help me to add a button on the ALV list which is a pop up using ABAP Objects.
Thanks in advance.
Regards,
Kavya.HI ,
I want to add a push button on the ALV list out put which is comming as a pop up and I want this using classes and methods.
I have got a method IF_SREL_BROWSER_COMMANDS~ADD_BUTTONS from class cl_gos_attachment_list but still I am unable to get any additional button on the output ALV popup.
Please help.
Regards,
Kavya. -
How to add a button to the grouped data in an AdvancedDataGrid?
Hi,
Can anyone please suggest how to add a button to the grouped data in the AdvancedDataGrid?
I have tried extending the AdvancedDataGridGroupItemRenderer and using it as the groupItemRenderer but its not reflecting.
For the leaf node the itemRenderer property works just fine.
Please help!HI ,
I want to add a push button on the ALV list out put which is comming as a pop up and I want this using classes and methods.
I have got a method IF_SREL_BROWSER_COMMANDS~ADD_BUTTONS from class cl_gos_attachment_list but still I am unable to get any additional button on the output ALV popup.
Please help.
Regards,
Kavya. -
How to add a button in Canvas!?!
Hi, I need help with programming a Canvas object.
Excuse my english, I'm not very good.
My problem is to add a button in a Canvas class,...
There's no add() method in Canvas so how could I solve this.
THX
WSMCan I use Panel to create own objects???
momentary I using Canvas like this,..
import java.awt.*;
import java.awt.event.*;
public class myObject extends Canvas {
public myObject() {
public void paint (Graphics g) {
mouseevents....
to create my own Object. But I want to give it some functions and odd some other Objects,...
THX
WSM -
Add a Button in JFrame Title Bar
How can I add a button in JFrame Title Bar. I want to put on more button for docking after the closing button in the title bar.
if you use JFrame.setDefaultLookAndFeelDecorated(true) then you can do it by extending the JRootPaneUI class of the L&F (the default is the metal L&F). that is not a easy task but if you want take a look at BasicRootPaneUI, there you will have to point it to a new TitlePane which you will have to create. to load all this you must use the UIManager class. if you need more explaination try reading on look and feel and customizing it.
-
Hello...
This is my code. How to add REFRESH button in this code
package sample.view;
import javax.faces.event.ActionEvent;
public class Student {
public Student() {
super();
private String name;
private String id;
private String course;
public void setName(String name) {
this.name = name;
public String getName() {
return name;
public void setId(String id) {
this.id = id;
public String getId() {
return id;
public void setCourse(String course) {
this.course = course;
public String getCourse() {
return course;
public void dosubmittoActionisterner() {
// Add event code here...
System.out.println(getName() + " " + getId() + " " + getCourse());
public void dorefershActionlistener(ActionEvent actionEvent) {
// Add event code here...Hi,
is this a home work you are working on? Even as a student you should be able to express questions more clearly.
Frank -
Can anyone help me add any type of ACTION EVENT /ACTION LISTENER TO THIS CODE
PLEASE REVIEW AND COMPILE IF NECESSARY. Ensure that it compiles without errors. Currently it compiles without errors. It opens up as a GUI window that accepts a password. If anyone could just add a button to it that will do just about anything, time check, date check whatever it would be great!!!!! THIS WAS COMPILED WITH THE JGRASP COMPILER JAVA ACCEPTED
Thank you all,
********************** Bruce's Code*****************************
import java.awt.*;
public class TimeEntryForm extends Panel
private Panel tallPanel = new Panel();
private Panel tallPanel2= new Panel();
public TimeEntryForm()
tallPanel.setLayout(new GridLayout(3, 1));
tallPanel.add(new Label("Hrs Total"));
tallPanel.add(new Label("Any"));
tallPanel.add(new Label("One"));
tallPanel2.setLayout(new GridLayout(3,1));
tallPanel2.add(new Label("Personal Leave "));
tallPanel2.add(new Label("Hrs Total "));
tallPanel2.add(new Label("Pay Calc "));
setLayout(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
c.gridx = 0; c.gridy = 2;
add(new Label("Social Security # "), c);
c.gridx = 1; c.gridy = 0;
add(new Label("TIME ENTRY FORM"), c);
c.gridx = 1;c.gridy = 1;
add(new Label("Enter Date Here "), c);
c.gridx = 3;c.gridy = 2;
add(new Label("Employee Name "), c);
c.gridx = 3;c.gridy = 4;
add(new Label("Sick Time "), c);
c.gridx = 0; c.gridy = 3;
add(new Label("IN OUT "), c);
c.gridx = 0; c.gridy = 4;
add(new Label("IN OUT "), c);
c.gridx = 0; c.gridy = 5;
add(new Label("IN OUT "), c);
c.gridx = 0; c.gridy = 6;
add(new Label("IN OUT "), c);
c.gridx = 0; c.gridy = 7;
add(new Label("IN OUT "), c);
c.gridx = 0; c.gridy = 8;
add(new Label("IN OUT "), c);
c.gridx = 0; c.gridy = 9;
add(tallPanel2, c);
c.gridx = 1;c.gridy = 11; //note, sets y
add(new Label("Hrs Worked Today "), c);
c.gridx = 1;c.gridy = 12;
add(new Label("Pay Earned Today "), c);
c.gridx = 2;
add(tallPanel2, c);
public static void main(String args[])
Frame f = new Frame("Time Entry Form");
f.add(new TimeEntryForm());
f.pack();
f.setVisible(true);
}Hi java-luv,
I am not sure if I understand the problem. But I was able to add a JButton to your code (using the JBuilder designer). The button just exists the application. Please check the listing below. Hope this helps.
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class TimeEntryForm extends Panel
private Panel tallPanel = new Panel();
private Panel tallPanel2 = new Panel();
private JButton jButton1 = new JButton();
public TimeEntryForm() {
tallPanel.setLayout(new GridLayout(3, 1));
tallPanel.add(new Label("Hrs Total"));
tallPanel.add(new Label("Any"));
tallPanel.add(new Label("One"));
tallPanel2.setLayout(new GridLayout(3, 1));
tallPanel2.add(new Label("Personal Leave "));
tallPanel2.add(new Label("Hrs Total "));
tallPanel2.add(new Label("Pay Calc "));
setLayout(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
c.gridx = 0;
c.gridy = 2;
add(new Label("Social Security # "), c);
c.gridx = 1;
c.gridy = 0;
add(new Label("TIME ENTRY FORM"), c);
c.gridx = 1;
c.gridy = 1;
add(new Label("Enter Date Here "), c);
c.gridx = 3;
c.gridy = 2;
add(new Label("Employee Name "), c);
c.gridx = 3;
c.gridy = 4;
add(new Label("Sick Time "), c);
c.gridx = 0;
c.gridy = 3;
add(new Label("IN OUT "), c);
c.gridx = 0;
c.gridy = 4;
add(new Label("IN OUT "), c);
c.gridx = 0;
c.gridy = 5;
add(new Label("IN OUT "), c);
c.gridx = 0;
c.gridy = 6;
add(new Label("IN OUT "), c);
c.gridx = 0;
c.gridy = 7;
add(new Label("IN OUT "), c);
c.gridx = 0;
c.gridy = 8;
add(new Label("IN OUT "), c);
c.gridx = 0;
c.gridy = 9;
add(tallPanel2, c);
c.gridx = 1;
c.gridy = 11; //note, sets y
add(new Label("Hrs Worked Today "), c);
c.gridx = 1;
c.gridy = 12;
add(new Label("Pay Earned Today "), c);
c.gridx = 2;
add(tallPanel2, c);
jbInit();
public static void main(String args[]) {
Frame f = new Frame("Time Entry Form");
f.add(new TimeEntryForm());
f.pack();
f.setVisible(true);
private void jbInit() {
jButton1.setText("Exit");
jButton1.addActionListener(new TimeEntryForm_jButton1_actionAdapter(this));
this.add(jButton1, null);
void jButton1_actionPerformed(ActionEvent e) {
System.exit(0);
class TimeEntryForm_jButton1_actionAdapter implements java.awt.event.ActionListener {
TimeEntryForm adaptee;
TimeEntryForm_jButton1_actionAdapter(TimeEntryForm adaptee) {
this.adaptee = adaptee;
public void actionPerformed(ActionEvent e) {
adaptee.jButton1_actionPerformed(e); -
Add a button to the branch/root in a Flex Tree
Can someone provide me code or guide me how to add a button to all nodes that has children/leaf( but not to leaf). I tried from the example in this link
http://www.remwebdevelopment.com/dev/a31/Flex-Checkbox-TreeItemRenderer.html , but I ma getting buttons for all the nodes(including leaf).
i need to hav ethe button on the rideside corners horizontally to all branches/root.
Please correct me where i am wrong or provide me correct code. Thanks in advance
package
PKG{
import mx.controls.Button;
import mx.controls.Tree;
import mx.controls.treeClasses.TreeItemRenderer;
import mx.controls.treeClasses.TreeListData;
public class TreeData extends TreeItemRenderer{
private var bWidth:Number = 30;
private var bHeight:Number = 20;
public function TreeData(){
super();}
var btn:Button=new Button();
override protected function createChildren():void{
//addChild(btn);
super.createChildren();}
override public function set data(value:Object):void{
super.data = value;
// get the tree that owns us
var _tree:Tree = Tree(this.parent.parent);
// if the current node is a branch node
//for each(item:Object in
if(TreeListData(super.listData).depth=1) -or if(TreeListData(super.listData).hasChildren) these are not working for me{
btn.width = bWidth;
btn.height= bHeight;
btn.label=
"Remove Attachment";btn.right=10;
else{
override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void{
super.updateDisplayList(unscaledWidth,unscaledHeight);
if(super.data){
var tld:TreeListData = TreeListData(super.listData);
// if the current node is a branch node
if(TreeListData(super.listData).depth=1){
this.btn.visible=true;
this.btn.x=200;
this.btn.y = super.label.y+4;
//super.label.x = this.btn.x +;
//this.btn.y = super.label.y+8;
else{
this.btn.visible=false;
this.btn.includeInLayout=false;}Hi Albert.
You need to do a few things for that :
- Create your own GUI status by copying STANDARD_FULLSCREEN from function group SLVC_FULLSCREEN.
- Set your own PF-Status using the Exclude table because otherwise your exclude table would become meaningless.
- define a subroutine to handle the user commands.
Sample implementation :
FORM pf_status USING extab TYPE slis_t_extab.
extab = pf_exclude.
SET PF-STATUS 'STANDARD' EXCLUDING extab.
ENDFORM. "PF_STATUS
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = repid
i_callback_user_command = 'USER_COMMAND'
i_callback_pf_status_set = 'PF_STATUS'
is_layout = layout
it_fieldcat = fieldcat
it_excluding = pf_exclude
TABLES
t_outtab = itab
EXCEPTIONS
OTHERS = 0.
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
ENDFORM.
Please reward points if found helpful. -
Cannot find JavaBean class?
Created JSP program that calls a javabean but for some reason it cannot find the javabean class. I moved the NonConfBean.class and NonConfBean.java modules to the directory: C:\jakarta-tomcat-4.0.3\webapps\examples\WEB-INF\classes. Also, I modified my CLASSPATH to the following: .;C:\j2sdk1.4.0\lib;C:\jakarta-tomcat-4.0.3\webapps\examples\WEB-INF\classes.
Here is the JSP:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<%@ page import="accsp.application.*"%>
<head>
<title>Add ACCSP Application for Non-Confidential Data</title>
</head>
<body>
<jsp:useBean id="accapp"
class="accsp.application.NonConfBean"
scope="request" />
<jsp:setProperty name="accapp" property="*"/>
<BR>
<% accapp.updateDatabase(); %>
<jsp:forward page="NonconfPresentation.jsp" />
</body>
</html>
And here is the error:
org.apache.jasper.JasperException: Unable to compile class for JSPNote: sun.tools.javac.Main has been deprecated.
C:\jakarta-tomcat-4.0.3\work\localhost\webdav\myJSPs\addaccspapp$jsp.java:3: Package accsp.application not found in import.
import accsp.application.*;
^
1 error, 1 warning
If I take out the import I receive the following error:
org.apache.jasper.JasperException: Unable to compile class for JSPNote: sun.tools.javac.Main has been deprecated.
An error occurred between lines: 7 and 9 in the jsp file: /myJSPs/addaccspapp.jsp
Generated servlet error:
C:\jakarta-tomcat-4.0.3\work\localhost\webdav\myJSPs\addaccspapp$jsp.java:60: Class accsp.application.NonConfBean not found.
accsp.application.NonConfBean accapp = null;
Why is this happening?Yes I have put NonConfBean.class in the following directories just to make sure I am covering all bases:
1. C:\accsp\application
2. C:\j2sdk1.4.0\accsp\application
3. C:\jakarta-tomcat-4.0.3\accsp\application
4. C:\jakarta-tomcat-4.0.3\webapps\examples\WEB-INF\classes\accsp\application
Here is my classpath: .;C:\j2sdk1.4.0\lib\tools.jar;C:\accsp\application;C:\j2sdk1.4.0\accsp\application;C:\jakarta-tomcat-4.0.3\accsp\application;C:\jakarta-tomcat-4.0.3\webapps\examples\WEB-INF\classes\accsp\application
And here is the JSP that tries to do the import:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@page import="accsp.application.*" %>
<html>
<head>
<title>Add ACCSP Application for Non-Confidential Data</title>
</head>
<body>
<jsp:useBean id="accapp"
class="accsp.application.NonConfBean"
scope="request" />
<jsp:setProperty name="accapp" property="*"/>
</jsp:useBean>
<BR>
<% accapp.updateDatabase(); %>
<jsp:forward page="NonconfPresentation.jsp" />
</body>
</html>
And here is the error message:
org.apache.jasper.JasperException: Unable to compile class for JSPNote: sun.tools.javac.Main has been deprecated.
C:\jakarta-tomcat-4.0.3\work\localhost\webdav\myJSPs\addaccspapp$jsp.java:3: Class accsp.application.NonConfBean not found in import.
import accsp.application.NonConfBean; -
In table view, how to add one button for selecting page?
Hi Experts,
In the OBIEE 11.1.1.6, we have one uncommon requirement that customers want to randomly select actual page to view expected data in table view.
For example:
We make use of some columns to create one report in table view, and set 'Rows per Page' equal to '5',
if this report contains 60 rows, it will have 12 pages, so customers want to select sepcial page number to view the some data. Is it possible to implement this requirement? Maybe we should write JS code.
Note: Below table view, it has four buttons: First Row, Previous Row, Next Row and Display (500) rows in per page. So we want to add one button to select per page.
We look at orgnial codes in WebBrowse, but do not know the following codes derive from which JS file.
Could you please tell me how to find this file?
<td class="TapeDeckCell"><img class="TapeDeckImage" onclick="" onkeypress="" src="res/s_blafp/viewui/pivot/first_dis.png" title="" alt="" ><img class="TapeDeckImage" onclick="" onkeypress="" src="res/s_blafp/viewui/pivot/previous_dis.png" title="" alt="" ><img class="TapeDeckImageEna" onclick="PTRowScroll('saw_5083_b','5','5', event)" onkeypress="PTRowScroll('saw_5083_b','5','5', event)" src="res/s_blafp/viewui/pivot/next_ena.png" tabIndex="0" onmouseover="PTTD(event, 'res/s_blafp/viewui/pivot/next_ovr.png');" onmouseout="PTTDO(event)" onmousedown="PTTD(event, 'res/s_blafp/viewui/pivot/next_dwn.png');" title="Next 5 Rows" alt="Next 5 Rows" ><img class="TapeDeckImageEna" onclick="*PTRowScroll*('saw_5083_b','-1)', event)" onkeypress="PTRowScroll('saw_5083_b','-1)', event)" src="res/s_blafp/viewui/pivot/showallrows_ena.png" tabIndex="0" onmouseover="PTTD(event, 'res/s_blafp/viewui/pivot/showallrows_ovr.png');" onmouseout="PTTDO(event)" onmousedown="PTTD(event, 'res/s_blafp/viewui/pivot/showallrows_dwn.png');" title="Display maximum (500) rows per page" alt="Display maximum (500) rows per page" > <Span class="TapeDeckRecords">Rows 1 - 5</Span></td>Hi Kobe,
Thanks for listening me.
I agree 11g have some issues unlike 10g. I've tried the same by creating a measure rcount(1) and name it as Page in RPD. I just pulled column Page in pivot table section 'Pivot Table Prompts' it is working but this may not answer your requirements.
I would suggest to use the column in Prompt and go by between operator to allow user to select the rows between.
In the report make Page as prompted.
If you are okay with this can look forward to tweak it further, like values in the prompt multiple of 5 or 10s some thing like that.
let me know updates on the same. -
ALV Grid default values for new rows added with Add/Insert buttons
Hi!
Help, please, to find a way how to set default values for new rows added with Add/Insert buttons in
ALV Grid.I have found salution:
ALV Grid u2013 Insert row function
Sometimes we need to assign some default values when we create a new row in a grid using standard ALV Append row button. In our scenario we will see how to assign default values to Airline Code (CARRID), Flight Connection Number (CONNID) and Flight date (FLDATE) when a new row is created. To do that we need to handle DATA_CHANGED event in the program like mentioned below.
Definition of a class:
Code:
CLASS lcl_event_receiver DEFINITION
CLASS LCL_EVENT_RECEIVER DEFINITION.
PUBLIC SECTION.
METHODS:
handle_data_changed
FOR EVENT data_changed OF cl_gui_alv_grid
IMPORTING er_data_changed
e_ucomm.
ENDCLASS. "lcl_event_receiver DEFINITION
Implementation of a class:
Code:
CLASS LCL_EVENT_RECEIVER IMPLEMENTATION.
METHOD HANDLE_DATA_CHANGED.
DATA: dl_ins_row TYPE lvc_s_moce. " Insert Row
FIELD-SYMBOLS: <fs> TYPE table. " Output table
Loop at the inserted rows table and assign default values
LOOP AT er_data_changed->mt_inserted_rows INTO dl_ins_row.
ASSIGN er_data_changed->mp_mod_rows->* TO <fs>.
loop at <fs> into ls_outtab.
ls_outtab-carrid = 'LH'.
ls_outtab-connid = '400'.
ls_outtab-fldate = sy-datum.
MODIFY <fs> FROM ls_outtab INDEX sy-tabix.
endloop.
endloop.
ENDMETHOD. "handle_data_changed
ENDCLASS. "lcl_event_receiver IMPLEMENTATION
Register the events to trigger DATA_CHANGED event when a new row is created.
Code:
CALL METHOD OBJ_GRID->REGISTER_EDIT_EVENT
EXPORTING
I_EVENT_ID = CL_GUI_ALV_GRID=>MC_EVT_ENTER.
CALL METHOD OBJ_GRID->REGISTER_EDIT_EVENT
EXPORTING
I_EVENT_ID = CL_GUI_ALV_GRID=>MC_EVT_MODIFIED. -
Need to Add a button in ALV Tool Bar
Hi,
I have a requirement where in i need to add a button to a standard ALV report. Its using the class CL_GUI_ALV_GRID. There is a Badi for the report. The Report is co05n and the Badi is WORKORDER_INFOSYSTEM . I am getting the handle of
CL_GUI_ALV_GRID object reference before screen display. Any guidance on how to add new button now to that toolbar?
Any help will be rewarded.
Thank you.
regards,
Deepthi lakshmi.A.Dear Deepthi Lakshmi.A.,
Refer the standard program BCALV_GRID_05 Add a Self-Defined Button to the Toolbar.
PROGRAM BCALV_GRID_05.
Purpose:
~~~~~~~~
Demonstrate the creation of an own toolbar button.
To check program behavior
~~~~~~~~~~~~~~~~~~~~~~~~~
The report shows a list of flights of one airline.
Select one or more lines and press the 'Detail'-Button to popup
a dialog window with related bookings.
Essential steps (Search for '§')
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1.Apply steps for event handling for events TOOLBAR and
USER_COMMAND (see example for print events)
2.In event handler method for event TOOLBAR: Append own functions
by using event parameter E_OBJECT.
3.In event handler method for event USER_COMMAND: Query your
function codes defined in step 2 and react accordingly.
4.Call method 'set_toolbar_interactive' to raise event TOOLBAR.
INCLUDE .
Predefine a local class for event handling to allow the
declaration of a reference variable before the class is defined.
CLASS lcl_event_receiver DEFINITION DEFERRED.
DATA: ok_code LIKE sy-ucomm,
gt_sflight TYPE TABLE OF sflight,
gt_sbook TYPE TABLE OF sbook,
g_repid LIKE sy-repid,
g_max type i value 100,
gs_layout TYPE lvc_s_layo,
cont_on_main TYPE scrfname VALUE 'BCALVC_TOOLBAR_D100_C1',
cont_on_dialog TYPE scrfname VALUE 'BCALVC_TOOLBAR_D101_C1',
grid1 TYPE REF TO cl_gui_alv_grid,
grid2 TYPE REF TO cl_gui_alv_grid,
custom_container1 TYPE REF TO cl_gui_custom_container,
custom_container2 TYPE REF TO cl_gui_custom_container,
event_receiver TYPE REF TO lcl_event_receiver.
Set initial dynpro
SET SCREEN 100.
LOCAL CLASSES: Definition
*===============================================================
class lcl_event_receiver: local class to
define and handle own functions.
Definition:
~~~~~~~~~~~
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
METHODS:
handle_toolbar
FOR EVENT toolbar OF cl_gui_alv_grid
IMPORTING e_object e_interactive,
handle_user_command
FOR EVENT user_command OF cl_gui_alv_grid
IMPORTING e_ucomm.
PRIVATE SECTION.
ENDCLASS.
lcl_event_receiver (Definition)
*===============================================================
LOCAL CLASSES: Implementation
*===============================================================
class lcl_event_receiver (Implementation)
CLASS lcl_event_receiver IMPLEMENTATION.
METHOD handle_toolbar.
§ 2.In event handler method for event TOOLBAR: Append own functions
by using event parameter E_OBJECT.
DATA: ls_toolbar TYPE stb_button.
E_OBJECT of event TOOLBAR is of type REF TO CL_ALV_EVENT_TOOLBAR_SET.
This class has got one attribute, namly MT_TOOLBAR, which
is a table of type TTB_BUTTON. One line of this table is
defined by the Structure STB_BUTTON (see data deklaration above).
A remark to the flag E_INTERACTIVE:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'e_interactive' is set, if this event is raised due to
the call of 'set_toolbar_interactive' by the user.
You can distinguish this way if the event was raised
by yourself or by ALV
(e.g. in method 'refresh_table_display').
An application of this feature is still unknown...
append a separator to normal toolbar
CLEAR ls_toolbar.
MOVE 3 TO ls_toolbar-butn_type.
APPEND ls_toolbar TO e_object->mt_toolbar.
append an icon to show booking table
CLEAR ls_toolbar.
MOVE 'BOOKINGS' TO ls_toolbar-function.
MOVE icon_employee TO ls_toolbar-icon.
MOVE 'Show Bookings'(111) TO ls_toolbar-quickinfo.
MOVE 'Detail'(112) TO ls_toolbar-text.
MOVE ' ' TO ls_toolbar-disabled.
APPEND ls_toolbar TO e_object->mt_toolbar.
ENDMETHOD.
METHOD handle_user_command.
§ 3.In event handler method for event USER_COMMAND: Query your
function codes defined in step 2 and react accordingly.
DATA: lt_rows TYPE lvc_t_row.
CASE e_ucomm.
WHEN 'BOOKINGS'.
CALL METHOD grid1->get_selected_rows
IMPORTING et_index_rows = lt_rows.
CALL METHOD cl_gui_cfw=>flush.
IF sy-subrc ne 0.
add your handling, for example
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = g_repid
txt2 = sy-subrc
txt1 = 'Error in Flush'(500).
else.
perform show_booking_table tables lt_rows.
ENDIF.
ENDCASE.
ENDMETHOD. "handle_user_command
ENDCLASS.
lcl_event_receiver (Implementation)
*===================================================================
FORM EXIT_PROGRAM *
FORM exit_program.
The instance grid2 is freed not until the program exits from the
main screen.
(It is created only once during the first selection of SBOOK,
no matter how many times the second window is called).
CALL METHOD custom_container1->free.
IF not custom_container2 is initial.
CALL METHOD custom_container2->free.
ENDIF.
CALL METHOD cl_gui_cfw=>flush.
IF sy-subrc ne 0.
add your handling, for example
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = g_repid
txt2 = sy-subrc
txt1 = 'Error in Flush'(500).
ENDIF.
LEAVE PROGRAM.
ENDFORM.
*& Module PBO_100 OUTPUT
text
MODULE pbo_100 OUTPUT.
SET PF-STATUS 'MAIN100'.
SET TITLEBAR 'MAIN100'.
g_repid = sy-repid.
IF custom_container1 is initial.
select data from table SFLIGHT
PERFORM select_table_sflight CHANGING gt_sflight.
create a custom container control for our ALV Control
CREATE OBJECT custom_container1
EXPORTING
container_name = cont_on_main
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5.
IF sy-subrc ne 0.
add your handling, for example
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = g_repid
txt2 = sy-subrc
txt1 = 'The control could not be created'(510).
ENDIF.
create an instance of alv control
CREATE OBJECT grid1
EXPORTING i_parent = custom_container1.
Set a titlebar for the grid control
gs_layout-grid_title = 'Flights'(100).
allow to select multiple lines
gs_layout-sel_mode = 'A'.
CALL METHOD grid1->set_table_for_first_display
EXPORTING i_structure_name = 'SFLIGHT'
is_layout = gs_layout
CHANGING it_outtab = gt_sflight.
->Create Object to receive events and link them to handler methods.
When the ALV Control raises the event for the specified instance
the corresponding method is automatically called.
CREATE OBJECT event_receiver.
SET HANDLER event_receiver->handle_user_command FOR grid1.
SET HANDLER event_receiver->handle_toolbar FOR grid1.
§ 4.Call method 'set_toolbar_interactive' to raise event TOOLBAR.
CALL METHOD grid1->set_toolbar_interactive.
ENDIF. "IF grid1 IS INITIAL
CALL METHOD cl_gui_control=>set_focus EXPORTING control = grid1.
ENDMODULE. " PBO_100 OUTPUT
*& Module PAI_100 INPUT
text
MODULE pai_100 INPUT.
CASE ok_code.
WHEN 'EXIT'.
PERFORM exit_program.
ENDCASE.
CLEAR ok_code.
ENDMODULE. " PAI_100 INPUT
*& Module PBO_0101 OUTPUT
text
MODULE pbo_0101 OUTPUT.
IF custom_container2 is initial.
(the data from sbook is already selected)
create a custom container control for our ALV Control
CREATE OBJECT custom_container2
EXPORTING
container_name = cont_on_dialog
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5.
IF sy-subrc ne 0.
add your handling, for example
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = g_repid
txt2 = sy-subrc
txt1 = 'The control could not be created'(510).
ENDIF.
create an instance of alv control
CREATE OBJECT grid2
EXPORTING i_parent = custom_container2.
change title
gs_layout-grid_title = 'Bookings'(101).
gs_layout-sel_mode = ' '.
CALL METHOD grid2->set_table_for_first_display
EXPORTING i_structure_name = 'SBOOK'
is_layout = gs_layout
CHANGING it_outtab = gt_sbook.
ELSE.
CALL METHOD grid2->refresh_table_display.
ENDIF. "IF custom_container2 IS INITIAL.
CALL METHOD cl_gui_control=>set_focus EXPORTING control = grid2.
CALL METHOD cl_gui_cfw=>flush.
IF sy-subrc ne 0.
add your handling, for example
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = g_repid
txt2 = sy-subrc
txt1 = 'Error in Flush'(500).
ENDIF.
ENDMODULE. " PBO_0101 OUTPUT
*& Form SELECT_TABLE_SFLIGHT
text
<--P_GT_SFLIGHT text
FORM select_table_sflight CHANGING p_gt_sflight LIKE gt_sflight[].
SELECT * FROM sflight INTO TABLE p_gt_sflight up to g_max rows.
ENDFORM. " SELECT_TABLE_SFLIGHT
*& Form SELECT_TABLE_SBOOK
text
-->P_LS_SFLIGHT text
<--P_GT_SBOOK text
FORM select_table_sbook USING p_ls_sflight LIKE LINE OF gt_sflight
CHANGING p_gt_sbook LIKE gt_sbook[].
DATA: lt_sbook LIKE gt_sbook[].
Select data from sbook according to a line of sflight
and append that data to table p_gt_sbook
SELECT * FROM sbook INTO TABLE lt_sbook
WHERE carrid = p_ls_sflight-carrid
AND connid = p_ls_sflight-connid
AND fldate = p_ls_sflight-fldate.
APPEND LINES OF lt_sbook TO p_gt_sbook.
ENDFORM. " SELECT_TABLE_SBOOK
*& Module PAI_0101 INPUT
text
MODULE pai_0101 INPUT.
CASE ok_code.
WHEN 'RETURN'.
LEAVE TO SCREEN 0.
ENDCASE.
CLEAR ok_code.
ENDMODULE. " PAI_0101 INPUT
*& Form show_booking_table
text
-->P_ET_INDEX_ROWS text
FORM show_booking_table TABLES p_et_index_rows
STRUCTURE lvc_s_row.
DATA: ls_selected_line LIKE lvc_s_row,
lf_row_index TYPE lvc_index,
ls_sflight LIKE LINE OF gt_sflight.
CLEAR gt_sbook[].
LOOP AT p_et_index_rows INTO ls_selected_line.
lf_row_index = ls_selected_line-index.
read selected row from internal table gt_sflight
READ TABLE gt_sflight INDEX lf_row_index INTO ls_sflight.
select corresponding lines of table sbook
and append new lines to global table
PERFORM select_table_sbook USING ls_sflight
CHANGING gt_sbook.
ENDLOOP.
call dialog screen and display new alv control
CALL SCREEN 101 STARTING AT 10 5.
ENDFORM. " show_booking_table
Regards,
Naveen. -
How to add push buttons in out put screen of ALV
Hai,
How to add push buttons in out put screen of ALV (tool bar) with out using classes or methods .I want to know using normal ALV .
Thanks in advance .
kiranHi Kiran,
Here is the sample code.If you are using reuse_alv_grid_display, no need to write code in PBO.
Just double click the 'TEST' which is written in code.Then create a GUI Status.In Application toolbar,type the name of the button you want(say BUTTON).Then double click that name.Then enter the ICON name and function text.Activate it.This itself will work.If you want all the functionalities,then try to do as Vinod told.
TYPE-POOLS: slis.
DATA: i_qmel LIKE qmel OCCURS 0.
data v_repid type repid.
SELECT * FROM qmel INTO TABLE i_qmel.
v_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = v_repid
I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
i_structure_name = 'QMEL'
TABLES
t_outtab = i_qmel
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
form set_pf_status using rt_extab type slis_t_extab.
set pf-status '<b>TEST</b>'.
endform.
FORM user_command USING ucomm LIKE sy-ucomm
selfield TYPE slis_selfield.
data lv_ucomm type sy-ucomm.
lv_ucomm
= sy-ucomm.
CASE lv_ucomm.
WHEN 'BUTTON'. "Double Click line Item
call transaction 'MM01'.
endcase.
endform. -
"Add Note" button not working.
Hi All,
On the HOME screen of EBP click Approval link ---> Under Appoval tab under Action Column click the magnifying glass icon ---> after the items table thers a button "Add Note"
When I click the button , it disapperas and no text box comes for entering notes.
In the view source found the following code for this button
<p class="pushButton"><a h ref="java sc ript:return;" on cli ck="SetOkCodeButton('=UI_APPR_NOTE_ADD', 'BBPForm', '', '',''); return false;" name="Add Note" class="pushButton"
title="Add Note: You can add a note. Pushbutton"
on clic k="return clic kURLLink();" on mo useover="status=' ';return true;" on mou seout="status=' ';">&n b sp;Add Note < / a>< / p>
Also found the code...
<!--
This page was created by the
SAP Integrated ITS, WebAS: SRM, workprocess: 0
All rights reserved.
Creation time: Tue Mar 24 14:33:29 2009
Charset: utf-8
Template: BBPSC07/Z2/saplbbp_sc_ui_its_9999.html -->
Just a few lines before the code of button but the Template: BBPSC07/Z2/saplbbp_sc_ui_its_9999.html does nt contains any code..
How to find the template that contains the code for this button?
Thanks a lot,
AnubhavHi Daniel,
The line 119 ..
`TD(class="data")`<textarea style="font-family:arial;font-size:11px;" name="TEXT_LINE:66[]" cols="66" rows="6" wrap="physical" title="`#APPR_INFO`">`repeat with r in TEXT_LINE;write (r, "\r\n");end`</textarea>
was commented in the template code...i uncommented it , now its showing textedit but the Add Note button disapperas , so the user can not ADD the note ..
Any ideas on this?
Thanks a lot,
Anubhav
Maybe you are looking for
-
Creating a share in 10.5 and connecting with XP or Vista - My Experience
Here was my situation. Client has a machine now running 10.5 on it that is sharing an external drive on the network for other mac users in the office to use as well as 3 Windows machines. I tested with an xp machine as well as a vista machine. The pr
-
Multiple ZR2740w failures within one and half year
Hello, i would like to ask you if it is "normal" for me to have this series of issues with my ZR2740w's (by normal i mean if this is typical problem for this model; i know it is not normal to have that many RMA) : 1) first ZR2740w (let's call it A, b
-
Cannot open all photos in iphoto
Hi! I was wondering if anyone could help me. When I try to open the pictures in iphoto, nothing happens. The thumbnails are there, but if I try to edit them for example, the picture won't come up onto the screen. I tried going into pictures/library/p
-
Hello, I wrote a java program to connect with ms access, and wished to ask if there was a sql command to delete all records from a table? Thanks
-
Regarding Interaction Records Creation
Hi All, I am implementing the BADI CRM_IC_IARECORD and write the code in BEFORE_IR_CREATE. Here i am going to suppress the creation of interaction record if user has not pressed save button. Could you please anybody suggest me here how to get whethe