Creation of Dynamic Table
Hello All,
I want to Create Dynamic Header of the Table and according to the Header have to filter the data. Kindly give me the
Suggestion how shd i resolve the problem.
Ex. Run time I will create the Heder as 4%, 5%, 12.5% and filter the amount as per %, the No of columns will be depend on the type of INvoice.
Hi,
Check this sample code
DEFINE dy_fields.
clear gs_fields.
gs_fields-fieldname = &1.
gs_fields-datatype = &2.
gs_fields-intlen = &3.
gs_fields-coltext = &4.
gs_fields-quantity = '3'.
append gs_fields to git_fields.
END-OF-DEFINITION. "add_field
DEFINE add_field.
gs_fcat-tabname = &1.
gs_fcat-fieldname = &2.
gs_fcat-ref_field = &3.
gs_fcat-ref_table = &4.
gs_fcat-inttype = &5.
gs_fcat-coltext = &6.
gs_fcat-col_pos = &7.
gs_fcat-quantity = '3'.
gs_fcat-col_opt = 'X'.
append gs_fcat to git_fcat.
END-OF-DEFINITION. "add_field
form form_fieldcatalog .
dy_fields 'MATNR' 'CHAR' '18' 'Material'(015).
dy_fields 'KTEXTMAT' 'CHAR' '40' 'Material Description'(003).
dy_fields 'PRUEFLOS' 'NUMC' '12' 'Inspection Lot Number'(004).
dy_fields 'ENSTEHDAT' 'DATS' '8' 'Date of Inspection'(005).
dy_fields 'ARBPL' 'CHAR' '8' 'Blast Fur. No.'(006).
dy_fields 'USERC1' 'CHAR' '18' 'Plnt No'(007).
dy_fields 'USERC2' 'CHAR' '10' 'Shift'(008).
dy_fields 'USERN1' 'NUMC' '10' 'Sample'(009).
LOOP AT git_qamv ASSIGNING <fs_qamv>.
TRANSLATE <fs_qamv>-kurztext TO UPPER CASE.
ENDLOOP.
refresh git_qamv_temp.
git_qamv_temp[] = git_qamv[].
sort git_qamv_temp by kurztext.
v_count = 8.
sort git_output by prueflos.
delete ADJACENT DUPLICATES FROM git_qamv_temp comparing kurztext.
LOOP AT git_qamv_temp into gs_qamv.
v_count = v_count + 1.
read table git_output ASSIGNING <fs_output> with key PRUEFLOS = gs_qamv-PRUEFLOS BINARY SEARCH.
IF sy-subrc = 0.
dy_fields gs_qamv-merknr 'QUAN' '25' gs_qamv-kurztext.
add_field 'GIT_FINAL' gs_qamv-merknr '' '' 'C' gs_qamv-kurztext v_count.
ENDIF.
ENDLOOP.
data v_cnt(4) type n.
clear v_cnt.
LOOP AT git_fcat ASSIGNING <fs_fcat>.
v_cnt = v_cnt + 10.
<fs_fcat>-fieldname = v_cnt.
READ TABLE git_fields ASSIGNING <fs_fields> WITH key coltext = <fs_fcat>-coltext.
if sy-subrc = 0.
move <fs_fcat>-fieldname to <fs_fields>-fieldname.
ENDIF.
ENDLOOP.
clear v_cnt.
sort GIT_QAMV by PRUEFLOS MERKNR.
LOOP AT GIT_QASR ASSIGNING <FS_QASR>.
READ TABLE GIT_QAMV ASSIGNING <fs_qamv> WITH KEY PRUEFLOS = <FS_QASR>-PRUEFLOS
MERKNR = <FS_QASR>-MERKNR BINARY SEARCH.
IF SY-SUBRC = 0.
MOVE <FS_QAMV>-KURZTEXT TO <FS_QASR>-PRUEFBEMKT.
ENDIF.
ENDLOOP.
*-> create dynamic internal table and assign to fs
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = git_fields
IMPORTING
ep_table = git_dy_final.
*-> Assigning The Referencing Pointer To The Field Symbol
ASSIGN git_dy_final->* TO <git_dy_final>.
Creating Dynamic Work Area And Assigning It To The Field Symbol.
CREATE DATA gs_dy_final LIKE LINE OF <git_dy_final>.
ASSIGN gs_dy_final->* TO <gs_dy_final>.
Regards
Ansari
Similar Messages
-
Creation of dynamic tables in data dictionary.
Hi Techies,
Can you help me how to create physical dynamic table in Abap dictionary.
In the selection screen, if i give Mara or Marc it should be create a dynamic table (zaa_mara) or (zaa_marc) with the similar structure.
Thanks.1) Parameters : P_TABLE --- Enter Table name.(Say mara/Marc)
2) Get the DataElements of Mara/Marc tables from DD03L.
Select RollName From DD03L INTO ITAB Where TABNAME = P_TABLE.
3) Do a Recording in SHDB Tcode for se38 to create table.
4) Use BDC to Created DBtableTABLE.
Call Transaction 'SE38' Using T_bdctable.
Regards,
Gurpreet -
Creation of internal table dynamically based on the Date Range entered
Hi SAPgurus,
I have been facing one issue i.e creation of internal table dynamically based on the date range entered in the selection screen. For example the date range I am giving as 06/2006 to 08/2006, it should display the Fieldcatelog dynamically, this part i have completed but the only issue I am facing is to populate the sales data into that fields.
Right now my program is displaying the ALV like this.
Ex:
<b>CSR District 06/2006 07/2006 08/2006 totals</b>
Shiva New York 10.00
Shiva new york 30.00
Shiva new york 40.00
but it should display like this
<b>CSR District 06/2006 07/2006 08/2006 totals</b>
Shiva New York 10.00 30.00 40.00
80.00
Please help me in this scenario, how to acheive like this..
Thanks & Regards,
Sivaram KandulaHi Sivaram,
I also got the same requirement . i saw rich and your code whatever you have uploaded.i have created dynamic internal table but i am facing the issue to populating the data to my dynamic internal table.
Sivaram, can you please explain your code after this.
*<dyn_table>
*tab_item.
LOOP AT tab_item.
ASSIGN COMPONENT 1 OF STRUCTURE <dyn_wa> TO <dyn_table>.
ASSIGN COMPONENT 2 OF STRUCTURE <dyn_wa> TO <dyn_table>.
* <dyn_wa> = tab_item-bztxt.
* <dyn_wa> = tab_item-total.
* APPEND <dyn_wa> TO <dyn_table>.
** <dyn_wa> = tab_item-total.
** ASSIGN tab_item-bezei TO <dyn_wa>.
* APPEND <dyn_table>.
ENDLOOP.
how you are puting the loop at tab_item. but tab_item is already commented.
can you send me the code after that.
i am sending some part of my code.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = gt_fCAT1
IMPORTING
ep_table = new_table.
ASSIGN new_table->* TO <dyn_table>.
create data new_line like line of <dyn_table>.
assign new_line->* to <dyn_wa>.
select vbeln
fkart
vkorg
vtweg
fkdat
spart
fksto
from vbrk
client specified
into table gt_vbrk
where mandt = sy-mandt
and fkart in ('ZF5','ZFR')
and vkorg = '1100'
and vtweg = '20'
and fkdat in s_fkdat
and spart = '06'
and fksto = ' '.
if gt_vbrk[] is not initial.
select vbeln
fkimg
prsdt
netwr
matnr
arktx
werks
mwsbp
from vbrp
client specified
into table gt_vbrp
for all entries in gt_vbrk
where vbeln = gt_vbrk-vbeln
and werks in s_werks
and matnr in s_matnr.
endif.
select mnr ltx spras from t247
into table it_t247
where spras = 'E'.
data: lv_month1 type vbrp-prsdt,
name1(3) type c,
s_month type string,
s_month1 type string,
s_month2 type string.
* lv_netwr1 type vbrp-netwr,
* lv_mwsbp1 type vbrp-mwsbp.
loop at gt_vbrp into gs_vbrp.
gs_final2-matnr = gs_vbrp-matnr.
gs_final2-arktx = gs_vbrp-arktx.
gs_final2-fkimg = gs_vbrp-fkimg.
lv_month1 = gs_vbrp-prsdt.
read table it_t247 into wa_t247 with key mnr = lv_month1+4(2).
if sy-subrc eq 0.
name1 = wa_t247-ltx.
endif.
concatenate name1
lv_month1(4) into s_month SEPARATED BY '_' .
CONCATENATE S_MONTH 'QTY' INTO S_MONTH1 SEPARATED BY ''.
CONCATENATE S_MONTH 'VALUE' INTO S_MONTH2 SEPARATED BY ''.
gs_final2-month = s_month.
lv_netwr1 = gs_vbrp-netwr.
lv_mwsbp1 = gs_vbrp-mwsbp.
gs_final2-MONTH_QTY = S_MONTH1.
GS_FINAL2-MONTH_VAL = S_MONTH2.
gs_final2-value = lv_netwr1 + lv_mwsbp1.
append gs_final2 to gt_final2.
clear: gs_final2. "lv_name2.
endloop.
if gt_final2[] is not initial.
sort gt_final2 by matnr month ascending .
loop at gt_final2 into gs_final2.
gs_final2_01 = gs_final2.
collect gs_final2_01 into gt_final2_01.
endloop.
endif.
ENDIF..
Regards
Ankur -
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:
RJundiHi,
Meybe this article helps: http://technology.amis.nl/blog/?p=2306
Kuba -
Static Tables Creation In oracle & Diff Between Static table ,Dynamic table
Static Tables Creation In oracle & Diff Between Static table ,Dynamic table
972471 wrote:
Static Tables Creation In oracle & Diff Between Static table ,Dynamic tableAll tables in a well designed application should be static tables.
Whilst it's possible to execute dynamic code and therefore create tables dynamically at run time, this is considered poor design and should be avoided in 99.99% of cases... though for some reason some people still think they need to do this, and it's never really justified.
So what issue are you facing that you need to even bother considering dynamic tables? -
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 -
Creation of dynamic internal table is not synchronous
In my code following lines are used to create a dynamic table.
REFRESH : INCTABL .
CLEAR INCTABL .
INCTABL-LINE = 'data: begin of dyntab occurs 10,'. APPEND INCTABL.
INCTABL-LINE = 'zpltnamec like zvendplt-zpltnamec,'. APPEND INCTABL.
INCTABL-LINE = 'sourcing like zopsdwbom-sourcing,'. APPEND INCTABL.
INCTABL-LINE = 'zmatgrp like zrmrpmaterial-zmatgrp,'. APPEND INCTABL.
INCTABL-LINE = 'zcollection like zrmrpmaterial-zcollection,'.
APPEND INCTABL.
INCTABL-LINE = 'fiscintrodt like zrmrpmaterial-zfiscintrodt,'.
APPEND INCTABL.
INCTABL-LINE = 'bednr like ekpo-bednr,'. APPEND INCTABL.
INCTABL-LINE = 'revlv like ekpo-revlv,'. APPEND INCTABL.
INCTABL-LINE = 'ematn like ekpo-ematn,'. APPEND INCTABL.
INCTABL-LINE = 'menge like mara-eannr,'. APPEND INCTABL.
INCTABL-LINE = 'stprs like mara-eannr,'. APPEND INCTABL.
*inctabl-line = 'kbetr like cdred-f_new,'. append inctabl.
DATA : T_KBETR(72) .
DATA :CNT(2).
DO LIN TIMES .
CNT = SY-INDEX .
CONCATENATE 'kbetr' CNT ' like cdred-f_new,' INTO T_KBETR .
CONDENSE T_KBETR .
INCTABL-LINE = T_KBETR . APPEND INCTABL.
ENDDO .
INCTABL-LINE = 'end of dyntab. '. APPEND INCTABL.
INSERT REPORT 'zcrchangereport_3'(001) FROM INCTABL.
but during run time it is using the previously created dynamic internal table structure and then creating currently required internal table.
how to overcome this problem/
Thanks.Hello,
Instead of creating report, create subroutine pool. Like
INCTABL-LINE = 'report ztest.'. APPEND INCTABL.
INCTABL-LINE = 'form main'. APPEND INCTABL.
INCTABL-LINE = 'data: begin of dyntab occurs 10,'. APPEND INCTABL.
INCTABL-LINE = 'zpltnamec like zvendplt-zpltnamec.'. APPEND INCTABL.
INCTABL-LINE = 'data: end of dyntab.'. APPEND INCTABL.
CATCH SYSTEM-EXCEPTIONS GENERATE_SUBPOOL_DIR_FULL = 9.
GENERATE SUBROUTINE POOL inctabl NAME l_name
MESSAGE L_MESSAGE LINE L_LINE WORD L_WORD.
ENDCATCH.
IF L_MESSAGE IS INITIAL.
PERFORM (L_FORM) IN PROGRAM (L_NAME).
ELSE.
WRITE : L_MESSAGE, L_LINE.
ENDIF.
You can get the message in L_message variable, if any error occurs.
Regards,
Naimesh -
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
kpThat 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 -
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).
AviadIWDColumn column = ...;
table.addGroupedColumn(column);
What exactly is the question?
Armin -
Creation of dynamic range tables
Hi there,
I have a question. I created a function module that generates a range table in a very dynamic way. The only thing needed is the table- and the field-name.
But now I don't know how to use these ranges because I declared the exporting parameter as "TABLE" (also dynamic). And now I don't know which type I have to give with when calling my function module.
The coding of my function module is like this:
Moderator message - Please respect the 2,500 character maximum when posting. Post only the relevant portions of code
So how can I use this function module in an easy way? What I need is such a dynamic
DATA: lt_range TYPE ANY TABLE (which doesn' exist).
I need the range table in the following for different IF-clauses I want to check.
Thank you very much vor every hint.
Kind regards
Markus
Edited by: Markus Glubka on Jun 6, 2010 1:49 PM
Edited by: Rob Burbank on Jun 6, 2010 7:52 PMHi Markus,
If you are talking about RANGE table the structure is fixed. You have the SIGN, OPTION, LOW, HIGH fields. [http://help.sap.com/abapdocu_70/en/ABAPTYPES_RANGES.htm]
Even if your table is dynamic you can get these values from by ASSIGN COMPONENT statement. Accessing components of dynamic table has been discussed many a times in the forum, you can check.
BR,
Suhas -
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 PMDid you find solution to this problem ?
-
Dynamic Table Width for XML Renderer
Hi Guys,
I'm looking for a way to get a XML documents with a dynamic table width.
Using a dynamic result table doesn't work.
The test program looks like this.
REPORT xml_test.
TYPE-POOLS: ixml.
DATA: go_ixml TYPE REF TO if_ixml.
go_ixml = cl_ixml=>create( ).
DATA: go_xml_document TYPE REF TO if_ixml_document.
go_xml_document = go_ixml->create_document( ).
DATA: go_xml_root_elm TYPE REF TO if_ixml_element.
go_xml_root_elm = go_xml_document->create_simple_element(
name = 'flights'
parent = go_xml_document
value = 'Texas Flight' ).
DATA: go_xml_main_elm TYPE REF TO if_ixml_element.
go_xml_main_elm = go_xml_document->create_simple_element(
name = 'airline'
parent = go_xml_root_elm ).
DATA: lv_rc TYPE i.
lv_rc = go_xml_main_elm->set_attribute( name = 'code' value = 'LH401' ).
DATA: go_xml_streamfactory TYPE REF TO if_ixml_stream_factory.
go_xml_streamfactory = go_ixml->create_stream_factory( ).
* Static Creation of X tab ---------------------------------------------
DATA: BEGIN OF gs_xml_line,
data(255) TYPE x,
END OF gs_xml_line.
DATA: gt_xml_table LIKE TABLE OF gs_xml_line,
gv_xml_size TYPE i,
go_ostream TYPE REF TO if_ixml_ostream.
* END Static Creation of X tab ------------------------------------------
* Dynamic Creation of X tab ---------------------------------------------
FIELD-SYMBOLS: <lf_x_tab> TYPE STANDARD TABLE,
<lf_x_stru> TYPE ANY.
DATA: lt_fldcat TYPE lvc_t_fcat.
DATA: lr_tab TYPE REF TO data,
lr_stru TYPE REF TO data,
ls_fldcat TYPE lvc_s_fcat,
lv_dyn_width TYPE i.
lv_dyn_width = 255.
* Append Dynamic Field.
CLEAR ls_fldcat.
ls_fldcat-fieldname = 'DATA' .
ls_fldcat-datatype = 'X'.
ls_fldcat-inttype = 'X'.
ls_fldcat-intlen = lv_dyn_width.
APPEND ls_fldcat TO lt_fldcat .
* Create dynamic internal table and assign to FS
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = lt_fldcat
IMPORTING
ep_table = lr_tab.
ASSIGN lr_tab->* TO <lf_x_tab>.
* Create dynamic work area and assign to FS
CREATE DATA lr_stru LIKE LINE OF <lf_x_tab>.
ASSIGN lr_stru->* TO <lf_x_stru>.
CHECK sy-subrc = 0.
* END Dynamic Creation of X tab ------------------------------------------
* Static Table works
go_ostream = go_xml_streamfactory->create_ostream_itable( table = gt_xml_table ).
* Dynamic Table doesn't work
go_ostream = go_xml_streamfactory->create_ostream_itable( table = <lf_x_tab> ).
* Show result
DATA: go_renderer TYPE REF TO if_ixml_renderer.
go_renderer = go_ixml->create_renderer( ostream = go_ostream
document = go_xml_document ).
lv_rc = go_renderer->render( ).
gv_xml_size = go_ostream->get_num_written_raw( ).
DATA: lv_str TYPE string,
lv_xstr TYPE xstring.
LOOP AT gt_xml_table INTO gs_xml_line.
lv_xstr = gs_xml_line-data.
CALL FUNCTION 'HR_KR_XSTRING_TO_STRING'
EXPORTING
* FROM_CODEPAGE = '8500'
in_xstring = lv_xstr
* OUT_LEN =
IMPORTING
out_string = lv_str.
WRITE: / lv_str.
ENDLOOP.
If the static table is used, the program gets a result, but it doesn't work with the dynamic table.
* Static Table works
go_ostream = go_xml_streamfactory->create_ostream_itable( table = gt_xml_table ).
* Dynamic Table doesn't work
go_ostream = go_xml_streamfactory->create_ostream_itable( table = <lf_x_tab> ).
Any Ideas?
Thanks in advance
DominikI've never used dynamically changing popup items variable before, and I'm not sure it will work(?)
But, if it's displaying a long string, it does not sound like 'items' is being assigned a proper table yet.
I don't know what you mean by a "chunk" of values. I assume you mean table.
In any case, if SYPNEventResults[1].title is a string, then SYPNEventResults[1].value can be any legal lua type.
Likewise for SYPNEventResults[2], SYPNEventResults[3], ...
If you can index/display the title with this syntax, e.g. LrDialogs.message( SYPNEventResults[1].title ), then the popup should be initialized thusly:
viewFactory:popup_menu {
items = SYPNEventResults,
value = LrView.bind('eventname2'),
width_in_chars = 40,
if a function is returning multiple values, then to get it into a table "array", do this:
local tableArray = { myTableArrayFunc( myTableArrayParameters ) }
Does this help?
Rob -
How to create a dynamic table region with dynamic VO
Hi All,
I have a requirement to create a dynamic table region with a dynamic VO.
I need this because at runtime only the user will select the table name. So based on that table name, i have to create a table region to display the records.
I already created a dynamic VO. Could anyone share the code for dynamic table region creation.
Thanks in Advance.
Thanks and Regards,
MyvizhiHi All,
I have a requirement to create a dynamic table region with a dynamic VO.
I need this because at runtime only the user will select the table name. So based on that table name, i have to create a table region to display the records.
I already created a dynamic VO. Could anyone share the code for dynamic table region creation.
Thanks in Advance.
Thanks and Regards,
Myvizhi -
How to create a dynamic table region with dynamic VO in processFormRequest
Hi All,
I have a requirement to create a dynamic table region with a dynamic VO.
I need this because at runtime only the user will select the table name. So based on that table name, i have to create a table region to display the records.
I already created a dynamic VO. Could anyone share the code for dynamic table region creation.
Thanks in Advance.
Thanks and Regards,
Myvizhi
Edited by: Myvizhi Selvi on May 20, 2013 6:21 PMHi,
You can use following sample code to create advance table columns dynamically with colum groups as well.
It assumes that you have already created advance table with ID EmpTblRN.
Below code returns column heading dynamically and if you keep your VO column names and attributes
same in all the cases (COL1, COL2.....) then you can easily use a loop to create advance table columns.
It is attaching VO attributes to OAMessageStyledText bean in the last.
Hope it helps.
OAAdvancedTableBean advTable = (OAAdvancedTableBean)webBean.findChildRecursive("EmpTblRN");
Serializable [] param = {currentWindowSeq.toString()};
Datum[] colHeadingArray = (Datum[])am.invokeMethod("getColumnHeading", param);
String oldGrpName = null;
String newGrpName = null;
OAColumnGroupBean columnGroup = null;
DictionaryData columnFormat = new DictionaryData();
columnFormat.put(WIDTH_KEY, "4%");
for (int i = 0; i < colHeadingArray.length; i++)
try
oracle.sql.STRUCT os = (oracle.sql.STRUCT)colHeadingArray;
Object[] colHeadAttr = os.getAttributes();
newGrpName = (String)colHeadAttr[0];
if(newGrpName!=null)
if(!newGrpName.equals(oldGrpName))
// Create a column group, create the set the column header,
// and add the column group under the advanced table
columnGroup = (OAColumnGroupBean)createWebBean(pageContext, COLUMN_GROUP_BEAN, null, "ColGroup"+i);
OASortableHeaderBean columnGroupHeader = (OASortableHeaderBean)createWebBean(pageContext, SORTABLE_HEADER_BEAN, null, "ColGroupHeader"+i);
columnGroupHeader.setText(newGrpName);
// Retrieve from message dictionary
columnGroup.setColumnHeader(columnGroupHeader);
advTable.addIndexedChild(columnGroup);
oldGrpName = newGrpName;
// Create a column, create the set the column header, and add the column
// under the column group
OAColumnBean column1 = (OAColumnBean)createWebBean(pageContext, COLUMN_BEAN, null, "Column"+i);
OASortableHeaderBean column1Header = (OASortableHeaderBean)createWebBean(pageContext, SORTABLE_HEADER_BEAN, null, "Column1Header"+i);
column1Header.setText(colHeadAttr[1].toString());
column1.setColumnHeader(column1Header);
column1.setColumnFormat(columnFormat);
columnGroup.addIndexedChild(column1);
// Create the actual leaf item under the first column
OAMessageStyledTextBean leaf1 = (OAMessageStyledTextBean)createWebBean(pageContext, MESSAGE_STYLED_TEXT_BEAN, null, "Leaf"+i);
//OARawTextBean leaf1 = (OARawTextBean)createWebBean(pageContext, RAW_TEXT_BEAN, null, "Leaf"+i);
leaf1.setViewAttributeName("Week"+(i+1));
String destination = "OA.jsp?page=/xxqc/oracle/apps/per/leaveadvance/webui/EmployeeLeaveDetailPG&personId={@PersonId}";
destination = destination + "&startDate="+colHeadAttr[1].toString()+"-"+(String)colHeadAttr[0];
destination = destination + "&addBreadCrumb=Y&retainAM=Y";
leaf1.setDestination(destination);
OADataBoundValueViewObject cssjob = new OADataBoundValueViewObject(leaf1,"Color"+(i+1));
//leaf1.setAttributeValue(oracle.cabo.ui.UIConstants.STYLE_CLASS_ATTR, cssjob);
leaf1.setAttributeValue(UIConstants.RENDERED_ATTR, cssjob);
column1.addIndexedChild(leaf1);
catch(Exception e)
System.out.println("e"+e); -
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,
RaydenHi,
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
Maybe you are looking for
-
How to call RFC in Async Mode using TCP/IP RFC Destination ?
Hi experts, Can anybody tell me how to call an Async RFC using TCP/IP RFC Destination ? Regards, Umesh
-
Best practice for breaking a book
Hi Everybody, I'm making a long technical manual in InDesign, and am facing the issue of how and when breaking it into separate ID Documents collected into an ID Book. In the past, I've never used ID for manuals longer than 40 pages, where I had no p
-
Output error in purchase order 3000000002 for output medium PRN
Hello, I got this error message: 'Output error in purchase order 3000000002 for output medium PRN' Regards, Lina
-
So I can put a movie in my mac's hard drive iTunes folder and it plays on my apple tv, how do i put movies onto the apple tv's hard drive so i can save the space on my mac's hard drive?
-
Oracle 9i reading BLOB performance issues
Windows XP Pro SP2 JDK 1.5.0_05 Oracle 9i Oracle Thin Driver for JDK 1.4 v.10.2.0.1.0 DBCP v.1.2.1 Spring v1.2.7 (I am using the JDBC template for convenience) I have run into serious performance issues reading BLOBs from Oracle using oracle's JDBC t