Event of add button
Which event is fired when we click on add ?
Dilip,
Are you tanking about the Add button (button with uid=1, situated in the bottom left corner of the form), or the Add button the changes the form to Add Mode?
If you are talking about the first, you must catch either the FORM_DATA_ADD event of the FormData type, or the CLICK event of the ItemEvent type.
If you are talking about the second, you must catch the MenuEvent, when pVal.BeforeAction = False and pVal.MenuUID = 1282.
Public Function MenuHandler(ByRef oCompany As SAPbobsCOM.Company, ByRef oApplication As SAPbouiCOM.Application, _
ByRef pVal As SAPbouiCOM.MenuEvent) As Boolean
MenuHandler = True
oForm = oApplication.Forms.ActiveForm
oForm.Freeze(True)
Try
If pVal.BeforeAction = True Then
Else '// If pVal.BeforeAction = False
Select Case pVal.MenuUID
Case "1282" '// Add Mode Button
If oForm.Mode = BoFormMode.fm_ADD_MODE Then
'// YOUR CODE HERE
End If
End Select
Regards,
Vítor Vieira
Similar Messages
-
HI All,
I am trying to update one UDT when PO creates. If i write code in before_action=True event of Add button, i can fetch values from matrix form and update my UDT. It works only if that transaction successfully completes. But when it fails ,my UDT contains wrong informaton. How will I fetch matrix values and update my UDT only on the basis of ActionSuccess =True? If I write code in Before_Action=fasle, i cant fetch matrix values. Please suggest me a solution?
Thanks in advance
DenisHi Denis,
You could use the SBO_SP_TransactionNotification instead of catching the event using the UI API. It is only raised when the creation process is successful. There you should locate the data and update your UDT (using SQL, DI Objects...)
Some documentation on SBO_SP_TransactionNotification:
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/34f5cd90-0201-0010-939b-abbfbe6a4dc3
Hope helps,
Ibai Peñ -
Catch event when user add an Invoice (push the Add button)
i have User Defined Table(@User_Table1)
so i like too whenever user click the Add Button, beside add an invoice..it write to the @User_Table1..
at the moment, i using Screen Painter to make the form not using the existing one like A/R Invoice for example
thanksI dont know about possibility how to continue the process of adding in case, that there will be some user input like msgbox, inputbox or something else. The only way how to do it (in my oppinion) is to at the end of the code set bubbleevent to true (maybe the msgbox sets it to false). You have 2 choices how to recevie invoice details:
- in case of beforeaction = true receive it from active form
- in case of beforaction = false receive number of invoice and through object get details of invoice
Petr -
Add data to the table in the database with the use of add button
The name of my database is Socrates.
The name of the table in the database is Employees
I want to be able to add data to the database. i am presently working on the add button such that when i enter date into the textfield and press the add button it should automatically register in the table.
The error upon compilation is with this line of code
If (ae.getSource() == jbtnA)// it says that ";" is expected
Below is the entire code
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Mainpage extends JFrame implements ActionListener
JTextField jFirstName = new JTextField(15);
JTextField jSurname = new JTextField(12);
JTextField jCity = new JTextField(10);
JTextField jCountry = new JTextField(12);
JTextField jSSN = new JTextField(8);
JLabel jFirstLab = new JLabel("First Name");
JLabel jSurnameLab = new JLabel("Surname");
JLabel jCityLab = new JLabel("City");
JLabel jCountryLab = new JLabel("Country");
JLabel jSSNLab = new JLabel("Social Security Number (SSN)");
JButton jbtnA = new JButton ("Add");
JButton jbtnPrv = new JButton ("Previous");
JButton jbtnNt = new JButton ("Next");
JButton jbtnDl= new JButton ("Delete");
JButton jbtnSrch = new JButton ("Search");
public Mainpage (String title)
super (title);
Container cont = getContentPane();
JPanel pane1 = new JPanel();
JPanel pane2 = new JPanel();
JPanel pane3 = new JPanel();
pane1.setLayout (new GridLayout (0,1));
pane2.setLayout (new GridLayout(0,1));
pane3.setLayout (new FlowLayout());
pane1.add(jFirstLab);
pane1.add(jSurnameLab);
pane1.add(jCityLab);
pane1.add(jCountryLab);
pane1.add(jSSNLab);
pane2.add(jFirstName);
pane2.add(jSurname);
pane2.add(jCity);
pane2.add(jCountry);
pane2.add(jSSN);
pane3.add(jbtnA);
pane3.add(jbtnPrv);
pane3.add(jbtnNt);
pane3.add(jbtnDl);
pane3.add(jbtnSrch);
cont.add(pane1, BorderLayout.CENTER);
cont.add(pane2, BorderLayout.LINE_END);
cont.add(pane3, BorderLayout.SOUTH);
jFirstName.addActionListener(this);
jSurname.addActionListener(this);
jCity.addActionListener(this);
jCountry.addActionListener(this);
jSSN.addActionListener(this);
jbtnA.addActionListener(this);
jbtnPrv.addActionListener(this);
jbtnNt.addActionListener(this);
jbtnDl.addActionListener(this);
jbtnSrch.addActionListener(this);
validate();
setVisible(true);
setDefaultCloseOperation(EXIT_ON_CLOSE);
pack();
setResizable(false);
public void actionPerformed(ActionEvent ae)
If (ae.getSource() == jbtnA)
fst = jFirstName.getText();
srn = jSurname.getText();
cty = jCity.getText();
cnty = jCountry.getText();
int sn =
Interger.parseInt(jSSN.getText());
String ad = "Insert into Employees
(Firstname,Surname,City,Country,SSN)" +
"values('"fst"','"srn"','"cty"','"cnty"','"sn"')";
Statement stmt = con.createStatment();
int rowcount = stmt.executeUpdate(ad);
JOptionPane.showMessageDialog("Your
details have been registered");
Statement stmt = con.createStatment();
int rowcount = stmt.executeUpdate(ad);
public static void main (String args[])
Mainpage ObjFr = new Mainpage("Please fill this
registration form");
try
Class.forname("sun.jdbc.odbc.JdbcOdbcDriver");
String plato = "jdbc:odbc:socrates";
Connection con =
DriverManager.getConnection(plato);
catch(SQLException ce)
System.out.println(ce);
}i have restructured the code, but the following line of code is giving error:
String plato = jdbc:odbc:socrates;
the entire code is below:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
public class Mainpage extends JFrame implements ActionListener
JTextField jFirstName = new JTextField(15);
JTextField jSurname = new JTextField(12);
JTextField jCity = new JTextField(10);
JTextField jCountry = new JTextField(12);
JTextField jSSN = new JTextField(8);
JLabel jFirstLab = new JLabel("First Name");
JLabel jSurnameLab = new JLabel("Surname");
JLabel jCityLab = new JLabel("City");
JLabel jCountryLab = new JLabel("Country");
JLabel jSSNLab = new JLabel("Social Security Number (SSN)");
JButton jbtnA = new JButton ("Add");
JButton jbtnPrv = new JButton ("Previous");
JButton jbtnNt = new JButton ("Next");
JButton jbtnDl= new JButton ("Delete");
JButton jbtnSrch = new JButton ("Search");
Statement stmt;
String ad;
public Mainpage (String title)
super (title);
Container cont = getContentPane();
JPanel pane1 = new JPanel();
JPanel pane2 = new JPanel();
JPanel pane3 = new JPanel();
pane1.setLayout (new GridLayout (0,1));
pane2.setLayout (new GridLayout(0,1));
pane3.setLayout (new FlowLayout());
pane1.add(jFirstLab);
pane1.add(jSurnameLab);
pane1.add(jCityLab);
pane1.add(jCountryLab);
pane1.add(jSSNLab);
pane2.add(jFirstName);
pane2.add(jSurname);
pane2.add(jCity);
pane2.add(jCountry);
pane2.add(jSSN);
pane3.add(jbtnA);
pane3.add(jbtnPrv);
pane3.add(jbtnNt);
pane3.add(jbtnDl);
pane3.add(jbtnSrch);
cont.add(pane1, BorderLayout.CENTER);
cont.add(pane2, BorderLayout.LINE_END);
cont.add(pane3, BorderLayout.SOUTH);
jFirstName.addActionListener(this);
jSurname.addActionListener(this);
jCity.addActionListener(this);
jCountry.addActionListener(this);
jSSN.addActionListener(this);
jbtnA.addActionListener(this);
jbtnPrv.addActionListener(this);
jbtnNt.addActionListener(this);
jbtnDl.addActionListener(this);
jbtnSrch.addActionListener(this);
validate();
setVisible(true);
setDefaultCloseOperation(EXIT_ON_CLOSE);
pack();
setResizable(false);
try
Class.forname(sun.jdbc.odbc.JdbcOdbcDriver);
String plato = jdbc:odbc:socrates;
Connection con = DriverManager.getConnection(plato);
stmt = con.createStatment();
catch(SQLException ce)
System.out.println(ce);
catch(ClassNotFoundException ce)
System.out.println(ce);
public void actionPerformed(ActionEvent ae)
try
if(ae.getSource().equals(jbtnA))
fst = jFirstName.getText();
srn = jSurname.getText();
cty = jCity.getText();
cnty = jCountry.getText();
int sn = Interger.parseInt(jSSN.getText());
ad = "Insert into Employees
values('"+fst+"',"+srn+"','"+cty+"','"+cnty+"','"+sn+"')";
stmt.executeUpdate(ad);
JOptionPane.showMessageDialog(this, "Your details have been
registered");
catch(SQLException ce)
System.out.println(ce);
public static void main(String args[])
Mainpage ObjFr = new Mainpage("Please fill this registration form");
} -
How to add button in ALV report (Class method )?
Hello experts,
I have developed one ALV report using classes.
I want to add one more button on the report like already is there named DISPLQUA
How ca i do that here?
Following the code of CLASS definition & implimentation
CLASS lcl_handle_events DEFINITION.
PUBLIC SECTION.
METHODS:
handle_on_user_command FOR EVENT added_function OF cl_salv_events
IMPORTING e_salv_function.
ENDCLASS. "lcl_handle_events DEFINITION
CLASS lcl_handle_events IMPLEMENTATION
CLASS lcl_handle_events IMPLEMENTATION.
METHOD handle_on_user_command.
CASE e_salv_function.
WHEN 'DISPLQUA'.
PERFORM show_quant_record.
WHEN 'DISPQM03'. " Here i want to add button
PERFORM display_quality_notification.
WHEN OTHERS.
ENDCASE.
ENDMETHOD. "handle_on_user_command
ENDCLASS. "lcl_handle_events IMPLEMENTATIONHI Ronny.
Code snippet for reference.
CLASS LCL_EVENT_HANDLER DEFINITION .
PUBLIC SECTION.
METHODS :
*--Toolbar control
HANDLE_TOOLBAR FOR EVENT TOOLBAR
OF CL_GUI_ALV_GRID IMPORTING E_OBJECT
E_INTERACTIVE,
ENDCLASS
CLASS LCL_EVENT_HANDLER IMPLEMENTATION.
*--handle toolbar
METHOD HANDLE_TOOLBAR.
* append a separator to normal toolbar
CLEAR G_TOOLBAR.
G_TOOLBAR-BUTN_TYPE = 3.
APPEND G_TOOLBAR TO E_OBJECT->MT_TOOLBAR.
CLEAR G_TOOLBAR.
G_TOOLBAR-FUNCTION = 'SAVE'.
G_TOOLBAR-ICON = ICON_SYSTEM_SAVE.
G_TOOLBAR-BUTN_TYPE = 0.
G_TOOLBAR-QUICKINFO = 'Save the Customer'(203).
APPEND G_TOOLBAR TO E_OBJECT->MT_TOOLBAR.
ENDMETHOD. "HANDLE_TOOLBAR
Hope this helps.
Gary.
<REMOVED BY MODERATOR>
Edited by: Alvaro Tejada Galindo on Apr 7, 2008 5:41 PM -
Add button to unused space in JTableHeader
I have modified my JTable so that I can have multiple rows of column headers. I did this by extending BasicTableHeaderUI. In my particular instance, the first column of the table will never have more than one row in the header (unlike other implementations of multi-row headers I have seen, my column headers don't automatically fill upwards to take up all usable space in the header). So, I have "unused" space in the header above the first column.
I would like to put some buttons there that are relevant to the table, but so far every effort to do so has failed.
In the SSCCE below I have created a very stripped down version of my TableHeaderUI. It doesn't contain any of the code to create multiple row headers, it just pushes down the standard column headers to create some space. I try adding a button to the rendererPane, but it doesn't show up. There is a commented out line that paints the button which does work in terms of showing the button, but that's probably not the right way to do this (and the button doesn't work anyway).
So, why isn't the button showing up? Am I doing this the right way (i.e. adding the button within the UI)? Thanks in advance for you help.
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Enumeration;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.plaf.basic.BasicTableHeaderUI;
import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableColumn;
import javax.swing.table.TableColumnModel;
public class HeaderButtonTable extends JPanel {
public HeaderButtonTable() {
String[] colNames = {"column 1", "column2", "column3"};
Object[][] data = {{"a","b","c"},{"d","e","f"}};
JTable table = new JTable(data, colNames);
table.setPreferredScrollableViewportSize(new Dimension(400,100));
table.setFillsViewportHeight(true);
table.getTableHeader().setUI(new ButtonHeaderUI());
JScrollPane scrollPane = new JScrollPane(table);
add(scrollPane);
public class ButtonHeaderUI extends BasicTableHeaderUI {
public void paint(Graphics g, JComponent c) {
Rectangle clip = g.getClipBounds();
Point left = clip.getLocation();
Point right = new Point( clip.x + clip.width - 1, clip.y );
TableColumnModel cm = header.getColumnModel();
int cMin = header.columnAtPoint(left);
int cMax = header.columnAtPoint(right);
if (cMin == -1) cMin = 0;
if (cMax == -1) cMax = cm.getColumnCount()-1;
TableColumn draggedColumn = header.getDraggedColumn();
int columnWidth;
Rectangle cellRect = header.getHeaderRect(cMin);
TableColumn aColumn;
for(int column = cMin; column <= cMax ; column++) {
aColumn = cm.getColumn(column);
columnWidth = aColumn.getWidth();
cellRect.width = columnWidth;
if (aColumn != draggedColumn) {
paintCell(g, cellRect, column);
cellRect.x += columnWidth;
JButton test = new JButton("test");
test.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
System.out.println("pressed");
test.setBounds(2, 2, 60, 15);
rendererPane.add(test); //why isn't this showing up?
//this line will display the button, but button doesn't work
// rendererPane.paintComponent(g, test, header, 2, 2, 60, 15);
private Component getHeaderRenderer(int columnIndex) {
TableColumn aColumn = header.getColumnModel().getColumn(columnIndex);
TableCellRenderer renderer = aColumn.getHeaderRenderer();
if (renderer == null) renderer = header.getDefaultRenderer();
return renderer.getTableCellRendererComponent(header.getTable(),
aColumn.getHeaderValue(), false, false, -1, columnIndex);
private void paintCell(Graphics g, Rectangle cellRect, int columnIndex) {
Component component = getHeaderRenderer(columnIndex);
rendererPane.paintComponent(g, component, header,
cellRect.x, cellRect.y + 30, cellRect.width,
cellRect.height - 30, true);
public Dimension getPreferredSize(JComponent c) {
long width = 0;
Enumeration enumeration = header.getColumnModel().getColumns();
while (enumeration.hasMoreElements()) {
TableColumn aColumn = (TableColumn)enumeration.nextElement();
width = width + aColumn.getPreferredWidth();
return new Dimension((int)width, 60);
public static void main(String[] args) {
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.add(new HeaderButtonTable());
frame.pack();
frame.setVisible(true);
}Yes, I've seen similar links/posts about how to activate buttons in the header of a table, but those do it by adding listeners to the renderer. My buttons would be directly in the CellRendererPane that is the container for the table header. I would have thought that by putting the button directly in the Cell RendererPane that it would have nothing to do with the rest of the table header. CellRendererPane extends Container. Is it not possible to put a JButton in a Container? JFrame extends indirectly from Container and you can add buttons to that.
Edited by: Bob.B on Oct 28, 2009 10:57 PM -
Dear Experts,
I have a requirement in SNC system.
Requirement: Add a new button on screen Due List for Purchasing Documents, if we click on the button it has to open a new screen where we should have a file browse filed, browse and upload buttons to upload ASN details from presentation server.
am using,
WebDynpro Component: /SCF/UIWD
WebDynpro Application: /scf/snc_s
I have used following details to add button and acheived to add button alone, but how can I assing action/event, where can I create the screen, where can I write code and how can I assign this to button action.
ApplicationID: ICH
ScreenID: DUELIST
ComponentID: DLRLTLR1
Please help me out, almost from 2 weeks am doing R and D on it.
Thanks in advance
PalluThanks for your inputs Sai, but here the screen design is not static as normal webdynpro, normally we add a button and in OnAction property we create new action and we write code for the corresponding method, but in my case (expecially in SNC) everything I need to do with configurations, the transaction for screeen configuraitons is /N/SCF/SCREENCFG, and the BADI which I used for adding button is /SCF/UIMDL_APPCUST, you can find these details only in SNC (Supply Network and Collaboration) system.
Please try with inputs again.
Thanks again in advance!
Pallu!! -
How to add button in reuse_alv not in gui status
hi guys,
my question how can i add button to reuse_alv not in gui_status or pf_status ? and also i have an internal table which contains a checkbox field when user select one or more check box and push button , new table will be sended to batch input program.how can i do add button part, the rest of it is done.?Hi,The following sample report ZUS_SDN_ALV_BUTTON_CLICK_LTXT shows a possible way how to handle the BUTTON_CLICK event in order to retrieve a longtext for a ALV entry. Please note that for the sake of simplicity I have choosen an obsolete function module for text editing (only enter numerical values otherwise the function module crashes).
*& Report ZUS_SDN_ALV_BUTTON_CLICK_LTXT
*& Screen '0100' contains no elements.
*& ok_code -> assigned to GD_OKCODE
*& Flow logic:
* PROCESS BEFORE OUTPUT.
* MODULE STATUS_0100.
* PROCESS AFTER INPUT.
* MODULE USER_COMMAND_0100.
*& PURPOSE: Demonstrate event BUTTON_CLICK for entering long text
REPORT zus_sdn_alv_button_click_ltxt.
TYPE-POOLS: icon.
TYPES: BEGIN OF ty_s_outtab.
INCLUDE TYPE knb1.
TYPES: button TYPE iconname.
TYPES: line TYPE bapi_line.
TYPES: END OF ty_s_outtab.
TYPES: ty_t_outtab TYPE STANDARD TABLE OF ty_s_outtab
WITH DEFAULT KEY.
DATA:
gd_okcode TYPE ui_func,
gd_repid TYPE syst-repid,
go_docking TYPE REF TO cl_gui_docking_container,
go_grid TYPE REF TO cl_gui_alv_grid,
gt_fcat TYPE lvc_t_fcat,
gt_variant TYPE disvariant,
gs_layout TYPE lvc_s_layo.
DATA:
gs_outtab TYPE ty_s_outtab,
gt_outtab TYPE ty_t_outtab.
* CLASS lcl_eventhandler DEFINITION
CLASS lcl_eventhandler DEFINITION.
PUBLIC SECTION.
CLASS-METHODS:
handle_button_click FOR EVENT button_click OF cl_gui_alv_grid
IMPORTING
es_col_id
es_row_no
sender.
ENDCLASS. "lcl_eventhandler DEFINITION
* CLASS lcl_eventhandler IMPLEMENTATION
CLASS lcl_eventhandler IMPLEMENTATION.
METHOD handle_button_click.
* define local data
DATA:
ld_answer(1) TYPE c,
ls_outtab TYPE ty_s_outtab.
CHECK ( sender = go_grid ).
READ TABLE gt_outtab INTO ls_outtab INDEX es_row_no-row_id.
" Note: This function module is obsolete and crashes if
" non-numerical values are entered. Choose a more
" appropriate way of entering the longtext.
CALL FUNCTION 'POPUP_TO_GET_VALUE'
EXPORTING
fieldname = 'LINE'
tabname = 'BAPITGB'
titel = 'Enter Longtext'
valuein = ls_outtab-line
IMPORTING
answer = ld_answer
valueout = ls_outtab-line
EXCEPTIONS
fieldname_not_found = 1
OTHERS = 2.
IF sy-subrc 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
IF ( ld_answer NE 'C' ). " 'C' = cancel
MODIFY gt_outtab FROM ls_outtab INDEX es_row_no-row_id
TRANSPORTING line.
ENDIF.
* Triggers PAI of the dynpro with the specified ok-code
CALL METHOD cl_gui_cfw=>set_new_ok_code( 'REFRESH' ).
ENDMETHOD. "handle_button_click
ENDCLASS. "lcl_eventhandler IMPLEMENTATION
START-OF-SELECTION.
SELECT * FROM knb1
INTO CORRESPONDING FIELDS OF TABLE gt_outtab
WHERE bukrs = '1000'.
CLEAR: gs_outtab.
gs_outtab-button = icon_change_text.
MODIFY gt_outtab FROM gs_outtab
TRANSPORTING button LINE
where ( bukrs NE space ). " modify all lines
PERFORM build_fieldcatalog.
* Create docking container
CREATE OBJECT go_docking
EXPORTING
parent = cl_gui_container=>screen0
ratio = 90
EXCEPTIONS
OTHERS = 6.
IF sy-subrc 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Create ALV grids
CREATE OBJECT go_grid
EXPORTING
i_parent = go_docking
EXCEPTIONS
OTHERS = 5.
IF sy-subrc 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Set event handler
SET HANDLER: lcl_eventhandler=>handle_button_click FOR go_grid.
* Display data
gs_layout-grid_title = 'Customers'.
CALL METHOD go_grid->set_table_for_first_display
EXPORTING
is_layout = gs_layout
CHANGING
it_outtab = gt_outtab
it_fieldcatalog = gt_fcat
EXCEPTIONS
OTHERS = 4.
IF sy-subrc 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Link the docking container to the target dynpro
gd_repid = syst-repid.
CALL METHOD go_docking->link
EXPORTING
repid = gd_repid
dynnr = '0100'
* CONTAINER =
EXCEPTIONS
OTHERS = 4.
IF sy-subrc 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* NOTE: dynpro does not contain any elements
CALL SCREEN '0100'.
* Flow logic of dynpro (does not contain any dynpro elements):
*PROCESS BEFORE OUTPUT.
* MODULE STATUS_0100.
*PROCESS AFTER INPUT.
* MODULE USER_COMMAND_0100.
END-OF-SELECTION.
*& Module STATUS_0100 OUTPUT
* text
MODULE status_0100 OUTPUT.
SET PF-STATUS 'STATUS_0100'. " contains push button "DETAIL"
* SET TITLEBAR 'xxx'.
CALL METHOD go_grid->refresh_table_display
* EXPORTING
* IS_STABLE =
* I_SOFT_REFRESH =
* EXCEPTIONS
* FINISHED = 1
* others = 2
IF sy-subrc 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
* text
MODULE user_command_0100 INPUT.
CASE gd_okcode.
WHEN 'BACK' OR
'END' OR
'CANC'.
SET SCREEN 0. LEAVE SCREEN.
* Refresh -> pass PAI and PBO where flushing occurs
WHEN 'REFRESH'.
WHEN OTHERS.
ENDCASE.
CLEAR: gd_okcode.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form BUILD_FIELDCATALOG
* text
* --> p1 text
* <-- p2 text
FORM build_fieldcatalog .
* define local data
DATA:
ls_fcat TYPE lvc_s_fcat,
lt_fcat TYPE lvc_t_fcat.
REFRESH: gt_fcat.
CLEAR: lt_fcat.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'KNB1'
CHANGING
ct_fieldcat = lt_fcat
EXCEPTIONS
OTHERS = 99.
IF sy-subrc 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
APPEND LINES OF lt_fcat TO gt_fcat.
CLEAR: lt_fcat.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'BAPITGB'
CHANGING
ct_fieldcat = lt_fcat
EXCEPTIONS
OTHERS = 99.
IF sy-subrc 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
READ TABLE lt_fcat INTO ls_fcat
WITH KEY fieldname = 'LINE'.
IF ( syst-subrc = 0 ).
INSERT ls_fcat INTO gt_fcat INDEX 4.
ENDIF.
CLEAR: lt_fcat.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'ICON'
CHANGING
ct_fieldcat = lt_fcat
EXCEPTIONS
OTHERS = 99.
IF sy-subrc 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
READ TABLE lt_fcat INTO ls_fcat
WITH KEY fieldname = 'NAME'.
IF ( syst-subrc = 0 ).
ls_fcat-fieldname = 'BUTTON'.
ls_fcat-style = cl_gui_alv_grid=>mc_style_button.
INSERT ls_fcat INTO gt_fcat INDEX 4.
ENDIF.
LOOP AT gt_fcat INTO ls_fcat.
ls_fcat-col_pos = syst-tabix.
MODIFY gt_fcat FROM ls_fcat INDEX syst-tabix.
ENDLOOP.
ENDFORM. " BUILD_FIELDCATALOG[/code]
Reward If Found Useful. -
Document Add button - change a UDF so B1 writes value to tables
When the user presses the add button on a document, like an invoice, I want to loop through the items matrix and update a UDF on each row, so that Business one will write my values in the UDFs to the line item table (INV1), but I can't figure out how.
2 problems: The first is all the message boxes that B1 sometimes displays (like document total is zero, or error messages like 'no tax code entered'. I need to do my work AFTER these all occur, but just BEFORE the document is created. WHEN do I do this?
The other problem is that it seems like when I've tried something like this before, My changes to anything on the screen cause B1 to re-fire the events and then cancel the Add.
I don't want users to change these fields after I've loaded them, and I'd rather not retrieve the document after it's added and then change the values. I've found similar problems in the forum but none of them speaks exactly to this
Any ideas?
Thanks/Gracias/Dankeschoen/Merci/Danyavad/Toa chieHi John,
Hope you're doing well.
I suggest the formdataevent.
There is a example in the sdk.
This is what I use:
Public Sub FormDataEvent(ByRef BusinessObjectInfo As SAPbouiCOM.BusinessObjectInfo, ByRef BubbleEvent As Boolean) Handles UIAPP.FormDataEvent
'Occurs when the application performs the following actions on forms connected to business objects:
' Add()
' Update()
' Delete()
'Load form data via browse, link button, or find
'The event provides the unique ID (BusinessObjectInfo.ObjectKey) of the modified business object.
'You can use the value of this property as an input parameter in the DI API DataBrowser.GetByKeys method to get a DI object.
Dim form As SAPbouiCOM.Form = UIAPP.Forms.Item(BusinessObjectInfo.FormUID)
Dim bisObj As SAPbouiCOM.BusinessObject = form.BusinessObject
Dim uid As String = bisObj.Key
FormDataEventCommon.FormDataEventLogic(BusinessObjectInfo, BubbleEvent, bisObj, form)
System.Runtime.InteropServices.Marshal.ReleaseComObject(form)
System.Runtime.InteropServices.Marshal.ReleaseComObject(bisObj)
form = Nothing
bisObj = Nothing
GC.Collect()
End Sub
calls this function.
Public Function FormDataEventLogic(ByRef BusinessObjectInfo As SAPbouiCOM.BusinessObjectInfo, ByRef BubbleEvent As Boolean, ByRef bisobj As SAPbouiCOM.BusinessObject, ByRef form As SAPbouiCOM.Form) As Boolean
Dim Test As Integer = form.Mode
Dim mat As String = ""
Dim Fld As String = ""
Dim rep As String = ""
Dim ColFlag As Boolean = False
If BusinessObjectInfo.BeforeAction Then
Select Case BusinessObjectInfo.EventType
Case SAPbouiCOM.BoEventTypes.et_FORM_DATA_ADD
Select Case BusinessObjectInfo.Type
Case "COMMISSION OBJ UDO"
Dim CommTblClass As New CommAdj_Class(form.UniqueID)
Dim StrLN As String = CommTblClass.GetFieldValue(form.UniqueID, "EMONLN")
If StrLN = "" Then
CommTblClass.Displayerror("Please enter a load number")
BubbleEvent = False
End If
CommTblClass.release()
End Select
End Select
Else
Select Case BusinessObjectInfo.EventType
Case SAPbouiCOM.BoEventTypes.et_FORM_DATA_ADD
' Addnew information for a new document
Select Case BusinessObjectInfo.Type
Case SAPbobsCOM.BoObjectTypes.oDeliveryNotes
Case SAPbobsCOM.BoObjectTypes.oPurchaseDeliveryNotes
Case SAPbobsCOM.BoObjectTypes.oOrders
Case SAPbobsCOM.BoObjectTypes.oInvoices
Case SAPbobsCOM.BoObjectTypes.oCreditNotes
Case SAPbobsCOM.BoObjectTypes.oReturns
Case SAPbobsCOM.BoObjectTypes.oQuotations
Case SAPbobsCOM.BoObjectTypes.oPurchaseInvoices
Case SAPbobsCOM.BoObjectTypes.oInventoryGenEntry
Case "COMMISSION OBJ UDO"
End Select
Case SAPbouiCOM.BoEventTypes.et_FORM_DATA_UPDATE
' Update exisitng Document
Select Case BusinessObjectInfo.Type
Case SAPbobsCOM.BoObjectTypes.oDeliveryNotes
Case SAPbobsCOM.BoObjectTypes.oPurchaseDeliveryNotes
Case SAPbobsCOM.BoObjectTypes.oInvoices
Case SAPbobsCOM.BoObjectTypes.oCreditNotes
Case SAPbobsCOM.BoObjectTypes.oReturns
Case SAPbobsCOM.BoObjectTypes.oOrders
Case SAPbobsCOM.BoObjectTypes.oQuotations
Case SAPbobsCOM.BoObjectTypes.oInventoryGenEntry
Case "COMMISSION OBJ UDO"
End Select
Case BoEventTypes.et_FORM_DATA_LOAD
Select Case BusinessObjectInfo.Type
Case SAPbobsCOM.BoObjectTypes.oDeliveryNotes
Case SAPbobsCOM.BoObjectTypes.oPurchaseDeliveryNotes
Case SAPbobsCOM.BoObjectTypes.oInvoices
Case SAPbobsCOM.BoObjectTypes.oCreditNotes
Case SAPbobsCOM.BoObjectTypes.oReturns
Case SAPbobsCOM.BoObjectTypes.oOrders
Case SAPbobsCOM.BoObjectTypes.oQuotations
End Select
End Select
End If
Return True
End Function -
Qurery on Add Button of Sales A/R Invoice form
Hello sir
I want to do the Update query on add button of Sales A/R From, to update the satus of my user form
plz suggestIf pVal.ItemUID = "1" And pVal.EventType = SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED And pVal.FormMode = SAPbouiCOM.BoFormMode.fm_ADD_MODE And pVal.BeforeAction = False Then
Dim oForm As SAPbouiCOM.Form
oForm = SBO_Application.Forms.Item(FormUID)
If oForm.Mode = SAPbouiCOM.BoFormMode.fm_ADD_MODE Then
If pVal.ActionSuccess = True Then
Try
' setVisibilityForControlPQ()
SetInitialDataPQ()
Catch ex As Exception
ShowErrMsg("Event Error et_ITEM_PRESSED: " & ex.Message)
Finally
End Try
End If ' action close
End If 'mode close
End If 'else if -
Contextual Event for a Button in Dialogue (inline popup)
I have dialogue(in-line popup window) which opens on click of button "viewPopUp" in parent window.
I have a table and "select" button inside dialogue. I have contextual event created for this button inside child wondow.
It never works for me. Its not calling the event handler method. But, If I add a contextual event for the button "viewPopUp" on the parent page works fine.
Anybody faced similar issue?
Any idea or tips to get it work?
Edited by: sideeque on Sep 17, 2011 11:08 PM
Edited by: sideeque on Sep 17, 2011 11:09 PMI use JDeveloper 11.1.1.5. I might be doing something wrong here. Do you have the sample code to share and test in JDeveloper 11.1.1.5? Is it running for you in JDeveloper 11.1.1.5 version?
-
Adobe reader closes automatically while table entry is added by add button
Hi Team,
I am new in adobe form. I have developed an adobe interactive form using livecycle designer integrated with SAP. My form has a table and under that there is an add button. When the form is opened in adobe reader and add button is clicked, I have written a javascript code which appends a new entry in the table above. Everything is fine upto here.
Now when I keep on clicking the add button, new entries are created and table grows. But when the table populates the current page and grows to populate the next page, suddenly the adobe form closes. I think there is an inconsistancy happening as my configuration for the table or the subform wrapping the table and the add button is conflicting.
Could you guys give me some advise on this. I can provide screenshots or the adobe document on request.
Thanks,
MainakHi,
I would say you are definitely coming up against memory restrictions. There are a couple of posts by John Brinkman that I would recommend.
First I would look at why the form is 6Mb and see if you can reduce this down. For example, select fonts that are already in Reader (like Myriad Pro) and then deselect Embed Fonts in the File > Form Properties > Save Options. Also do not embed images into the form. See:
http://blogs.adobe.com/formfeed/2010/02/big_and_complex_forms.html.
http://blogs.adobe.com/formfeed/2010/09/xdp-size-matters.html.
http://blogs.adobe.com/formfeed/2009/11/linked_vs_embedded_template_im.html.
Next look at your script. You mention loops, so check is your script efficient. For example, use xfa.resolveNodes() once outside of the loop, instead of xfa.resolveNode() inside the loop. Make sure that variables are declared. See:
http://blogs.adobe.com/formfeed/2011/10/script-performance-exercise.html.
http://assure.ly/kUP02y.
Also check for any script that you have in events that fire frequently, like layout:ready event and comment these out. See.
http://assure.ly/nB0Bvz.
The dataset seems very large at 2Mb. Does this include image data? It may be that the user is interacting with the form, while it is still trying to process the XML and the loops.
Hope that helps,
Niall -
Hello,
I have created a subform that I would like to be hidden and when the add button is clicked the form will appear, then the user can click the add button as many times for the subform to appear as many times as necessary.
currently the add button works if i have the subform visible. however, as soon as i changed the subform to 'hidden' the add button does not work.
i tried adding code in the click event to make the subform visible when the button is clicked, however this is not working.
does anyone know another way around this?
thanks in advance,
NikThanks Niall,
I have tried to remove the minimum however i cannot find anything that says addInstance.
I am using the generic Add button from the object library. this is the code that is under the click event:
/* This button will Add one instance of the repeating subform or table row.
sSubformSOM: SOM expression of the repeating subform or table row.
bCalc: Flag - true if the new instance might be referenced by other calculations, otherwise false.
message: The error message displayed.
These variables must be assigned for this script to run correctly.
Replace <value> with the correct value.
var sSubformSOM = " form1.subfrmChildren1"; // Example: var sSubformSOM = "xfa.form.form1.Subform1";
var bCalc = true; // Example: var bCalc = false;
var message = "You have reached the maximum number of items allowed.";
// DO NOT MODIFY THE CODE BEYOND THIS POINT - 8.2.1.3158.1.475346.466429 - Subform_Instance_Controls_Add.xfo
// Build the SOM expression of the Instance Manager using the 'underscore' syntax.
var oSubform = xfa.resolveNode(sSubformSOM); // Evaluate the SOM expression.
var sParentSOM = oSubform.parent.somExpression; // Get the parent SOM expression.
var sManagerSOM = sParentSOM + "._" + oSubform.name; // Build the SOM expression of the Instance Manager.
var oManager = xfa.resolveNode(sManagerSOM); // Evaluate the SOM expression.
var nMaxCount = oManager.occur.max; // Get the maximum number of subform occurrences allowed.
var nSubCount = oManager.count; // Get the current number of instances.
// Proceed if the maximum number of subform occurrences has not been reached.
if ((nMaxCount == "-1") || (nSubCount < nMaxCount)) {
// Invoke the Instance Manager.
var oNewInstance = oManager.addInstance(1);
// Fire the form calculations.
if (bCalc == true) {
// Execute all the form calculations.
xfa.form.recalculate(1);
} else {
xfa.host.messageBox(message,"Add Item", 3);
// END OF DO NOT MODIFY -
How to add button to Table View and initiate action?
hello,
i'm new to Javafx 2, i recently followed the tutorial on tableview and would like to add a deletion action on particular row. What i had in mind was to add a delete button on the last column of each row, when clicked it will fire a handler and remove that row from the data observablelist. how do i do that?
please advice,
wesleyHi,
Please find the below code. I am creating a table view with two columns. The second column consists of delete button.
TableVeiw table = new TableView();
/*First column*/
final TableColumn<String> titleCol = new TableColumn<String>("Title");
titleCol.setProperty("title");
/*Second column*/
TableColumn<String> actionCol = new TableColumn<String>("Action");
actionCol.setCellFactory(new Callback<TableColumn<String>, TableCell<String>>() {
@Override
public TableCell<String> call(TableColumn<String> param) {
final TableCell<String> cell = new TableCell<String>() {
@Override
public void updateItem(String value, boolean empty) {
super.updateItem(value, empty);
final VBox vbox = new VBox(5);
Image image = new Image(getClass().getResourceAsStream("/images/delete.png"));
Button button = new Button("", new ImageView(image));
button.getStyleClass().add("deleteButton");
final TableCell<String> c = this;
button.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
TableRow tableRow = c.getTableRow();
Item item= (Item) tableRow.getTableView().getItems().get(tableRow.getIndex());
/* TODO : Delete this item from your data list and refresh the table */
vbox.getChildren().add(button);
setGraphic(vbox);
cell.setAlignment(Pos.TOP_RIGHT);
return cell;
grid.addColumns(titleCol,actionCol);I hope this can help you. :)
Edited by: Sai Pradeep Dandem on Aug 18, 2011 10:04 PM -
Can I stop the event to add an entry??
Can I stop the event to add an entry if this entry does not comply with a condition that I make?
I can catch th event to add an entry, but i want to stop it and i dont know how to do it?
anyone can help me ??
Thanks.Hi,
Try the following...
1) In the Add button click in the before action TRUE part u check the condition and validate.
If ur condition is False..
then Exit sub
Else
MsgBox("Fill the required info corectly")
BubbleEvent = False
I wrote this code:
If pVal.FormType = 134 And pVal.ItemUID = "1" And pVal.EventType = SAPbouiCOM.BoEventTypes.et_CLICK And pVal.BeforeAction = True Then
Dim o As Boolean = False
If o = False Then
Exit Sub
Else
End If
End If
where FormType = 134 is BusinessPartner. When add record I capture this event but added the IC to BBDD, otherwise would have to stop using the event et_FORM_DATA_ADD??
thanks.
Maybe you are looking for
-
Delete records from tableA which are not in tableB
Table A contains milions of records which is the best way to delete records from tableA which are not in tableB delete from tableA where empno not in (select empno from tableb) or delete from tableA where empno not exists (select empno from tableb wh
-
How to understand Permission level SoD analysis reports?
Hi , We would like to confirm whether our understanding is correct in analysing the SoD analysis reports at Permission Level Below is an example on how functions are configured at permission level Under Function 0C0004 we have t-code as below VA01 -
-
Standard Table entries missing in E-RECRUIT System
Hi, We are in the phase of E-Rec implementation. We have installed standalone E-recruit system (NW 7.4) We did client copy with SAP_CUST profile from 000 to 300, but some of the table were not reflected which we copied again. We run the report RHTTCP
-
We currently have our Oracle BPM Dev/UAT Engine and Directory databases on a sort of "sandbox" server and we are looking to move this to a DBA managed server with an export from our Production instance. I see that I need to point to the new Directory
-
Rich client installation package
Hi, Is it possible to create a dedicated rich client installation package. the target users of this application rarely need all the other tools in the enterprise client package. And this package is quite big and hard to distribute. Best regards Thoma