Creating Dynamic select boxes

Can we create dynamic select boxes which will change when the user selection changes. How many levels we can go about.
For example
we have one combo box named states--> depending upon the states selected the corresponding districts should be shown in the other combo box, and when the user selects a district it should show the corresponding villages or towns and further..
Can we do it without ajax concept. if yes how?
If we have to use ajax one level is easy how to go about two or three levels.
Thanks in advance.

Hi !
ya it is possible to change values of Combobox depending on the value changed in another combobox.
it is possible when you implement Model and by reference of that
model you can change values of that combobox such as.
model1.removeAllItems();
model1.addItemAt(location); etc
inspite of this if you need code help i will provide it to you.

Similar Messages

  • How to create dynamic selection-screen

    Hi all,
    I want to create dynamic selection-screen.in that dynamic selectio-screen i want to display date fields based on table name given in the selection-screen.
    Regards,
    Billa

    Hi Billa,
    Look into the function group SSEL, this has some SAP standard functions to work with dynamic selection screens.
    Below is sample FM, I wrote making use of standard FM from the above. This FM will take table name as input and will display a screen with all the fields within that table for selection. This can also be customized to restrict the fields for display.
    Hope this helps,
    Sumant.
    FUNCTION y_ss_test_dynamic_selection.
    ""Local interface:
    *"  IMPORTING
    *"     REFERENCE(TABNAME) LIKE  DD02L-TABNAME
    *"  EXPORTING
    *"     REFERENCE(DS_CLAUSES) TYPE  RSDS_WHERE
    *"  EXCEPTIONS
    *"      TABLE_NOT_VALID
    *"      OTHER_ERROR
      DATA texpr TYPE rsds_texpr.
      DATA twhere TYPE rsds_twhere.
      DATA trange TYPE rsds_trange.
      DATA BEGIN OF qcat.                    "Selections View for
              INCLUDE STRUCTURE rsdsqcat.    "Free Selectoptions
      DATA END OF qcat.
      DATA BEGIN OF tabs OCCURS 10.
              INCLUDE STRUCTURE rsdstabs.
      DATA END   OF tabs.
      DATA BEGIN OF fields OCCURS 10.
              INCLUDE STRUCTURE rsdsfields.
      DATA END   OF fields.
      DATA BEGIN OF efields OCCURS 10.
              INCLUDE STRUCTURE rsdsfields.
      DATA END   OF efields.
      DATA selid LIKE rsdynsel-selid.
      DATA actnum LIKE sy-tfill.
      DATA title LIKE sy-title VALUE 'Selection Screen'.
      DATA: maxnum LIKE sy-subrc VALUE '69'.
      CLEAR    tabs.
      tabs-prim_tab = tabname.
      COLLECT  tabs.
      DATA: position LIKE dd03l-position.
      DATA: keyflag  LIKE dd03l-keyflag.
      CLEAR fields.
      fields-tablename = tabname.
      fields-sign      = 'I'.
      DATA: step LIKE sy-subrc.
      SELECT fieldname keyflag position
        INTO (fields-fieldname, keyflag, position)
        FROM dd03l
        WHERE tabname = tabname
          AND fieldname NOT LIKE '.INCLU%'
          AND datatype NE 'CLNT'
        ORDER BY position.
        ADD 1 TO step.
        CHECK step LE maxnum.
        IF keyflag <> 'X'.
          efields = fields.
          APPEND efields.
        ENDIF.
        APPEND fields.
      ENDSELECT.
      IF sy-subrc <> 0.
        RAISE table_not_valid.
      ENDIF.
      CALL FUNCTION 'FREE_SELECTIONS_INIT'
           EXPORTING
                expressions              = texpr
                kind                     = 'F'
           IMPORTING
                selection_id             = selid
                expressions              = texpr
                where_clauses            = twhere
                field_ranges             = trange
                number_of_active_fields  = actnum
           TABLES
                tables_tab               = tabs
                fields_tab               = fields
                fields_not_selected      = efields
           EXCEPTIONS
                fields_incomplete        = 01
                fields_no_join           = 02
                field_not_found          = 03
                no_tables                = 04
                table_not_found          = 05
                expression_not_supported = 06
                incorrect_expression     = 07
                illegal_kind             = 08
                area_not_found           = 09
                inconsistent_area        = 10
                kind_f_no_fields_left    = 11
                kind_f_no_fields         = 12
                too_many_fields          = 13.
      IF sy-subrc = 0.
        CALL FUNCTION 'FREE_SELECTIONS_DIALOG'
             EXPORTING
                  selection_id            = selid
                  title                   = title
             IMPORTING
                  where_clauses           = twhere
                  expressions             = texpr
                  field_ranges            = trange
                  number_of_active_fields = actnum
             TABLES
                  fields_tab              = fields
             EXCEPTIONS
                  internal_error          = 01
                  no_action               = 02
                  no_fields_selected      = 03
                  no_tables_selected      = 04
                  selid_not_found         = 05.
        IF sy-subrc = 0.
          CLEAR ds_clauses.
          MOVE tabname TO ds_clauses-tablename.
          READ TABLE twhere WITH KEY ds_clauses-tablename INTO ds_clauses.
          IF sy-subrc <> 0.
            RAISE other_error.
          ENDIF.
        ELSE.
          RAISE other_error.
        ENDIF.
      ELSE.
        RAISE other_error.
      ENDIF.
    ENDFUNCTION.

  • To create Dynamic Selection screen using Key Fields

    Hi All,
    We have a requirement where we want to create Dynamic selection screen using Key fileds of Z-table or any standard table.
    Please provide some solution if you have worked in this area.
    Thanks in Advance,
    Anand Raj Kuruba

    Hi,
    You can use the following statement.
    SELECTION-SCREEN DYNAMIC SELECTIONS FOR NODE|TABLE <node>.
    declares a node <node> of a logical database for dynamic selections in the selection include.
    To use the dynamic selections in the SELECT statements of the subroutine PUT_<node>, you must use the data object DYN_SEL. The data object DYN_SEL is automatically generated in the logical database program as follows:
    TYPE-POOLS RSDS.
    DATA DYN_SEL TYPE RSDS_TYPE.
    You do not have to program these lines yourself. The data object DYN_SEL is available in the database program but not in a connected executable program.
    The type RSDS_TYPE of the data object is defined in the type group RSDS as follows:
    TYPE-POOL RSDS.
    WHERE-clauses ------------------------------
    TYPES: RSDS_WHERE_TAB LIKE RSDSWHERE OCCURS 5.
    TYPES: BEGIN OF RSDS_WHERE,
    TABLENAME LIKE RSDSTABS-PRIM_TAB,
    WHERE_TAB TYPE RSDS_WHERE_TAB,
    END OF RSDS_WHERE.
    TYPES: RSDS_TWHERE TYPE RSDS_WHERE OCCURS 5.
    Expressions Polish notation ---------------
    TYPES: RSDS_EXPR_TAB LIKE RSDSEXPR OCCURS 10.
    TYPES: BEGIN OF RSDS_EXPR,
    TABLENAME LIKE RSDSTABS-PRIM_TAB,
    EXPR_TAB TYPE RSDS_EXPR_TAB,
    END OF RSDS_EXPR.
    TYPES: RSDS_TEXPR TYPE RSDS_EXPR OCCURS 10.
    Selections as RANGES-tables -----------------
    TYPES: RSDS_SELOPT_T LIKE RSDSSELOPT OCCURS 10.
    TYPES: BEGIN OF RSDS_FRANGE,
    FIELDNAME LIKE RSDSTABS-PRIM_FNAME,
    SELOPT_T TYPE RSDS_SELOPT_T,
    END OF RSDS_FRANGE.
    TYPES: RSDS_FRANGE_T TYPE RSDS_FRANGE OCCURS 10.
    TYPES: BEGIN OF RSDS_RANGE,
    TABLENAME LIKE RSDSTABS-PRIM_TAB,
    FRANGE_T TYPE RSDS_FRANGE_T,
    END OF RSDS_RANGE.
    TYPES: RSDS_TRANGE TYPE RSDS_RANGE OCCURS 10.
    Definition of RSDS_TYPE
    TYPES: BEGIN OF RSDS_TYPE,
    CLAUSES TYPE RSDS_TWHERE,
    TEXPR TYPE RSDS_TEXPR,
    TRANGE TYPE RSDS_TRANGE,
    END OF RSDS_TYPE.
    For more information, please check this link.
    http://help.sap.com/saphelp_nw04/helpdata/en/67/93b80914a911d2953c0000e8353423/content.htm
    Regards,
    Ferry Lianto

  • Problems creating dynamic selection screen

    Hi all,
    i'm trying to dynamically generate a selection screen and show it as subscreen using the two function modules FREE_SELECTIONS_INIT and FREE_SELECTIONS_DIALOG. I call the function modules in the PBO of the therefor defined subscreen. The FREE_SELECTIONS_DIALOG fm has the two import parameter "as_subscreen" and "as_window". If i use the "as_window" parameter the selection screen comes up as popup. If i use the "as_subscreen" parameter, i can't see anything in my defined subscreen.
    Any suggestions ?
    Thanks in Advance
    Dirk

    Hi,
    The above requirement is not possible without using logical database.
    The reason is that the compiler identifies the below syntax only inside a LDB program .
    SELECTION-SCREEN DYNAMIC SELECTIONS
                     FOR {NODE|TABLE} node [ID id].
    The above syntax creates a subscreen container on the standard selection screen of the program during generation
    and we are able to view the dynamic selections icon on the selection screen.
    Hence it is not possible to use the FM 'FREE_SELECTIONS_DIALOG' as a subscreen without using a
    logical database of the relevant table.
    However if you dont want to create a new LDB for each table, there is a trick which needs to be performed
    once in your SAP system and all custom programs can use this FM to create a dynamic selection screen
    as a subscreen of the standard selection screen.
    The prerequisite steps are as follows:
    1: Create a dummy  / test database table in SE11 with a single field i.e. for example mandt , matnr
    2: Create a new logical database program for this table in SE36. Save and activate.
    This will create dynamic selections for the fields of the table created in step 1.
    Steps to be followed in the required custom ABAP program to create the dynamic selection screen as a subscreen.
    A: Include the LDB program created in step 2, in the attributes of the custom ABAP program.
    Now when you execute the program, you can see the dynamic selection icon for the dummy table created in step 1.
    B: In your custom program we need to suppress the icon for 'Dynamic Selections' from the standard selection screen.
       We need to perform this action, because the 'Dynamic Selections' icon always triggers a call to the
       dynamic selection screen of the included LDB progam. ( In our case a dummy table created in step 1 ).
       Whereas we want to trigger a call of the dynamic selection screen of our desired table.
       Logic is as follows:
       In 'AT SELECTION-SCREEN OUTPUT' event call the FM RS_SET_SELSCREEN_STATUS to exclude the fcode 'DYNS'.
    C: Add a pushbutton / checkbox on your selection screen to trigger a call to the FM 'FREE_SELECTIONS_INIT' &
       'FREE_SELECTIONS_DIALOG' in the 'AT SELECTION-SCREEN' event.
    D: When the user clicks the pushbutton / checkbox for dynamic selections call the above 2 FM for the desired table
        with the AS_SUBSCREEN flag of FREE_SELECTIONS_DIALOG = 'X'
    Result: Your dynamic selections screen will be created as a subscreen of the standard selection screen and not as a pop-up.
    Advantage: With the creation of the single custom table & LDB, you are now able to create dynamic selections as subscreen
    in any program in the system. All we need to do is follow the steps A, B & C in each program.
    Note: Your other restrictions with dynamic selection screen ie. submit in background , save as variant still remain and
    you need to handle them accordingly.
    let me know if you need sample code.
    Regards,
    Bhawit Kumar

  • DYNAMIC SELECT BOX

    The problem is that the second select box is not displaying what is the wrong in the code
    <html>
    <head>
    <script>
    function setList(theList) {
    switch (theList) {
    case 1 : {
    document.theForm.mySelect.options[0].value="50THD-OZAM";
    document.theForm.mySelect.options[1].value="ABABA-BALB";
    document.theForm.mySelect.options[2].value="BALAB-KIDA";
    document.theForm.mySelect.options[3].value="CALIC-BABA";
    document.theForm.mySelect.options[4].value="GUTAO-DINE";
    document.theForm.mySelect.options[5].value="";
    document.theForm.mySelect.options[6].value="";
    document.theForm.mySelect.options[7].value="";
    document.theForm.mySelect.options[0].selected=true;
    document.theForm.radioButton[0].checked=true;
    break;
    case 2 : {
    document.theForm.mySelect.options[0].value="AGON";
    document.theForm.mySelect.options[1].value="AJUY";
    document.theForm.mySelect.options[2].value="Abay";
    document.theForm.radioButton[1].checked=true;
    break;
    case 3 : {
    document.theForm.mySelect.options[0].value="KAL";
    document.theForm.mySelect.options[1].value="ILO ";
    document.theForm.mySelect.options[2].value="LEY";
    document.theForm.radioButton[2].checked=true;
    break;
    setOptionText();
    function setOptionText() {
    document.theForm.mySelect.options[0].text=document.theForm.mySelect.options[0].value;
    document.theForm.mySelect.options[1].text=document.theForm.mySelect.options[1].value;
    document.theForm.mySelect.options[2].text=document.theForm.mySelect.options[2].value;
    var group=new Array(document.theForm.mySelect.options.length)
    for (i=0; i<document.theForm.mySelect.options.length; i++)
    group=new Array()
    group[0][0]=new Option("---Select2---"," ");
    group[1][0]=new Option("Now Select This One"," ");
    group[1][1]=new Option("C","3");
    group[1][2]=new Option("DA","2");
    group[1][3]=new Option("DB","1");
    group[2][0]=new Option("Now Select This One"," ");
    group[2][1]=new Option("A","5");
    function redirect(x)
    var i=document.theForm.mySelect.options.length
    for (m=0;m<i;m++)
    for (i=0;i<group[x].length;i++)
    document.theForm.stage2.options[i]=new Option(group[x][i].text,group[x][i].value)
    </script>
    </head>
    <body onload="setList(1)">
    <form name="theForm" onreset="setList(1)">
    BirthPlace is:<br>
    <input checked name="radioButton" type="radio" value="Brgy" onclick="setList(1)">Brgy&&
    <input name="radioButton" type="radio" value="MuniCity" onclick="setList(2)">Muni/city&&
    <input name="radioButton" type="radio" value="Province" onclick="setList(3)">Province<hr>
    <select name="mySelect" onChange="redirect(this.options.selectedIndex)">
    <option value=""></option>
    <option value=""></option>
    <option value=""></option>
    <option value=""></option>
    <option value=""></option>
    <option value=""></option>
    <option value=""></option>
    </select>
    <select name="stage2" size="1" >
    <option value=" " > </option>
    <option value=" " ></option>
    <option value=""></option>
    <option value=""></option>
    <option value=""></option>
    <option value=""></option>
    <option value=""></option>
    </select>
    <br><br>
    </form>
    </body>
    </html>

    hello mate,
    you can just use another javascript code for your application since it seems that( as well as i understood ) you couldn't set the array if user make a selection.
    A few times ago i had a probelm like that but i used the below code..
    Here the DynamicOptionList.js file and source code:
    you just call this code from your html page like this :
    <SCRIPT LANGUAGE="JavaScript" SRC="DynamicOptionList.js"></SCRIPT>
    //STARTS HERE DynamicOptionList.js
    // CONSTRUCTOR
    // Pass in the name of the element, then the names of the lists it depends on
    function DynamicOptionList() {
         if (arguments.length < 2) { alert("Not enough arguments in DynamicOptionList()"); }
         // Name of the list containing dynamic values
         this.target = arguments[0];
         // Set the lists that this dynamic list depends on
         this.dependencies = new Array();
         for (var i=1; i<arguments.length; i++) {
              this.dependencies[this.dependencies.length] = arguments;
         // The form this list belongs to
         this.form = null;
         // Place-holder for currently-selected values of dependent select lists
         this.dependentValues = new Object();
         // Hold default values to be selected for conditions
         this.defaultValues = new Object();
         // Storage for the dynamic values
         this.options = new Object();
         // Delimiter between dependent values
         this.delimiter = "|";
         // Logest string currently a potential options (for Netscape)
         this.longestString = "";
         // The total number of options that might be displayed, to build dummy options (for Netscape)
         this.numberOfOptions = 0;
         // Method mappings
         this.addOptions      = DynamicOptionList_addOptions;
         this.populate           = DynamicOptionList_populate;
         this.setDelimiter     = DynamicOptionList_setDelimiter;
         this.setDefaultOption      = DynamicOptionList_setDefaultOption;
         this.printOptions      = DynamicOptionList_printOptions;
         this.init           = DynamicOptionList_init;
    // Set the delimiter to something other than | when defining condition values
    function DynamicOptionList_setDelimiter(val) {
         this.delimiter = val;
    // Set the default option to be selected when the list is painted
    function DynamicOptionList_setDefaultOption(condition, val) {
         if (typeof this.defaultValues[condition] == "undefined" || this.defaultValues[condition]==null) {
              this.defaultValues[condition] = new Object();
         for (var i=1; i<arguments.length; i++) {
              this.defaultValues[condition][arguments[i]]=1;
    // Init call to map the form to the object and populate it
    function DynamicOptionList_init(theform) {
         this.form = theform;
         this.populate();
    // Add options to the list.
    // Pass the condition string, then the list of text/value pairs that populate the list     
    function DynamicOptionList_addOptions(dependentValue) {
         if (typeof this.options[dependentValue] != "object") { this.options[dependentValue] = new Array(); }
         for (var i=1; i<arguments.length; i+=2) {
              // Keep track of the longest potential string, to draw the option list
              if (arguments[i].length > this.longestString.length) {
                   this.longestString = arguments[i];
              this.numberOfOptions++;
              this.options[dependentValue][this.options[dependentValue].length] = arguments[i];
              this.options[dependentValue][this.options[dependentValue].length] = arguments[i+1];
    // Print dummy options so Netscape behaves nicely
    function DynamicOptionList_printOptions() {
         // Only need to write out "dummy" options for Netscape
    if ((navigator.appName == 'Netscape') && (parseInt(navigator.appVersion) <= 4)){
              var ret = "";
              for (var i=0; i<this.numberOfOptions; i++) {
                   ret += "<OPTION>";
              ret += "<OPTION>"
              for (var i=0; i<this.longestString.length; i++) {
                   ret += "_";
              document.writeln(ret);
    // Populate the list
    function DynamicOptionList_populate() {
         var theform = this.form;
         var i,j,obj,obj2;
         // Get the current value(s) of all select lists this list depends on
         this.dependentValues = new Object;
         var dependentValuesInitialized = false;
         for (i=0; i<this.dependencies.length;i++) {
              var sel = theform[this.dependencies[i]];
              var selName = sel.name;
              // If this is the first dependent list, just fill in the dependentValues
              if (!dependentValuesInitialized) {
                   dependentValuesInitialized = true;
                   for (j=0; j<sel.options.length; j++) {
                        if (sel.options[j].selected) {
                             this.dependentValues[sel.options[j].value] = true;
              // Otherwise, add new options for every existing option
              else {
                   var tmpList = new Object();
                   var newList = new Object();
                   for (j=0; j<sel.options.length; j++) {
                        if (sel.options[j].selected) {
                             tmpList[sel.options[j].value] = true;
                   for (obj in this.dependentValues) {
                        for (obj2 in tmpList) {
                             newList[obj + this.delimiter + obj2] = true;
                   this.dependentValues = newList;
         var targetSel = theform[this.target];
         // Store the currently-selected values of the target list to maintain them (in case of multiple select lists)
         var targetSelected = new Object();
         for (i=0; i<targetSel.options.length; i++) {
              if (targetSel.options[i].selected) {
                   targetSelected[targetSel.options[i].value] = true;
         targetSel.options.length = 0; // Clear all target options
         for (i in this.dependentValues) {
              if (typeof this.options[i] == "object") {
                   var o = this.options[i];
                   for (j=0; j<o.length; j+=2) {
                        var text = o[j];
                        var val = o[j+1];
                        targetSel.options[targetSel.options.length] = new Option(text, val, false, false);
                        if (typeof this.defaultValues[i] != "undefined" && this.defaultValues[i]!=null) {
                             for (def in this.defaultValues[i]) {
                                  if (def == val) {
                                       targetSelected[val] = true;
         targetSel.selectedIndex=-1;
         // Select the options that were selected before
         for (i=0; i<targetSel.options.length; i++) {
              if (targetSelected[targetSel.options[i].value] != null && targetSelected[targetSel.options[i].value]==true) {
                   targetSel.options[i].selected = true;
    //********** ENDS HERE
    now the html page and how the trick is going :
    <HTML>
    <HEAD>
    <META CONTENT="text/html; charset=windows-1254" HTTP-EQUIV="Content-Type">
    <META CONTENT="text/html; charset=iso-8859-9" HTTP-EQUIV="Content-Type">
         <TITLE>JavaScript Toolbox - Dynamic Option List</TITLE>
    <SCRIPT LANGUAGE="JavaScript" SRC="C:\WINNT\Profiles\calisirmu\Desktop\javaScripts\DynamicOptionList.js"></SCRIPT>
    <SCRIPT LANGUAGE="JavaScript">
    // First example
    var listB = new DynamicOptionList("B","A");
    //first initialize parameters
    listB.addOptions("CARs",
              "BMW","BMW",
              "PEUGEOT","PEUGEOT",
              "PORSCHE","PORSCHE",
              "TOYOTA","TOYOTA");     
    listB.addOptions("MOTORCYCLEs",
              "HONDA","HONDA",
              "KAWASAKI","KAWASAKI");
    listB.addOptions("FORMULA CARS",
              "FERRARI","FERRARI",
              "MERCEDES","MERCEDES",
              "JAGUAR","JAGUAR");
    //set default options
    listB.setDefaultOption("CARs","PORSCHE");
    listB.setDefaultOption("MOTORCYCLEs","HONDA");
    listB.setDefaultOption("FORMULA CARS","FERRARI");
    var listC = new DynamicOptionList("C","A","B");
    listC.addOptions("CARs|PORSCHE","911 TURBO GT2","911 TURBO GT2",
                        "MOBY DICK","MOBY DICK",
                        "GT1 RACE VERSION","GT1 RACE VERSION");
    listC.setDefaultOption("CARs|PORSCHE","911 TURBO GT2");
    listC.addOptions("CARs|BMV","750 IL","750 IL");
    listC.addOptions("CARs|PEUGEOT","406","406");
    listC.addOptions("CARs|TOYOTA","AVENSIS","AVENSIS");
    listC.addOptions("MOTORCYCLEs|HONDA","SUPER 5000","SUPER 5000");
    listC.setDefaultOption("MOTORCYCLEs|HONDA","SUPER 5000");
    listC.addOptions("MOTORCYCLEs|KAWASAKI","SUPER KACAR","SUPER KACAR");
    listC.addOptions("MOTORCYCLEs|KAWASAKI","YAVAS GIDER","YAVAS GIDER");
    listC.addOptions("MOTORCYCLEs|KAWASAKI","ANCA GIDER","ANCA GIDER");
    listC.addOptions("FORMULA CARS|FERRARI","F1 2000","F1 2000");
    listC.setDefaultOption("FORMULA CARS|FERRARI","F1 2000");
    listC.addOptions("FORMULA CARS|MERCEDES","CLK","CLK");
    listC.addOptions("FORMULA CARS|JAGUAR","SALLA GITSIN","SALLA GITSIN");
    function init() {
         var theform = document.forms[0];
         listB.init(theform);
         listC.init(theform);
         listE.init(theform);
         listF.init(theform);
    </SCRIPT>
    </HEAD>
    <BODY BGCOLOR=#FFFFFF LINK="#00615F" VLINK="#00615F" ALINK="#00615F" onLoad="init()">
    <BR><BR>
    <BR>
    <FORM ACTION="" METHOD="" name="Form1">
    <BR>
    <TABLE BORDER="0">
    <TR bgcolor="#ffffe6">
         <TH >TYPE</TH>
         <TH>NAME</TH>
         <TH>MODEL</TH>
    </TR>
    <TR>
         <TD>
              <SELECT NAME="A" onChange="listB.populate();listC.populate();">
                   <OPTION VALUE="CARs">CARs
                   <OPTION VALUE="MOTORCYCLEs">MOTORCYCLEs
                   <OPTION VALUE="FORMULA CARS">FORMULA CARS
              </SELECT>
         </TD>
         <TD>
              <SELECT NAME="B" onChange="listC.populate();">
                   <SCRIPT LANGUAGE="JavaScript">listB.printOptions()</SCRIPT>
              </SELECT>
         </TD>
         <TD>
              <SELECT NAME="C">
                   <SCRIPT LANGUAGE="JavaScript">listC.printOptions()</SCRIPT>
              </SELECT>
         </TD>
    </TR>
    </TABLE>
    </FORM>
    </BODY>
    </HTML>
    you save this html page as xxx.html and thane run it.
    I hope this is beneficial for you.
    mcaldeveloper :-)

  • Creating dynamic select list

    I have a dynamic select list populated by site names and URLs from a map; when a user clicks on an entry the site name and URL will fill two text boxes. There are also buttons to add, update, and delete entries. These buttons lead to actions within my JPF file.
              When I select an entry to delete, the script runs a delete SQL statement again my Ora db instance, then the page content is repopulated. I want to know how come when I do that I always get the sequence ID of the just deleted entry at the end of my select list.
              Here is a snippet of what I've got:
              JSP:
                        <netui:select
                dataSource="{actionForm.siteList[0]}"
                optionsDataSource="{actionForm.itemOptions}"
                size="4"
                tagId="siteList">
              <netui:textBox
                dataSource="{actionForm.title}"
                size="30" maxlength="200" tagId="title"/>
              <netui:textBox
                dataSource="{actionForm.url}"
                size="30" maxlength="200" tagId="url"/>
              <netui:hidden dataSource="{actionForm.key}"
                tagId="key"/>
              <script language="javascript">
                <!--
                <%=session.getAttribute("jsArray")%>
                  function siteClicked()
                    var index =
                      document[getNetuiTagName("process",this)]
                      [getNetuiTagName("siteList",this)][
                        document[getNetuiTagName("process",this)]
                        [getNetuiTagName("siteList",this)]
                        .selectedIndex]
                      .value
                    document[getNetuiTagName("process",this)]
                    [getNetuiTagName("key",this)].value
                      = index;
                    document[getNetuiTagName("process",this)]
                    [getNetuiTagName("title",this)].value
                      = siteArray[ index ][0];
                    document[getNetuiTagName("process",this)]
                    [getNetuiTagName("url",this)].value
                      = siteArray[ index ][1];
                -->
              </script>
                                  JPF:
                        Connection conn = null;
              query = "delete from stlnt_other_ref_sites " +
                      "where stlnt_ors_site_id = " + form.getKey();
              try {
                pstmt = conn.prepareStatement( query );
                pstmt.executeUpdate();
              } catch (SQLException ex) {
              try {
                Map map = new LinkedHashMap();
                while ( rs.next() )
                  map.put(new Integer(rs.getInt(1)), rs.getString(2));
                  jsArray += "siteArray[" + rs.getInt(1)
                    + "]=new Array(\"" + rs.getString(2)
                    + "\",\"" + rs.getString(3) + "\");";
                  hasResults = true;
                options = map;
                getSession().setAttribute("jsArray",jsArray);
                getSession().setAttribute("hasResults",
                  String.valueOf(hasResults));
              } catch (SQLException ex) {
              

    OK I got it working... Mostly... I don't know if it was a combination of changes that made the difference, but I'll put down what I did. First, I switched my select object in the form bean into just a string type from a string array (it was allowing the selection of one entry anyways). Second, rather than just blanking out the options map, I also blanked out the select object [eg form.setSelect("")].
              Now when I select an entry and click delete, the resulting select list is short one visible element. However, you can still select the blank spot where that last entry used to be. However, this is not a huge issue for me now; I will investigate this at a later time.

  • Error in creating dynamic select list

    Hi all,
    I am creating a select list at runtime by using the following code.
    While submitting, I got error.
    ERROR:
    ORA-06550: line 13, column 1: PLS-00428: an INTO clause is expected in this SELECT statement
    My Code behind is:
    SELECT HTMLDB_ITEM.SELECT_LIST_FROM_QUERY_XL(1,ename,'select distinct ename r, ename t from emp') FROM emp;
    Then I modified the above code as :
    SELECT HTMLDB_ITEM.SELECT_LIST_FROM_QUERY_XL(1,ename,'select distinct ename r, ename t from emp') [b]into test FROM emp;
    (NOTE:where datatype of test is CLOB)
    I am getting following error:
    ORA-01422: exact fetch returns more than requested number of rows
    Can anybody tell me, what should be the datatype of test to get rid of this error OR is there some other way to overcome this problem?
    Thanks,
    Dinesh

    OK I got it working... Mostly... I don't know if it was a combination of changes that made the difference, but I'll put down what I did. First, I switched my select object in the form bean into just a string type from a string array (it was allowing the selection of one entry anyways). Second, rather than just blanking out the options map, I also blanked out the select object [eg form.setSelect("")].
              Now when I select an entry and click delete, the resulting select list is short one visible element. However, you can still select the blank spot where that last entry used to be. However, this is not a huge issue for me now; I will investigate this at a later time.

  • How to create editable select box in jsp page

    hi,
    i got som peculiar requirement in my jsp page.i have my page like this.
    <html>
    <body>
    <form name="test">
    <select name="test">
    <option value="one">USA</option>
    <option value="two">India</option>
    <option value="three">UAE</option>
    </select>
    </body>
    </html>
    this is one of the select box in my jsp page.
    now i want to change the look and feel of select box..
    1-dont want to show the scrollbar means the right side arrow which allows to see the total options in select box.
    it should look like normal text box.
    2-roveer apert from the existing values if there is no matching value user must be allowed to enter his own value in above select box..
    how i can solve this problen..
    regards,
    sam

    Is that maybe a browser memory auto-complete thing? It works on Netscape 7.2. But no, it's not a browser auto-complete thing (does NS have that? IE does... either way, I would've disabled that). It's definitely a Javascript trick, I'm sure of that. I know I haven't sent mail to all people in my address book from my work PC, but it doesn't stop them from showing in the list as I type...
    Unless there is a special HTML tag option or browser extension that I've never heard of that allows you to supply a set of values to a text input field for auto-completion (as opposed to the browser remembering what was typed).

  • Problem in creating dynamic select-options creating from ';' seperated file

    Hi all,
    My requriement is selection screen fields will come from a flat file like below(first row is field names and remaining r field values)
    For example for VBAK table
    VBELN;VKORG;VTWEG;SPART
    3999202;B227;BD;XX
    file can be vary(number of fields)  and based on table .
    Please let me know how can i convert this file in to the selection-screen fields and how can i pass these values in the select statement WHERE condition....
    Thank you very much,
    Krishna D

    Hi,
    First Split the Data using Field Symbold.Because you don't know how many fields are there in the text file.
    Pass the values to the below Syntax
    SELECTION-SCREEN DYNAMIC SELECTIONS FOR NODE|TABLE <node>.
    declares a node <node> of a logical database for dynamic selections in the selection include.
    You have an Example in the Below Link.
    http://help.sap.com/SAPhelp_nw04/helpdata/en/67/93b80914a911d2953c0000e8353423/content.htm
    Thanks,
    Venkat.
    Edited by: Venkatesh Kolluru on Mar 4, 2011 6:32 AM
    Edited by: Venkatesh Kolluru on Mar 4, 2011 6:32 AM

  • Create dynamically  check box

    hi,
    i need a sample code to create a check box dynamically

    JCheckBox checkBox = new JCheckBox(...);
    somePanel.add( checkBox );
    somePanel.revalidate();

  • How to create Dynamic Selection List containg file names of a directory?

    Hi,
    I need a Selection List with a Dynamic List of Values containing all file names of a particular directory (can change through the time).
    Basically, I need an Iterator over all file names in a directory, which could be used for Selection List in a JSF form.
    This iterator has nothing to do with a database, but should get the names directly from the file system (java.io.File).
    Can anybody tell me how to create such an iterator/selection list?
    I am working with JDeveloper 10.1.3.2, JSF and Business Services.
    Thank you,
    Igor

    Create a class like this:
    package list;
    import java.io.File;
    public class fileList {
        public fileList() {
        public String[] listFiles(){
        File dir = new File("c:/temp");
        String[] files = dir.list();
        for (int i = 0; i < files.length; i++)  {
                System.out.println(files);
    return files;
    Right click to create a data control from it.
    Then you can drag the return value of the listFiles method to a page and drop as a table for example.
    Also note that the Content Repository data control in 10.1.3.2 has the file system as a possible data source.

  • Dynamic check box

    Hi I need help from all java expertise, I need to create dynamic check boxes. table have the customer name, one customer have multiple locations, on selection of customer name, all the locations should be displayed with chek box option, so that the user will allocate some rebate or ajustment to a particular location. How to achive this. any help will be appericiated
    thanks

    Lets assume that you got your customer information and everything is stored in a ResultSet rs
    The value of the radio buttons in this case will be the customer name but you can change it
    to whatever you want that way you can get the parameter accordingly to do your updates.
    <%
    ResultSet rs = ....... ;
    for( int n = 1; n <= rs.size(); n++ )
    while (rs.next()) {
    String custName = rs.getString("CUSTOMER_NAME");
    String custLoc = rs.getString("CUSTOMER_LOCATION");
    %>
    <tr>
    <td BGCOLOR="#FFFFCE" valign="top" align="left"><input type="radio" name="radioButton" value="<%=custName%>"> </td>
    <td BGCOLOR="#FFFFCE" valign="top" align="left"><%=custName%> </td>
    <td BGCOLOR="#FFFFCE" valign="top" align="left"><%=custLoc%> </td>
    </tr>
    <% } // end while loop
    } // end for loop
    %>
    </table>

  • Apex with dynamic check box....

    hi to all:
    i have report emp.it contain data like eno,ename,sal,record .
    example:eno ename sal record
    100 a 100
    200 b 3000 going on...
    using this column i am making report by using apex and report contain one submit button also.
    1)in this report i am creating dynamic check box depend on eno..see my coding
    declare
    str varchar2(3000);
    begin
    str:='select htmldb_item.CHECKBOX(10,eno,DECODE(record,1,''CHECKED'')) "SELECT" ,eno,ename,sal ,record from emp where 1=1';
    return str;
    end;
    2)in process created after  submit
    iam created pl/code like ..this code for
    declare
    i number;
    str varchar2(2000);
    emp_id number;
    begin
    FOR i in 1..HTMLDB_APPLICATION.G_F10.count
    LOOP
    IF HTMLDB_APPLICATION.G_F10(i) is not null then
    SELECT htmldb_application.G_F10(i) INTO emp_id from dual;
    --insert into my_log values(emp_id);commit;
    update emp set record=1 where eno=emp_id ;
    commit;
    else if HTMLDB_APPLICATION.G_F10(i) is null then
    update emp set record=0 where eno=emp_id ;
    commit;
    else
    null;
    end if;
    end loop;
    end;
    my requirenent:
    a)if check box checked then -update -record column -1
    b)if check box uncked then -update - record column -0
    in process coding--
    eno alway is not null only..
    so i want to do check box with update the record column..like this
    a)if check box checked then -update -record column -1
    b)if check box uncked then -update - record column -0
    pls give solution.
    output i want like this example:
    chebox eno ename sal record
    checked(X) 100 a 300 1
    checked(x) 200 b 300 1
    next time i am trying to make uncheck first row like
    chebox eno ename sal record
    unchecked 100 a 300 0
    checked(x) 200 b 300 1

    Hi VKR,
    Please try this,
    <cfform name="frmTest"  format="Flash" action="test.cfm" method="post"  >
    <cfscript>
        qryCountry = queryNew("Country,CountryID");   
          queryAddRow(qryCountry);  
          querySetCell(qryCountry, "Country", "India");  
          querySetCell(qryCountry, "CountryID", "1");  
          queryAddRow(qryCountry);  
          querySetCell(qryCountry, "Country", "England");
           querySetCell(qryCountry, "CountryID", "2");    
          queryAddRow(qryCountry);  
          querySetCell(qryCountry, "Country", "Kenya");
           querySetCell(qryCountry, "CountryID", "3");      
    </cfscript>   
        <cfformgroup type="repeater"  query="qryCountry">                       
            <cfinput type="checkbox" value="{qryCountry.currentItem.CountryID}" name="chk" Label="{qryCountry.currentItem.Country}">                               
        </cfformgroup>
        <cfinput type="submit" name="submit" width="100" value="Submit"  >
    </cfform>
    Hope this will help

  • Dynamic Selection on report not working

    Dear all,
    I have several reports on which the dynamic selection is not working. For instance, the report CN43N. The report is outputting all data in a year i.e it is disregarding the condition I specified in the dynamic selection fields.
    Is there some configuration to make to this report so that the dynamic selection works?
    Thanks for ur help.
    Nas

    Also Nelmaz,
    I have just checked OSS notes and found below note helpful to you:
    Note 1059465 - CN43N: Dynamic selections for scheduling data of WBS elemnts
    Symptom
    You cannot use transaction CN43N to create dynamic selections for scheduling data of WBS elements (table PRTE). You can use transaction CNS43 to do so.
    Hope this helps.
    Please assign points as way to say thanks

  • How to populate select boxes in custom work flows?

    We are trying to create a workflow that allows users to select a few item details from a select box inside the form. I created the select box but I can't figure out how to populate it with elements. I've been reluctant to post here because this question seems so straight forward but I haven't been able to find the answer and don't want waste more time searching for this answer. Please help!
    Thanks,
    Richard

    Sorry for the trouble, I found the answer. I was looking in all the wrong places. Thanks anyway!
    Richard

Maybe you are looking for

  • Planing In PCA

    Hi Experts, My Client wants to Copy planning data from Version 1 to Version 0 in PCA. This because planning data for some Profit centers were wrongly recorded in Version 1 instead of Version 0. Can it be possible to copy Planning data from Ver. 1 to

  • Ableton live

    Trying to render audio from live's master outputs but keep getting the following message and most of the time no audio:- "/users/name/Library/Caches/Cleanup At Startup/name was not found. If I turn the laptop off and on again it sometimes works. Mac

  • Music is out of sync with slides after exporting to iDVD.. what to do?

    I created a slideshow in iPhoto and spent hours getting exactly the right music and transitions. I then sent it to iDVD to burn a dvd of the completed slideshow, however the music is no longer in sync with the slides and actually stops abruptly a cou

  • Transcoding 50fps footage in FCP7 that's shot with the HVX?

    How do I transcode DVCPRO HD which has been shot in 50fps to 50fps? Videorate says it's 25fps, compression says it's 720p50. Cinema tools I guess? I have many clips so is there a way to do them all at once?

  • ConnectinG external HD FW800 TO FW400

    i am just starting with Final Cut Express 4 and i have an external hard drive connection question. as the FireWire400 port is in use on the back of my iMac, can i connect to a FW400 on my external G-Drive from the FW800 port on the iMac? on an amusin