Dynamic Table Creation & Fill Up

Hello,
Can anyone please guide where I can find examples for dynamic table creation (programmaticaly), with dynamic number of columns and rows, used to place inside text components (or whatever) to fill them with data.
All programmatic.
Using JSF, ADF BC
JDeveloper 10.1.3.1
Thanks
Message was edited by:
RJundi

Hi,
Meybe this article helps: http://technology.amis.nl/blog/?p=2306
Kuba

Similar Messages

  • Why dynamic table creation with struts working only for JDK1.3.1_02 version

    Row
    import java.util.Vector;
    public class Row
    private static int colsize;
    private Column[] columns;
    public void setColumns(Column[] columns)
    System.out.println("SetColumns");
    this.columns = columns;
    public void setColumn(int i, Column column)
         System.out.println("setting"+ i+"th column"+column);
    public Column[] getColumns()
    return null;
    public Column getColumns(int i)
    System.out.println("Column"+i);
    System.out.println("Colsize"+colsize);
    if(columns == null)
    columns= new Column[colsize];
    if(columns[i] == null)
    columns[i] = new Column();
    return columns;
    public int getColsize()
         return colsize;
    public static void setColsize(int size)
         colsize = size;
    Column:
    public class Column
    private String value;
    public void setValue(String value)
    System.out.println("Value="+value);
    this.value = value;
    public String getValue()
    return value;
    ApplicationResources:
    button.cancel=Cancel
    button.confirm=Confirm
    button.reset=Reset
    button.save=Save
    database.load=Cannot load database from {0}
    error.database.missing=<li>User database is missing, cannot validate logon credentials</li>
    error.fromAddress.format=<li>Invalid format for From Address</li>
    error.fromAddress.required=<li>From Address is required</li>
    error.fullName.required=<li>Full Name is required</li>
    error.host.required=<li>Mail Server is required</li>
    error.noSubscription=<li>No Subscription bean in user session</li>
    error.password.required=<li>Password is required</li>
    error.password2.required=<li>Confirmation password is required</li>
    error.password.match=<li>Password and confirmation password must match</li>
    error.password.mismatch=<li>Invalid username and/or password, please try again</li>
    error.replyToAddress.format=<li>Invalid format for Reply To Address</li>
    error.transaction.token=<li>Cannot submit this form out of order</li>
    error.type.invalid=<li>Server Type must be 'imap' or 'pop3'</li>
    error.type.required=<li>Server Type is required</li>
    error.username.required=<li>Username is required</li>
    error.username.unique=<li>That username is already in use - please select another</li>
    errors.footer=</ul><hr>
    errors.header=<h3><font color="red">Validation Error</font></h3>You must correct the following error(s) before proceeding:<ul>
    errors.ioException=I/O exception rendering error messages: {0}
    heading.autoConnect=Auto
    heading.subscriptions=Current Subscriptions
    heading.host=Host Name
    heading.user=User Name
    heading.type=Server Type
    heading.action=Action
    index.heading=MailReader Demonstration Application Options
    index.logon=Log on to the MailReader Demonstration Application
    index.registration=Register with the MailReader Demonstration Application
    index.title=MailReader Demonstration Application (Struts 1.0-b1)
    index.tour=A Walking Tour of the Example Application
    linkSubscription.io=I/O Error: {0}
    linkSubscription.noSubscription=No subscription under attribute {0}
    linkUser.io=I/O Error: {0}
    linkUser.noUser=No user under attribute {0}
    logon.title=MailReader Demonstration Application - Logon
    mainMenu.heading=Main Menu Options for
    mainMenu.logoff=Log off MailReader Demonstration Application
    mainMenu.registration=Edit your user registration profile
    mainMenu.title=MailReader Demonstration Application - Main Menu
    option.imap=IMAP Protocol
    option.pop3=POP3 Protocol
    prompt.autoConnect=Auto Connect:
    prompt.fromAddress=From Address:
    prompt.fullName=Full Name:
    prompt.mailHostname=Mail Server:
    prompt.mailPassword=Mail Password:
    prompt.mailServerType=Server Type:
    prompt.mailUsername=Mail Username:
    prompt.password=Password:
    prompt.password2=(Repeat) Password:
    prompt.replyToAddress=Reply To Address:
    prompt.username=Username:
    registration.addSubscription=Add
    registration.deleteSubscription=Delete
    registration.editSubscription=Edit
    registration.title.create=Register for the MailReader Demostration Application
    registration.title.edit=Edit Registration for the MailReader Demonstration Application
    subscription.title.create=Create New Mail Subscription
    subscription.title.delete=Delete Existing Mail Subscription
    subscription.title.edit=Edit Existing Mail Subscription
    LogonForm
    import javax.servlet.http.HttpServletRequest;
    import org.apache.struts.action.ActionError;
    import org.apache.struts.action.ActionErrors;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionMapping;
    public class LogonForm extends ActionForm
    private String username;
    private String password;
    private String errors;
    public String getUsername()
    return username;
    public void setUsername(String username)
    this.username = username;
    public void setPassword(String password)
    this.password = password;
    public String getPassword()
    return password;
    public String getErrors()
         return errors;
    public void setErrors(String errors)
         this.errors = errors;
    public ActionErrors validate(ActionMapping mapping,
    HttpServletRequest request) {
    ActionErrors errors = new ActionErrors();
    if ((username == null) || (username.length() < 1))
    errors.add("username", new ActionError("error.username.required"));
    if ((password == null) || (password.length() < 1))
    errors.add("password", new ActionError("error.password.required"));
    return errors;
    TableForm
    import org.apache.struts.action.ActionForm;
    import java.util.Vector;
    public class TableForm extends ActionForm
    private static int rowsize;
    private Row[] rows;
    public Row getRows(int i)
    System.out.println("Row"+i);
    System.out.println("Rowsize"+rowsize);
    if(rows == null)
    rows = new Row[rowsize];
    if(rows[i] == null)
    rows[i] = new Row();
    return rows[i];
    public Row[] getRows()
         return null;
    public void setRows(Row[] rows)
         System.out.println("SetRows");
         // this.rows=rows;
    public static void setRowsize(int size)
         rowsize = size;
    public int getRowSize()
         return rowsize;
    LogonAction
    import java.io.IOException;
    import java.util.Hashtable;
    import java.util.Locale;
    import javax.servlet.RequestDispatcher;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpSession;
    import javax.servlet.http.HttpServletResponse;
    import org.apache.struts.action.Action;
    import org.apache.struts.action.ActionError;
    import org.apache.struts.action.ActionErrors;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionForward;
    import org.apache.struts.action.ActionMapping;
    import org.apache.struts.action.ActionServlet;
    import org.apache.struts.util.MessageResources;
    public class LogonAction extends Action
    public ActionForward execute(ActionMapping mapping,
                        ActionForm form,
                        HttpServletRequest request,
                        HttpServletResponse response)
         throws IOException, ServletException {
    LogonForm logonForm = (LogonForm) form;
    System.out.println(logonForm);
    System.out.println(logonForm.getUsername());
    System.out.println(logonForm.getPassword());
    if(logonForm.getUsername().equals("test") && logonForm.getPassword().equals("test"))
    //TableForm tform = new TableForm();
    //tform.setRowsize(2);
    //tform.getRows(0).setColsize(2);
    //tform.getRows(1).setColsize(2);
    //request.getSession().setAttribute("tableForm",tform);
         System.out.println("Table Form setRowSize");
    TableForm.setRowsize(2);
         System.out.println("Table Form set ColSize");
    Row.setColsize(2);
         System.out.println("Returning success");
    return mapping.findForward("success");
    else
              ActionErrors errors = new ActionErrors();
              errors.add("password",
    new ActionError("error.password.mismatch"));
    saveErrors(request, errors);
    //logonForm.setErrors("LoginError");
    return mapping.findForward("failure");
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <!DOCTYPE struts-config PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 1.0//EN"
    "http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd">
    <!--
    This is the Struts configuration file for the example application,
    using the proposed new syntax.
    NOTE: You would only flesh out the details in the "form-bean"
    declarations if you had a generator tool that used them to create
    the corresponding Java classes for you. Otherwise, you would
    need only the "form-bean" element itself, with the corresponding
    "name" and "type" attributes.
    -->
    <struts-config>
    <form-beans>
    <!-- Logon form bean -->
    <form-bean name="logonForm"
    type="LogonForm"/>
    <form-bean name="tableForm"
    type="TableForm"/>
    <form-bean name="profileForm"
    type="ProfileForm"/>
    </form-beans>
    <global-forwards>
    <forward name="success" path="/Profile.jsp"/>
    </global-forwards>
    <!-- ========== Action Mapping Definitions ============================== -->
    <action-mappings>
    <!-- Edit user registration -->
    <action path="/logon"
    type="LogonAction"
    name="logonForm"
    scope="request"
    validate="false"
    input="/Test.jsp">
    <forward name="success" path="/Table.jsp"/>
    <forward name="failure" path="/Test.jsp"/>
    </action>
    <action path="/table"
    type="TableAction"
    name="tableForm"
    scope="request"
    validate="false">
    <forward name="success" path="/Bean.jsp"/>
    <forward name="failure" path="/Table.jsp"/>
    </action>
    <action path="/profile"
    type="ProfileAction"
    name="profileForm"
    scope="request"
    validate="false"
    parameter="method">
    <forward name="edit" path="/EditProfile.jsp"/>
    <forward name="show" path="/Profile.jsp"/>
    </action>
    </action-mappings>
    </struts-config>
    Test.jsp
    <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
    <html:html locale="true">
    <html:form action="/logon" >
    <center>
    <table>
    <tr>
    <td> Username </td>
    <td> <html:text property="username" size="16" maxlength="16"/> </td>
    <td> <html:errors property="username" /> </td>
    </tr>
    <tr>
    <td> Password </td>
    <td> <html:password property="password" size="16" maxlength="16"
    redisplay="false"/> </td>
    <td><html:errors property="password" /> </td>
    </tr>
    </table>
    </center>
    <center> <html:submit property="submit" value="Submit"/> </center>
    </html:form>
    </html:html>
    Table.jsp
    <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
    <html:html locale="true">
    <html:form action="/table" >
    <center>
    <table>
    <tr>
    <td> <html:text property="rows[0].columns[0].value" /> </td>
    <td> <html:text property="rows[0].columns[1].value" /></td>
    </tr>
    <tr>
    <td> <html:text property="rows[1].columns[0].value" /> </td>
    <td> <html:text property="rows[1].columns[1].value" /></td>
    </tr>
    </table>
    </center>
    <center> <html:submit property="submit" value="Submit"/> </center>
    </html:form>
    </html:html>

    The above application runs only with JDK1.3.1_02 and not with any other version. This application is creating dynamic table using struts.
    Can anybody help me on the same
    also appending web.xml contents:
    <?xml version="1.0" ?>
    <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
    <!-- Action Servlet Configuration -->
    <servlet>
    <servlet-name>action</servlet-name>
    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
    <init-param>
    <param-name>application</param-name>
    <param-value>ApplicationResources</param-value>
    </init-param>
    <init-param>
    <param-name>config</param-name>
    <param-value>/WEB-INF/struts-config.xml</param-value>
    </init-param>
    <init-param>
    <param-name>debug</param-name>
    <param-value>2</param-value>
    </init-param>
    <init-param>
    <param-name>detail</param-name>
    <param-value>2</param-value>
    </init-param>
    <init-param>
    <param-name>validate</param-name>
    <param-value>true</param-value>
    </init-param>
    <load-on-startup>2</load-on-startup>
    </servlet>
    <!-- Action Servlet Mapping -->
    <servlet-mapping>
    <servlet-name>action</servlet-name>
    <url-pattern>*.do</url-pattern>
    </servlet-mapping>
    <!--Welcome file list starts here -->
    <welcome-file-list>
    <welcome-file>
    /test.jsp
    </welcome-file>
    </welcome-file-list>
    <!-- Struts Tag Library Descriptors -->
    <taglib>
    <taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
    <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
    </taglib>
    <taglib>
    <taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
    <taglib-location>/WEB-INF/struts-html.tld</taglib-location>
    </taglib>
    <taglib>
    <taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri>
    <taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
    </taglib>
    </web-app>
    validate-rules.xml
    <!DOCTYPE form-validation PUBLIC
    "-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.0//EN"
    "http://jakarta.apache.org/commons/dtds/validator_1_0.dtd">
    <!--
    This file contains the default Struts Validator pluggable validator
    definitions. It should be placed somewhere under /WEB-INF and
    referenced in the struts-config.xml under the plug-in element
    for the ValidatorPlugIn.
    <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
    <set-property property="pathnames" value="/WEB-INF/validator-rules.xml,
    /WEB-INF/validation.xml"/>
    </plug-in>
    These are the default error messages associated with
    each validator defined in this file. They should be
    added to your projects ApplicationResources.properties
    file or you can associate new ones by modifying the
    pluggable validators msg attributes in this file.
    # Struts Validator Error Messages
    errors.required={0} is required.
    errors.minlength={0} can not be less than {1} characters.
    errors.maxlength={0} can not be greater than {1} characters.
    errors.invalid={0} is invalid.
    errors.byte={0} must be a byte.
    errors.short={0} must be a short.
    errors.integer={0} must be an integer.
    errors.long={0} must be a long.
    errors.float={0} must be a float.
    errors.double={0} must be a double.
    errors.date={0} is not a date.
    errors.range={0} is not in the range {1} through {2}.
    errors.creditcard={0} is an invalid credit card number.
    errors.email={0} is an invalid e-mail address.
    -->
    <form-validation>
    <global>
    <validator name="required"
    classname="org.apache.struts.validator.FieldChecks"
    method="validateRequired"
    methodParams="java.lang.Object,
    org.apache.commons.validator.ValidatorAction,
    org.apache.commons.validator.Field,
    org.apache.struts.action.ActionErrors,
    javax.servlet.http.HttpServletRequest"
    msg="errors.required">
    <javascript><![CDATA[
    function validateRequired(form) {
    var isValid = true;
    var focusField = null;
    var i = 0;
    var fields = new Array();
    oRequired = new required();
    for (x in oRequired) {
         var field = form[oRequired[x][0]];
    if (field.type == 'text' ||
    field.type == 'textarea' ||
    field.type == 'file' ||
    field.type == 'select-one' ||
    field.type == 'radio' ||
    field.type == 'password') {
    var value = '';
                                  // get field's value
                                  if (field.type == "select-one") {
                                       var si = field.selectedIndex;
                                       if (si >= 0) {
                                            value = field.options[si].value;
                                  } else {
                                       value = field.value;
    if (trim(value).length == 0) {
         if (i == 0) {
         focusField = field;
         fields[i++] = oRequired[x][1];
         isValid = false;
    if (fields.length > 0) {
    focusField.focus();
    alert(fields.join('\n'));
    return isValid;
    // Trim whitespace from left and right sides of s.
    function trim(s) {
    return s.replace( /^\s*/, "" ).replace( /\s*$/, "" );
    ]]>
    </javascript>
    </validator>
    <validator name="requiredif"
    classname="org.apache.struts.validator.FieldChecks"
    method="validateRequiredIf"
    methodParams="java.lang.Object,
    org.apache.commons.validator.ValidatorAction,
    org.apache.commons.validator.Field,
    org.apache.struts.action.ActionErrors,
    org.apache.commons.validator.Validator,
    javax.servlet.http.HttpServletRequest"
    msg="errors.required">
    </validator>
    <validator name="minlength"
    classname="org.apache.struts.validator.FieldChecks"
    method="validateMinLength"
    methodParams="java.lang.Object,
    org.apache.commons.validator.ValidatorAction,
    org.apache.commons.validator.Field,
    org.apache.struts.action.ActionErrors,
    javax.servlet.http.HttpServletRequest"
    depends=""
    msg="errors.minlength">
    <javascript><![CDATA[
    function validateMinLength(form) {
    var isValid = true;
    var focusField = null;
    var i = 0;
    var fields = new Array();
    oMinLength = new minlength();
    for (x in oMinLength) {
    var field = form[oMinLength[x][0]];
    if (field.type == 'text' ||
    field.type == 'textarea') {
    var iMin = parseInt(oMinLength[x][2]("minlength"));
    if ((trim(field.value).length > 0) && (field.value.length < iMin)) {
    if (i == 0) {
    focusField = field;
    fields[i++] = oMinLength[x][1];
    isValid = false;
    if (fields.length > 0) {
    focusField.focus();
    alert(fields.join('\n'));
    return isValid;
    }]]>
    </javascript>
    </validator>
    <validator name="maxlength"
    classname="org.apache.struts.validator.FieldChecks"
    method="validateMaxLength"
    methodParams="java.lang.Object,
    org.apache.commons.validator.ValidatorAction,
    org.apache.commons.validator.Field,
    org.apache.struts.action.ActionErrors,
    javax.servlet.http.HttpServletRequest"
    depends=""
    msg="errors.maxlength">
    <javascript><![CDATA[
    function validateMaxLength(form) {
    var isValid = true;
    var focusField = null;
    var i = 0;
    var fields = new Array();
    oMaxLength = new maxlength();
    for (x in oMaxLength) {
    var field = form[oMaxLength[x][0]];
    if (field.type == 'text' ||
    field.type == 'textarea') {
    var iMax = parseInt(oMaxLength[x][2]("maxlength"));
    if (field.value.length > iMax) {
    if (i == 0) {
    focusField = field;
    fields[i++] = oMaxLength[x][1];
    isValid = false;
    if (fields.length > 0) {
    focusField.focus();
    alert(fields.join('\n'));
    return isValid;
    }]]>
    </javascript>
    </validator>
    <validator name="mask"
    classname="org.apache.struts.validator.FieldChecks"
    method="validateMask"
    methodParams="java.lang.Object,
    org.apache.commons.validator.ValidatorAction,
    org.apache.commons.validator.Field,
    org.apache.struts.action.ActionErrors,
    javax.servlet.http.HttpServletRequest"
    depends=""
    msg="errors.invalid">
    <javascript><![CDATA[
    function validateMask(form) {
    var isValid = true;
    var focusField = null;
    var i = 0;
    var fields = new Array();
    oMasked = new mask();
    for (x in oMasked) {
    var field = form[oMasked[x][0]];
    if ((field.type == 'text' ||
    field.type == 'textarea') &&
    (field.value.length > 0)) {
    if (!matchPattern(field.value, oMasked[x][2]("mask"))) {
    if (i == 0) {
    focusField = field;
    fields[i++] = oMasked[x][1];
    isValid = false;
    if (fields.length > 0) {
    focusField.focus();
    alert(fields.join('\n'));
    return isValid;
    function matchPattern(value, mask) {
    return mask.exec(value);
    }]]>
    </javascript>
    </validator>
    <validator name="byte"
    classname="org.apache.struts.validator.FieldChecks"
    method="validateByte"
    methodParams="java.lang.Object,
    org.apache.commons.validator.ValidatorAction,
    org.apache.commons.validator.Field,
    org.apache.struts.action.ActionErrors,
    javax.servlet.http.HttpServletRequest"
    depends=""
    msg="errors.byte"
    jsFunctionName="ByteValidations">
    <javascript><![CDATA[
    function validateByte(form) {
    var bValid = true;
    var focusField = null;
    var i = 0;
    var fields = new Array();
    oByte = new ByteValidations();
    for (x in oByte) {
         var field = form[oByte[x][0]];
    if (field.type == 'text' ||
    field.type == 'textarea' ||
    field.type == 'select-one' ||
                                  field.type == 'radio') {
                                  var value = '';
                                  // get field's value
                                  if (field.type == "select-one") {
                                       var si = field.selectedIndex;
                                       if (si >= 0) {
                                            value = field.options[si].value;
                                  } else {
                                       value = field.value;
    if (value.length > 0) {
    if (!isAllDigits(value)) {
    bValid = false;
    if (i == 0) {
    focusField = field;
    fields[i++] = oByte[x][1];
    } else {
         var iValue = parseInt(value);
         if (isNaN(iValue) || !(iValue >= -128 && iValue <= 127)) {
         if (i == 0) {
         focusField = field;
         fields[i++] = oByte[x][1];
         bValid = false;
    if (fields.length > 0) {
    focusField.focus();
    alert(fields.join('\n'));
    return bValid;
    }]]>
    </javascript>
    </validator>
    <validator name="short"
    classname="org.apache.struts.validator.FieldChecks"
    method="validateShort"
    methodParams="java.lang.Object,
    org.apache.commons.validator.ValidatorAction,
    org.apache.commons.validator.Field,
    org.apache.struts.action.ActionErrors,
    javax.servlet.http.HttpServletRequest"
    depends=""
    msg="errors.short"
    jsFunctionName="ShortValidations">
    <javascript><![CDATA[
    function validateShort(form) {
    var bValid = true;
    var focusField = null;
    var i = 0;
    var fields = new Array();
    oShort = new ShortValidations();
    for (x in oShort) {
         var field = form[oShort[x][0]];
    if (field.type == 'text' ||
    field.type == 'textarea' ||
    field.type == 'select-one' ||
    field.type == 'radio') {
    var value = '';
                                  // get field's value
                                  if (field.type == "select-one") {
                                       var si = field.selectedIndex;
                                       if (si >= 0) {
                                            value = field.options[si].value;
                                  } else {
                                       value = field.value;
    if (value.length > 0) {
    if (!isAllDigits(value)) {
    bValid = false;
    if (i == 0) {
    focusField = field;
    fields[i++] = oShort[x][1];
    } else {
         var iValue = parseInt(value);
         if (isNaN(iValue) || !(iValue >= -32768 && iValue <= 32767)) {
         if (i == 0) {
         focusField = field;
         fields[i++] = oShort[x][1];
         bValid = false;
    if (fields.length > 0) {
    focusField.focus();
    alert(fields.join('\n'));
    return bValid;
    }]]>
    </javascript>
    </validator>
    <validator name="integer"
    classname="org.apache.struts.validator.FieldChecks"
    method="validateInteger"
    methodParams="java.lang.Object,
    org.apache.commons.validator.ValidatorAction,
    org.apache.commons.validator.Field,
    org.apache.struts.action.ActionErrors,
    javax.servlet.http.HttpServletRequest"
    depends=""
    msg="errors.integer"
    jsFunctionName="IntegerValidations">
    <javascript><![CDATA[
    function validateInteger(form) {
    var bValid = true;
    var focusField = null;
    var i = 0;
    var fields = new Array();
    oInteger = new IntegerValidations();
    for (x in oInteger) {
         var field = form[oInteger[x][0]];
    if (field.type == 'text' ||
    field.type == 'textarea' ||
    field.type == 'select-one' ||
    field.type == 'radio') {
    var value = '';
                                  // get field's value
                                  if (field.type == "select-one") {
                                       var si = field.selectedIndex;
                                  if (si >= 0) {
                                       value = field.options[si].value;
                                  } else {
                                       value = field.value;
    if (value.length > 0) {
    if (!isAllDigits(value)) {
    bValid = false;
    if (i == 0) {
         focusField = field;
                                  fields[i++] = oInteger[x][1];
    } else {
         var iValue = parseInt(value);
         if (isNaN(iValue) || !(iValue >= -2147483648 && iValue <= 2147483647)) {
         if (i == 0) {
         focusField = field;
         fields[i++] = oInteger[x][1];
         bValid = false;
    if (fields.length > 0) {
    focusField.focus();
    alert(fields.join('\n'));
    return bValid;
    function isAllDigits(argvalue) {
    argvalue = argvalue.toString();
    var validChars = "0123456789";
    var startFrom = 0;
    if (argvalue.substring(0, 2) == "0x") {
    validChars = "0123456789abcdefABCDEF";
    startFrom = 2;
    } else if (argvalue.charAt(0) == "0") {
    validChars = "01234567";
    startFrom = 1;
    } else if (argvalue.charAt(0) == "-") {
    startFrom = 1;
    for (var n = startFrom; n < argvalue.length; n++) {
    if (validChars.indexOf(argvalue.substring(n, n+1)) == -1) return false;
    return true;
    }]]>
    </javascript>
    </validator>
    <validator name="long"
    classname="org.apache.struts.validator.FieldChecks"
    method="validateLong"
    methodParams="java.lang.Object,
    org.apache.commons.validator.ValidatorAction,
    org.apache.commons.validator.Field,
    org.apache.struts.action.ActionErrors,
    javax.servlet.http.HttpServletRequest"
    depends=""
    msg="errors.long"/>
    <validator name="float"
    classname="org.apache.struts.validator.FieldChecks"
    method="validateFloat"
    methodParams="java.lang.Object,
    org.apache.commons.validator.ValidatorAction,
    org.apache.commons.validator.Field,
    org.apache.struts.action.ActionErrors,
    javax.servlet.http.HttpServletRequest"
    depends=""
    msg="errors.float"
    jsFunctionName="FloatValidations">
    <javascript><![CDATA[
    function validateFloat(form) {
    var bValid = true;
    var focusField = null;
    var i = 0;
    var fields = new Array();
    oFloat = new FloatValidations();
    for (x in oFloat) {
         var field = form[oFloat[x][0]];
    if (field.type == 'text' ||
    field.type == 'textarea' ||
    field.type == 'select-one' ||
    field.type == 'radio') {
         var value = '';
                                  // get field's value
                                  if (field.type == "select-one") {
                                       var si = field.selectedIndex;
                                       if (si >= 0) {
                                       value = field.options[si].value;
                                  } else {
                                       value = field.value;
    if (value.length > 0) {
    // remove '.' before checking digits
    var tempArray = value.split('.');
    var joinedString= tempArray.join('');
    if (!isAllDigits(joinedString)) {
    bValid = false;
    if (i == 0) {
    focusField = field;
    fields[i++] = oFloat[x][1];
    } else {
         var iValue = parseFloat(value);
         if (isNaN(iValue)) {
         if (i == 0) {
         focusField = field;
         fields[i++] = oFloat[x][1];
         bValid = false;
    if (fields.length > 0) {
    focusField.focus();
    alert(fields.join('\n'));
    return bValid;
    }]]>
    </javascript>
    </validator>
    <validator name="double"
    classname="org.apache.struts.validator.FieldChecks"
    method="validateDouble"
    methodParams="java.lang.Object,
    org.apache.commons.validator.ValidatorAction,
    org.apache.commons.validator.Field,
    org.apache.struts.action.ActionErrors,
    javax.servlet.http.HttpServletRequest"
    depends=""
    msg="errors.double"/>
    <validator name="date"
    classname="org.apache.struts.validator.FieldChecks"
    method="validateDate"
    methodParams="java.lang.Object,
    org.apache.commons.validator.ValidatorAction,
    org.apache.commons.validator.Field,
    org.apache.struts.action.ActionErrors,
    javax.servlet.http.HttpServletRequest"
    depends=""
    msg="errors.date"
    jsFunctionName="DateValidations">
    <javascript><![CDATA[
    function validateDate(form) {
    var bValid = true;
    var focusField = null;
    var i = 0;
    var fields = new Array();
    oDate = new DateValidations();
    for (x in oDate) {
    var value = form[oDate[x][0]].value;
    var datePattern = oDate[x][2]("datePatternStrict");
    if ((form[oDate[x][0]].type == 'text' ||
    form[oDate[x][0]].type == 'textarea') &&
    (value.length > 0) &&
    (datePattern.length > 0)) {
    var MONTH = "MM";
    var DAY = "dd";
    var YEAR = "yyyy";
    var orderMonth = datePattern.indexOf(MONTH);
    var orderDay = datePattern.indexOf(DAY);
    var orderYear = datePattern.indexOf(YEAR);
    if ((orderDay < orderYear && orderDay > orderMonth)) {
    var iDelim1 = orderMonth + MONTH.length;
    var iDelim2 = orderDay + DAY.length;
    var delim1 = datePattern.substring(iDelim1, iDelim1 + 1);
    var delim2 = datePattern.substring(iDelim2, iDelim2 + 1);
    if (iDelim1 == orderDay && iDelim2 == orderYear) {
    dateRegexp = new RegExp("^(\\d{2})(\\d{2})(\\d{4})$");
    } else if (iDelim1 == orderDay) {
    dateRegexp = new RegExp("^(\\d{2})(\\d{2})[" + delim2 + "](\\d{4})$");
    } else if (iDelim2 == orderYear) {
    dateRegexp = new RegExp("^(\\d{2})[" + delim1 + "](\\d{2})(\\d{4})$");
    } else {
    dateRegexp = new RegExp("^(\\d{2})[" + delim1 + "](\\d{2})[" + delim2 + "](\\d{4})$");
    var matched = dateRegexp.exec(value);
    if(matched != null) {
    if (!isValidDate(matched[2], matched[1], matched[3])) {
    if (i == 0) {
    focusField = form[oDate[x][0]];
    fields[i++] = oDate[x][1];
    bValid = false;
    } else {
    if (i == 0) {
    focusField = form[oDate[x][0]];
    fields[i++] = oDate[x][1];
    bValid = false;
    } else if ((orderMonth < orderYear && orderMonth > orderDay)) {
    var iDelim1 = orderDay + DAY.length;
    var iDelim2 = orderMonth + MONTH.length;
    var delim1 = datePattern.substring(iDelim1, iDelim1 + 1);
    var delim2 = datePattern.substring(iDelim2, iDelim2 + 1);
    if (iDelim1 == orderMonth && iDelim2 == orderYear) {
    dateRegexp = new RegExp("^(\\d{2})(\\d{2})(\\d{4})$");
    } else if (iDelim1 == orderMonth) {
    dateRegexp = new RegExp("^(\\d{2})(\\d{2})[" + delim2 + "](\\d{4})$");
    } else if (iDelim2 == orderYear) {
    dateRegexp = new RegExp("^(\\d{2})[" + delim1 + "](\\d{2})(\\d{4})$");
    } else {
    dateRegexp = new RegExp("^(\\d{2})[" + delim1 + "](\\d{2})[" + delim2 + "](\\d{4})$");
    var matched = dateRegexp.exec(value);
    if(matched != null) {
    if (!isValidDate(matched[1], matched[2], matched[3])) {
    if (i == 0) {
    focusField = form[oDate[x][0]];
    fields[i++] = oDate[x][1];
    bValid = false;
    } else {
    if (i == 0) {
    focusField = form[oDate[x][0]];
    fields[i++] = oDate[x][1];
    bValid = false;
    } else if ((orderMonth > orderYear && orderMonth < orderDay)) {
    var iDelim1 = orderYear + YEAR.length;
    var iDelim2 = orderMonth + MONTH.length;
    var delim1 = datePattern.substring(iDelim1, iDelim1 + 1);
    var delim2 = datePattern.substring(iDelim2, iDelim2 + 1);
    if (iDelim1 == orderMonth && iDelim2 == orderDay) {
    dateRegexp = new RegExp("^(\\d{4})(\\d{2})(\\d{2})$");
    } else if (iDelim1 == orderMonth) {
    dateRegexp = new RegExp("^(\\d{4})(\\d{2})[" + delim2 + "](\\d{2})$");
    } else if (iDelim2 == orderDay) {
    dateRegexp = new RegExp("^(\\d{4})[" + delim1 + "](\\d{2})(\\d{2})$");
    } else {
    dateRegexp = new Reg

  • Issue in Dynamic table creation in userform

    Hi all,
    My userform displays a simpletable using an arraylist returned from the WF as data source. I have all the columns of this dynamic table displayed as labels.
    Question:
    Now I have added another new column to this table which I want to be editable (textfield) while the rest of the existing columns should be the same labels. How do I accomplish this task since the fieldloop for the table uses only a single arraylist?
    this is how my code looks like
    <FieldLoop for='abc'>
    <expression>
    <block>
    <ref>List</ref>
    </block>
    </expression>
    <Field name='tmptable'>
    <Display class='SimpleTable'>
    <Property name='noNewRow' value='true'/>
    <Property name='border' value='0'/>
    <Property name='align' value='center'/>
    </Display>
    <Field name='$(abc)'>
    <Display class='Label' action='true'>
    <Property name='value'>
    <ref>abc</ref>
    </Property>
    </Display>
    </Field>
    </Field>
    </FieldLoop>
    thanks in advance
    kp

    That was pretty simple solution. I made a disable clause to the label control for the last column and instead displayed a textbox control.
    thanks anyway

  • Dynamic Table Creation

    Hi All,
    I know how to create a dynamic table with dynamic tablecolumn.
    How can I create a dynamic table using only  tablecolumngroup (which is not deprecated).
    Aviad

    IWDColumn column = ...;
    table.addGroupedColumn(column);
    What exactly is the question?
    Armin

  • Dynamic Table Creation with the sortable collection model in the bean.

    Hi all,
    My requirement: I want to create the table dynamically with the set of rows. This set of rows will be holded in the Bean for the sortable variable.
    (private SortableModel viewDeleteCollectionModel)
    Issue: "_No Data to Display_" is coming in the Dynamic Table. Whereas when i checked with the collection model row count it is showing the correct no of rows.
    Code for Dynamic Table in JSFF:
    <af:table varStatus="rowStat" value="#{ViewHistoryDelete.viewDeleteCollectionModel}"
    rows="#{ViewHistoryDelete.viewDeleteCollectionModel.rowCount}"
    rowSelection="single" width="99%" var="row" id="t2" summary=" " >
    <af:forEach items="#{ViewHistoryDelete.viewDeleteColumnNames}" var="name">
    <af:column headerText="#{name}" sortable="true" sortProperty="#{name}" id="pt_c1">
    <af:inputText value="#{row[name]}" label="#{row[name]}" readOnly="true" id="it2"/>
    </af:column>
    </af:forEach>
    </af:table>
    Bean Code:
    Varaible DEclaration : private SortableModel viewDeleteCollectionModel;
    Row assignig to collection model : viewDeleteCollectionModel = new SortableModel(new ArrayList<Map<String, Object>>());
    ((List<Map<String, Object>>) viewDeleteCollectionModel.getWrappedData()).addAll(viewDeletedData);
    viewHistoryDelete.setViewDeleteCollectionModel(viewDeleteCollectionModel);
    After this iam checked by putting sop for the table row count
    iam getting actual no.of rows. But to the screen it is not showing the rows.
    Any solution............
    reg,
    bakkia.
    Edited by: Bakkia on Oct 11, 2011 11:20 PM

    Did you find solution to this problem ?

  • Dynamic Table creation Problem

    Hi All,
    I have a requirement to create tables  dynamically based on data coming from backend .
    The problem is there can be muliple tables created based on data.and I need to fill each row of tables correspondingly.Row and column values might very for each and every tables.
    Other issue is how will I attach a selection listener to any column created dynamically.
    It will be useful if anyone can provide some example for implementing same.
    Thanks in Advance.

    Hi,
    1. You don't add a selection listener to a column but the table. The selection listener is a MethodExpression that points to a managed bean method. You can manually create a MethodExpression from FacesContext --> Application --> ExpressionFactory (for this you need FacesContext --> ELContext). Once you have the MethodExpression you can call the setter on RichTable
    2. For querying the data, you can build tables based on Arrays. So queue the data in an array and you will be good to go. The question however is, what is the object type to put into the array and this I don't know because I no nothing about how the data arrives in your managed bean
    However, since tables rows are not stuffed cell-by-cell you need to provide a row object
    Frank

  • Dynamic Table Creation using RTTS - Question on Issue

    I am using the RTTS services to dynamically create a table.  However, when I attempt to use the get_components method it does not return all the components for all tables that I am working with.
    Cases and End Results
    1) Created structure in data dictionary – get_components works.
    2) Pass PA0001, P0001 or T001P to get_components and I do not receive the correct results.  It only returns a small subset of these objects.  The components table has all the entries; however, the get_components method only returns about 4 rows.
    Can you explain this and point me to the correct logic sequence? I would like the logic to work with all tables.
    Code excerpt below:
    The logic for the get components works for case 1, but not case 2. When I pass into this method a "Z" custom table or structure name for parameter “structure_name” and the get_components() method executes and returns the correct results. However, when I pass in any of the objects listed above in case 2, the get_components method does not return the correct number of entries. When I check typ_struct which is populated right before the get_components line, I see the correct number of components in the components table. 
    method pb_add_column_headings .
      constants: c_generic_struct type c length 19 value 'ZXX_COLUMN_HEADINGS'.
      data: cnt_lines      type sytabix,
            rf_data        type ref to data,
            typ_field      type ref to cl_abap_datadescr,
            typ_struct     type ref to cl_abap_structdescr,
            typ_table      type ref to cl_abap_tabledescr.
      data: wa_col_headings type ddobjname.
      data: rf_tbl_creation_exception type ref to 
                                      cx_sy_table_creation,
            rf_struct_creation_exception type ref to
                                      cx_sy_struct_creation.
      data: t_comp_tab type
                       cl_abap_structdescr=>component_table,
            t_comp_tab_new      like t_comp_tab,
            t_comp_tab_imported like t_comp_tab.
      field-symbols: <fs_comp> like line of t_comp_tab,
                     <fs_col_headings_tbl> type any table.
    **Get components of generic structure
      wa_col_headings = c_generic_struct.
      typ_struct ?= cl_abap_typedescr=>describe_by_name(
                                       wa_col_headings ).
      T_COMP_TAB = typ_struct->get_components( ).
    **Determine how many components in imported structure.
      typ_struct ?= cl_abap_typedescr=>describe_by_name(
                                        structure_name ).
      t_comp_tab_imported = typ_struct->get_components( ).
      cnt_lines = lines( t_comp_tab_imported[] ).

    Hi Garton,
    1. GET_COMPONENT_LIST
       Use this FM.
       It gives all fieldnames.
    2. Use this code (just copy paste)
    REPORT abc.
    DATA : cmp LIKE TABLE OF rstrucinfo WITH HEADER LINE.
    DATA : pa0001 LIKE TABLE OF pa0001 WITH HEADER LINE.
    CALL FUNCTION 'GET_COMPONENT_LIST'
      EXPORTING
        program    = sy-repid
        fieldname  = 'PA0001'
      TABLES
        components = cmp.
    LOOP AT cmp.
      WRITE :/ cmp-compname.
    ENDLOOP.
    regards,
    amit m.

  • SQL script: dynamic table creation

    Hello,
    I should write a sql script to do the following (simplified):
    - Create a table if it doesn't exist yet
    - Select something from the newly created table and do further conditional actions
    I've tried something like that:
    DECLARE
    lv_count INTEGER;
    BEGIN
    DBMS_OUTPUT.enable();
    SELECT COUNT(*) INTO lv_count FROM user_tables WHERE table_name = 'DATABASEINFO';
    IF(lv_count = 0)
    THEN
         DBMS_OUTPUT.PUT_LINE('Create DatabaseInfo');
    EXECUTE IMMEDIATE
         'CREATE TABLE DATABASEINFO(
              ZDatabaseInfoId RAW(16) NOT NULL,
              ZInfo VARCHAR2(30) NOT NULL,
              ZValue VARCHAR2(100) NOT NULL,
    CONSTRAINT DatabaseInfo_U_NC_PK PRIMARY KEY
    ZDatabaseInfoId
    END IF;
    SELECT COUNT(*) INTO lv_count FROM DatabaseInfo WHERE ZInfo = 'anything';
    The select statement fails with error message "Table or view cannot be found". As far as I know, this is because the table is created dynamically and validation of the sql script fails because the table doesn't exist on compile time.
    How to solve that?
    Best Regards
    Andreas

    866121 wrote:
    Hello,
    I should write a sql script to do the following (simplified):
    - Create a table if it doesn't exist yet
    - Select something from the newly created table and do further conditional actions
    I've tried something like that:
    DECLARE
    lv_count INTEGER;
    BEGIN
    DBMS_OUTPUT.enable();
    SELECT COUNT(*) INTO lv_count FROM user_tables WHERE table_name = 'DATABASEINFO';
    IF(lv_count = 0)
    THEN
         DBMS_OUTPUT.PUT_LINE('Create DatabaseInfo');
    EXECUTE IMMEDIATE
         'CREATE TABLE DATABASEINFO(
              ZDatabaseInfoId RAW(16) NOT NULL,
              ZInfo VARCHAR2(30) NOT NULL,
              ZValue VARCHAR2(100) NOT NULL,
    CONSTRAINT DatabaseInfo_U_NC_PK PRIMARY KEY
    ZDatabaseInfoId
    END IF;
    SELECT COUNT(*) INTO lv_count FROM DatabaseInfo WHERE ZInfo = 'anything';
    The select statement fails with error message "Table or view cannot be found". As far as I know, this is because the table is created dynamically and validation of the sql script fails because the table doesn't exist on compile time.
    How to solve that?
    why, oh why, are you dynamically making table?
    DDL should be done only once via static SQL.
    dig a deeper hole & EXECUTE IMMEDIATE the SELECT.

  • DYNAMIC TABLE CREATION USING JSP

    I WANT TO CREATE A DATABASE TABLE IN AN INTERACTIVE WAY ie MY QUESTION IS: HOW TO CREATE A TABLE USING JSP WITH TWO ARRAYS(FIRST ARRAY CONTAINS FIELD(COLUMN) NAMES AND THE SECOND ARRAY CONTAINS ITS CORRESPONDING DATATYPE)BOTH ARRAYS ARE OF VARYING SIZE.IF THE USER ENTERS SUPPOSE '6' AS THE INPUT TO FORM A TABLE OF 6 FIELDS SO, THE QUERY SHOULD BE DYNAMICALLY FORME USING THE ARRAY NAME FOR FIELD AND THE ARRANAME FOR ITS CORRESPONDING DATATYPE.HAVE ANY IDEA ON THIS PLEASE LET ME KNOW.
    THANKS

    u need to know quite a few java technologies to make archieve your dream.
    JDBC, dynamic array and JSP.
    after reading tutorial regarding to these 3 materials, you should be able to get your job done.

  • Dynamic table creation using JDBC

    hi all, i am working in JDBC and using prepared statements.the problem i have is i need to create and read from tables,dynamically and i should also create tables with keys dynamically,i.e the user gives the table name and i should create it using JDBC.the user does not enter the full query he just types the table name.i am using oracle as backend.i have tried prepared statements to retrieve datas from tables whose names r given dynamically like
    "select * from ?"
    and then using
    setString(1,the variable which holds the table name);
    but this doesnt seem to work.it says invalid table name.how can i do this.i shd also create tables the same way like
    "create table ? ..."
    is there a way out of this problem or is there any other type of statement that i can use.please give a detailed example.thanks in advance.

    Usually when I work with Oracle DBA's they get real excited when I suggest that the application could create the tables dynamically. Because this means that there is absolutely no chance that there is a coherent implemetation of table allocation.
    Seemed like a good point to me.

  • Dynamic Table Creation Question

    Can you dynamically add a column to a data table at run time using JSC and JSF? I have a case where I want to add a column to a table based on a selection by the user.

    Hi
    I have been trying to this when I saw your question first time two days back. I tried changing the rowset's query but nothing seems to work. I will try again and I am sure that I can give you something on this if there is any straight solution to this.
    Thanks
    Srinivas

  • JSP : Dynamic Table creation

    HI Frds
    I am looking for solution for my following problem ...
    I want to create dyanmic table i.e rows & column on the basis of user
    input
    Thanks
    Ashish

    ok if you want a sample here it is;
    <%@ page contentType="text/html;charset=windows-1252"%>
    <html>
      <head>
        <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
        <title>untitled</title>
      </head>
      <body>
      <table  cellspacing="0" cellpadding="0" border="0" width="200">
    <tr>
        <td>Column 1</td>
        <td>Column 2</td>
    </tr>
    <%for(int x=0;x<5;x++){%>
    <tr>
        <td>Row</td>
        <td><%=x%></td>
    </tr>
    <%}%>
    </table>
      </body>
    </html>

  • Dynamic Table with Validation

    Hi,
    I need to have a Screen that has an input field for the user to enter the table name. The code behind will need to be able to know the fieldname (column) of the table schema. It also must do a simple validation on all the data. It will return the row number and the fieldname (column) of the data if it is blank. This is a dynamic program, regardless of SAP table 'spfli' or custom table that user define. It should work well also. Is it possible to do that? How to do and what is the code like?
    Best Regards,
    Rayden

    Hi,
    Check the code below:
    REPORT ZYKTEST3 .
    DATA: d_ref TYPE REF TO data,
    d_ref2 TYPE REF TO data,
    i_alv_cat TYPE TABLE OF lvc_s_fcat,
    ls_alv_cat LIKE LINE OF i_alv_cat.
    TYPES: tabname LIKE dcobjdef-name ,
    fieldname LIKE dcobjdef-name,
    desc LIKE dntab-fieldtext.
    PARAMETER: p_tablen TYPE tabname.  -
    >  <b>Input table field</b>
    DATA: BEGIN OF itab OCCURS 0.
    INCLUDE STRUCTURE dntab.
    DATA: END OF itab.
    FIELD-SYMBOLS : <f_fs> TYPE table,
    <f_fs1> TYPE table,
    <f_fs2> TYPE ANY,
    <f_fs3> TYPE ANY,
    <f_fs4> type any,
    <f_field> TYPE ANY.
    REFRESH itab.
    CALL FUNCTION 'NAMETAB_GET'  -
    > <b>Fetches the fields</b>
    EXPORTING
    langu = sy-langu
    tabname = p_tablen
    TABLES
    nametab = itab
    EXCEPTIONS
    no_texts_found = 1.
    LOOP AT itab .
    ls_alv_cat-fieldname = itab-fieldname.
    ls_alv_cat-ref_table = p_tablen.
    ls_alv_cat-ref_field = itab-fieldname.
    ls_alv_cat-seltext = itab-fieldtext.
    ls_alv_cat-reptext = itab-fieldtext.
    APPEND ls_alv_cat TO i_alv_cat.
    ENDLOOP.
    internal table build
    CALL METHOD cl_alv_table_create=>create_dynamic_table
    EXPORTING
    it_fieldcatalog = i_alv_cat
    IMPORTING
    ep_table = d_ref.
    ASSIGN d_ref->* TO <f_fs>.  -
    > <b>Dynamic table creation with fields of the table</b>
    DATA: l_field TYPE fieldname,
    l_field1 type fieldname.
    <b>SELECT * FROM (p_tablen) INTO CORRESPONDING FIELDS OF TABLE <f_fs>.
      Fetching of the data from the table</b>
    LOOP AT <f_fs> ASSIGNING <f_fs2>.
    <b>Here u can check the validations and process</b>
    ASSIGN COMPONENT 2 OF STRUCTURE <f_fs2> TO <f_fs3>.
    ASSIGN COMPONENT 3 OF STRUCTURE <f_fs2> TO <f_fs4>.
    IF sy-subrc = 0.
    MOVE <f_fs3> TO l_field.
    MOVE <f_fs4> TO l_field1.
    WRITE:/1 l_field(20),
    22 l_field1(10).
    ENDIF.
    ENDLOOP.
    Regards
    Kannaiah

  • Dynamic Table

    Hi Experts,
                      I have an issue with Dynamic Table creation. This is the situation. I have an XML Where in i store table rows and columns. when the page loads i have to read the XML and i have to create row and columns dynamically as in the XML. I have  done this . Problem is , i user wants to add a new column. i am giving one pop up window , where in i am getting column name. when pop up window closed, the dynamic table was not there .
    What i am doing wrong?
    I am creating dynamic table in init method. is it if control goes to anther window all context info will be lost?
    Please help me on this.
    Thank you,
    Regrads,
    Senthil

    Hi Ayyapparaj,
                              This is the code
    public void wdDoInit()
        //@@begin wdDoInit()
           //Add Buttons
           IWDView view = (IWDView)this.wdControllerAPI;
           XMLParseWrite pars = new XMLParseWrite();
           IWDNodeInfo tabNode=wdContext.getNodeInfo().addChild("sharedData", null,true, true, true,false,true,false,null,null,null);
           IWDTransparentContainer root = (IWDTransparentContainer)view.getRootElement();
           // Add Master Data Button Creation
           IWDButton addMasterData = (IWDButton)view.createElement(IWDButton.class,"AddMasterData");
           addMasterData.setText("AddMasterData");
           root.addChild(addMasterData);
           // Action Creation for Add masterData Button
           IWDAction addmd  = wdThis.wdCreateAction(IPrivateMDMView.WDActionEventHandler.GENERIC_ACTION, "AddMasterdataAction");
           addMasterData.setOnAction(addmd);
          WDDeployableObjectPart dobp = wdComponentAPI.getDeployableObjectPart();
           String path=null;
           try{
          path = WDURLGenerator.getResourcePath(dobp,"TestRun.xml");
           }catch(WDAliasResolvingException e){
                wdComponentAPI.getMessageManager().reportSuccess(e.getMessage()); 
           File f = new File(path);
    //       wdComponentAPI.getMessageManager().reportSuccess(path"status"f.exists());
          Document d = pars.parseXML(path);
           NodeList root_nod = d.getElementsByTagName("SharedMasterData");
           // Creating Dynamic nodes and data for Master Data
           ArrayList al = pars.getChileNodesByName(root_nod.item(0), "LineItem");
           Node lineitem[] = new Node[al.size()];
           Iterator it = al.iterator();
           int len= 0;
           while(it.hasNext()){
              lineitem[len] = (Node)it.next(); 
              len++;
           Node masterData[] = pars.getOnlyElementChildNodes(lineitem[0].getChildNodes());
           String[] masterDataName = new String[masterData.length];
           for(int i = 0;i < masterData.length;i++)
                Node n = masterData<i>;
                masterDataName<i> = n.getNodeName();
               tabNode.addAttribute(masterDataName<i>, "ddic:com.sap.dictionary.string");
    //       IWDAttributeInfo tabAttrib1 = tabNode.addAttribute("ProductID", "ddic:com.sap.dictionary.string");
    //       IWDAttributeInfo tabAttrib2 = tabNode.addAttribute("PartyID", "ddic:com.sap.dictionary.string");
    //       IWDAttributeInfo tabAttrib3 = tabNode.addAttribute("Count", "ddic:com.sap.dictionary.string");
           IWDTable table = (IWDTable)view.createElement(IWDTable.class,"TestDataTable");
           table.bindDataSource(tabNode);
          // table.setCompatibilityMode(WDTableCompatibilityMode.AUTO);
           table.setDesign(WDTableDesign.ALTERNATING);
           IWDTableColumnGroup MasterDataGroup = (IWDTableColumnGroup)view.createElement(IWDTableColumnGroup.class,"MasterData");
           IWDCaption caption = (IWDCaption)view.createElement(IWDCaption.class,"colGroupCaption");
           caption.setText("MasterData");
           MasterDataGroup.setHeader(caption);
           for(int i=0;i<masterDataName.length;i++)
                IWDAttributeInfo attrbt = tabNode.getAttribute(masterDataName<i>);
                IWDTableColumn col = (IWDTableColumn)view.createElement(IWDTableColumn.class,masterDataName<i>);
                IWDCaption colcap1 = (IWDCaption)view.createElement(IWDCaption.class,"MasterDataCaption"+i);
                colcap1.setText(masterDataName<i>);
                col.setHeader(colcap1);
                IWDTextView celleditor = (IWDTextView)view.createElement(IWDTextView.class,"MDtextView"+i);
                celleditor.bindText(attrbt);
                col.setTableCellEditor(celleditor);
                MasterDataGroup.addColumn(col);
           // Static data Reacding part
           table.addGroupedColumn(MasterDataGroup);
           NodeList st_root_nod = d.getElementsByTagName("SharedStaticData");
           // Creating Dynamic nodes and data for Master Data
           ArrayList al2 = pars.getChileNodesByName(st_root_nod.item(0), "LineItem");
           Node st_lineitem[] = new Node[al2.size()];
           Iterator it2 = al2.iterator();
           int len2= 0;
           while(it2.hasNext()){
              st_lineitem[len2] = (Node)it2.next(); 
              len2++;
           Node staticData[] = pars.getOnlyElementChildNodes(st_lineitem[0].getChildNodes());
    //       wdComponentAPI.getMessageManager().reportSuccess("Size"al2.size()staticData.length);
           String[] staticDataName = new String[staticData.length];
           for(int i = 0;i < staticData.length;i++)
                Node n = staticData<i>;
                staticDataName<i> = n.getNodeName();
               tabNode.addAttribute(staticDataName<i>, "ddic:com.sap.dictionary.string");
           if(staticData.length>0)
           IWDTableColumnGroup staticDataGroup = (IWDTableColumnGroup)view.createElement(IWDTableColumnGroup.class,"StaticData");
           IWDCaption staticcaption = (IWDCaption)view.createElement(IWDCaption.class,"colGroupCaption1");
           staticcaption.setText("StaticData");
           staticDataGroup.setHeader(staticcaption);
           for(int i=0;i<staticDataName.length;i++)
                IWDAttributeInfo attrbt = tabNode.getAttribute(staticDataName<i>);
                IWDTableColumn col1 = (IWDTableColumn)view.createElement(IWDTableColumn.class,staticDataName<i>);
                IWDCaption colcap1 = (IWDCaption)view.createElement(IWDCaption.class,"StaticDataCaption"+i);
                colcap1.setText(staticDataName<i>);
                col1.setHeader(colcap1);
                IWDTextView celleditor = (IWDTextView)view.createElement(IWDTextView.class,"STtextView"+i);
                celleditor.bindText(attrbt);
                col1.setTableCellEditor(celleditor);
                staticDataGroup.addColumn(col1);
           table.addGroupedColumn(staticDataGroup);
         //  table.addGroupedColumn(col2);
           table.createLayoutData(IWDRowHeadData.class);
           table.setWidth("500");
           IWDNode node = (IWDNode)wdContext.getChildNode("sharedData",0);
           for(int i=0;i<lineitem.length;i++)
                IWDNodeElement ele = (IWDNodeElement)node.createElement();
                Node masterDatas[] = pars.getOnlyElementChildNodes(lineitem<i>.getChildNodes());
                for(int j=0;j<masterDatas.length;j++)
                     ele.setAttributeValue(masterDatas[j].getNodeName(), masterDatas[j].getTextContent());
                Node staticDatas[] = pars.getOnlyElementChildNodes(st_lineitem<i>.getChildNodes());
                for(int k=0;k<staticDatas.length;k++)
                     ele.setAttributeValue(staticDatas[k].getNodeName(), staticDatas[k].getTextContent());
                node.addElement(ele);
           root.addChild(table);
        //@@end

  • Data type doubled on dynamic table

    Hello Everyone,
    I'm creating a Z program to insert data to any Z table created, for that, the user must put the name of the Z table and the path of the file with all data to be inserted.
    The problem is that on dynamic table creation the datatype of the fields are doubled, I.E.: if the datatype is N length 3, it's coming as N length 6.
    Does anyone know to solve this issue?
    Thanks in Advance!

    Hi
    Just as I said, if u need to create a table like a dictionary table u can use the standard fm DDIF_FIELDINFO_GET in order to get the informations, so it doesn't need to calculate the real size.
    My system is unicode too, and I used the fm above to create dynamically a structure based on dictionary definition:
    LOOP AT VAKE_DFIES_TAB INTO DFIES WHERE FIELDNAME <> 'KFRST' AND
                                              FIELDNAME <> 'KBSTAT'.
        COMPONENT-NAME = DFIES-FIELDNAME.
        MOVE DFIES-LENG     TO _LEN.
        MOVE DFIES-DECIMALS TO _DEC.
        CASE DFIES-DATATYPE.
          WHEN 'CHAR' OR 'LANG' OR 'CUKY'.
            MOVE CL_ABAP_ELEMDESCR=>GET_C( P_LENGTH = _LEN )
                                                          TO LR_VALUE_DESCR.
          WHEN 'NUMC'.
            MOVE CL_ABAP_ELEMDESCR=>GET_N( P_LENGTH = _LEN )
                                                          TO LR_VALUE_DESCR.
          WHEN 'INT1' OR 'INT2' OR 'INT4'.
            MOVE CL_ABAP_ELEMDESCR=>GET_I( ) TO LR_VALUE_DESCR.
          WHEN 'DATE'.
            MOVE CL_ABAP_ELEMDESCR=>GET_D( ) TO LR_VALUE_DESCR.
          WHEN 'DEC' OR 'CURR'.
            MOVE CL_ABAP_ELEMDESCR=>GET_P( P_LENGTH   = _LEN
                                           P_DECIMALS = _DEC )
                                                          TO LR_VALUE_DESCR.
          WHEN 'TIME'.
            MOVE  CL_ABAP_ELEMDESCR=>GET_T( ) TO LR_VALUE_DESCR.
          WHEN 'UDEF'.
        ENDCASE.
        COMPONENT-TYPE = LR_VALUE_DESCR.
        INSERT COMPONENT INTO TABLE LT_COMPONENTS.
      ENDLOOP.
      IF SY-SUBRC <> 0.
        PERFORM RAISE_ERROR USING 'C'.
      ENDIF.
    * Creazione struttura chiave
      LR_STRUCT_DESCR
            = CL_ABAP_STRUCTDESCR=>CREATE( P_COMPONENTS = LT_COMPONENTS
                                           P_STRICT     = 'X' ).
      CREATE DATA DYN_VAKEY TYPE HANDLE LR_STRUCT_DESCR.
      ASSIGN DYN_VAKEY->* TO <FS_VAKEY>.
    Max

Maybe you are looking for

  • How can I bring back the nice big refresh button?

    The refresh button used to be a nice big one at the top left. Now it is a tiny one hidden near the search stuff on the right. I want the big one back. And while we're at it, I'd like the home button to be bigger again, as well. How can I do that?

  • Arp entries becoming zero

    Hi, We have Sun 1280 servers running in our lab. We observe that sometime arp entries for some interfaces become zero suddenly. Here is the warning we observe in /var/adm/messages :- 09:53:50 ca-a ip: [ID 903730 kern.warning] WARNING: IP: Hardware ad

  • Since installing Mavericks, I've been unable to download Flash. Why is this happening?

    Since I installed OS X Mavericks (10.9.1) on my iMac, I have been unable to download Adobe Flash Player plug-ins and have consequently had to uninstall Flash for security reasons. I tried to install the latest update of Flash today (v. 12.0.0.44) but

  • LACIE HD'S WONT MOUNT. APPLE THINKS I NEED A SEPERATE FIREWIRE CARD.

    I have 2 lacie hd's that will not mount they used to mount but now they will not. I have been back and forth to the Mac store and I have been on the phone with Lacie . My drives were tested and my computer was tested and nothing is wrong WITH EITHER.

  • Link not working on a pie chart which uses a customized XML

    Hi, I have created a pie chart which uses customized XML. For this, i am using database function. This function returns a customized XML which is eventually used by chart. But the problem now i am facing is the link on chart is not working . I have t