Creatin g a table dynamically....
hi all,
I am trying to create a table dynamically....
but neither table is getting created nor giving error....
can anybody help me to resolve the issue.......
EXECUTE IMMEDIATE 'CREATE TABLE'|| 'xxce_bai_stmt_hdr_temp'||
'AS'|| '(SELECT * FROM XXCE_BAI_STMT_HDR_IN_SB
WHERE (intf_sender_id = l_chr_sender_id) AND
(account_num_03 = NVL(p_in_chr_account_num,account_num_03)) AND
(account_num_03 in(
SELECT bank_account_num
FROM ap_bank_accounts
where bank_branch_id = NVL(p_in_num_bank_branch_id,bank_branch_id)
AND (account_num_03 in
( select bank_account_num
from ap_bank_accounts
where bank_branch_id in(
select bank_branch_id
from ap_bank_branches
where bank_name = NVL(p_in_chr_bank_name,bank_name)
AND intf_status = g_chr_validated_status )';
hello Justin,hello Hans,
i am agree with both of you..
that it is not a good practice to create tables
dynamically...Cool, so we're all in agreement...
Actually, i need to put the data into temporary table
every time we run the procedure...Normal so far. I'm not sure whether you really mean a temporary table or a staging table, but we'll get to that later...
i am doing a Bank Interface where in which i want to
load the data from staging to temporary
tables...thats why everytime whenever i run the
procedure i need to put data in to temporary table.Do you really mean "temporary" as in "delete this data when my session goes away"? Or do you mean that you want to load the data into a permanent staging table?
The data changes dynamically depending upon the
parameters passed to the procedure.....The data is changing, but the set of columns in your temporary/ staging table is not. That means that you could create the table once (possibly as a temporary table), then just insert the data. Something like
Once, when you create all your other tables
CREATE GLOBAL TEMPORARY TABLE temp_table_name (
<<list of columns>>
ON COMMIT DELETE ROWSIn your code, you'd just do
INSERT INTO temp_table_name( list_of_columns )
<<your select statement>>
i am using this data here after in my package...
thats why instead of inserting the data everytime &
at every level..And your package is free to use the data that had been loaded into the temporary table throughout the scope of the transaction/ session (depending on how you create the temp table). Since you're not dynamically creating the table, you also don't have to worry about violating transactional integrity, dropping the table if it exists, truncating the table, using dynamic SQL whenever you want to query it, etc. It's just another table that your code uses.
i just want to create a table once in the
package......No, just create it once. At compile time.
Justin
Similar Messages
-
How to find the number of columns in an internal table DYNAMICALLY ?
Hi,
How to find the number of columns in an internal table DYNAMICALLY ?
Thanks and Regards,
saleem.Hi,
you can find the number of columns and their order using
the <b>'REUSE_ALV_FIELDCATALOG_MERGE'</b>
call function 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = sy-repid
I_INTERNAL_TABNAME = 'ITAB'
I_INCLNAME = sy-repid
changing
ct_fieldcat = IT_FIELDCAT
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif
now describe your fieldcat . and find no of columns.
and their order also..
regards
vijay -
hello, i am a fresher in jsp. i want to add new rows in html table dynamically.In my coding, just only shows in one row . please help my problem with correct coding and i don't want to use database. Thanks ...............!
Here is my coding-------------------
---------------- form.jsp --------------------->
<%@ page import="java.util.*,newtest1.Validation" %>
<jsp:useBean id="mybean" scope="page" class="newtest1.Validation" />
<jsp:setProperty name="mybean" property="name" param="name" />
<jsp:setProperty name="mybean" property="age" param="age" />
<% s[i][j] %>
<html>
<head><title>Form</title></head>
<body>
<form method="get">
<table border="0" width="700">
<tr>
<td width="150" align="right">Name</td>
<td width="550" align="left"><input type="text" name="name" size="35"></td>
</tr>
<tr>
<td width="150" align="right">Age</td>
<td width="550" align="left"><input type="text" name="age" size="35"></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="5">
<tr><td> </td></tr>
<tr><td><input type="submit" name="submit" value="ADD"></td></tr>
<tr><td> </td></tr>
<tr><td width="100%" align="center" border=1>
<% int count=mybean.getStart();
for(int i=count; i<count+1; i++) { %>
<tr>
<td><jsp:getProperty name="mybean" property="name" /></td>
<td><jsp:getProperty name="mybean" property="age" /></td>
<td><%= count %></td>
<% count+=1; %>
</tr>
<% } %></td></tr>
</table>
</form>
</body>
</html>
----------------- Validation.java ----------------->
package newtest1;
import java.util.*;
public class Validation {
private String name;
private String age;
static int start=0;
public Validation() { name=null;
age=null;
++start;}
public void setName(String username) { if(username!="")
name=username;
public String getName() { return name; }
public void setAge(String userage) { if (age!="")
{age=userage;}
public String getAge() { return age; }
public int getStart() {
return start; }Hi, Do you mean to say,
You have an HTML page in which you have a text field and an add button. If you enter anything in that text field and click on Add button the text field contents should be displayed in the same HTML page and you should be able to go on entering new values into the text field and you should be able to retain and display all the previously entered values..
and finally the list of added items are not stored in the database..
If this is the case
i. Your html form should be submitted to the same page.
ii. You need to have a Vector which holds the entered values.
iii. Bind the vector object to the request object and collect the same vector object from the request and display its contents...
I think this would help... -
How to make columns in a table dynamic
Hi,
I want to make the columns of a table dynamic.
At design time I dont know how many columns will be required.
Rows are made dynamic by using the bean concept.
Please help me in this reference(columns).
Thanks
PoojaHi, i don't know how you create the rows dynamically but
have you tried to use a forEach?
<af:table ...>
<af:forEach items="..." var="...">
<af:column headerText="...">
<af:outputText value="..."/>
</af:column>
</af:forEach>
</af:table>
here there is an example of a dynamic panelList:
<af:panelList rows="3" maxColumns="6">
<af:forEach items="#{bindings.ContratosView1.rangeSet}" var="li">
<af:commandLink text="#{li.Codigo}" action="Edit"/>
</af:forEach>
</af:panelList> -
Error While creating Table dynamically
Hello gurus,
I am trying to create a table dynamically in OA Page. For this I have added an Empty TableLayoutBean called "TestTableLayoutRN" in My PG. and In the controller's process request I have added following Code
public void processRequest(OAPageContext pageContext, OAWebBean webBean)
System.out.println("TableBeanCO:ProcessRequest");
super.processRequest(pageContext, webBean);
OAApplicationModule am = pageContext.getApplicationModule(webBean);
Serializable[] parameters = null;
//am.invokeMethod("rollbackSupplier");
OATableLayoutBean tableLayoutBean = (OATableLayoutBean)webBean.findIndexedChildRecursive("TestTableLayoutRN");
OARowLayoutBean row = (OARowLayoutBean)createWebBean(pageContext,
OAWebBeanConstants.ROW_LAYOUT_BEAN,null,"rowHeader");
tableLayoutBean.addIndexedChild(row);
OACellFormatBean cell = (OACellFormatBean)createWebBean(pageContext,
OAWebBeanConstants.CELL_FORMAT_BEAN,null,"cellHeader");
row.addIndexedChild(cell);
System.out.println("TableBeanCO:End ProcessRequest");
But I am getting null pointer exception on the Line tableLayoutBean.addIndexedChild(row);
when I am trying to add the row to this table..
Can you please help why I am getting this error?
Exception Details.
oracle.apps.fnd.framework.OAException: java.lang.NullPointerException
at oracle.apps.fnd.framework.OAException.wrapperException(OAException.java:888)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:597)
at oracle.apps.fnd.framework.webui.OAWebBeanTableHelper.processRequest(OAWebBeanTableHelper.java:2084)
at oracle.apps.fnd.framework.webui.beans.table.OATableBean.processRequest(OATableBean.java:1030)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:932)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:899)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:640)
at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:247)
at oracle.apps.fnd.framework.webui.beans.layout.OAStackLayoutBean.processRequest(OAStackLayoutBean.java:350)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:932)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:899)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:640)
at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:247)
at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processRequest(OAPageLayoutHelper.java:1095)
at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processRequest(OAPageLayoutBean.java:1569)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:932)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:899)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:640)
at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:247)
at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processRequest(OAFormBean.java:385)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:932)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:899)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:640)
at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:247)
at oracle.apps.fnd.framework.webui.beans.OABodyBean.processRequest(OABodyBean.java:353)
at oracle.apps.fnd.framework.webui.OAPageBean.processRequest(OAPageBean.java:2298)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1711)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:497)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:418)
at OA.jspService(OA.jsp:40)
at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)
at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:727)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:259)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:106)
at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:803)
at java.lang.Thread.run(Thread.java:534)
## Detail 0 ##
java.lang.NullPointerException
at xx.oracle.apps.fnd.webui.TableBeanCO.processRequest(TableBeanCO.java:79)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:581)
at oracle.apps.fnd.framework.webui.OAWebBeanTableHelper.processRequest(OAWebBeanTableHelper.java:2084)
at oracle.apps.fnd.framework.webui.beans.table.OATableBean.processRequest(OATableBean.java:1030)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:932)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:899)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:640)
at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:247)
at oracle.apps.fnd.framework.webui.beans.layout.OAStackLayoutBean.processRequest(OAStackLayoutBean.java:350)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:932)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:899)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:640)
at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:247)
at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processRequest(OAPageLayoutHelper.java:1095)
at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processRequest(OAPageLayoutBean.java:1569)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:932)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:899)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:640)
at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:247)
at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processRequest(OAFormBean.java:385)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:932)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:899)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:640)
at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:247)
at oracle.apps.fnd.framework.webui.beans.OABodyBean.processRequest(OABodyBean.java:353)
at oracle.apps.fnd.framework.webui.OAPageBean.processRequest(OAPageBean.java:2298)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1711)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:497)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:418)
at OA.jspService(OA.jsp:40)
at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)
at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:727)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:259)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:106)
at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:803)
at java.lang.Thread.run(Thread.java:534)I am not very sure - but I seem to remember that you need to call tableBean.prepareForRendering() before you start altering it... well - dont count on my suggestion to work.. I had tried something similar 3 years ago... and speaking from what little i remember from then...
-
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 -
Problem creating an internal table dynamically
Hi,
I'm trying to create an internal table dynamically as i would be able to determine the structure of the table based on the user input.
I've used the sample code from this forum ...
REPORT ZRICH_0003 .
type-pools: slis.
field-symbols: <dyn_table> type standard table,
<dyn_wa>,
<dyn_field>.
data: alv_fldcat type slis_t_fieldcat_alv,
it_fldcat type lvc_t_fcat.
type-pools : abap.
data : it_details type abap_compdescr_tab,
wa_details type abap_compdescr.
data : ref_descr type ref to cl_abap_structdescr.
data: new_table type ref to data,
new_line type ref to data,
wa_it_fldcat type lvc_s_fcat.
selection-screen begin of block b1 with frame title text.
parameters: p_table(30) type c.
selection-screen end of block b1.
Get the structure of the table.
ref_descr ?= cl_abap_typedescr=>describe_by_name( p_table ).
it_details[] = ref_descr->components[].
loop at it_details into wa_details.
clear wa_it_fldcat.
wa_it_fldcat-fieldname = wa_details-name .
wa_it_fldcat-datatype = wa_details-type_kind.
wa_it_fldcat-inttype = wa_details-type_kind.
wa_it_fldcat-intlen = wa_details-length.
wa_it_fldcat-decimals = wa_details-decimals.
append wa_it_fldcat to it_fldcat .
endloop.
Create dynamic internal table and assign to FS
call method cl_alv_table_create=>create_dynamic_table
exporting
it_fieldcatalog = it_fldcat
importing
ep_table = new_table.
assign new_table->* to <dyn_table>.
Create dynamic work area and assign to FS
create data new_line like line of <dyn_table>.
assign new_line->* to <dyn_wa>.
<b>* Select Data from table.
select * into table <dyn_table> from
(p_table).</b>
Write out data from table.
loop at <dyn_table> into <dyn_wa>.
do.
assign component sy-index of structure <dyn_wa> to <dyn_field>.
if sy-subrc <> 0.
exit.
endif.
if sy-index = 1.
write:/ <dyn_field>.
else.
write: <dyn_field>.
endif.
enddo.
endloop.
I'm able to get the structure of the table that i want, but when i'm trying to select data from the table into this internal table..as highlighted in the sample code above..i'm getting a short dump...saying that ' the database table is 600 bytes wide but the internal table is only 576 bytes wide.
The internal table is declared as
field-symbols: <dyn_table> type standard table..
Could anyone please tell me how to rectify this.
Thanks in advance,
Harsha.Hi Smitha,
I'm building the internal table by getting the structure using the method
cl_abap_typedescr=>describe_by_name( p_table ).
where p_table is the table name determined dynamically..
Now using this structure, i'm building an internal table by calling the method
call method cl_alv_table_create=>create_dynamic_table
I've checked all the fields after the internal table has been created .. and it contains all the fields of the table that i'm supplying initially..
But when i read data into that internal table, it gives me that dump..I've described it in this post earlier.
Any more suggestions would be very helpful.
Thanks,
Harsha -
Reg. Creation of table dynamically
Hi Experts,
While creating a table dynamically some of the fields in it_lvc_cat are Integer but the created table (new_table) contains all the fields as character. Is there any possibility of changing the datatype as interger for required fields.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = it_lvc_cat
IMPORTING
ep_table = new_table.
Regards,
Vijay.Hi,
Refer this code:
REPORT zmtable LINE-SIZE 255
LINE-COUNT 65.
Program written by Vijay Chaitanya Raju
Maintain Table dynamicly (Table name is entered on Selection Screen)
Very powerfull program. Please maintain authorisation access and
restrict maintenance to Z-tables
Version 6.20 and up
(can be used in 4.6C with some modifications to block try - endtry
and classes)
Enhanced functionality with dynamic selection screen
TABLES: sscrfields. "Fields on selection screens
TYPE-POOLS rsds.
DATA ds_clauses TYPE rsds_where.
DATA: BEGIN OF ifield OCCURS 0,
fieldname LIKE dd03l-fieldname,
position LIKE dd03l-position,
keyflag LIKE dd03l-keyflag,
datatype LIKE dd03l-datatype.
DATA: END OF ifield.
DATA: sl_step LIKE sy-tabix,
ss_step LIKE sy-subrc,
ss_act(1) TYPE c,
sl_lines LIKE sy-tfill,
sl_status LIKE sy-subrc,
sl_subrc LIKE sy-subrc,
sl_update(1) TYPE c,
sl_mandt(1) TYPE c,
len(6) TYPE n,
f_value(255) TYPE c,
sl_datum LIKE sy-datum,
sl_uzeit LIKE sy-uzeit,
price1(15) TYPE c,
price2(15) TYPE c,
mess(60) TYPE c,
d_stat LIKE sy-subrc,
m_stat LIKE sy-subrc,
slchar(6) TYPE c.
DATA: ref_ptr TYPE REF TO cx_root. "Root class more common
DATA: text TYPE string.
DATA: sl_index LIKE sy-tabix.
DATA: zauth LIKE dd02l-tabname.
DATA: num TYPE i,
max_len TYPE i,
check_len TYPE i,
sl_sel(1) TYPE c.
TYPE-POOLS: icon.
SELECTION-SCREEN.
SELECTION-SCREEN BEGIN OF LINE.
text-012 - 'Table Name'
SELECTION-SCREEN COMMENT 1(25) text-012.
PARAMETERS: tabname LIKE dd02l-tabname DEFAULT 'ZSCARE'.
text-003 - 'Selection'
SELECTION-SCREEN PUSHBUTTON 75(9) text-003 USER-COMMAND sta1.
SELECTION-SCREEN END OF LINE.
numrows(text) - 'Max Number of ROWS'
PARAMETERS: numrows LIKE sy-subrc DEFAULT '100'.
At Selection-Screen *
AT SELECTION-SCREEN.
CASE sscrfields-ucomm.
WHEN 'STA1'.
CLEAR sl_sel.
CALL FUNCTION 'ZSTAN_SELECTIONS'
EXPORTING
tabname = tabname
IMPORTING
ds_clauses = ds_clauses
EXCEPTIONS
table_not_valid = 1
other_error = 2
OTHERS = 3.
IF sy-subrc = 0.
sl_sel = 'X'.
ENDIF.
ENDCASE.
*At Selection-Screen Output *
AT SELECTION-SCREEN OUTPUT.
SELECT SINGLE tabname
INTO tabname
FROM dd02l
WHERE tabname = tabname
AND as4local = 'A'
AND ( tabclass = 'TRANSP' OR tabclass = 'POOL'
OR tabclass = 'CLUSTER' ).
IF sy-subrc <> 0.
MESSAGE 'Table is not valid' TYPE 'S'.
RETURN.
ENDIF.
START-OF-SELECTION.
START-OF-SELECTION.
DEFINE: acheck.
zauth = 'ZTABAUTH'.
select single statu
into sl_update
from (zauth)
where tabname = tabname
and bname = sy-uname.
if sy-subrc <> 0.
message 'You are not authorized to view this table' type 'S'.
return.
endif.
END-OF-DEFINITION.
SELECT SINGLE tabname
INTO tabname
FROM dd02l
WHERE tabname = tabname
AND as4local = 'A'
AND ( tabclass = 'TRANSP' OR tabclass = 'POOL'
OR tabclass = 'CLUSTER' ).
IF sy-subrc <> 0.
MESSAGE 'Table is not valid' TYPE 'S'.
RETURN.
ENDIF.
DATA: ptr_itab TYPE REF TO data.
FIELD-SYMBOLS: <fs_itab> TYPE STANDARD TABLE. "ANY TABLE.
CREATE DATA ptr_itab TYPE STANDARD TABLE OF (tabname).
ASSIGN ptr_itab->* TO <fs_itab>.
For DELETION
DATA: ptr_itd TYPE REF TO data.
FIELD-SYMBOLS: <fs_itd> TYPE STANDARD TABLE.
CREATE DATA ptr_itd TYPE STANDARD TABLE OF (tabname).
ASSIGN ptr_itd->* TO <fs_itd>.
For MODIFICATION
DATA: ptr_itm TYPE REF TO data.
FIELD-SYMBOLS: <fs_itm> TYPE STANDARD TABLE.
CREATE DATA ptr_itm TYPE STANDARD TABLE OF (tabname).
ASSIGN ptr_itm->* TO <fs_itm>.
DATA: ptr_wtab TYPE REF TO data.
FIELD-SYMBOLS: <fs_wtab> TYPE ANY.
CREATE DATA ptr_wtab TYPE (tabname).
ASSIGN ptr_wtab->* TO <fs_wtab>.
DATA: itabname(15) TYPE c.
itabname = '<fs_wtab>'.
Standard list status with 'SAVE' button
SET PF-STATUS 'STLI'.
CLEAR sl_update.
Maintain authorisation access in table ZTABAUTH
Key fields: tabname - Table name
bname = sy-uname - User name
statu = 'X' - maintain
' ' - view
Check authorisation access
acheck.
SELECT fieldname position keyflag datatype
INTO TABLE ifield
FROM dd03l
WHERE tabname = tabname
AND fieldname NOT LIKE '.INCLU%'
ORDER BY position.
FIELD-SYMBOLS: <f1> TYPE ANY.
DATA: tab_field(60) TYPE c,
sline LIKE sy-lisel.
DATA: field_attr LIKE dfies.
DATA: BEGIN OF tfield_attr OCCURS 0.
INCLUDE STRUCTURE field_attr.
DATA: END OF tfield_attr.
LOOP AT ifield.
CALL FUNCTION 'G_FIELD_READ'
EXPORTING
table = tabname
fieldname = ifield-fieldname
text_flag = 'X'
IMPORTING
field_attr = field_attr.
tfield_attr = field_attr.
APPEND tfield_attr.
ENDLOOP.
IF sl_sel = 'X'.
SELECT *
FROM (tabname)
INTO TABLE <fs_itab> UP TO numrows ROWS
WHERE (ds_clauses-where_tab).
ELSE.
SELECT *
FROM (tabname)
INTO TABLE <fs_itab> UP TO numrows ROWS.
ENDIF.
DESCRIBE TABLE <fs_itab> LINES sl_lines.
Show two extra lines to allow addition up to 2 new lines
IF sl_update = 'X'.
DO 2 TIMES.
APPEND INITIAL LINE TO <fs_itab>.
ENDDO.
ENDIF.
DATA: info(22) VALUE 'D - Delete, M - Modify'.
WRITE: / icon_information AS ICON QUICKINFO info.
WRITE ' '.
CLEAR check_len.
LOOP AT tfield_attr.
IF tfield_attr-datatype = 'CLNT'.
CONTINUE.
ENDIF.
len = tfield_attr-outputlen.
IF tfield_attr-keyflag = 'X'.
check_len = check_len + len + 1.
ENDIF.
IF tfield_attr-scrtext_m IS NOT INITIAL.
WRITE: AT (len) tfield_attr-scrtext_m COLOR 1.
ELSE.
WRITE: AT (len) tfield_attr-fieldtext COLOR 1.
ENDIF.
ENDLOOP.
CLEAR ss_step.
CLEAR ss_act.
LOOP AT <fs_itab> INTO <fs_wtab>.
IF sy-tabix LE sl_lines.
ss_step = 1.
ELSE.
CLEAR ss_step.
ENDIF.
In field SS_STEP put D - to delete record
M - to modify/add new record
IF sl_update = 'X'.
WRITE:/ icon_change AS ICON.
IF ss_step = 1.
WRITE: ss_act INPUT ON.
ELSE.
ss_act = 'M'.
WRITE: ss_act.
CLEAR ss_act.
ENDIF.
ELSE.
WRITE:/ icon_display AS ICON.
WRITE: ss_act COLOR 2.
ENDIF.
LOOP AT ifield.
Maintain client dependant tables in the same client
IF ifield-datatype = 'CLNT'.
sl_mandt = 'X'.
CONTINUE.
ENDIF.
CONCATENATE itabname '-' ifield-fieldname INTO tab_field.
ASSIGN (tab_field) TO <f1>.
IF sl_update = 'X'.
IF ifield-keyflag = 'X' AND ss_step IS NOT INITIAL.
WRITE: <f1> COLOR 4.
ELSE.
WRITE: <f1> INPUT ON.
ENDIF.
ELSE.
IF ifield-keyflag = 'X' AND ss_step IS NOT INITIAL.
WRITE: <f1> COLOR 4.
ELSE.
WRITE: <f1> COLOR 2.
ENDIF.
ENDIF.
UNASSIGN <f1>.
ENDLOOP.
ENDLOOP.
END-OF-SELECTION.
END-OF-SELECTION.
AT USER-COMMAND.
AT USER-COMMAND.
CASE sy-ucomm.
WHEN 'SAVE'.
IF sl_update = 'X'.
CLEAR: sl_step,
sl_status,
sl_subrc,
<fs_wtab>,
d_stat,
m_stat,
max_len.
REFRESH <fs_itd>.
REFRESH <fs_itm>.
DO.
IF sl_status <> 0.
EXIT.
ENDIF.
ADD 1 TO sl_step.
IF sl_subrc <> 0.
EXIT.
ENDIF.
CLEAR ss_step.
CLEAR ss_act.
READ LINE sl_step
FIELD VALUE ss_act INTO f_value.
sl_subrc = sy-subrc.
IF f_value(1) EQ 'D' OR f_value(1) = 'd'.
ss_step = 1. "Delete
ELSEIF f_value(1) EQ 'M' OR f_value(1) = 'm'.
ss_step = 2. "Modify
ELSE.
CLEAR ss_step.
ENDIF.
CHECK sy-lisel(3) = '0Z '.
IF ss_step GT 0.
CLEAR sline.
sline = sy-lisel+5(250).
max_len = 250.
CHECK sline(check_len) <> ' '.
LOOP AT tfield_attr.
CONCATENATE itabname '-' tfield_attr-fieldname
INTO tab_field.
ASSIGN (tab_field) TO <f1>.
IF tfield_attr-fieldname = 'MANDT'.
<f1> = sy-mandt.
ELSE.
CLEAR f_value.
IF max_len LT tfield_attr-outputlen.
max_len = 255.
ADD 1 TO sl_step.
READ LINE sl_step.
sline = sy-lisel.
ENDIF.
f_value = sline(tfield_attr-outputlen).
max_len = max_len - tfield_attr-outputlen - 1.
IF tfield_attr-inttype = 'D'.
IF f_value CO ' 0./-'.
CLEAR sl_datum.
<f1> = sl_datum.
ELSE.
CALL FUNCTION 'CONVERT_DATE_INPUT'
EXPORTING
input = f_value
plausibility_check = 'X'
IMPORTING
output = sl_datum
EXCEPTIONS
plausibility_check_failed = 1
wrong_format_in_input = 2
OTHERS = 3.
IF sy-subrc = 0.
<f1> = sl_datum.
ELSE.
text = 'Invalid Date'.
sl_status = 1.
EXIT.
ENDIF.
ENDIF.
ELSEIF tfield_attr-inttype = 'T'.
IF f_value CO ' 0:'.
CLEAR sl_uzeit.
<f1> = sl_uzeit.
ELSE.
CALL FUNCTION 'CONVERT_TIME_INPUT'
EXPORTING
input = f_value
plausibility_check = 'X'
IMPORTING
output = sl_uzeit
EXCEPTIONS
plausibility_check_failed = 1
wrong_format_in_input = 2
OTHERS = 3.
IF sy-subrc = 0.
<f1> = sl_uzeit.
ELSE.
text = 'Invalid Time'.
sl_status = 1.
EXIT.
ENDIF.
ENDIF.
ELSEIF tfield_attr-inttype = 'C'.
TRANSLATE f_value TO UPPER CASE.
<f1> = f_value.
ELSE.
TRANSLATE f_value USING ', '.
CONDENSE f_value NO-GAPS.
TRY.
<f1> = f_value.
CATCH cx_root INTO ref_ptr.
text = ref_ptr->get_text( ).
sl_status = 1.
EXIT.
ENDTRY.
ENDIF.
SHIFT sline BY tfield_attr-outputlen PLACES.
SHIFT sline LEFT.
ENDIF.
UNASSIGN <f1>.
ENDLOOP.
IF sl_status = 0.
CASE ss_step.
WHEN 1. "Delete
ADD 1 TO d_stat.
APPEND <fs_wtab> TO <fs_itd>.
WHEN 2. "Modify
ADD 1 TO m_stat.
APPEND <fs_wtab> TO <fs_itm>.
ENDCASE.
ENDIF.
ENDIF.
ENDDO.
IF sl_status = 0.
IF d_stat IS NOT INITIAL.
slchar = d_stat.
CONCATENATE 'Deleted -' slchar 'record.' INTO text
SEPARATED BY space.
DELETE (tabname) FROM TABLE <fs_itd>.
ENDIF.
IF m_stat IS NOT INITIAL.
slchar = m_stat.
CONCATENATE text 'Modified -' slchar 'record.' INTO text
SEPARATED BY space.
MODIFY (tabname) FROM TABLE <fs_itm>.
ENDIF.
IF d_stat IS INITIAL AND m_stat IS INITIAL.
MESSAGE 'No changes were done' TYPE 'S'.
ELSE.
MESSAGE text TYPE 'S'.
ENDIF.
LEAVE.
ELSE.
MESSAGE text TYPE 'I'.
EXIT.
ENDIF.
ELSE.
LEAVE.
ENDIF.
ENDCASE.
*--END--
Below is Function for a Dynamic Selection Screen
FUNCTION zstan_selections.
""Local interface:
*" IMPORTING
*" VALUE(TABNAME) LIKE DD02L-TABNAME DEFAULT 'ZSCARE'
*" EXPORTING
*" VALUE(DS_CLAUSES) TYPE RSDS_WHERE
*" EXCEPTIONS
*" TABLE_NOT_VALID
*" OTHER_ERROR
DATA texpr TYPE rsds_texpr.
DATA twhere TYPE rsds_twhere.
DATA trange TYPE rsds_trange.
DATA BEGIN OF qcat. "Selections View for
INCLUDE STRUCTURE rsdsqcat. "Free Selectoptions
DATA END OF qcat.
DATA BEGIN OF tabs OCCURS 10.
INCLUDE STRUCTURE rsdstabs.
DATA END OF tabs.
DATA BEGIN OF fields OCCURS 10.
INCLUDE STRUCTURE rsdsfields.
DATA END OF fields.
DATA BEGIN OF efields OCCURS 10.
INCLUDE STRUCTURE rsdsfields.
DATA END OF efields.
DATA selid LIKE rsdynsel-selid.
DATA actnum LIKE sy-tfill.
DATA title LIKE sy-title VALUE 'Selection Screen'.
DATA: maxnum LIKE sy-subrc VALUE '69'.
CLEAR tabs.
tabs-prim_tab = tabname.
COLLECT tabs.
DATA: position LIKE dd03l-position.
DATA: keyflag LIKE dd03l-keyflag.
CLEAR fields.
fields-tablename = tabname.
fields-sign = 'I'.
DATA: step LIKE sy-subrc.
SELECT fieldname keyflag position
INTO (fields-fieldname, keyflag, position)
FROM dd03l
WHERE tabname = tabname
AND fieldname NOT LIKE '.INCLU%'
AND datatype NE 'CLNT'
ORDER BY position.
ADD 1 TO step.
CHECK step LE maxnum.
IF keyflag <> 'X'.
efields = fields.
APPEND efields.
ENDIF.
APPEND fields.
ENDSELECT.
IF sy-subrc <> 0.
RAISE table_not_valid.
ENDIF.
CALL FUNCTION 'FREE_SELECTIONS_INIT'
EXPORTING
expressions = texpr
kind = 'F'
IMPORTING
selection_id = selid
expressions = texpr
where_clauses = twhere
field_ranges = trange
number_of_active_fields = actnum
TABLES
tables_tab = tabs
fields_tab = fields
fields_not_selected = efields
EXCEPTIONS
fields_incomplete = 01
fields_no_join = 02
field_not_found = 03
no_tables = 04
table_not_found = 05
expression_not_supported = 06
incorrect_expression = 07
illegal_kind = 08
area_not_found = 09
inconsistent_area = 10
kind_f_no_fields_left = 11
kind_f_no_fields = 12
too_many_fields = 13.
IF sy-subrc = 0.
CALL FUNCTION 'FREE_SELECTIONS_DIALOG'
EXPORTING
selection_id = selid
title = title
IMPORTING
where_clauses = twhere
expressions = texpr
field_ranges = trange
number_of_active_fields = actnum
TABLES
fields_tab = fields
EXCEPTIONS
internal_error = 01
no_action = 02
no_fields_selected = 03
no_tables_selected = 04
selid_not_found = 05.
IF sy-subrc = 0.
CLEAR ds_clauses.
MOVE tabname TO ds_clauses-tablename.
READ TABLE twhere WITH KEY ds_clauses-tablename INTO ds_clauses.
IF sy-subrc <> 0.
RAISE other_error.
ENDIF.
ELSE.
RAISE other_error.
ENDIF.
ELSE.
RAISE other_error.
ENDIF.
ENDFUNCTION.
Regards,
Shiva -
Help required in creation of Dictionary table dynamically
Hello All,
I have created DDIC table created dynamically.
But what i require is! the dictionary table which i have created should be under the package name as given by the customer.
I have seen in FM DDIF_TABL_PUT the parameter dd02v-APPLCLASS is the write parameter to create the table under the required package. This field is of length char 4 only.
Normally the package name will be greater than char4 and also it happend in my case that the package name is more than char4.
Now i am unable to create the table dynamically under the specified pacakage of the customer
How can i solve this problem?
Can any one help me in this issue?
Regards,
GuptaHi Lakshman,
Thank you for your reply,
I have used the FM which you have mentioned but i didn't work. I mean when i see the attributes of the table, package is still empty.
Can you help me to solve the problem.
CALL FUNCTION 'TR_TADIR_INTERFACE'
EXPORTING
* WI_DELETE_TADIR_ENTRY = ' '
* WI_REMOVE_REPAIR_FLAG = ' '
* WI_SET_REPAIR_FLAG = ' '
* WI_TEST_MODUS = 'X'
wi_tadir_pgmid = 'R3TR'
wi_tadir_object = 'TABL'
wi_tadir_obj_name = lv_objname
* WI_TADIR_KORRNUM = ' '
* WI_TADIR_SRCSYSTEM = ' '
* WI_TADIR_AUTHOR = ' '
wi_tadir_devclass = 'ZV/HF/PLANNING'
* WI_TADIR_MASTERLANG = ' '
* WI_TADIR_CPROJECT = ' '
* WI_TADIR_VERSID = ' '
* WI_REMOVE_GENFLAG = ' '
* WI_SET_GENFLAG = ' '
* WI_READ_ONLY = ' '
* IV_SET_EDTFLAG = ' '
* IMPORTING
* NEW_GTADIR_ENTRY =
* NEW_TADIR_ENTRY =
EXCEPTIONS
tadir_entry_not_existing = 1
tadir_entry_ill_type = 2
no_systemname = 3
no_systemtype = 4
original_system_conflict = 5
object_reserved_for_devclass = 6
object_exists_global = 7
object_exists_local = 8
object_is_distributed = 9
obj_specification_not_unique = 10
no_authorization_to_delete = 11
devclass_not_existing = 12
simultanious_set_remove_repair = 13
order_missing = 14
no_modification_of_head_syst = 15
pgmid_object_not_allowed = 16
masterlanguage_not_specified = 17
devclass_not_specified = 18
specify_owner_unique = 19
loc_priv_objs_no_repair = 20
gtadir_not_reached = 21
object_locked_for_order = 22
change_of_class_not_allowed = 23
no_change_from_sap_to_tmp = 24
OTHERS = 25
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Regards,
Lisa
Edited by: Lisa Roy on Apr 9, 2008 11:37 AM -
How to create internal table dynamically based on a table entry
hi Experts,
I have table yprod_cat. It has product categories.
In my ABAP program I need to create internal table dynamically based on the number of entries in the table.
For example:
If the table has 3 entries for product category
1. Board
2. Micro
3. Syst
Then create three (3) internal tables.
i_board
i_micro
i_syst
How can we do this? Any sample code will be very usefull
Thanks & Regards
Gopal
Moderator Message: No sample codes can be given. Please search for them or work it!
Edited by: kishan P on Jan 19, 2011 4:22 PMOur APEX version is 4.2We are using below SQL query to display radio groups dynamically..
SELECT APEX_ITEM.RADIOGROUP (1,deptno,'20',dname) dt
FROM dept
ORDER BY 1;
Created a form using SQL type and given abouve SQL query as source.. But when we run the page, there were no radio groups displayed in the page..
Below is the output of the query..
<input type="radio" name="f01" value="10" />ACCOUNTING
<input type="radio" name="f01" value="20" checked="checked" />RESEARCH
<input type="radio" name="f01" value="30" />SALES
<input type="radio" name="f01" value="40" />OPERATIONS
>
If Tabular Form:
Edit Region > Report Attributes > Edit Column > Change the Column type to "Standard Report Column"
If normal Page Item:
Edit Page Item > Security > Escape special characters=No.
Pl read the help on that page item to understand the security risk associated with =NO.
Cheers,
Edited by: Prabodh on Dec 3, 2012 5:59 PM -
How to insert data into the existin table dynamically
Hi All....
Iam creating the table dynamically(on the fly) if the the table already exist in the database then the data should be inserted. though the table is created dynamically we dont know the columns of the table.. how i can solve the issue.. pls help meThis will create your table and also data will be inserted. Use execute immediate.
CREATE TABLE Table_name AS <Query to fetch data> -
Setting the header of a Column group in a Advanced table dynamically
Hi All,
There is a requirement to set the Header of a column group in a Advanced table dynamically by fetching the values from a view attribute.
Code :
OAAdvancedTableBean spiderTbl1 ;
Problem:
It is not able to set the value for the header inspite of getting the handle of the bean.
Analysis:
the same piece of code works for
1) Setting the text of the advanced table
2) Setting the header of a column in a column group
Please let me know if there is anything more that needs to be done for setting the prompt of a column group header.
Thanks in advance!I have posted it without giving the complete code by mistake. Below is the code:
OAAdvancedTableBean spiderTbl1 ;
OASortableHeaderBean spiderHdr1;
spiderTbl1 = (OAAdvancedTableBean)webBean.findChildRecursive("SpiderCatTbl1RN");
if (spiderTbl1!=null){
spiderHdr1= (OASortableHeaderBean)spiderTbl1.findChildRecursive("AnalogHdr");
if (spiderHdr1!=null) {
spiderHdr1.setAttributeValue(OAWebBeanConstants.PROMPT_ATTR,
new OADataBoundValueViewObject(spiderHdr1,
"SpiderCategory1",
"ProjRegPVO1"));
} -
How to increase the length of internal table dynamically
How to increase the length of internal table dynamically depending on the number of fields fetched into the internal table ?
The requirement code :
types: begin of t_data,
form like zscr_data_hdr-form,
werks like zscr_data_hdr-werks,
matnr like zscr_data_hdr-matnr,
verid like zscr_data_hdr-verid,
lot like zscr_data_hdr-lot,
lot_qty like zscr_data_hdr-lot_qty,
udate like zscr_data_hdr-udate,
utime like zscr_data_hdr-utime,
zuser like zscr_data_hdr-zuser,
processed like zscr_data_hdr-processed,
defect like zscr_defect_data-defect,
vornr like zscr_route_data-vornr,
fld1 like zscr_defect_data-defect_val,
fld2 like zscr_defect_data-defect_val,
fld3 like zscr_defect_data-defect_val,
fld4 like zscr_defect_data-defect_val,
fld5 like zscr_defect_data-defect_val,
fld6 like zscr_defect_data-defect_val,
fld7 like zscr_defect_data-defect_val,
fld8 like zscr_defect_data-defect_val,
fld9 like zscr_defect_data-defect_val,
fld10 like zscr_defect_data-defect_val,
fld11 like zscr_defect_data-defect_val,
fld12 like zscr_defect_data-defect_val,
fld13 like zscr_defect_data-defect_val,
fld14 like zscr_defect_data-defect_val,
fld15 like zscr_defect_data-defect_val,
fld16 like zscr_defect_data-defect_val,
fld17 like zscr_defect_data-defect_val,
fld18 like zscr_defect_data-defect_val,
fld19 like zscr_defect_data-defect_val,
fld20 like zscr_defect_data-defect_val,
fld21 like zscr_defect_data-defect_val,
fld22 like zscr_defect_data-defect_val,
fld23 like zscr_defect_data-defect_val,
fld24 like zscr_defect_data-defect_val,
fld25 like zscr_defect_data-defect_val,
fld26 like zscr_defect_data-defect_val,
fld27 like zscr_defect_data-defect_val,
fld28 like zscr_defect_data-defect_val,
fld29 like zscr_defect_data-defect_val,
fld30 like zscr_defect_data-defect_val,
fld31 like zscr_defect_data-defect_val,
fld32 like zscr_defect_data-defect_val,
fld33 like zscr_defect_data-defect_val,
fld34 like zscr_defect_data-defect_val,
fld35 like zscr_defect_data-defect_val,
fld36 like zscr_defect_data-defect_val,
fld37 like zscr_defect_data-defect_val,
fld38 like zscr_defect_data-defect_val,
fld39 like zscr_defect_data-defect_val,
fld40 like zscr_defect_data-defect_val,
fld41 like zscr_defect_data-defect_val,
fld42 like zscr_defect_data-defect_val,
fld43 like zscr_defect_data-defect_val,
fld44 like zscr_defect_data-defect_val,
fld45 like zscr_defect_data-defect_val,
fld46 like zscr_defect_data-defect_val,
fld47 like zscr_defect_data-defect_val,
fld48 like zscr_defect_data-defect_val,
fld49 like zscr_defect_data-defect_val,
fld50 like zscr_defect_data-defect_val,
fld51 like zscr_defect_data-defect_val,
fld52 like zscr_defect_data-defect_val,
fld53 like zscr_defect_data-defect_val,
fld54 like zscr_defect_data-defect_val,
fld55 like zscr_defect_data-defect_val,
fld56 like zscr_defect_data-defect_val,
fld57 like zscr_defect_data-defect_val,
fld58 like zscr_defect_data-defect_val,
fld59 like zscr_defect_data-defect_val,
fld60 like zscr_defect_data-defect_val,
fld61 like zscr_defect_data-defect_val,
fld62 like zscr_defect_data-defect_val,
fld63 like zscr_defect_data-defect_val,
fld64 like zscr_defect_data-defect_val,
fld65 like zscr_defect_data-defect_val,
fld66 like zscr_defect_data-defect_val,
fld67 like zscr_defect_data-defect_val,
fld68 like zscr_defect_data-defect_val,
fld69 like zscr_defect_data-defect_val,
fld70 like zscr_defect_data-defect_val,
fld71 like zscr_defect_data-defect_val,
fld72 like zscr_defect_data-defect_val,
fld73 like zscr_defect_data-defect_val,
fld74 like zscr_defect_data-defect_val,
fld75 like zscr_defect_data-defect_val,
fld76 like zscr_defect_data-defect_val,
fld77 like zscr_defect_data-defect_val,
fld78 like zscr_defect_data-defect_val,
fld79 like zscr_defect_data-defect_val,
fld80 like zscr_defect_data-defect_val,
fld81 like zscr_defect_data-defect_val,
fld82 like zscr_defect_data-defect_val,
fld83 like zscr_defect_data-defect_val,
fld84 like zscr_defect_data-defect_val,
fld85 like zscr_defect_data-defect_val,
fld86 like zscr_defect_data-defect_val,
fld87 like zscr_defect_data-defect_val,
fld88 like zscr_defect_data-defect_val,
fld89 like zscr_defect_data-defect_val,
fld90 like zscr_defect_data-defect_val,
fld91 like zscr_defect_data-defect_val,
fld92 like zscr_defect_data-defect_val,
fld93 like zscr_defect_data-defect_val,
fld94 like zscr_defect_data-defect_val,
fld95 like zscr_defect_data-defect_val,
fld96 like zscr_defect_data-defect_val,
fld97 like zscr_defect_data-defect_val,
fld98 like zscr_defect_data-defect_val,
fld99 like zscr_defect_data-defect_val,
fld100 like zscr_defect_data-defect_val,
fld101 like zscr_defect_data-defect_val,
fld102 like zscr_defect_data-defect_val,
fld103 like zscr_defect_data-defect_val,
fld104 like zscr_defect_data-defect_val,
fld105 like zscr_defect_data-defect_val,
fld106 like zscr_defect_data-defect_val,
fld107 like zscr_defect_data-defect_val,
fld108 like zscr_defect_data-defect_val,
fld109 like zscr_defect_data-defect_val,
fld110 like zscr_defect_data-defect_val,
fld111 like zscr_defect_data-defect_val,
fld112 like zscr_defect_data-defect_val,
fld113 like zscr_defect_data-defect_val,
fld114 like zscr_defect_data-defect_val,
fld115 like zscr_defect_data-defect_val,
fld116 like zscr_defect_data-defect_val,
fld117 like zscr_defect_data-defect_val,
fld118 like zscr_defect_data-defect_val,
fld119 like zscr_defect_data-defect_val,
fld120 like zscr_defect_data-defect_val,
fld121 like zscr_defect_data-defect_val,
fld122 like zscr_defect_data-defect_val,
fld123 like zscr_defect_data-defect_val,
fld124 like zscr_defect_data-defect_val,
fld125 like zscr_defect_data-defect_val,
fld126 like zscr_defect_data-defect_val,
fld127 like zscr_defect_data-defect_val,
fld128 like zscr_defect_data-defect_val,
fld129 like zscr_defect_data-defect_val,
fld130 like zscr_defect_data-defect_val,
fld131 like zscr_defect_data-defect_val,
fld132 like zscr_defect_data-defect_val,
fld133 like zscr_defect_data-defect_val,
fld134 like zscr_defect_data-defect_val,
fld135 like zscr_defect_data-defect_val,
dayst like zscr_data_hdr-dayst,
end of t_data.
In this fld1 to fld135 are defined in internal table.
But if the number of fields are more than 135 then the program is going to short dump.
Some times fld1 to fid170 or more fields will be there in my internal table.
Please suggest me how to make my requirement dynamic and display this data fetched into this internal table onto a .XLS file in the presentation server ?Hi
You can try to use the type string:
form like zscr_data_hdr-form,
werks like zscr_data_hdr-werks,
matnr like zscr_data_hdr-matnr,
verid like zscr_data_hdr-verid,
lot like zscr_data_hdr-lot,
lot_qty like zscr_data_hdr-lot_qty,
udate like zscr_data_hdr-udate,
utime like zscr_data_hdr-utime,
zuser like zscr_data_hdr-zuser,
processed like zscr_data_hdr-processed,
defect like zscr_defect_data-defect,
vornr like zscr_route_data-vornr,
fieldxx type string,
dayst like zscr_data_hdr-dayst,
end of t_data.
So you can save you informations of every fld<n> concatenating their values into fieldxx.
Max -
Create Fieldcatalog based on internal table (dynamic)
Hi ,
Is there a way to create Create Fieldcatalog based on internal table (dynamic).
while creating fieldcat we usually many give the fields "fieldname" and "tabname".
is there a way to get the fieldname from the main table ?
Eg ..
I have i_tab as the output table. It has 3 fields "a", "b" and "c"
Now when i created fieldcat manually ( in case i cannot use fieldcat_merge FM) , i have to append 3 throws in fieldcat table.
These rows would have "a", "b" and "c".
Now i want to know if there is a way in which i can find "a" "b" and "c" fieldnames from the createdd internal tables.
i can then append the same to fieldcat.Hi Anuj,
I created a FORM routine for this 4 or 5 years ago and made a couple of refinements. Meanwhile it has prooved as very useful.
The disadvantag is that it creates the oldfashioned field catalog for the function calls. But I already used it for OO fieldcatalog of LVC type - there is a function module for this but I do not have the name here.
You need the two forms (second called in first) to build the field catalog from any internal table that can be used for ALV display.
*& Form ALV_FIELDCAT_FOR_ITAB
* Feldkatalog from (arbitrary) internal Table (c) Clemens Li
* * build field catalog from type description
form alv_fieldcat_for_itab "#EC *
tables pt_outtab type table "#EC *
changing pt_alv_fieldcat type slis_t_fieldcat_alv."#EC *
data:
lv_desc type sydes_desc,
ls_alv_fieldcat type slis_fieldcat_alv,
lv_longfield type text80."CRM<=R/3 fname.
field-symbols:
<typeinfo> type sydes_typeinfo,
<nameinfo> type sydes_nameinfo.
describe field pt_outtab into lv_desc. "#EC *
loop at lv_desc-types
assigning <typeinfo>
where not idx_name is initial
and table_kind is initial "no entries for deep table like color
and back = 1. "top-level-entries only.
read table lv_desc-names index <typeinfo>-idx_name
assigning <nameinfo>.
check <nameinfo>-name <> 'INCLUDE'.
ls_alv_fieldcat-fieldname = <nameinfo>-name.
while not <nameinfo>-continue is initial.
add 1 to <typeinfo>-idx_name.
read table lv_desc-names index <typeinfo>-idx_name
assigning <nameinfo>.
concatenate
ls_alv_fieldcat-fieldname
<nameinfo>-name
into ls_alv_fieldcat-fieldname.
endwhile." not <nameinfo>-continue IS INITIAL.
read table lv_desc-names index <typeinfo>-idx_help_id
assigning <nameinfo>.
if sy-subrc = 0.
* Caution: Help-ID may be Tablename-Fieldname and thus longer
* than 30 Chars; ls_alv_fieldcat-rollname is 30 Chars only
ls_alv_fieldcat-rollname = <nameinfo>-name.
lv_longfield = <nameinfo>-name.
while not <nameinfo>-continue is initial.
add 1 to <typeinfo>-idx_help_id.
read table lv_desc-names index <typeinfo>-idx_help_id
assigning <nameinfo>.
concatenate
lv_longfield
<nameinfo>-name
into lv_longfield.
endwhile." not lv_desc-continue is initial.
* help id may be data element or <table>-<field>
if lv_longfield ca '-'.
* get data type for table field
perform get_rollname_4_tabfield
using lv_longfield changing ls_alv_fieldcat.
endif." lv_longfield ca '-'.
else.
* No Help-ID: Use Fieldname as text
ls_alv_fieldcat-seltext_s =
ls_alv_fieldcat-seltext_m =
ls_alv_fieldcat-seltext_l =
ls_alv_fieldcat-reptext_ddic =
<nameinfo>-name.
endif." sy-subrc = 0.
* Starting 4.7: get edit mask
if not <typeinfo>-idx_edit_mask is initial.
read table lv_desc-names index <typeinfo>-idx_edit_mask
assigning <nameinfo>.
ls_alv_fieldcat-edit_mask = <nameinfo>-name.
if not <nameinfo>-continue is initial.
add 1 to <typeinfo>-idx_edit_mask.
read table lv_desc-names index <typeinfo>-idx_edit_mask
assigning <nameinfo>.
concatenate
ls_alv_fieldcat-edit_mask
<nameinfo>-name
into ls_alv_fieldcat-edit_mask.
endif." not <nameinfo>-continue IS INITIAL.
endif." not <typeinfo>-IDX_EDIT_MASK is initial.
* assign length, output length and decimals
ls_alv_fieldcat-intlen = <typeinfo>-length.
ls_alv_fieldcat-outputlen = <typeinfo>-output_length.
ls_alv_fieldcat-decimals_out = <typeinfo>-decimals.
ls_alv_fieldcat-inttype = <typeinfo>-type.
append ls_alv_fieldcat to pt_alv_fieldcat.
clear: "prevent anything 2 B taken for subsequent fields
ls_alv_fieldcat.
endloop." at lv_desc-types where not IDX_NAME is in initial.
endform. " ALV_FIELDCAT_FOR_ITAB
*& Form get_rollname_4_tabfield
* Get Data type for Table field
form get_rollname_4_tabfield
using p_fname type text80 ""CRM<=R/3 fname
changing p_alv_fieldcat type slis_fieldcat_alv.
field-symbols:
<dfies> type dfies.
data:
lv_tabname type tabname,
lt_dfies type table of dfies,
lv_fieldname type fieldname.
split p_fname at '-'
into lv_tabname lv_fieldname.
clear p_alv_fieldcat-rollname.
call function 'DDIF_FIELDINFO_GET'
exporting
tabname = lv_tabname
fieldname = lv_fieldname
* LANGU = SY-LANGU
* LFIELDNAME = ' '
* ALL_TYPES = ' '
* IMPORTING
* X030L_WA =
* DDOBJTYPE =
* DFIES_WA =
* LINES_DESCR =
tables
dfies_tab = lt_dfies
* FIXED_VALUES =
exceptions
not_found = 1
internal_error = 2
others = 3
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
else.
read table lt_dfies assigning <dfies> index 1.
p_alv_fieldcat-rollname = <dfies>-rollname.
* Und wenn keinerlei Twexte gepflegt sind?
if <dfies>-reptext is initial and
<dfies>-scrtext_s is initial and
<dfies>-scrtext_m is initial and
<dfies>-scrtext_l is initial.
* No Text: Use Fieldname as text
p_alv_fieldcat-seltext_s =
p_alv_fieldcat-seltext_m =
p_alv_fieldcat-seltext_l =
p_alv_fieldcat-reptext_ddic =
p_alv_fieldcat-fieldname.
endif." <dfies>-reptext IS INITIAL AND
endif.
endform. " get_rollname_4_tabfield
Regards,
Clemens -
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?
Maybe you are looking for
-
Hi, We are working with configuration material scenario. This configuration material is use for Planned Independent Requirement (PIR). I have maintain the Planning profile and create the PIR (MD61) Here select the characteristic value, its character
-
Recover Notes from iTunes Backup without Restoring Device
Can I directly view iPhone Notes files backed up to my computer through iTunes, without restoring those files to my iPhone from backup? My ideal solution will involve a transfer of iPhone Notes backup files directly to MacBook Notes for viewing. My N
-
Extracting Photograph Noise as a black and white layer from Photograph
I am looking to extract natural noise from a photographs material and create a black and white layer out of it, but I am new to photoshop and unsure how to proceed with this. For example, here is a photograph of a hard plastic gun. [IMG]http://dl.dro
-
Asking for the current position in SAPScript Form
Hello, is there the possibility to get the current position which is printed at that moment in SAPScript Form? Thanks. Regards, Lars.
-
Last 3 years events library are gone!!!
two days ago when I opened iphoto program, last 3 years events are no more at my library. I didn't deleded them, I'm the only one user of my macbook. I kept photos from 2002 up today, after I lost last 3 years events I only have 9,000 photos at libra