Passing a field in a button to the actionPerformed()

I have a series of buttons in a JApplet.
For an example I define a button in init() by:
ButtonArray[ i ] = new MyButton( "Clear", CLEAR, 0 );
ButttonArray[ i ].addActionListener( this );
Then in the actionPerformed() there is an if statement, which, depending on
the type of button, calls one of two methods. The methods require a specific field value ( one needs the 2nd field value,
the other needs the 3rd field value ).
Such as ( the astericks is where the problem is ):
if ( evt.getActionCommand().equals( "NO_OP" ) ){
evaluate( ** needs 3rd value ** );
} else {
doCalc( ** needs 2nd value ** );
I've been stumped for hours on this so any help is greatly appreciated.
Thanks

Here it is. I posted all of it. I know there are easier ways to do create
this type of app, but I need to know for future GUI projects.
custom button class first then the applet code.
public class HandyButton extends javax.swing.JButton {
/** for function button */
private int operation;
/** for number button */
private int value;
/** Creates HandyButton */
public HandyButton( String buttonText,int nOp,int nValue ) {
super( buttonText );
operation = nOp;
value = nValue;
public int getOp() { return operation; }
public int getValue() { return value; }
Here is the applet code:
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import javax.swing.event.*;
//** Be sure to have HandyButton.java AND HandyFrame.java before compiling. */
public class HandyCalc extends javax.swing.JApplet implements ActionListener {
/** Button operation constants */
public final int NO_OP = 0;
public final int ADD = 1;
public final int SUBTRACT = 2;
public final int MULTIPLY = 3;
public final int DIVIDE = 4;
public final int POSNEG = 5;
public final int SQRT = 6;
public final int EQUALS = 7;
public final int CLEAR = 8;
public final int SIN = 9;
public final int COS = 10;
public final int TAN = 11;
public final int DECIMAL = -1;
/** GUI component declaration */
/** Text field object */
private javax.swing.JTextField output;
/** Panel for number keypad */
private javax.swing.JPanel pnlNumbers;
/** Buttons for number keypad */
private HandyButton btnNumbers[];
/** Operation buttons */
private HandyButton btnFunctions[ ];
private HandyButton btnArrayHButtons[ ];
private int buttonCount;
/** Panel for operation buttons */
private javax.swing.JPanel pnlFunctions;
/** Display string */
String sDisplay;
/** Operation to do */
int nOp = NO_OP;
/** Number is a new number */
boolean bNewNum = true;
/** Number is a decimal */
boolean bIsDecimal = false;
public void init() {
/** Set HandyButton arrays */
btnFunctions = new HandyButton[ 9 ];
btnNumbers = new HandyButton[ 12 ];
//buttonCount = 21
btnArrayHButtons = new HandyButton[ buttonCount ];
//getContentPane().setName("pnlGod");
/** Create Text field */
JTextField output = new JTextField();
output.setAlignmentY(50.0F);
output.setAlignmentX(20.0F);
output.setPreferredSize(new java.awt.Dimension(60, 30));
output.setMaximumSize(new java.awt.Dimension(60, 30));
output.setMargin(new java.awt.Insets(2, 2, 2, 2));
output.setMinimumSize(new java.awt.Dimension(50, 30));
output.setBorder(new javax.swing.border.MatteBorder( 1, 3, 3, 1, new java.awt.Color ( 51, 0, 102 ) ) );
output.setFont(new Font("Helvetica", Font.BOLD, 18));
output.setText("0");
//output.setBackground(new java.awt.Color ( 204, 255, 255 ));
output.setHorizontalAlignment( javax.swing.SwingConstants.RIGHT );
/** Add text field to frame */
getContentPane().add( output, java.awt.BorderLayout.NORTH );
/** Create function panel */
JPanel pnlFunctions = new JPanel();
pnlFunctions.setLayout( new java.awt.GridLayout( 5, 2, 2, 2 ) );
/** Create function buttons */
//HandyButton btnAdd = new HandyButton( "+", ADD, 0 );
btnFunctions[ 0 ] = new HandyButton( "+", ADD, 0 );
btnFunctions[ 0 ].setActionCommand( "ADD" );
pnlFunctions.add( btnFunctions[ 0 ] );
//HandyButton btnSin = new HandyButton( "Sin", SIN, 0 );
btnFunctions[ 1 ] = new HandyButton( "Sin", SIN, 0 );
btnFunctions[ 1 ].setActionCommand( "SIN" );
pnlFunctions.add( btnFunctions[ 1 ] );
//HandyButton btnSubt = new HandyButton( "-", SUBTRACT, 0 );
btnFunctions[ 2 ] = new HandyButton( "-", SUBTRACT, 0 );
btnFunctions[ 2 ].setActionCommand( "SUBTRACT" );
pnlFunctions.add( btnFunctions[ 2 ] );
//HandyButton btnCos = new HandyButton( "Cos", COS, 0 );
btnFunctions[ 3 ] = new HandyButton( "Cos", COS, 0 );
btnFunctions[ 3 ].setActionCommand( "COS" );
pnlFunctions.add( btnFunctions[ 3 ] );
//HandyButton btnMult = new HandyButton( "*", MULTIPLY, 0 );
btnFunctions[ 4 ] = new HandyButton( "*", MULTIPLY, 0 );
btnFunctions[ 4 ].setActionCommand( "MULTIPLY" );
pnlFunctions.add( btnFunctions[ 4 ] );
//HandyButton btnTan = new HandyButton( "Tan", TAN, 0 );
btnFunctions[ 5 ] = new HandyButton( "Tan", TAN, 0 );
btnFunctions[ 5 ].setActionCommand( "TAN" );
pnlFunctions.add( btnFunctions[ 5 ] );
//HandyButton btnDiv = new HandyButton( "�", DIVIDE, 0 );
btnFunctions[ 6 ] = new HandyButton( "�", DIVIDE, 0 );
btnFunctions[ 6 ].setActionCommand( "DIVIDE" );
pnlFunctions.add( btnFunctions[ 6 ] );
//HandyButton btnClear = new HandyButton( "Clear", CLEAR, 0 );
btnFunctions[ 7 ] = new HandyButton( "Clear", CLEAR, 0 );
btnFunctions[ 7 ].setActionCommand( "CLEAR" );
pnlFunctions.add( btnFunctions[ 7 ] );
//HandyButton btnEquals = new HandyButton( "=", EQUALS, 0 );
btnFunctions[ 8 ] = new HandyButton( "=", EQUALS, 0 );
btnFunctions[ 8 ].setActionCommand( "EQUALS" );
pnlFunctions.add( btnFunctions[ 8 ] );
for ( int i = 0; i < btnFunctions.length; i++ ) {           
btnFunctions[ i ].addActionListener( this );
/** Add functions panel to frame */
getContentPane().add( pnlFunctions, java.awt.BorderLayout.EAST );
/** Create number panel */
JPanel pnlNumbers = new JPanel();
pnlNumbers.setLayout( new java.awt.GridLayout( 4, 3, 2, 2 ) );
/** Create number buttons */
//HandyButton btnNum1 = new HandyButton( "1", NO_OP, 1 );
btnNumbers[ 0 ] = new HandyButton( "1", NO_OP, 1 );
btnNumbers[ 0 ].setActionCommand( "NO_OP" );
pnlNumbers.add( btnNumbers[ 0 ] );
//HandyButton btnNum2 = new HandyButton( "2", NO_OP, 2 );
btnNumbers[ 1 ] = new HandyButton( "2", NO_OP, 2 );
btnNumbers[ 1 ].setActionCommand( "NO_OP" );
pnlNumbers.add( btnNumbers[ 1 ] );
//HandyButton btnNum3 = new HandyButton( "3", NO_OP, 3 );
btnNumbers[ 2 ] = new HandyButton( "3", NO_OP, 3 );
btnNumbers[ 2 ].setActionCommand( "NO_OP" );
pnlNumbers.add( btnNumbers[ 2 ] );
//HandyButton btnNum4 = new HandyButton( "4", NO_OP, 4 );
btnNumbers[ 3 ] = new HandyButton( "4", NO_OP, 4 );
btnNumbers[ 3 ].setActionCommand( "NO_OP" );
pnlNumbers.add( btnNumbers[ 3 ] );
//HandyButton btnNum5 = new HandyButton( "5", NO_OP, 5 );
btnNumbers[ 4 ] = new HandyButton( "5", NO_OP, 5 );
btnNumbers[ 4 ].setActionCommand( "NO_OP" );
pnlNumbers.add( btnNumbers[ 4 ] );
//HandyButton btnNum6 = new HandyButton( "6", NO_OP, 6 );
btnNumbers[ 5 ] = new HandyButton( "6", NO_OP, 6 );
btnNumbers[ 5 ].setActionCommand( "NO_OP" );
pnlNumbers.add( btnNumbers[ 5 ] );
//HandyButton btnNum7 = new HandyButton( "7", NO_OP, 7 );
btnNumbers[ 6 ] = new HandyButton( "7", NO_OP, 7 );
btnNumbers[ 6 ].setActionCommand( "NO_OP" );
pnlNumbers.add( btnNumbers[ 6 ] );
//HandyButton btnNum8 = new HandyButton( "8", NO_OP, 8 );
btnNumbers[ 7 ] = new HandyButton( "8", NO_OP, 8 );
btnNumbers[ 7 ].setActionCommand( "NO_OP" );
pnlNumbers.add( btnNumbers[ 7 ] );
//HandyButton btnNum9 = new HandyButton( "9", NO_OP, 9 );
btnNumbers[ 8 ] = new HandyButton( "9", NO_OP, 9 );
btnNumbers[ 8 ].setActionCommand( "NO_OP" );
pnlNumbers.add( btnNumbers[ 8 ] );
//HandyButton btnPosNeg = new HandyButton( "+/-", NO_OP, 0 );
btnNumbers[ 9 ] = new HandyButton( "+/-", NO_OP, 0 );
btnNumbers[ 9 ].setActionCommand( "NO_OP" );
pnlNumbers.add( btnNumbers[ 9 ] );
//HandyButton btnNum0 = new HandyButton( "0", NO_OP, 0 );
btnNumbers[ 10 ] = new HandyButton( "0", NO_OP, 0 );
btnNumbers[ 10 ].setActionCommand( "NO_OP" );
pnlNumbers.add( btnNumbers[ 10 ] );
//HandyButton btnDecimal = new HandyButton( ".", NO_OP, DECIMAL );
btnNumbers[ 11 ] = new HandyButton( ".", NO_OP, DECIMAL );
btnNumbers[ 11 ].setActionCommand( "NO_OP" );
pnlNumbers.add( btnNumbers[ 11 ] );
for ( int i = 0; i < btnNumbers.length; i++ ) {
btnNumbers[ i ].addActionListener( this );
/** Add numbers panel to frame */
getContentPane().add( pnlNumbers, java.awt.BorderLayout.CENTER );
String sTenth = (new Double(0.1)).toString();
sDisplay = sTenth.substring(sTenth.length()-2).substring(0, 1);
public void actionPerformed( java.awt.event.ActionEvent evt ) {               
Object temp = evt.getSource();
JOptionPane.showMessageDialog( null, String.valueOf(evt. ) );
//int buttonCount = btnNumbers.length + btnFunctions.length;
//int allButtons;
try {
JOptionPane.showMessageDialog( null, String.valueOf(temp.getClass().getDeclaredField( "value").getInt( "value" ) ) );
catch ( NoSuchFieldException e1 ) {
JOptionPane.showMessageDialog( null, e1 );
catch ( IllegalAccessException e2 ) {
JOptionPane.showMessageDialog( null, e2 );
JOptionPane.showMessageDialog( null, "You clicked a button\n" + evt.getActionCommand() );
buttonCount = btnFunctions.length + btnNumbers.length;
/** Determine what type of button - function or number */
JOptionPane.showMessageDialog( null, evt.getSource() );
if ( evt.getActionCommand().equals( "NO_OP" ) ){
JOptionPane.showMessageDialog( null, "number key\n" );
evaluate( evt.getSource( nValue ) );
} else {
JOptionPane.showMessageDialog( null, "function key" );
doCalc( evt.getSource() );
public void evaluate( int nValue ) {
JOptionPane.showMessageDialog( null, "Starting method evaluate\nButton value: " + nValue );
String Number;
if(nValue == DECIMAL)
if(!bIsDecimal)
if(bNewNum)
output.setText("0");
bNewNum = false;
bIsDecimal = true;
Number = sDisplay;
else
return;
else
Number = (new Integer(nValue)).toString();
if(bNewNum)
output.setText(Number);
if(nValue != 0)
bNewNum = false;
else
output.setText(output.getText() + Number);
repaint();
public void doCalc( int nOp ) {
JOptionPane.showMessageDialog( null, "Made it to doCalc\n" );
public static void main(String args[]) {
/** Create a handy frame */
HandyFrame hfrmMain = new HandyFrame( "Handy Calculator V1.0" );
/** Create a handy calculator */
HandyCalc HCalc = new HandyCalc();
/** Build the handy calculator */
HCalc.init();
/** Put handy calculator on the frame */
hfrmMain.getContentPane().add( "Center", HCalc );
/** Package the frame */
hfrmMain.pack();
/** Display the frame */
hfrmMain.show();

Similar Messages

  • Issue with fill in the blank field and back button.

    I am working in CP4 AS2.  I have create a page of fill in the blank fields to simulate filling in a form.  On the next slide, I show the answers by extracting the variables into text boxes.  I have a back and a next button and instruct the user to review their answers and if incorrect, to select the back button in order to reenter the data.  I have the back button set to jump to the previous slide by number (i've tried previous, last slide, etc...)
    The flash movie freezes when I select the back button.  I think flash is having trouble going back to the fill in the blank fields from the displayed variables.  Any ideas? or work arounds for this.  The idea solution would take them back to the page with the data already in the fields so they could correct the errors only and then return to the review page.
    Thanks
    Scott

    Hi there
    Is scoring enabled on these? If so, perhaps your quiz settings are preventing backward movement.
    Cheers... Rick
    Helpful and Handy Links
    Captivate Wish Form/Bug Reporting Form
    Adobe Certified Captivate Training
    SorcerStone Blog
    Captivate eBooks

  • How do I change the text in a field with radio buttons or check box?

    Hi All:
    I have a form that has a list of things with check boxes (could be done with radio buttons) at the bottom. The client wants a single field at the top of the form that repeats the text next to the checkboxes. For example if a user checks the box next to the words "You did thing 1 wrong" the client wants "You did thing 1 wrong" to appear in this text box at the top of the form. If the user checks the box next to the words "You did thing 2 wrong" the client wants the words "You did thing 2 wrong" to appear in the magic box at the top of the page. There are 10 different check box options, so the box at the top would need to be able to have 10 different things in it.
    Client is not interested in a drop down menu. I asked.
    I am in a bit over my head here, so my question is twofold.
    1. Can you do this in Acrobat Pro 10 on a Mac?
    2. Can you supply me with code?
    Thanks in Advance,
    Amy W.

    Create a text field and make this script its custom calculation script :
         var a ="";
         if (this.getField("Check1").value == "Yes"){
         a="You did thing 1 wrong";
         event.value = a;
    Also, replace "Check1" with the name of your check box or radio button, and give it an export value of "Yes".

  • When I try to use the Submit Form button on the Interactive PDF I created (IN Design CS6) I get this message. "There is no value in form field 'Program.' Please put in it before proceeding. What can I do to fix this and make the Submit button work?

    When I try to use the Submit Form button on the Interactive PDF I created (In Design CS6), I get this message:
    There is no value in form field "Program." Please put in it before proceeding.
    How can I fix this and make the Submit Form button work?

    Are you running modified software on your phone?  This error seems to be common if the firmware has been modified and you're trying to restore the phone again. 

  • Add a button on the param form and display a list and pass back to param

    10GR2
    Report is saved in RDF
    Requirement is that we create a button on the paramter screen and let user go through a list of first name to select from. The list could be long. same with the las name
    Example
    First Name < text box > < button >
    Last Name < text box > < button >
    Where if you click on this button, I want to show a list that gets populated from the database in some form if possible and then when they select a value, return it to the text field.
    Similar to how LOV works on Oracle forms.
    Unless there is some simpler solution
    Thanks for your response.

    The only way I figured out how to do this was to create the page in iWeb and then manually edit the page in Dreamweaver to add the form. The form them posts to a php page that collects the info and mails it to me.
    Works ok, but it was completely manual.

  • I'm having constant problems with pages not working. I.E.: I cannot fill in writeable fields, click on buttons... or anything... nothing on the page works. And, this is not exclusive to a particular site. I can, however, work well in Explorer.

    For the last few weeks I have had constant problems with pages not working. I.E.: I cannot fill in writeable fields, click on buttons... or anything... nothing on the page works. And, this is not exclusive to a particular site. It does seem to be a browser issue, because I can work well in Explorer.

    Both the Yahoo! Toolbar extension and the Babylon extension have been reported to cause an issue like that. Disable or uninstall those add-ons.
    * https://support.mozilla.com/kb/Troubleshooting+extensions+and+themes

  • Can you display a radio button on the same line as a selection field?

    I am fairly sure this can not be done but then I have never had a request like this.
    My users want me to change a screen to have radio buttons on the same liines as other fields.
    For example:
    From Order: ________   To Order: ________         @ First Radio Button
    From Loc:    ____            To Loc:    _____               @ Second Radio Button
    These are using selection screens in an SAP report program - no dynpro or web design.
    And the user would only be able to select one button as all are in the same group.
    I could define as a check box too and only permit one to be selected - I think.
    if this can be done i do not know anyway to codee it.

    Hi
    Please check the below code:
    TABLES: mara,
            vbak.
    SELECTION-SCREEN BEGIN OF BLOCK b1.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(15) v_mat.
    SELECT-OPTIONS: s_matnr FOR mara-matnr.
    SELECTION-SCREEN POSITION 60.
    SELECTION-SCREEN COMMENT 70(10) v_ma.
    PARAMETERS: r_m  RADIOBUTTON GROUP g1 DEFAULT 'X' USER-COMMAND abc.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(15) v_sal.
    SELECT-OPTIONS:  s_vbeln FOR vbak-vbeln.
    SELECTION-SCREEN POSITION 60.
    SELECTION-SCREEN COMMENT 70(10) v_sa.
    PARAMETERS:  r_s  RADIOBUTTON GROUP g1.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN END OF BLOCK b1.
    INITIALIZATION.
      v_mat = 'Material number'.
      v_sal = 'Sales Order Number'.
      v_sa = 'Sales'.
      v_ma = 'Mat'.
    Shiva

  • Leave TO address field button, remove the CC & BCC buttons

    Greetings, where can I install/remove the buttons beside the address fields on the Write page please?
    A friend has somehow got 3 buttons and only needs the To Field, as the other fields are getting populated with whatever she types in the To Field and so she's inadvertently copying mail to herself. Thanks.

    What version of Thunderbird are they using? My Thunderbird defaults to To for the initial and subsequent addressing. You have to click a down arrow and select something else from the list. rather difficult to do by accident.

  • HT1430 The not enouth storage is stuck on my screen and it will not let me by pass it even though I have increased the storage. I can not shut down the ipad or by forcing it or sliding the power off button. Advice on what to do?

    My ipad is frozen with the not enough storage box up. I have tried a hard reboot and it will not respond to anything... help!

    Try reset iPad
    Hold down the Sleep/Wake button and the Home button at the same time for at least ten seconds, until the Apple logo appears
    Note: Data will not be affected.

  • Passing values to jSP on button click

    Hello
    I have multiple delete buttons on the JSP page. What i want is to get the value as to which delete button was clicked. I am not sure if i shld have multiple names for the buttons. For now all have the same name since its inside a while loop.
    Also i want to confirm that the user really wants to delete the field. But i dont know how can i pass the value as well as the function at the same time through the onClick function.
    I tried type="hidden" for the field value and onClick="function" (where function is a javascript function that confirms if the user does want to delete the field). BUt in this case with type = hidden i get all the values corresponding to the field.
    Any pointers?
    heres the sample HTML code if it helps.. this one is just to show how the screen looks like. The actual JSP has the while loop.. which is also pasted below
    <HTML>
    <HEAD><TITLE>File Format Management</TITLE>
    <META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <SCRIPT language="JavaScript" type="text/javascript">
    <!--
    var errMsg = "";
    function confirmDelete(frm)
         var deleteSure = confirm("Are you sure you want to delete the fileType?");
         if (deleteSure)
                frm.submit();
         return deleteSure
    //-->
    </SCRIPT>
    </head>
    <body>
    <BR>
    <CENTER>
    <TABLE border="1" cellpadding="0" cellspacing="0" marginwidth=0 marginheight=0>
      <TR class="titlebar">
        <TD align="center">File Format Management</TD>
      </TR>
      <TR bgcolor="#cccccc">
        <TD>
    <B>File Types:</B>
    <p>The following file types are defined for this project.</p>
    <div align="center">
    <table cellpadding="3" cellspacing="0" border="0" width="100%">
    <tr><td>Filetype��</td><td># of fields��</td><th></th><th></th></tr>
    <tr><td>Demographics</td><td align="center">5</td><td><input type="submit" value="Edit"></a></td><td align="right"><input type="submit" value="Delete"></a></td></tr>
    <tr><td>Clinical</td><td align="center">17</td><td><input type="submit" value="Edit"></td><td align="right"><input type="submit" value="Delete"></td></tr>
    <tr><td>MS</td><td align="center">9</td><td><input type="submit" value="Edit"></td><td align="right"><input type="submit" value="Delete"></td></tr>
    <tr><td>HLA</td><td align="center">20</td><td><input type="submit" value="Edit"></td><td align="right"><input type="submit" value="Delete"></td></tr>
    <tr><td>SNP</td><td align="center">18</td><td><input type="submit" value="Edit"></td><td align="right"><input type="submit" value="Delete"></td></tr>
    <tr><td colspan="4"><input type="submit" value="Add new filetype..."></td></tr>
    </table>
    </div>
    <p align="center"><input type="submit" value="Return"></p>
    </td>
    </tr>
    </table>
    </body>
    </html>
    //actual while loop in JSP
    <table cellpadding="3" cellspacing="0" border="0" width="100%">
                <tr class="titleitem"><td>Filetype��</td><td># of fields��</td><th></th><th></th></tr>
                <% if ((!fileTypesFormats.equals(null)) && (fileTypesFormats.size() > 0))
                        Iterator keyIter = fileTypesFormats.entrySet().iterator();
                        while (keyIter.hasNext())
                            Map.Entry CurrentEntry = (Map.Entry) keyIter.next();
                            String formatNos = CurrentEntry.getKey().toString();
                            String fileTypeName = CurrentEntry.getValue().toString();
                            count++;
                 %>
                       <tr class="<%=htmlObj.getClassString(count)%>">
                         <td><input type="hidden" name="filetypeName" value="<%=fileTypeName%>"><%=fileTypeName%></td>
                         <td align="center"><%=formatNos%></td>
                         <td><input type="button" value="Edit" name="editBtn" onclick="location.href='edit_delete_filetype_format.jsp'"></a></td>
                         <td align="right"><input type="button" name="deleteBtn" value="Delete" onclick='confirmDelete(this.form)'></a></td>
                       </tr>
                 <% } } %>
                        <tr class="<%=htmlObj.getClassString(count)%>"><td colspan="4"><input type="button" value="Add new filetype..." onclick="location.href='edit_delete_filetype_format.jsp'"></td></tr>
            </table>

    Thanx for your help praveen
    I appreciate that.. but i misguided you. I am sorry abt that
    I want the value of the field beside the delete box to be passed to the Server side scripting.
    so if u see the html page u see something like this
    "Demographics 4 Edit Delete "
    "Clinical 3 Edit Delete"
    //note edit and delete are buttons
    Of this when the user clicks on Delete I want the jsp to pass Demographics value to the JSP.
    Right now it will pass all the values like "Demographics Clinical" . I probably have to give different names to the buttons...lets c
    Thanx for u r help

  • Button on the manual form

    I am pretty new in APEX and need your help.
    I have a manual form for ex: say on Employee form with only one editable field say 'Salary'. If a user edits the salary and hits save, the record goes into the history table but doesn't update the original table (in this case emloyee). The table is also showing the new salary (coming from history table).
    I need to show a history button on the form for each row (pass empno). Whenever a person hits history button, it shows history (updated rows) against that empno in a new region but on the same page. It should have 'close' button to close the history region.
    Do you have any similar example?
    Thanks.
    Edited by: user6699807 on Dec 3, 2008 6:07 AM

    Hi,
    You can create a custom report template to handle that.
    Go to Shared Components, Templates and Create a new report - use a copy of your existing report template.
    When the template is created, select it from the templates list to edit it. On the template definition, you will see four sections - Custom Template 1, 2, 3 and 4. In these, we can define up to four formats depending on stated conditions. In your case you only need to use the first two sections (and perhaps the third if you have users that don't fall into either category?).
    In Custom Template 1, enter the following:
    &lt;td headers="#COLUMN_HEADER_NAME#" #ALIGNMENT# class="t18data" style="background-color:lightgreen"&gt;#COLUMN_VALUE#&lt;/td&gt;You should adjust the t18data class name to whatever your one is - all I've really added here is added the style attribute.
    In Custom Template 1 Condition, select: Use Based on PL/SQL Condition
    In Custom Template 1 Expression, we need to enter whatever the expression would be to return true for your first style. For example:
    '#ROLE#' = 'EDITOR'or
    #ROLE# = EDITORdepending on if the ROLE column is a string or number - replace ROLE with whatever the name is for the column containing the role (but keeping the #'s). #ROLE# would be repaced by the value on the column for the current row - if the equation returns true, then the custom template is used, otherwise the next one is checked instead.
    Make similar entries in Custom Template 2 settings for your approver role.
    And, if you will have users that fall outside of these roles, then repeat the process for the Custom 3 Template setting, but leaving the Condition and Expression as their defaults - that way, if the ROLE value does not match either of the first two template settings, then this third one must be used as it is effectively unconditional.
    I have done this here: http://htmldb.oracle.com/pls/otn/f?p=55041:44 - any DEPTNO of 10 turns the line lightgreen, 20 is pink and all others are yellow.
    Andy

  • How to clear the fields within copy routines in the copy contorl

    HI Gurus,
    I need to clear  the fields VBP-VBELV and VBAP-PSSNV within the copy routines 303 in the copy control between quote item and sales order item. I am not sure how to do that... Can some body please help.
    This is required because we had sales order and quote using the same requirement type which controls the special stock indicator. This leads to the stock getting update in quotation instead of the sales order, because the quotation is initiating document (collecting all cost etc).Now i know requirement should only be passed to production from sales order and not from quotation so i changed the config but there are some existing documents using same requirement type on both quotation and sales order and to correct those i need to clear fields VBP-VBELV and VBAP-PSSNV within the copy routines 303.
    Please help!
    Regards,
    Sam

    Hi ,
    just use this code in ur save button action handler , this will clear the field after entered in to the database and will ready for the next set of data.
    String password=wdContext.currentContextElement().getpwd();
    try{
         InitialContext ctx=new InitialContext();
         DataSource ds=(DataSource)ctx.lookup("jdbc/SAPJ2EDB");
         Connection con=ds.getConnection();
         con.setAutoCommit(false);
         Statement stmt=con.createStatement();
         int retIns = stmt.executeUpdate("insert into TMP_NEWUSERDETAIL(PASSWORD) values("password")");
         con.commit();
         con.setAutoCommit(true);
         wdContext.currentContextElement().setpwd(null);
    or use a seperate button to clear the field.
    wdContext.currentContextElement().set<Attributename>(null);
    Regards
    Vijayakhanna Raman

  • Push button in the application tool bar in the standard LDB PNP

    Hi ABAPERS,
    I have a  requirement that in the selction screen to use the standard LDB PNP beyond that I need to pass one push button in the selection screen 1000 ( in the application tool bar beside execute button) actually i  passes the push button in the gui status but its not refelcting in the output  and in the initilization event also i passed even then its noty working,
    initialization.
      move 'Cluster ID'(010) to sscrfields-functxt_01.
    Thanks and Regards,
    Deepthi.

    Pavan,
    write code like this
    TABLES: USR02,       "Logon data
            SSCRFIELDS.  "FIELDS ON SELECTION SCREENS
    STANDARD SELECTION SCREEN FOR SCROLLING LEFT AND RIGHT
    SELECTION-SCREEN: FUNCTION KEY 1.
    SELECTION-SCREEN begin of BLOCK b1.
      PARAMETERs p1 type i.
      SELECTION-SCREEN end of BLOCK b1.
    INITIALIZATION.
    SCREEN ICON LEFT AND RIGHT
      SSCRFIELDS-FUNCTXT_01 = 'Button'.
      start-OF-SELECTION.
    Thanks
    Bala Duvvuri

  • Close the IE page on click of a button in the transaction

    Hi All,
    I have a button on the transaction and once I click the button it should log off from the SAP WEB AS and close the Internet Explorer page.
    Can anyone guide me through the process?
    Thanks in advance,
    Sudhi

    from your earlier Passing data through URL i understand that you use integrated ITS, so my answer is going to be based on that.
    in your program add the following :
    include AVWRTCXM .
    and write the following code for button click.
    field-set '~OkCode' 1 '/NEX' .
    its-browser_redirect 'XXX'.
    now go to SICF
    navigate to your service under sap/bc/gui/sap/its/
    double click on the service
    choose error pages tab
    then choose logoff page tab
    make sure "explicit response time" radio button is selected.
    Click on the create icon next to "Body" in the resulting window enter the following text
    Thanks for using ITS
    <a href="#" anclick="windaw.clase();">
    click here to close this window
    </a>
    in this line (anclick="windaw.clase();) change the alphabet 'a' to 'o' .
    Save the service.
    and test the same.
    Regards
    Raja
    Message was edited by:
            Durairaj Athavan Raja

  • Wan to add push button in the output of ALV Grid display.

    Hi Friends,
    I wan to add a Push button in the output of ALV GRID display with STANDARD ikons.
    How to copy standard ikons of GRID output.
    How to apply the copied status into my code.
    Regards,
    Viji

    Hi,
    Goto SE41, create a pf-status for your alv report program.
    On the next screen, click menu EXTRAS --> click option ADJUST TEMPLATES and select radiobutton LIST VIEWER --> you will get all standard buttons of alv in the pf-status.
    Delete the unwanted buttons and also you can add new buttons if reqd.
    Activate pf-status --> and apply in alv program.
    Now to apply this pf-status in your alv report follow code:-
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
         i_callback_program                = v_rep_id       " report id
         i_callback_pf_status_set          = 'PF'           " for PF-STATUS
         i_callback_user_command           = 'USER_COMMAND' " for User-Command
         is_layout                         = wa_layout      " for layout
         it_fieldcat                       = it_field       " field catalog
         it_sort                           = it_sort        " sort info
        TABLES
          t_outtab                          = it_final      " internal table
       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  pf
    *       SUB-ROUTINE PF IS USED TO SET THE PF-STATUS OF THE SCREEN
    *       ON WHICH THE ALV GRID IS DISPLAYED
    *       -->RT_EXTAB
    FORM pf USING rt_extab TYPE slis_t_extab.
      SET PF-STATUS 'ZTG_STAT'. "<--pass pf-status name here
    ENDFORM.                    "pf
    *&      Form  USER_COMMAND
    *       SUB-ROUTINE USER_COMMAND IS USED TO HANDLE THE USER ACTION
    *       AND EXECUTE THE APPROPIATE CODE
    *      -->LV_OKCODE   used to capture the function code
    *                     of the user-defined push-buttons
    *      -->L_SELFIELD   text
    FORM user_command USING lv_okcode LIKE sy-ucomm l_selfield TYPE slis_selfield.
    * assign the function code to variable v_okcode
      lv_okcode = sy-ucomm.
    * handle the code execution based on the function code encountered
      CASE lv_okcode.
        WHEN '<function_code>'. "<--to handle user actions
      ENDCASE.
    ENDFORM.                    "USER_COMMAND
    Hope this helps you.
    Regards,
    Tarun

Maybe you are looking for

  • Using Skype Mobile while traveling in Europe

    I have a Verizon Samsung Fascinate with Skype installed.   I have bought credits. I will soon be traveling to Belgium and France.  I have been told by Verizon that my phone will not work in Europe.  However, when my husband talked to a representative

  • Is there a way to retrieve camera roll photos after failed backup

    I backed up my iphone 4 to itunes (not icloud) yesterday, and today i went to the apple store to see if they could fix a broken lock button. They issued me a new phone, and assured me that i woult be able to retrieve my camera roll photos after resto

  • CCK & iPad2 FAIL - (Accessory Unavailable-The attached accessory uses too much power)

    Well, I'm not too impressed right now. Picked up my new Camera Connection Kit (CCK) tonight and received the error message (see post title) on every camera I tried it on. DCMI folders located in root. Latest update (5.1) This is with direct to camera

  • Boycott Skype - Terrible response to requests for ...

    After multiple attempts to add credit.... been an ongoing customer for 2 years, I am done.  Tried 3 different accounts to make payments.  Skype keeps refusing my payment.  Off to Google Talk.

  • Line of text in two rows in a check box

    Greets Ive been working in a poll, and i use a check box in some part, but de question its to long to put it in i have the same problem with the text box, but with the command &#13; it can be possible to put a long question in two rows, but that comm