Data Maintain in a table form another table....using field symbols.
Hi,
I am using dynamic table concepts.I am using field symbols.I need to maintain two tables of similar structure.
when i append data it will enter into both tables.when i unassign first table and reassign it ,i am getting back that data again into first table ..how to slve this problem.i need to start first table as fresh table and second table contain copy of the first table.
Hi,
maybe you should clarify your problem a bit more by pasting some code and try to explain it a bit more in detail.
Roy
Similar Messages
-
Delete row from internal table using field symbol.
Hi friends,
I created dynamic internal table using field symbol. I want to delete some data using where clause.
for example. i want to use like,
DELETE <FS> WHERE KUNNR = WA_KNA1-KUNNR.
Like the above statment it won't work. How i can use delete with where clause in field symbols.
Hope any one can help me.
Thanks and regards
Srikanth. Shi Srikanth,
I think you have to LOOP through the whole internal table and check each line and decide to delete or not:
LOOP at <itab> INTO <wa>.
ASSIGN COMPONENT 'KUNNR' OF STRUCTURE <wa> TO <field>.
CHECK <field> IS ASSIGNED.
IF <field> EQ WA_KNA1-KUNNR.
DELETE ...
ENDIF.
UNASSIGN <field>.
ENDLOOP.
hope this helps
ec -
Dynamic internal tables using field symbols
Hello,
Is it possible to create a dynamic table where the no of fields in the internal table can be created dynamically(using field symbols).
Say sometimes internal tables with 10 fields and depending upon the requirement the fields can be dynamically increased or decreased in runtime.
Thanks.Hi,
Go through the following code....
*Data definitions
*** Tables
data: lt_data type ref to data.
data: lt_fieldcatalog type lvc_t_fcat.
*** Structure
data: ls_fieldcatalog type lvc_s_fcat.
*** Data References
data: new_line type ref to data,
fs_data type ref to data.
*** Field Symbols
field-symbols: <fs_data> type ref to data,
<fs_1> type any table,
<fs_2>,
<fs_3>.
*Populating the internal table with fieldnames required for our dynamic
*internal table
ls_fieldcatalog-fieldname = 'MANDT'.
append ls_fieldcatalog to lt_fieldcatalog.
ls_fieldcatalog-fieldname = 'CARRID'. "Fieldname
ls_fieldcatalog-inttype = 'C'. "Internal Type C-> Character
append ls_fieldcatalog to lt_fieldcatalog.
ls_fieldcatalog-fieldname = 'CONNID'.
ls_fieldcatalog-inttype = 'N'.
append ls_fieldcatalog to lt_fieldcatalog.
ls_fieldcatalog-fieldname = 'FLDATE'.
ls_fieldcatalog-inttype = 'D'.
append ls_fieldcatalog to lt_fieldcatalog.
ls_fieldcatalog-fieldname = 'PRICE'.
ls_fieldcatalog-inttype = 'P'.
append ls_fieldcatalog to lt_fieldcatalog.
ls_fieldcatalog-fieldname = 'CURRENCY'.
ls_fieldcatalog-inttype = 'C'.
append ls_fieldcatalog to lt_fieldcatalog.
*Calling the method CREATE_DYNAMIC_TABLE
call method cl_alv_table_create=>create_dynamic_table
exporting
it_fieldcatalog = lt_fieldcatalog
importing
ep_table = fs_data
exceptions
generate_subpool_dir_full = 1
others = 2
if sy-subrc <> 0.
endif.
*Assigning Field-Symbol to our dynamic internal table
assign lt_data to <fs_data>.
*Internal Table is ready, now to put data in that table
*** So <FS_1> now points to our dynamic internal table.
assign fs_data->* to <fs_1>.
*** Next step is to create a work area for our dynamic internal table.
create data new_line like line of <fs_1>.
*** A field-symbol to access that work area
assign new_line->* to <fs_2>.
*** And to put the data in the internal table
select
mandt
carrid
connid
fldate
price
currency
from sflight
into corresponding fields of table <fs_1>.
*** Access contents of internal table
loop at <fs_1> assigning <fs_2>.
do 5 times.
assign component sy-index of structure <fs_2> to <fs_3>.
write: <fs_3>.
enddo.
skip 1.
endloop.
top-of-page.
write:/5 'FUJITSU CONSULTING COMPANY' inverse color 6,
50 sy-datum inverse color 6,
70 sy-pagno inverse color 6.
uline.
<REMOVED BY MODERATOR>
Vijay C
Code Formatted by: Alvaro Tejada Galindo on Apr 14, 2008 1:47 PM -
Can I pass a table using field-symbols to a PERFORM
Can I pass an internal table using a field-symbol via a PERFORM that is stored in another program.
For example, I want to pass lt_data using a field-symbol. If I can do this, please tell me how to define a field-symbol for a table and how I setup the parameters on the FORM.
perform TEST_FIELD_SYMBOLS in program zadd_data
changing lt_data[]
if found.
Thanks.
Regards,
RyanSince in ABAP all FORM-paramters are passe call-by reference, it makes imho no difference if u pass a table directly or via a fieldsymbol.
U can pass a REF TO DATA to a form and then assign it to an FS like shown in the following example.
TYPES: BEGIN OF s_data,
data TYPE c,
END OF s_data,
s_tab TYPE STANDARD TABLE OF s_data.
TYPES: r_tab TYPE REF TO data.
START-OF-SELECTION.
DATA: t_foo TYPE s_tab.
DATA: ref_foo TYPE r_tab.
GET REFERENCE OF t_foo INTO ref_foo.
PERFORM my_form_fs USING ref_foo.
FORM my_form_fs USING u_ref TYPE r_tab.
FIELD-SYMBOLS: <fs> TYPE s_tab.
DATA: w_tab TYPE s_data.
ASSIGN u_ref->* TO <fs>.
w_tab-data = 'X'.
APPEND w_tab TO <fs>.
ENDFORM.
This also works for external performs....
Best regards,
Sebastian
Message was edited by:
Sebastian Rötzel -
How to populate one internal table from another using field symbols
Hi Gurus,
I have a problem. I have to populate one internal table (sructure t_otput) from another internal table (sructure t_from) using field symbol.
Structure for from table.
types: begin of t_from,
year(4) type c,
ww(2) type c,
site type marc-werks,
demand type i,
end of t_from.
Structure for output table.
types: begin of t_display,
title(30),
WW1(10),
WW2(10),
WW3(10),
end of t_display.
The from table looks like this:
Year | WW | Site | Demand
2005 | 1 | OR1 | 12.00
2005 | 2 | OR1 | 13.00
2005 | 3 | OR1 | 14.00
The display table which has to be populated should look like this:
Title | WW1 | WW2 | WW3
OR1 | | |
Demand | 12.00 | 13.00 | 14.00
How to populate display table using field symbol?
Please give code snippets
Thanks,
GopalGopal,
Here is the code, however I am not vary clear about the ORG1 and Demand display that you have shown in the display. I am sure with this code it should not be a big deal to tweak in whatever manner you want.
TABLES : marc.
TYPES: BEGIN OF type_display,
title(30),
ww1(10),
ww2(10),
ww3(10),
END OF type_display.
TYPES: BEGIN OF type_from,
year(4) TYPE c,
ww(2) TYPE c,
site TYPE marc-werks,
demand TYPE i,
END OF type_from.
data : t_from type table of type_from,
t_display type table of type_display.
field-symbols : <fs_from> type type_from,
<fs_display> type type_display.
data : wa_from type type_From,
wa_display type type_display.
wa_from-year = '2005'.
wa_from-ww = '1'.
wa_from-site = 'OR1'.
wa_from-demand = '12.00'.
insert wa_from into table t_from.
wa_from-year = '2005'.
wa_from-ww = '2'.
wa_from-site = 'OR1'.
wa_from-demand = '13.00'.
insert wa_from into table t_from.
wa_from-year = '2005'.
wa_from-ww = '3'.
wa_from-site = 'OR1'.
wa_from-demand = '14.00'.
insert wa_from into table t_from.
data : variable(3) type c.
field-symbols : <fs_any> type any.
break-point.
Loop at t_from assigning <fs_from>.
variable = 'WW'.
wa_display-title = <fs_from>-site.
concatenate variable <fs_from>-ww into variable.
assign component variable of structure wa_display to <fs_any>.
<fs_any> = <fs_from>-demand.
endloop.
append wa_display to t_display.
clear wa_display.
loop at t_display assigning <Fs_display>.
write :/ <fs_display>.
endloop.
Note : Please award points if this helps you.
Regards,
Ravi -
Hi Friends,
I am using Oracle 8.1.6 Server, & facing problems while retrieving data from a PL/SQL Table:
CREATE or REPLACE PROCEDURE test_proc IS
TYPE tP2 is TABLE of varchar2(10); --declared a collection
dt2 tP2 := tP2('a','b','c');
i NUMBER(8);
begin
SELECT COUNT(*) INTO i FROM TABLE(CAST(dt2 as tP2));
DBMS_OUTPUT.PUT_LINE('**'||i);
end;
While executing the above procedure, I encountered foll. error:
ERROR at line 1:
ORA-00600: internal error code, arguments: [15419], [severe error during PL/SQL execution], [], [],
ORA-06544: PL/SQL: internal error, arguments: [pfrrun.c:pfrbnd1()], [], [], [], [], [], [], []
ORA-06553: PLS-801: internal error [0]
Can anyone please help me, where the problem is??
Is it Possible to retrieve data from PL/SQL TABLE using SELECT statement? & How ?
Thanks in advance.
Best Regards,
Jay Raval.Thanks Roger for the Update.
It means that have to first CREATE TYPE .. TABLE in database then only I can fire a Select statement on that TYPE.
Actually I wanted to fire a Select statement on the TABLE TYPE, defined & declared in PLSQL stored procedure using DECLARE TYPE .. TABLE & not using CREATE TYPE .. TABLE.
I was eager to know this, because my organization is reluctant in using CREATE TYPE .. TABLE defined in the database, so I was looking out for another alternative to access PL/SQL TABLE using Select statement without defining it database. It would have been good if I could access a PLSQL TABLE using Select statement Declared locally in the stored procedure.
Can I summarize that to access a PL/SQL TABLE using SELECT statement, I have to first CREATE TYPE .. TABLE?
If someone have any other idea on this, please do let me know.
Thanks a lot for all help.
Best Regards,
Jay Raval.
You have to define a database type...
create type tP2 is table of varchar2(10)
CREATE OR REPLACE PROCEDURE TEST_PROC
IS
dt2 tP2 := tP2('a','b','c');
i NUMBER(8);
begin
SELECT COUNT(*) INTO i FROM TABLE(CAST (dt2 AS tP2));
DBMS_OUTPUT.PUT_LINE('**'||i);
end;
This will work.
Roger -
How do u save datas more than one table using net beans ide using JSF
Hi,
I am new to JSF.
I save / delete / update / New master table using POJO (Plain Old Java Objects), database - oracle and Toplink Persistence Unit.
How do u save data more than one table using net beans ide using JSF (I am using POJO) ?
and also Tell me the reference book for JSF.
Thanks in advance.
regards,
N.P.SivaSivaNellai wrote:
I am new to JSF.
So, I am using net beans IDE 6.1 from sun microsystem. It is a free software.No, you don't drag'n'drop if you're new to JSF. Switch to source code mode. Write code manually, with the help of IDE for the speed up.
So, please guide me the reference books, articles. I need the basic understanding of JSF, net beans IDE.[JSF: The Complete Reference|http://www.amazon.com/JavaServer-Faces-Complete-Reference/dp/0072262400] is a good book. The [JSF specification document|http://jcp.org/aboutJava/communityprocess/final/jsr252/index.html] is also a good reading to understand what JSF is and how it works. There are also javadocs and tlddocs of Sun JSF Mojarra. -
Creating dynamic internal table(Not field symbol table)
Hi Experts,
I am facing problem creating Intarnal table
I have fieldcatalog, I want create dynamic internal table(Not field symbol table).
I have written----
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
i_style_table =
it_fieldcatalog = it_fldcat
it_fieldcatalog = me->gt_fieldcat
i_length_in_byte =
IMPORTING
ep_table = lt_new_table
e_style_fname =
EXCEPTIONS
generate_subpool_dir_full = 1
OTHERS = 2.
ASSIGN lt_new_table->* TO <gt_dyn_repdata>.
CREATE DATA ls_new_line LIKE LINE OF <gt_dyn_repdata>.
ASSIGN ls_new_line->* TO <gs_dyn_repdata>.
above logic creating dynamic field symbol table.... But I want create normal internal table.
Thanks,
RajasekharHi
What do you mean?
It needs to use the field-symbol, this is the price to pay if it wants a dynamic object
Max -
Assigning Table/Structure Types using Field-Symbols
Hello Gurus,
How can we assign a table or structure type to a particulart internal table?
What I want to do is to make my data declaration for i_tab reusable.
i.e.
DATA: v_tab TYPE string.
v_tab = 'MARA'.
DATA : i_tab TYPE STANDARD TABLE OF v_tab.
The purpose is to make the declaration flexible so program can change v_tab to any table names like LIPS, KNA1...etc making the i_tab flexible and reusable enough. Can anyone help me please? I try to use field-symbols, but I can not achieve what I want. Any bright ideas please?DATA: dref TYPE REF TO data.
FIELD-SYMBOLS: <table> TYPE STANDARD TABLE,
<line> TYPE ANY.
PARAMETERS: pa_tab TYPE tabname DEFAULT 'BUT000'.
CREATE DATA dref TYPE STANDARD TABLE OF (pa_tab).
ASSIGN dref->* TO <table>.
SELECT * FROM (pa_tab) INTO TABLE <table>
UP TO 10 ROWS.
LOOP AT <table> ASSIGNING <line>.
ENDLOOP.
<LINE> will take the structure of the table line at runtime.
This is quite flexible.
But you can also declare it like this, as we did with the <table>:
DATA: dref1 TYPE REF TO data.
CREATE DATA dref1 TYPE (pa_tab).
ASSIGN dref1->* TO <line>.
This way <line> will already have the correct structure, even before the <ASSIGNING>.
Edited by: Micky Oestreich on Mar 24, 2009 8:21 AM -
How to use FIELD-SYMBOLS to declare a table
How to use FIELD-SYMBOLS to declare a table?
hi yong,
this will be very general:
FIELD-SYMBOLS : <gf_table> TYPE ANY TABLE.
or
to do like a specific table from your program
FIELD-SYMBOLS : <gf_table> TYPE itab.
itab is of course your internal table from your program.
ec -
How to load data dynamically into target tables using files as a source
Hi ,
My scenario needs a single interface to load the data of 5 different files into five target tables using a single interface. All target tables have the same structure. It is possible to point to variable source files using ODI. But the same approach is not working with Database tables. I am getting errors while trying to make my target /source table as a dynamic one.
Can anybody suggest anything. The last option would be writing a dynamic PL/SQL block in the KM. Any other suggestions friends ?
Regards,
AtishAfter creating a pair of identical source and target tables, I have carried out the following steps:
I am trying just keeping the target as variable
a)created a one to one interface,
b)tested that it is running.
c)created a variable(type =text),
d)used the variable as #v_name in the resource of the target table datastore.
e)in a package used the variable in a set variable step (first step).
f) used the interface as the second step.
g)executed the same in my context.
the <project_code>.variable_name is not getting substituted in the sql_code that is generated by the KM. My KM is SQL Control Append and following is the code that it generates in the Insert into I$ step:
/* DETECTION_STRATEGY = NOT_EXISTS */
insert /*+ APPEND */ into HR.I$_JOBS_COPY1
JOB_ID,
JOB_TITLE,
MIN_SALARY,
MAX_SALARY,
IND_UPDATE
select
JOBS.JOB_ID JOB_ID,
JOBS.JOB_TITLE JOB_TITLE,
JOBS.MIN_SALARY MIN_SALARY,
JOBS.MAX_SALARY MAX_SALARY,
'I' IND_UPDATE
from HR.JOBS JOBS
where (1=1)
and not exists (
select 'X'
from HR.#PLAYGROUND."v_tab_name" T
where T.JOB_ID = JOBS.JOB_ID
and ((JOBS.JOB_TITLE = T.JOB_TITLE) or (JOBS.JOB_TITLE IS NULL and T.JOB_TITLE IS NULL))
and ((JOBS.MIN_SALARY = T.MIN_SALARY) or (JOBS.MIN_SALARY IS NULL and T.MIN_SALARY IS NULL))
and ((JOBS.MAX_SALARY = T.MAX_SALARY) or (JOBS.MAX_SALARY IS NULL and T.MAX_SALARY IS NULL))
) -
How to fetch data from single database table using 2 internal tables.
Hi friends,
i am a new user of ABAP and also SDN.
i need a help.
i want to fetch data from one database table based on primary keys of 2 internal tables. how to put in where clause.
Thanks in advance.hii
refer to following code ..i hope it will help you
SELECT matnr " Material Number
FROM mara
INTO TABLE i_mara
WHERE matnr IN s_matnr.
IF i_mara[] IS NOT INITIAL.
SELECT matnr " Material Number
werks " Plants
prctr " Profit Center
FROM marc
INTO TABLE i_marc
FOR ALL ENTRIES IN i_mara
WHERE matnr = i_mara-matnr
AND werks IN s_werks.
ENDIF. " IF i_mara[] IS NOT INITIAL
i_output = i_marc.
IF i_marc[] IS NOT INITIAL.
SELECT matnr " Material Number
werks " Plants
lgort " Storage Location
FROM mard
INTO TABLE i_mard
FOR ALL ENTRIES IN i_marc
WHERE matnr EQ i_marc-matnr
AND werks EQ i_marc-werks
AND lgort IN s_lgort.
ENDIF. " IF i_mara[] IS NOT INITIAL
regards
twinkal -
Create a data source and database tables using WSAD
Hi, guys:
the following is from a tutorial:
http://www-106.ibm.com/developerworks/websphere/techjournal/0306_wosnick/wosnick.html
"To create the data source and Cloudscape database tables automatically, right click on the HelloWorldServer in the Servers view, and select the Create tables and data sources menu item. A dialog will then display showing that the data source and database tables were created successfully (Figure 5)."
I am using WSAD 5.0 trial version. I cannot find Create tables and data sources menu item if I right click on the HelloWorldServer in the Servers view. I am wondering if this is because trial version does not have this feature?
regardsThis question is a little off topic but you may get a reply. Please note this forum is about Sun's J2EE SDK and its related technologies. You may have better luck posting your question to an IBM specific resource.
-
Selecting data from a RDBMS table using connector framework, JDBC-Connector
Hi Experts,
I'm trying to select data from a mysql database that is connected via the BI-JDBC System in the portal (EP 7 SP 11).
The connection (using the Connector Gateway Service) is set up, but selecting data fails.
Can you please give me a code example how to select data from a table using INativeQuery or IOperation / IExcecution ?? IQuery is depracted...
Here my piece of code, actually method "connection.newNativeQuery()" throws exception "BICapabilityNotSupportedException: Operation is not supported":
IConnection connection = null;
public void connectToJDBCSystem(String jdbcSystem) {
// open a connection
try { // get the Connector Gateway Service
Object connectorservice =
PortalRuntime.getRuntimeResources().getService(IConnectorGatewayService.KEY);
IConnectorGatewayService cgService =
(IConnectorGatewayService) connectorservice;
if (cgService == null) {
response.write("Error in get Connector Gateway Service <br>");
try {
ConnectionProperties prop =
new ConnectionProperties(request.getLocale(), request.getUser());
connection = cgService.getConnection(jdbcSystem, prop);
} catch (Exception e) {
response.write("Connection to JDBC system " + jdbcSystem + " failed <br>");
response.write((String)e.getMessage() + "<br>");
e.printStackTrace();
if (connection == null) {
response.write("No connection to JDBC system " + jdbcSystem + "<br>");
} else {
response.write("Connection to JDBC system " + jdbcSystem + " successful <br>");
} catch (Exception e) {
response.write("Exception occurred <br>");
// up to this point it works fine...
// build query using an IExecution object obtained from the Connection object
response.write("prepare query 'SELECT idArt, art FROM art' <br>");
String qstr = "SELECT idArt, art FROM art";
INativeQuery query = null;
try {
query = connection.newNativeQuery();
response.write("execute query...<br>");
ResultSet rs = (ResultSet)query.execute(qstr);
while (rs.next()) {
response.write("<th>" + rs.getString(1) + "</th>");
} catch(Exception e)
response.write("connection.newNativeQuery() failed <br>");
response.write((String)e.getMessage() + "<br>");
e.printStackTrace();
} finally {
if( connection != null )
try {connection.close();}
catch(Exception ee){}
Many thanks in advance, Monika
Edited by: Monika Verwohlt on Jan 26, 2010 9:49 AMHowever this doesn't affect the XML encoding in data retrieved from XMLType using PL/SQL or programs (but it does work OK for SQLPlus SELECT).When performing an explicit serialization, with getClobVal method or XMLSerialize function, the database character set is used :
NLS_LANG = FRENCH_FRANCE.WE8MSWIN1252
NLS_CHARACTERSET = AL32UTF8
SQL> select * from v$version;
BANNER
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
PL/SQL Release 11.2.0.1.0 - Production
CORE 11.2.0.1.0 Production
TNS for 32-bit Windows: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production
SQL> create table test_nls of xmltype;
Table créée.
SQL> insert into test_nls values(xmltype('<?xml version="1.0" encoding="UTF-8"?><root/>'));
1 ligne créée.
SQL> select * from test_nls;
SYS_NC_ROWINFO$
<?xml version="1.0" encoding="WINDOWS-1252"?>
<root/>
SQL> select t.object_value.getclobval() from test_nls t;
T.OBJECT_VALUE.GETCLOBVAL()
<?xml version="1.0" encoding="UTF-8"?><root/>
SQL> select xmlserialize(document object_value as clob) from test_nls;
XMLSERIALIZE(DOCUMENTOBJECT_VALUEASCLOB)
<?xml version="1.0" encoding="UTF-8"?><root/> -
Hi,
i would like to retreive payroll results from it's allocated cluster tables using buffer.
i donot know how to use BUFFER concept and it's statments.
could anyone guide me in this topic?
thanks
theresita.jHi theresita,
i would like to retreive payroll results from it's allocated cluster tables .
1. U want the remuneration (monthly salary )
2. U won't get it DIRECTLY from any table.
(Its stored in cluster format)
3. Use this logic and FM.
DATA: myseqnr LIKE hrpy_rgdir-seqnr.
DATA : mypy TYPE payin_result.
DATA : myrt LIKE TABLE OF pc207 WITH HEADER LINE.
SELECT SINGLE seqnr FROM hrpy_rgdir
INTO myseqnr
WHERE pernr = mypernr
AND fpper = '200409'
AND srtza = 'A'.
IF sy-subrc = 0.
CALL FUNCTION 'PYXX_READ_PAYROLL_RESULT'
EXPORTING
clusterid = 'IN'
employeenumber = mypernr
sequencenumber = myseqnr
CHANGING
payroll_result = mypy
EXCEPTIONS
illegal_isocode_or_clusterid = 1
error_generating_import = 2
import_mismatch_error = 3
subpool_dir_full = 4
no_read_authority = 5
no_record_found = 6
versions_do_not_match = 7
error_reading_archive = 8
error_reading_relid = 9
OTHERS = 10.
myrt[] = mypy-inter-rt.
READ TABLE myrt WITH KEY lgart = '1899'.
4. the internal table myrt
will contain what u require.
I dont think there is any buffering concept
involved in cluster table.
regards,
amit m.
Maybe you are looking for
-
Apple TV 2 all of a sudden has trouble streaming. I stream from my desktop computer's iTunes for movies, and tonight it started stopping randomly mid movie and saying it wasn't connected. Any ideas? Router? ATV dying? It just says not connected,
-
My HP Pavilion a 6130n shows no video signal
My HP Pavilion a 6130n shows no video signal via aga. Attached another monitor via dvi. Still no video signal. Any troubleshooting suggestions? This question was solved. View Solution.
-
UTL FILE or SQLLDR??
I need some opinions about this, I need to load a big file more than 600 fields into a table and I am trying to decide what will be the best method, (sqlldr or UTL_FILE?) I have good luck with sqlldr, I like the report that the CTL file generates, bu
-
MOVED: FoxConn Piece of CRAP!
This topic has been moved to Off-Topic Technical. FoxConn Piece of CRAP!
-
Loop movie on a single frame with AS2?
Hi, i'm animating a web banner, which is supposed to loop infinite times. The thing is, i learnt to use tweening prototype for my animation, so the entire code is written on a single frame. Is there a way to loop the entire movie at the end?