Sub screen: Handling the Radio button selection?

Hi,
Scenario:
I have a Main screen and a sub screen. From the main screen I am calling the sub screen. On the Sub screen, I have 2 radio button. On the selection of the Radio buttons, I am activating/deactivating few of the screen elements on the sub screen.
I have grouped the radio button and also tried assigning Function code to it, but in vain..:(
Issue
I am not able to handle the event triggered by the selection of the radio buttons?
Kindly suggest.
Regards
s@k

Hi,
Are you still have any Issue, Let us know
In the Main Screen Element List there is a field OK_CODE pass an entry into it
in the TOP Include
DATA : OK_CODE type SY-UCOMM. " This captures the OK_CODE from the Screen.
Since SUb Screen cant have their Own OK_CODE this can be handled in the Main Screen only
Try in PAI of Sub Screen using OK_CODE if it is not working then Implement the same in PAI of Main Screen
The system will generate UCOMM for Radio Button since they are in One Group only. Each Radio button cannt have a separate UCOMM assigned. In Screen Painter (if It is Module Pool) assign a FCode for the Radio Button.
Even if try changing the FCODe Value they still will have the New Changed Value but cannot be changed.
This automatically triggers PAI . only way to capture it is check
case ok_code. " Optionally you can omit this
when  ok_code = 'RAD'.  " This is common for all the Radio BUttons but cant be different
if r1 = 'X'.
elseif r2 'X' " Etc.
endif.
endcase.
Ram
Edited by: Ramchander Krishnamraju on Feb 26, 2010 10:37 AM

Similar Messages

  • Display Hide screen elements on radio button select

    Hi all,
    We have requirement to display some elements if radio button 1 is selected and display others elements if radio button 2 is selected .
    All elements should display/hide on radio button click not on any other button .
    <REMOVED BY MODERATOR>
    Regards,
    Edited by: Alvaro Tejada Galindo on Jun 12, 2008 5:34 PM

    Hi,
    Refer the code below:
    *Radiobuttons for selecting single material or range of BOM components
    SELECTION-SCREEN:BEGIN OF BLOCK b1 WITH FRAME TITLE text-001 .
    *Radiobutton for selecting material
    PARAMETERS:rb_mat RADIOBUTTON GROUP g1 DEFAULT 'X' USER-COMMAND com1.
    *Radiobutton for selecting BOM components
    PARAMETERS:rb_comp RADIOBUTTON GROUP g1.
    SELECTION-SCREEN END OF BLOCK b1.
    *Enter BOM header and details
    SELECTION-SCREEN BEGIN OF BLOCK sub1 WITH FRAME TITLE text-002.
    PARAMETERS:p_matnr TYPE mara-matnr MODIF ID id1.                 "Material Number
    PARAMETERS:p_werks TYPE marc-werks MODIF ID id1.                 "Plant
    PARAMETERS:p_stlan TYPE mast-stlan MODIF ID id1.                 "BOM usage
    PARAMETERS:p_stlal TYPE mast-stlal MODIF ID id1.                 "Alternative BOM
    PARAMETERS:p_capid TYPE rc29l-capid MODIF ID id1.                "BOM Application
    SELECTION-SCREEN END OF BLOCK sub1.
    *Enter BOM components
    SELECTION-SCREEN BEGIN OF BLOCK sub2 WITH FRAME TITLE text-003.
    SELECT-OPTIONS:s_matnr FOR marc-matnr MODIF ID id2.              "Material Number(BOM component)
    SELECTION-SCREEN END OF BLOCK sub2.
    *Enter document details
    SELECTION-SCREEN BEGIN OF BLOCK sub3 WITH FRAME TITLE text-004.
    *Document number
    PARAMETERS:p_doknr TYPE draw-doknr.
    *Document Type
    PARAMETERS:p_dokar TYPE draw-dokar.
    *Document Part
    PARAMETERS:p_doktl TYPE draw-doktl DEFAULT '000'.
    *Document Version
    PARAMETERS:p_dokvr TYPE draw-dokvr DEFAULT '00'.
    SELECTION-SCREEN END OF BLOCK sub3.
    *Display screen based on selection of radio button
    AT SELECTION-SCREEN OUTPUT.
      LOOP AT SCREEN.
        IF rb_mat = 'X'.
          IF screen-group1 = 'ID2'.
            screen-active = 0.
          ENDIF.
        ELSEIF rb_comp = 'X'.
          IF screen-group1 = 'ID1'.
            screen-active = 0.
          ENDIF.
        ENDIF.
        MODIFY SCREEN.
      ENDLOOP.

  • File name should change by selecting the radio buttons

    Hi all,
    PARAMETERs: p_file LIKE rlgrap-filename.
    PARAMETERS: p_app RADIOBUTTON GROUP rg DEFAULT 'X',
                             p_pre RADIOBUTTON GROUP rg.
    this is to download the ITAB data to presentation and application servers depending upon the radio button selected.
    if i select p_pre , then default download path is : 'C:/ download.txt'.
    if i select P_app , default download path is : '\usr\sap\EBG\SYS\profile\DOWN.TXT'.
    how the file name should change by selecting the radio buttons ?
    Thanks
    KR

    Hi,
    DATA: c_x VALUE 'X'.
    selection-screen begin of block input with frame title text-000.
    parameters :desktop     radiobutton group rg_f user-command rg_f,
                       in_file type ibipparms-path modif id ps DEFAULT 'C:/ download.txt',
                menu     radiobutton group rg_f ,
                       sys_file type ibipparms-path modif id as default  '\usr\sap\EBG\SYS\profile\DOWN.TXT' .
    selection-screen end of block input.
    at selection-screen output.
      if desktop is initial and menu is initial.
        desktop = c_x.
      endif.
      perform f_toggle_finputs.
    form f_toggle_finputs.
    loop at screen.
        if screen-group1 = 'PS'.
          if desktop = c_x.
            screen-input    = 1.
    *         sys_file = c_server_path.
          else.
            screen-input    = 0.
          endif.
        endif.
        if screen-group1 = 'AS'.
          if menu = c_x.
            screen-input    = 1.
    *        clear: in_file.
          else.
            screen-input    = 0.
          endif.
        endif.
        modify screen.
      endloop.
    endform. "f_toggle_finputs
    Hope this helps u.
    Thanks.

  • Keep Radio Button selected after action

    Hi All - This is a strange situation.
    I have 3 context node for Radio Buttons
    the 1st context node is for 2 radio buttons
    the 2nd context node is for 6 radio buttons
    the 3rd context node is for 4 radio buttons
    Scenario: 1st Context node has "DEFAULT VALUE" so is initially selected, the other two context node doesn't have DEFAULT VALUE.
    I select a radio button (that belongs to the second node) and also select a radio button (that belongs to the 3rd context node) now I click a custom button that will trigger an ACTION.
    1st & 3rd Radio buttons keep the RADIO BUTTON SELECTED but 2nd Radio Button now is like INITIAL, WHY??? if everything is designed the same way.
    I want to keep the selected value so the user can see which options they selected.
    A1          B2            C3      <----
    First time (after initialization)
    X
    A1         B2            C3      <----
    I selected values
    X            X              X
    A1         B2             C3     <----
    After Action is trigger
    X                             X
    thanks!
    Jason PV

    Hi,
    I dont see any reason other than selected value getting lost in wddomodify method or in action event handler.
    Check in WDDOMODIFYVIEW or in Action Handler method you are not playing modifying the context node bound to 2 group of radio buttons .
    Or you can fetch the selected value in your action handler store it in some view attribute and bind the node back again with same value on wddomodifyview.
    Regards
    Manas Dua

  • Clearing radio button selection

    Guys, iam stuck in a situation where iam not able to clear the radio button selection in the SINGLESELECT tableview. I am using MVC approach and my layout is similar to bookshop example in SAP  tutorial_4_mvc.
    I found that even in the SAP example the raio button is not cleared when a new search is used. The radio button remains selected and it has to be clicked again to refresh and retrieve new values. But I would like to clear the selection.
    Any help on how to clear previous radio button selection every time the page is reloaded?
    Thanks.

    hi,
    i tried this but for some reason the index of the prviously selected row still gets applied to the new selection and is checked.
    in my do_handle_event:
    IF htmlb_event IS BOUND  AND
         htmlb_event->name = 'tableView'.
        table_event ?= htmlb_event.
        selectedrowindex = table_event->selectedrowindex.
        READ TABLE i_result INDEX selectedrowindex INTO wa.
        IF sy-subrc EQ 0.
          CLEAR: imatfact1, iagrfact1, iagrhead1, iabgru1, v_part_detail,
    selectedrowindex.
    processing data
    ENDIF.
    In my DO_REQUEST:
    result_view->set_attribute( name = 'i_result' value = i_result ).
      result_view->set_attribute( name = 'iterator' value = me ).
    result_view->set_attribute( name = 'selectedrowindex' value =
    selectedrowindex ).
      call_view( result_view ).
    In my page:
    <htmlb:tableView id              = "result"
                     headerText      = "Header Text"
                     onNavigate      = "onMyNavigate"
                     selectionMode   = "<%= v_sel_mode %>"
                     emptyTableText  = "No data found matching your query!"
                     onRowSelection  = "<%= v_onrow_sel %>"
                     table           = "<%= i_result %>"
                     iterator        = "<%= iterator %>"
                     visibleRowCount = "10"
                     selectedRowIndex = "<%= selectedrowindex %>">
      <htmlb:tableViewColumns>
        <htmlb:tableViewColumn columnName          = "MATNR"
                               width               = "100"
                               horizontalAlignment = "left"
                               title               = "PART" >
        </htmlb:tableViewColumn>
        <htmlb:tableViewColumn columnName          = "ZFLAG"
                               width               = "100"
                               horizontalAlignment = "left"
                               title               = "DISCOUNT" >
        </htmlb:tableViewColumn>
      </htmlb:tableViewColumns>
    </htmlb:tableView>
    I am also using the interface methods u tthere is no code inside:
    IF_HTMLB_TABLEVIEW_ITERATOR~GET_COLUMN_DEFINITIONS
    IF_HTMLB_TABLEVIEW_ITERATOR~RENDER_ROW_START
    IF_HTMLB_TABLEVIEW_ITERATOR~RENDER_CELL_START
    Please suggest what could be wrong.
    I have debugged this and saw the selected rowindex as '0' also but it gets applied somewhere again.
    Thanks.

  • When I flatten an acroform, the radio buttons no longer show as checked.

    If I don't call flatten (CFPDF....flatten="true"), the PDF shows the radio buttons selected, but as soon as I flatten the PDF, the radio buttons are not shown as selected. Checkboxes work, text fields work, but radio buttons just all show as unselected.
    This is on CF 9,0,1,274733. Has any one else seen this?
    Any suggestions?

    Yes, that setting disables the backgrounds and if button use a background image then they may become invisible.
    You can use the NoSquint extension to set font size (text/page zoom) and text color on web pages.
    *NoSquint: https://addons.mozilla.org/firefox/addon/nosquint/

  • How to get Radio button select event in my co

    Hi,
    I want to get the radio button selection event in my co,how can i get the event?

    Hi,
    841475 wrote:
    I want to get the radio button selection event in my co,how can i get the event?---There is no event for radio button.
    ---U need to explicitily set the event for the radio button.
    Action:FirePaatialAction
    Event:RadioEvent---Get the event in co by below code:
    if("RadioEvent".equals(pageContext.getParameter(EVENT_PARAM)))
    ---In radio button event..:)
    Regards
    Meher Irk

  • While opening a screen none of the radio button should not selected

    Hi,
    i have three radio button on the screens.By default the first radio button is getting selected for each and every time when ever i'm opening the screen.i dont want the default select should happen and even i dont want any of the radio button should be selected.
    how i can acheive through dialog programming.
    kind regards,
    Poornima.

    Hi,
    You can have radio buttons with any one field selected from a group .
    ex:
    selection-screen begin of block b2 with frame title text-042.
    parameters:r_detail    radiobutton  group g2 user-command cmd default
    'X',
           r_sumry   radiobutton  group g2,
           r_totals    radiobutton group g2.
    selection-screen end of block b2.
    or
    selection-screen begin of block b2 with frame title text-042.
    parameters:r_detail    radiobutton  group g2 user-command cmd,
           r_sumry   radiobutton  group g2 default 'X',
          r_totals    radiobutton group g2.
    selection-screen end of block b2.
    or
    selection-screen begin of block b2 with frame title text-042.
    parameters:r_detail    radiobutton  group g2 user-command cmd,
           r_sumry   radiobutton  group g2 ,
          r_totals    radiobutton group g2 default 'X'.
    selection-screen end of block b2.
    Else you can opt for checkbox and have all of them not checked.
    Regards,
    Dep

  • How to handle the current row with radio button selection???

    Hi Everyone,
    I have one ADF page with one table and one "Find" button.
    I have created one new attribute with VARCHAR2(1) in the VO and dragged that attribute as first column in the table. And changed that first column to Radio Button to select only one row at a time.
    Upon clicking on the "Find" button i need to get the values of current selected row.
    How can i get the values of selected row?
    What code should i write to get the values of selected row in Method Binding of "Find" button?
    Any suggestions will be really useful.
    Thanks.

    Hello Kumar,
    I have some comments on your case.
    >
    I have created one new attribute with VARCHAR2(1) in the VO
    >
    1- You should create this attribute in the Entity object and then add it to the view object.
    2- Do you need that only one radio button is set at a time for all rows ? If yes then you need to handle the case when the user set more than one row and clear the value of the attribute for all other rows.
    >
    How can i get all the values of current row in backing bean method(method binding of Find method)?
    can u plz provide me the code for that?
    >
    If you mean by the current row is that the row with its value of the selected attribute is set (the radio button is set for that row), then you can write a method in the viewObjectImpl class and expose it to client interface and call it from your bean.
    here is an example based in Department table in HR schema.
    //This method is written in DepartmentsViewImpl   
    public Row getSelectedRadioRow(){
                //create a second row set to not impact the row set used in ADF
                RowSet duplicateRowSet = this.createRowSet("duplicateRowSet");
                //get the current row of the table to set it back after re-executing the VO
                DepartmentsViewRowImpl currentRow = (DepartmentsViewRowImpl)this.getCurrentRow();
                Row[] filteredRows = duplicateRowSet.getFilteredRows("IsSelected", "1");
                DepartmentsViewRowImpl row=null;
                if(filteredRows.length>0){
                    row = (DepartmentsViewRowImpl)filteredRows[0];
                    System.out.println("Department Name " + row.getDepartmentName());              
                this.setCurrentRow(currentRow);
                duplicateRowSet.closeRowSet();
                return row;           
            }

  • Disabling fields on the basis of radio button selected

    Hi experts,
    I have a requirement where in i have a dialogue screen which has radio buttons and few other input fields.
    when i check a radio button on the screen i have to get an input field greyed out on the same screen immediately.
    i have grouped the input fields to be greyed out as GR1.
    i used the following code in the PBO of the screen which is not working,
    if  oradio eq 'X'.
          loop at screen.
            if screen-name = 'S_CREATE'.
              screen-group1 = 'GR1'.
              screen-input   = 0.
            endif.
            modify screen.
          endloop.
    endif.
    please give some input.

    Hi
    *Hello Just do the Following.*
    *" I think you are missing the below Grouping Part otherwise your code looks ok*
    *go to EDIT -->Grouping--> Radio Button Group --> Define " before this select all the Radio Buttons.*
    *all the radio button names should be r1, r2, r3 etc as declared above " Make their names same whatever you give.*
    *" Assign a Function Code for them So that automatic PAI/PBO will Take Place once you select a radio Button*
    In TOP include/ Global area declare no of radio buttons.
    data : r1, r2, r3. etc " Default they take char with one length.
    if you are in Dialog program
    " I think you are missing the below Grouping Part otherwise your code looks ok
    go to EDIT -->Grouping--> Radio Button Group --> Define " before this select all the Radio Buttons.
    all the radio button names should be r1, r2, r3 etc as declared above " Make their names same whatever you give.
    " Assign a Function Code for them So that automatic PAI/PBO will Take Place once you select a radio Button
    in PBO
    module modify_screen.
    Now in Program
    Module modify_screen.
    if r1 = 'X'.
    loop at screen.
    if screen-group1 = 'GRP'.
    screen-input = 0 " or 1.
    modify screen.
    else" implement for other Radio buttons
    endloop.
    endmodule.
    Cheerz
    Ram

  • I want to add radio button selected value in shopping cart

    hi
    i am new to java
    and i am doing shopping cart project
    and i want to aad radio button selected value in cart but only one value.
    i am doing that in jsp.
    when iam adding that value the name of radio button is printed.
    and in remove page nothing displyed
    pls help me
    Thanks in advance.
    my code is-
    index.jsp
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Insert title here</title>
    <html>
    <head>
    <title>Shopping cart</title>
    <style>
    * { font-size: 12px; font-family: Verdana }
    input { border: 1px solid #ccc }
    </style>
    </head>
    <body>
    <jsp:declaration>
    java.util.Enumeration parms;
    java.util.Enumeration values;
    </jsp:declaration>
    <jsp:scriptlet>
    parms = request.getParameterNames();
    values = request.getParameterNames();
    while(parms.hasMoreElements()) {
    String name = (String) parms.nextElement();
    String value = (String) values.nextElement();
    session.setAttribute(name, value);
    </jsp:scriptlet>
    <img src="images/add.png" onclick="document.location='index.jsp'">
    <img src="images/remove.png" onclick="document.location='remove.jsp'">
    <img src="images/cart.png" onclick="document.location='cart.jsp'">
    <h2>Add to shopping cart</h2>
    <form method="POST" action="index.jsp">
    <table>
    <tr>
    <td><input type="radio" name="radio" value="$10.00" checked></td>
    <td>$10.00</td>
    </tr>
    <tr>
    <td><input type="radio" name="radio" value="$15.00"></td>
    <td>$15.00</td>
    </tr>
    <tr>
    <td><input type="radio" name="radio" value="$20.00"></td>
    <td>$20.00</td>
    </tr>
    <tr>
    <td><input type="radio" name="radio" value="$25.00"></td>
    <td>$25.00</td>
    </tr>
    <tr>
    <td><input type="radio" name="radio" value="$30.00"></td>
    <td>$30.00</td>
    </tr>
    <tr>
    <td><input type="radio" name="radio" value="$35.00"></td>
    <td>$35.00</td>
    </tr>
    </table>
    <br><br>
    <input type="submit" value="submit">
    </form>
    </body>
    </html>
    cart.jsp
    <html>
    <head>
    <title>Shopping cart</title>
    <style>
    * { font-size: 12px; font-family: Verdana }
    </style>
    </head>
    <body>
    <jsp:declaration>
    java.util.Enumeration parms;
    </jsp:declaration>
    <img src="images/add.png" onclick="document.location='index.jsp'">
    <img src="images/remove.png" onclick="document.location='remove.jsp'">
    <img src="images/cart.png" onclick="document.location='cart.jsp'">
    <h2>The shopping cart</h2>
    <jsp:scriptlet><![CDATA[
    java.util.Enumeration content = session.getAttributeNames();
    while (content.hasMoreElements()) {
        out.println(content.nextElement());
        out.println("<br>");
    ]]></jsp:scriptlet>
    </body>
    </html>
    remove.jsp
    <html>
    <head>
    <title>Shopping cart</title>
    <style>
    * { font-size: 12px; font-family: Verdana }
    input { border: 1px solid #ccc }
    </style>
    </head>
    <body>
    <jsp:declaration>
    java.util.Enumeration parms;
    </jsp:declaration>
    <jsp:scriptlet>
    parms = request.getParameterNames();
    while(parms.hasMoreElements()) {
    String name = (String) parms.nextElement();
    session.removeAttribute(name);
    </jsp:scriptlet>
    <img src="images/add.png" onclick="document.location='index.jsp'">
    <img src="images/remove.png" onclick="document.location='remove.jsp'">
    <img src="images/cart.png" onclick="document.location='cart.jsp'">
    <h2>Remove items from cart</h2>
    <form method="get" action="remove.jsp">
    <table>
    <% if (session.getAttribute("$10.00") != null) { %>
    <tr>
    <td><input type="radio" name="radio"></td><td>$10.00</td>
    </tr>
    <% } %>
    <% if (session.getAttribute("$15.00") != null) { %>
    <tr>
    <td><input type="radio" name="radio"></td><td>$15.00</td>
    </tr>
    <% } %>
    <% if (session.getAttribute("$20.00") != null) { %>
    <tr>
    <td><input type="radio" name="radio"></td><td>$20.00</td>
    </tr>
    <% } %>
    <% if (session.getAttribute("$25.00") != null) { %>
    <tr>
    <td><input type="radio" name="radio"></td><td>$25.00</td>
    </tr>
    <% } %>
    <% if (session.getAttribute("$30.00") != null) { %>
    <tr>
    <td><input type="radio" name="radio"></td><td>$30.00</td>
    </tr>
    <% } %>
    <% if (session.getAttribute("$35.00") != null) { %>
    <tr>
    <td><input type="radio" name="radio"></td><td>$35.00</td>
    </tr>
    <% } %>
    </table>
    <br><br>
    <input type="submit" value="submit">
    </form>
    </body>
    </html>

    i used this where park .visits is the java class for
    visit object that contains getResort() method
    now error has gone but nothing is stored in the
    actionform class I would take that to mean the List
    1. does not contain a collection of Visit. You can check that by printing some debug statements inside the loop
    2. contains collection of visit objects. However the visit objects return null for getResort().
    Why dont you debug by printing out the objects from wherever you sit it in request/session scop (i.e in your servlet/web-handler)
    ram.

  • How to handle the single line selection in table control

    Hi All,
       I am facing a problem in the table control of modulepool program.
       I have line selection as "Single" in the table control attributes. But when i am selecting a line in the table control as long as it is in the same page,the line selection is single but when i am selecting the line in the next page,the previous selection is not deselected. So I am seeing two selection for "Single line selector" attribute.
       Could any one help me solve this problem?
    Thanks & Regards,
    S.Lakshmi

    Hi Lakshmi,
    Just Go to Table control , click on it , you can see the attributes screen , there you can see option for
    <b>Line selection</b>
    none
    multiple selection
    single selection
    check the radio button single selection.
    that will solve your problem..
    regards
    vijay

  • Dynamic Radio Button Selection option in reports

    Hello Friends !
    Here is my strange requirement.
    Table Name: Z1, Fields are Material, Type
    Contents will be like under:
    Material  Type
    M1         A
    M2         A
    M2         B
    M3         X
    M4         X
    M4         Y
    M4         Z
    The report has the following Parameters:
    Material
    Plant
    If the user enters say M1 then the radio buttons should get generated like under:
    o - A
    If the user enters say M2 then the radio buttons should get generated like under:
    o - A
    o - B
    If the user enteres M4 then 3 radio buttons should get generated
    o-X
    o-Y
    o-Z
    Once the radio buttons comeup then the user will select any of them and then update the same.
    I will have a maximum of 5 different values for a material.
    Can you please suggest a way out for this. I want to do this in a report selection screen
    Thanks
    Narayanan P

    Hi
    You can think of different approach, instead of radio button.
    Create a module pool program
    In the first screen, user will enter Material / Plant and in the second screen, create a table control and shows the details of Material / Plant combination.
    User can select a line and do furthe processing
    Regards
    Madhan

  • Why does is not show the radio buttons

    I want to display the buttons in a row then radio button in a row under the button and then log scroll pane under the radio buttons. This is my code:
            //Add the buttons and the log to this panel.
            add(buttonPanel, BorderLayout.PAGE_START);
            add(radioPanel, BorderLayout.CENTER);
            add(logScrollPane, BorderLayout.CENTER);When i run it it display the buttons and the logsrollpane. Why does it not display the radio buttons?

    Thanks guys.
    This is my problem. We have a big system that produce lots of log files and the software testers have to manually have to go through the logs file and look for a certain XML tags in the log file.
    What I want to do is help the software testers my developing a small tool that will allow them to open a log file and then click on a radio button corresponding to a xml tags that they are looking for and automatically highlight the tags in the file in yellow color .
    I am not sure how feasible this is and I am stuck.
    This is what I have done so far.
    Can you please guys help me go forward.
    import java.io.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.filechooser.*;
    public class FileChooserDemo extends JPanel
                                 implements ActionListener {
        static private final String newline = "\n";
        JButton openButton;
        JButton clearButton;
        JTextArea log;
        JFileChooser fc;
        // Radio Buttons
        static String em01 = "EM01";
        static String em07 = "EM07";
        /*static String dogString = "Dog";
        static String rabbitString = "Rabbit";
        static String pigString = "Pig";*/
        public FileChooserDemo() {
            super(new BorderLayout());
            //Create the radio buttons.
            JRadioButton em01Button = new JRadioButton(em01);
            em01Button.setMnemonic(KeyEvent.VK_B);
            em01Button.setActionCommand(em01);
            em01Button.setSelected(true);
            JRadioButton em07Button = new JRadioButton(em07);
            em07Button.setMnemonic(KeyEvent.VK_C);
            em07Button.setActionCommand(em07);
            //Group the radio buttons.
            ButtonGroup group = new ButtonGroup();
            group.add(em01Button);
            group.add(em07Button);
            //Register a listener for the radio buttons.
            em01Button.addActionListener(this);
            em07Button.addActionListener(this);
            //Put the radio buttons in a column in a panel.
            JPanel radioPanel = new JPanel(new GridLayout(0, 1));
            radioPanel.add(em01Button);
            radioPanel.add(em07Button);       
            //Create the log first, because the action listeners
            //need to refer to it.
            log = new JTextArea(40,60);
            log.setMargin(new Insets(5,5,5,5));
            log.setEditable(false);
            JScrollPane logScrollPane = new JScrollPane(log);
            //Create a file chooser
            fc = new JFileChooser();
            //Uncomment one of the following lines to try a different
            //file selection mode.  The first allows just directories
            //to be selected (and, at least in the Java look and feel,
            //shown).  The second allows both files and directories
            //to be selected.  If you leave these lines commented out,
            //then the default mode (FILES_ONLY) will be used.
            //fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
            //fc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
            //Create the open button.  We use the image from the JLF
            //Graphics Repository (but we extracted it from the jar).
            openButton = new JButton("Open File");
            openButton.addActionListener(this);
            //Create the save button.  We use the image from the JLF
            //Graphics Repository (but we extracted it from the jar).
            clearButton = new JButton("Clear Text Area");
            clearButton.addActionListener(this);
            //For layout purposes, put the buttons in a separate panel
            JPanel buttonPanel = new JPanel(); //use FlowLayout
            buttonPanel.add(openButton);
            buttonPanel.add(clearButton);
            //Add the buttons and the log to this panel.
            add(buttonPanel, BorderLayout.PAGE_START);
            add(radioPanel, BorderLayout.LINE_START);
            add(logScrollPane, BorderLayout.CENTER);
        public void actionPerformed(ActionEvent e) {
            //Handle open button action.
            if (e.getSource() == openButton) {
                int returnVal = fc.showOpenDialog(FileChooserDemo.this);
                if (returnVal == JFileChooser.APPROVE_OPTION) {
                     log.setText("");
                    File file = fc.getSelectedFile();
                    try{
                         BufferedReader in = new BufferedReader(new FileReader(file));
                             String data;
                             while ((data = in.readLine()) != null) {
                                  log.append(data + newline);
                    }catch(IOException ioe){
                log.setCaretPosition(log.getDocument().getLength());
            //Handle save button action.
            }else if (e.getSource() == clearButton) {
                  log.setText("");
         * Create the GUI and show it.  For thread safety,
         * this method should be invoked from the
         * event-dispatching thread.
        private static void createAndShowGUI() {
            //Create and set up the window.
            JFrame frame = new JFrame("PROGRESS Message Viewer");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            //Create and set up the content pane.
            JComponent newContentPane = new FileChooserDemo();
            newContentPane.setOpaque(true); //content panes must be opaque
            frame.setContentPane(newContentPane);
            //Display the window.
            frame.pack();
            frame.setVisible(true);
        public static void main(String[] args) {
            //Schedule a job for the event-dispatching thread:
            //creating and showing this application's GUI.
            javax.swing.SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    createAndShowGUI();
    }

  • Want excute the program accourding to the radio buttons

    hello,
    i am writing an extraction program. here i want to get the out put file in diffrent formats based on the selection on myselection screen.
    if
    I seclect the radio button "EXCEL" the output should be excel file.
    else
    if
    I select the  radio button  "DAT"  the output should be DAT file.
    Thanks,
    vineetha.

    Hi Vineetha,
    Check this program..
    PARAMETERS:p_vbeln LIKE vbrp-vbeln.
    Parameters:EXCEL  radiobutton group GP1.
    Parameters:TEXT  radiobutton group GP1.
    DATA:BEGIN OF it_vbrp OCCURS 0,
         vbeln LIKE vbrp-vbeln,
         posnr LIKE vbrp-posnr,
         meins LIKE vbrp-meins,
         ntgew LIKE vbrp-ntgew,
         END OF it_vbrp.
    START-OF-SELECTION.
         SELECT vbeln
           posnr
           meins
           ntgew FROM vbrp INTO TABLE it_vbrp where vbeln eq p_vbeln.
    if EXCEL = 'X'.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        FILENAME  ='C:\Documents and Settings\Vishnu.Chintala\reddy.xls'
      TABLES
        DATA_TAB                      = IT_VBRP
    EXCEPTIONS
       FILE_WRITE_ERROR              = 1
       NO_BATCH                      = 2
       GUI_REFUSE_FILETRANSFER       = 3
       INVALID_TYPE                  = 4
       NO_AUTHORITY                  = 5
       UNKNOWN_ERROR                 = 6
       HEADER_NOT_ALLOWED            = 7
       SEPARATOR_NOT_ALLOWED         = 8
       FILESIZE_NOT_ALLOWED          = 9
       HEADER_TOO_LONG               = 10
       DP_ERROR_CREATE               = 11
       DP_ERROR_SEND                 = 12
       DP_ERROR_WRITE                = 13
       UNKNOWN_DP_ERROR              = 14
       ACCESS_DENIED                 = 15
       DP_OUT_OF_MEMORY              = 16
       DISK_FULL                     = 17
       DP_TIMEOUT                    = 18
       FILE_NOT_FOUND                = 19
       DATAPROVIDER_EXCEPTION        = 20
       CONTROL_FLUSH_ERROR           = 21
       OTHERS                        = 22
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Endif.
    If TEXT = 'X'.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        FILENAME  ='C:\Documents and Settings\Vishnu.Chintala\reddy2.TXT'
      TABLES
        DATA_TAB                      = IT_VBRP
    EXCEPTIONS
       FILE_WRITE_ERROR              = 1
       NO_BATCH                      = 2
       GUI_REFUSE_FILETRANSFER       = 3
       INVALID_TYPE                  = 4
       NO_AUTHORITY                  = 5
       UNKNOWN_ERROR                 = 6
       HEADER_NOT_ALLOWED            = 7
       SEPARATOR_NOT_ALLOWED         = 8
       FILESIZE_NOT_ALLOWED          = 9
       HEADER_TOO_LONG               = 10
       DP_ERROR_CREATE               = 11
       DP_ERROR_SEND                 = 12
       DP_ERROR_WRITE                = 13
       UNKNOWN_DP_ERROR              = 14
       ACCESS_DENIED                 = 15
       DP_OUT_OF_MEMORY              = 16
       DISK_FULL                     = 17
       DP_TIMEOUT                    = 18
       FILE_NOT_FOUND                = 19
       DATAPROVIDER_EXCEPTION        = 20
       CONTROL_FLUSH_ERROR           = 21
       OTHERS                        = 22
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    endif.

Maybe you are looking for