Problem in using component Table
hi,
I have a probleme when I use the component "Table" binded to a Data Provider "Object Array Data Provider. I have a error message in java script.
I associated with my prodider of data an Array: Customer []. The class Customer has two propri�tes: name and prenom.
My Navigator is IE6. I have an error message of the javascript loursque I deploy the project in local.
regards
Actually I just found the problem.
It comes from the fact I used a french version of JSC2.
The parameters of the function sjwuic_table_assignSortPanelProperties are outline by quote, and the problem comes when the tool put some text with quote. That cause the folowing message : '"Error: ) expected".
ex :
<SCRIPT type=text/javascript>sjwuic_table_assignSortPanelProperties('form1:table1',new Array('form1:table1:_embeddedPanels:_primarySortColumnMenu','form1:table1:_embeddedPanels:_secondarySortColumnMenu','form1:table1:_embeddedPanels:_tertiarySortColumnMenu'),new Array('form1:table1:_embeddedPanels:_primarySortOrderMenu','form1:table1:_embeddedPanels:_secondarySortOrderMenu','form1:table1:_embeddedPanels:_tertiarySortOrderMenu'),new Array('Ordre croissant','Ordre croissant (A-Z, 0-9)','Ordre croissant (A-Z, 0-9)','Ordre croissant (A-Z, 0-9)'),new Array('Ordre d��croissant','Ordre d��croissant (Z-A, 9-0)','Ordre d��croissant (Z-A, 9-0)','Ordre d��croissant (Z-A, 9-0)'),'Des colonnes de tri ont ��t�� s��lectionn��es deux fois. Vous ne pouvez en s��lectionner qu'une pour chaque tri.','Colonne de tri manquante. S��lectionnez toutes les colonnes de tri jusqu'� l'avant-derni��re.','null',false,false)</SCRIPT>.
Add to that, the problem doesn't appear on Firefox, only on IE.
It's not the first time I notice some problems with IE. Last time, it was the use of the grey theme who dosn't work. Images of the buttons (in components such as table or Calendar) doesn' t appear with IE wheras they appear with Firefox (there is no problem with the blue theme).
Similar Messages
-
Problem while using Component Usage
Hi,
I am using Component - BT116IT_SRVO/TableWindowOVE as component usage in my component - SRQM_INCIDENT_H. Added this as assignment block.
The problem is :
It is not showing any button as "Edit List" as it is showing in Service Order. And I am not able to see any values in dropdown to select "SHOW".
Can you please help me, how to enable Edit List and how to make it work as same in Service Order.
Thanks,
SandeepHi Sandeep
Check whether you have added below formate to the ComponentUsages of SRQM_INCIDENT_H. If not add like below. It will get you out from the issue.
ComponentUsage :CUItemTable
Used Component : BT116IT_SRVO
InterfaceView: BT116IT_SRVO/TableWindowOVE
InterfaceView :TableWindow
Once you added component usage properly as mentioned above, you can able see below lines of code in Repository.xml of SRQM_INCIDENT_H. BUT Dont cahnge manually in Repository.xml
<!-- Declaration of windows -->
<Window id="SRQM_INCIDENT_H/MainWindow" default="TRUE">
<EmbeddedView id="CUItemTable.TableWindow"/>
</Window>
<ViewSet id="SRQM_INCIDENT_H/IncidentOV">
<EmbeddedView id="CUItemTable.BT116IT_SRVO/TableWindowOVE"/>
</ViewSet>
Now restart your browser and test the application.
Thanks
Chand -
Problem in using CREATE TABLE with Execute Immediate
I'm trying to create a table using Native Dynamic SQL. the code of the pl/sql block is
BEGIN
EXECUTE IMMEDIATE 'create table demo (ddate date)';
END;
The problem is that the above block is executed successfully as an anonymous PL/SQL block. The same block when written in a procedure it gives an error
"ORA-01031 Insufficient privelages"
at the time of execution. The procedure is complied successfully.
nullYour user needs direct system privs to create tables. You are receiving your privs properly by the role RESOURCE. Connect as system and grant CREATE TABLE directly to your user - that should do it.
Regards
Peter Larsen -
Hi ,
I created 2 Nested Table & tried to insert the data in Table through Procedure but it gave an err msg.
create type name as object
(fname varchar2(20),
mname varchar2(20),
lname varchar2(20));
create type address as object
(city varchar2(20),
state varchar2(20),
pin varchar2(20));
create type ename as table of name;
create type eaddress as table of address;
create table emp_rec
(employee_id varchar2(5),
employee_name ename,
employee_address eaddress)
nested table employee_name store as empname,
nested table employee_address store as empaddress;
insert into emp_rec
values('1',
ename(name('anand','kumar','chouksey')),
eaddress(address('vashi','mh','400093')));
//Data Inserted
//Procedure for Inserting Another Data Works
create or replace procedure nest_proc
is
begin
insert into
the
(select employee_address from emp_rec where employee_id=1 ) e
values('jbp','mp','482002');
--where employee_id=1;
end;
begin
nest_proc;
end;
PL/SQL procedure successfully completed.
//But if i'll try to insert the data into 2 nested tables then gets failed.
create or replace procedure nest_proc
is
begin
insert all into
the
(select employee_name,employee_address from emp_rec where employee_id=1 ) e
values('x','y','z');
into the(select employee_address from emp_rec where employee_id=1 ) e
values('a','b','c');
--where employee_id=1;
end;
Kindly help me out.
Rgrds,
AnandHi,
Thanks for replying ,actually i did the mistake. I'm using multitable insert stmt. on 2 different tables that's why it gave an err msg.Instead of using multitable insert stmts i used 2 insert stmt. on Procedure & it gets compiled.
Regards,
Anand -
I have a problem for using af:table component please I want a help for small problem:
I have 2 variable (or two elements in an Array) in backing bean and I want to display it in a af:table component in a jsf page.
thank youHave a look at the source code for the ADF Faces RC demo to see how the table is populated there:
http://www.oracle.com/technology/products/adf/adffaces/11/doc/demo/adf_faces_rc_demo.html -
Java script error when using a "Table" component (jsc2)
using a table component, I get a js errors, when lodiing the HTML page, sorting rows etc.
can some one helpe me or can some one have the same problem ?Hi,
Please post JSC2 related queries at:
https://feedbackprograms.sun.com/login.html
Cheers
Giri -
Problem with checkbox on table component
Hello i am having a problem with checkbox in table component
i am developing something like a shopping cart app and i have a checkbox in my table component , i want users to select items from the checkbox to add to thier cart, They can select the items from cartegory combobox , my problem is when they select the items from the checkbox if they select another category the alread selected once do not display in my collection opbject please how can i maintain the state of the already selected items in my collection objectHi,
Please go through the tutorial "Understanding scope and managed beans". This is available at:
http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/scopes.html
The details of the selected items need to be stored in an object that is in session scope.
Hope this helps
Cheers
Girish -
Problems using different tables for base class and derived class
I have a class named SuperProject and another class Project derived from
it. If I let SchemaTool generate the tables without specifying a "table"
extension, I get a single TABLE with all the columns from both classes and
everything works fine. But if I specify a "table" for the derived class,
SchemaTool generates the derived class with just one column (corresponds
to the attribute in derived class). Also it causes problems in using the
Project class in collection attributes.
JDO file:
<jdo>
<package name="jdo">
<class name="Project" identity-type="application"
persistence-capable-superclass="SuperProject">
<extension vendor-name="kodo" key="table" value="PROJECT"/>
</class>
<class name="SuperProject" identity-type="application"
objectid-class="ProjectId">
<field name="id" primary-key="true"/>
</class>
</package>
</jdo>
java classes:
public class Project extends SuperProject
String projectSpecific
public class SuperProject
BigDecimal id;
String name;
tables generated by SchemaTool:
TABLE SUPERPROJECTSX (IDX, JDOCLASSX, JDOLOCKX, NAMEX);
TABLE PROJECT(PROJECTSPECIFICX)
Thanks,
Justine ThomasJustine,
This will be resolved in 2.3.4, to be released later this evening.
-Patrick
In article <aofo2q$mih$[email protected]>, Justine Thomas wrote:
I have a class named SuperProject and another class Project derived from
it. If I let SchemaTool generate the tables without specifying a "table"
extension, I get a single TABLE with all the columns from both classes and
everything works fine. But if I specify a "table" for the derived class,
SchemaTool generates the derived class with just one column (corresponds
to the attribute in derived class). Also it causes problems in using the
Project class in collection attributes.
JDO file:
<jdo>
<package name="jdo">
<class name="Project" identity-type="application"
persistence-capable-superclass="SuperProject">
<extension vendor-name="kodo" key="table" value="PROJECT"/>
</class>
<class name="SuperProject" identity-type="application"
objectid-class="ProjectId">
<field name="id" primary-key="true"/>
</class>
</package>
</jdo>
java classes:
public class Project extends SuperProject
String projectSpecific
public class SuperProject
BigDecimal id;
String name;
tables generated by SchemaTool:
TABLE SUPERPROJECTSX (IDX, JDOCLASSX, JDOLOCKX, NAMEX);
TABLE PROJECT(PROJECTSPECIFICX)
Thanks,
Justine Thomas
Patrick Linskey [email protected]
SolarMetric Inc. http://www.solarmetric.com -
Problem with format displayed in output while using Pivot table
Hi All,
I am using Pivot table in 10.1.3.4.1 version for displaying dynamic type data. Data is coming fine but it is coming in very strange format. I have following two tables in my RTF Template.
Table1 using Pivot table
!http://farm3.static.flickr.com/2570/4092137243_924cca92ca.jpg!
Table 2 - A normal table
!http://img5.imageshack.us/img5/6651/table3p.jpg!
In the output PDF, “Table 2” shows data fine but “Table 1” shows very strange kind of behaviour if the columns exceed more than 5 in “Table 1” . If columns in Pivot table output are more than 5[at present according to my Table1 size] then columns more than 5 are shown on next page after Table 2 instead of displaying inside outer table “Table1“. Anyone has any idea what is the reason behind this strange behavior and how can I avoid it ?
Thanks
-SookieHi All,
I tried including following piece of code in RTF as mentioned here: [http://winrichman.blogspot.com/2009/05/cross-tab-by-limiting-number-of-colums.html] but as a result it showed blank page in report. Nothing else.
<?variable:G11;count(xdoxslt:distinct_values(/CUST_SUMMARY/LIST_CLIENT/CLIENT/LIST_OVERALL_ASSET_ALLOC/OVERALL_ASSET_ALLOC/ASSET_LIAB_DESC))?> <?variable:numcol;5?>
<?template:table1?><?param:cellvalue;1?><?param:maxcolvalue;5?>
<?choose:?>
<?when:$cellvalue < $maxcolvalue?>
!http://farm3.static.flickr.com/2508/4104410643_f540c1d5a3_m.jpg!
<?call@inlines:table1?><?with-param:cellvalue;(number($cellvalue) + $numcol)?><?with-param:maxcolvalue;$maxcolvalue?><?end call?>
<?end when?>
<?end choose?>
<?end template?>
Also modified RTf as
C <?crosstab:c594;"//OVERALL_ASSET_ALLOC";"PORTFOLIO_NAME{,o=a,t=t}";"ASSET_LIAB_DESC{,o=a,t=t}";"PERCENT";"sum"?>
H
G <?for-each@column:$c594//C1?><?if@column:position() > $cellvalue and position() <= ($cellvalue + $numcol) ?>
ASSET_LIAB_DESC <?./H?>
E <?end if?><?end for-each?>
G <?for-each:$c594//R1?>
PORTFOLIO_NAME <?./H?>
G <?for-each@cell:.//R1C1?><?if@cell:position() > $cellvalue and position() <= ($cellvalue + $numcol) ?>
99.00% <?./M1?>
E <?end if?><?end for-each?>
E <?end for-each?>I have this as my xml
<?xml version="1.0" encoding="UTF-8"?>
<CUST_SUMMARY>
<CLIENTID>1034</CLIENTID>
<LIST_CLIENT>
<CLIENT>
<CLIENT_ID>1034</CLIENT_ID>
<LIST_OVERALL_ASSET_ALLOC>
<OVERALL_ASSET_ALLOC>
<PORTFOLIO_ID>1110</PORTFOLIO_ID>
<PORTFOLIO_NAME>RM Managed</PORTFOLIO_NAME>
<ASSET_LIAB_DESC>Alternatives</ASSET_LIAB_DESC>
<PERCENT>2.93117485730770817994482449012020516681E-03</PERCENT>
</OVERALL_ASSET_ALLOC>
<OVERALL_ASSET_ALLOC>
<PORTFOLIO_ID>1110</PORTFOLIO_ID>
<PORTFOLIO_NAME>RM Managed</PORTFOLIO_NAME>
<ASSET_LIAB_DESC>Collectables</ASSET_LIAB_DESC>
<PERCENT>1.28354604277895431879689156620000563094E-02</PERCENT>
</OVERALL_ASSET_ALLOC>
<OVERALL_ASSET_ALLOC>
<PORTFOLIO_ID>1110</PORTFOLIO_ID>
<PORTFOLIO_NAME>RM Managed</PORTFOLIO_NAME>
<ASSET_LIAB_DESC>Debt</ASSET_LIAB_DESC>
<PERCENT>3.91466115811489974032104849667369505831E-02</PERCENT>
</OVERALL_ASSET_ALLOC>
<OVERALL_ASSET_ALLOC>
<PORTFOLIO_ID>1110</PORTFOLIO_ID>
<PORTFOLIO_NAME>RM Managed</PORTFOLIO_NAME>
<ASSET_LIAB_DESC>Equity</ASSET_LIAB_DESC>
<PERCENT>8.71946226825880885538778864840827563226E-01</PERCENT>
</OVERALL_ASSET_ALLOC>
<OVERALL_ASSET_ALLOC>
<PORTFOLIO_ID>1110</PORTFOLIO_ID>
<PORTFOLIO_NAME>RM Managed</PORTFOLIO_NAME>
<ASSET_LIAB_DESC>Others</ASSET_LIAB_DESC>
<PERCENT>7.3140526307872865690096910040315224715E-02</PERCENT>
</OVERALL_ASSET_ALLOC>
<OVERALL_ASSET_ALLOC>
<PORTFOLIO_ID/>
<PORTFOLIO_NAME>Aggregate Portfolio</PORTFOLIO_NAME>
<ASSET_LIAB_DESC>Alternatives</ASSET_LIAB_DESC>
<PERCENT>2.93117485730770817994482449012020516681E-03</PERCENT>
</OVERALL_ASSET_ALLOC>
<OVERALL_ASSET_ALLOC>
<PORTFOLIO_ID/>
<PORTFOLIO_NAME>Aggregate Portfolio</PORTFOLIO_NAME>
<ASSET_LIAB_DESC>Collectables</ASSET_LIAB_DESC>
<PERCENT>1.28354604277895431879689156620000563094E-02</PERCENT>
</OVERALL_ASSET_ALLOC>
<OVERALL_ASSET_ALLOC>
<PORTFOLIO_ID/>
<PORTFOLIO_NAME>Aggregate Portfolio</PORTFOLIO_NAME>
<ASSET_LIAB_DESC>Debt</ASSET_LIAB_DESC>
<PERCENT>3.91466115811489974032104849667369505831E-02</PERCENT>
</OVERALL_ASSET_ALLOC>
<OVERALL_ASSET_ALLOC>
<PORTFOLIO_ID/>
<PORTFOLIO_NAME>Aggregate Portfolio</PORTFOLIO_NAME>
<ASSET_LIAB_DESC>Equity</ASSET_LIAB_DESC>
<PERCENT>8.71946226825880885538778864840827563226E-01</PERCENT>
</OVERALL_ASSET_ALLOC>
<OVERALL_ASSET_ALLOC>
<PORTFOLIO_ID/>
<PORTFOLIO_NAME>Aggregate Portfolio</PORTFOLIO_NAME>
<ASSET_LIAB_DESC>Others</ASSET_LIAB_DESC>
<PERCENT>7.3140526307872865690096910040315224715E-02</PERCENT>
</OVERALL_ASSET_ALLOC>
<OVERALL_ASSET_ALLOC>
<PORTFOLIO_ID/>
<PORTFOLIO_NAME>Deviation</PORTFOLIO_NAME>
<ASSET_LIAB_DESC>Alternatives</ASSET_LIAB_DESC>
<PERCENT>2.93117485730770817994482449012020516681E-03</PERCENT>
</OVERALL_ASSET_ALLOC>
<OVERALL_ASSET_ALLOC>
<PORTFOLIO_ID/>
<PORTFOLIO_NAME>Deviation</PORTFOLIO_NAME>
<ASSET_LIAB_DESC>Collectables</ASSET_LIAB_DESC>
<PERCENT>1.28354604277895431879689156620000563094E-02</PERCENT>
</OVERALL_ASSET_ALLOC>
<OVERALL_ASSET_ALLOC>
<PORTFOLIO_ID/>
<PORTFOLIO_NAME>Deviation</PORTFOLIO_NAME>
<ASSET_LIAB_DESC>Debt</ASSET_LIAB_DESC>
<PERCENT>-3.6085338841885100259678951503326304942E-01</PERCENT>
</OVERALL_ASSET_ALLOC>
<OVERALL_ASSET_ALLOC>
<PORTFOLIO_ID/>
<PORTFOLIO_NAME>Deviation</PORTFOLIO_NAME>
<ASSET_LIAB_DESC>Equity</ASSET_LIAB_DESC>
<PERCENT>2.71946226825880885538778864840827563226E-01</PERCENT>
</OVERALL_ASSET_ALLOC>
<OVERALL_ASSET_ALLOC>
<PORTFOLIO_ID/>
<PORTFOLIO_NAME>Deviation</PORTFOLIO_NAME>
<ASSET_LIAB_DESC>Others</ASSET_LIAB_DESC>
<PERCENT>7.3140526307872865690096910040315224715E-02</PERCENT>
</OVERALL_ASSET_ALLOC>
<OVERALL_ASSET_ALLOC>
<PORTFOLIO_ID/>
<PORTFOLIO_NAME>Deviation</PORTFOLIO_NAME>
<ASSET_LIAB_DESC>Cash</ASSET_LIAB_DESC>
<PERCENT>.3</PERCENT>
</OVERALL_ASSET_ALLOC>
<OVERALL_ASSET_ALLOC>
<PORTFOLIO_ID/>
<PORTFOLIO_NAME>Recommended Allocation</PORTFOLIO_NAME>
<ASSET_LIAB_DESC>Debt</ASSET_LIAB_DESC>
<PERCENT>.4</PERCENT>
</OVERALL_ASSET_ALLOC>
<OVERALL_ASSET_ALLOC>
<PORTFOLIO_ID/>
<PORTFOLIO_NAME>Recommended Allocation</PORTFOLIO_NAME>
<ASSET_LIAB_DESC>Equity</ASSET_LIAB_DESC>
<PERCENT>.3</PERCENT>
</OVERALL_ASSET_ALLOC>
<OVERALL_ASSET_ALLOC>
<PORTFOLIO_ID/>
<PORTFOLIO_NAME>Recommended Allocation</PORTFOLIO_NAME>
<ASSET_LIAB_DESC>Cash</ASSET_LIAB_DESC>
<PERCENT>.3</PERCENT>
</OVERALL_ASSET_ALLOC>
</LIST_OVERALL_ASSET_ALLOC>
</CLIENT>
</LIST_CLIENT>
</CUST_SUMMARY>and Original RTF looks like !http://farm3.static.flickr.com/2508/4104410643_f540c1d5a3_m.jpg!
with code as
C <?crosstab:c594;"//OVERALL_ASSET_ALLOC";"PORTFOLIO_NAME{,o=a,t=t}";"ASSET_LIAB_DESC{,o=a,t=t}";"PERCENT";"sum"?>
H <?horizontal-break-table:1?>
G <?for-each@column:$c594//C1?>
ASSET_LIAB_DESC <?./H?>
E <?end for-each?>
G <?for-each:$c594//R1?>
PORTFOLIO_NAME <?./H?>
G <?for-each@cell:.//R1C1?>
99.00% <?./M1?>
E <?end for-each?>
E <?end for-each?>Anyone can now tell my mistake? What wrong I am doing? Why it is showing blank page in output? How to solve this page breaking problem?
Thanks
-Sookie -
Problem in accessing mseg table using MSEG~M Index.
Hi Experts,
I am facing problem in accessing mseg table using MSEG~M Index. I used same sequence of fields and i tried with mandt field also. but it is not taking the Index and it is going for TImeout ABAP dump.
This are my codes used in different ways
1. SELECT mjahr
bwart
matnr
lifnr
dmbtr
kostl
aufnr
bukrs
FROM mseg CLIENT SPECIFIED INTO TABLE t_mseg2
WHERE mandt EQ sy-mandt AND
matnr NE SPACE AND
werks EQ p_werks AND
lgort NE '0000' AND
bwart IN (122,201,262) AND
sobkz NE '0'
%_HINTS ORACLE 'INDEX("MSEG" "MSEG~M")'.
2. SELECT mjahr
bwart
matnr
lifnr
dmbtr
kostl
aufnr
bukrs
FROM mseg INTO TABLE t_mseg2
WHERE matnr NE SPACE AND
werks EQ p_werks AND
lgort NE '0000' AND
bwart IN (122,201,262) AND
sobkz NE '0'
%_HINTS ORACLE 'INDEX("MSEG" "MSEG~M")'.
3. SELECT mjahr
bwart
matnr
lifnr
dmbtr
kostl
aufnr
bukrs
FROM mseg INTO TABLE t_mseg2
WHERE matnr NE SPACE AND
werks EQ p_werks AND
lgort NE '0000' AND
bwart IN (122,201,262) AND
sobkz NE '0'.
The above all code is not at all taking the index in Quality server .but in Development it is taking .In Quality server it is reading all datas without using the index and going Timeout ABAP dmup
Please, Suggest me some solutions.
Thanks in Advance.
Regards,
NandhaHi,
Without NE also not working out. i am facing same problem still.
SELECT bwart
matnr
lifnr
dmbtr
kostl
aufnr
FROM mseg CLIENT SPECIFIED INTO TABLE t_mseg
WHERE mandt EQ sy-mandt AND
werks EQ p_werks AND
bwart IN (122,201,262) AND
mjahr EQ p_year AND
bukrs EQ p_cc
%_HINTS ORACLE 'INDEX("MSEG" "MSEG~M")'.
Please,check and help me out from this issue.
Regards,
Nandha -
Problem in using Auto-generated Table in Program
Hi experts,
I'm using some auto-generated table in my program. But the Problem is program is not activated due to non-existance of any type of table or structure or view of that Table type in the development server. i.e. table name in development is FMFMOADE12200014 and same in Production is FMFMOAPE14000018.
How can I solve this problem to active the program and transport it?
Thnaks in advance.
GoutamHi Friend ,
If an Auto-generated tables inside your program ,then you should not use that table directly as internal table type .
In that case you have used the Dynamic structure in your program .
tips is you should check first the table is there in the database through your programing using the standard function module for checking the table exsisting , then use the field symbols for dynmaic creating of program strucuture ,including field creation to tat strcuture . this will make your program more lines in that case you can write subroutine for creating the fields and adding inside the dynamice strucure .
simple example please see this link : [http://www.sap-img.com/ab030.htm]
becasuse we do have the same auto-generating table concept in Finance base on the Operating cencern out table name & fields inside will be changing ,Our program has to support world wide Rollouts . so we used dynamic structuring inside Our program .
Regards, -
Problem entering values in table after creating it in Word using OLE2
Hi,
I want to create a Word document from a Oracle Forms 6i application. The document will have standard text followed by a table. The cells of this table are to be populated from fields in the Forms application.
I have created a sample code below. When executed from within the Forms application, it creates a document fine. It writes the text "Hello World". It then creates a table as expected. But when I try to enter a value "Cell Value" in the table, the value does not get written to the cell of the table. Instead it writes the value outside the table.
Can someone please tell me what I am doing wrong here and what I need to do so that after writing the text on the document I can write values into the table also.
Any help will be much appreciated.
Here is the code(it works but then it doesn't ):
PROCEDURE TEST_PROC IS
hApplication OLE2.OBJ_TYPE;
hDocuments OLE2.OBJ_TYPE;
hDocument OLE2.OBJ_TYPE;
hSelection OLE2.OBJ_TYPE;
hParagraphFormat OLE2.OBJ_TYPE;
hRange OLE2.OBJ_TYPE;
hFont OLE2.OBJ_TYPE;
hTables OLE2.OBJ_TYPE;
hTable OLE2.OBJ_TYPE;
args OLE2.LIST_TYPE;
wdAlignParagraphLeft CONSTANT number(3) := 0; --Default
wdword9tablebehavior CONSTANT NUMBER (5) := 1;
wdautofitfixed CONSTANT NUMBER (5) := 0;
---- wdUnits Class members
wdcharacter CONSTANT NUMBER (5) := 1;
wdmove CONSTANT NUMBER (5) := 0; --Default
--wdBorderType Class members
wdborderleft CONSTANT NUMBER := -2;
wdborderright CONSTANT NUMBER := -4;
wdbordertop CONSTANT NUMBER := -1;
wdborderbottom CONSTANT NUMBER := -3;
--WdLineStyle Class member
wdlinestylenone CONSTANT NUMBER := 0;
BEGIN
hApplication:=OLE2.CREATE_OBJ('Word.Application');
OLE2.SET_PROPERTY(hApplication, 'Visible', 1);
hDocuments := OLE2.GET_OBJ_PROPERTY(hApplication, 'Documents');
hDocument := OLE2.INVOKE_OBJ(hDocuments, 'Add');
hSelection := OLE2.GET_OBJ_PROPERTY(hApplication, 'Selection');
hFont := OLE2.GET_OBJ_PROPERTY(hSelection, 'Font');
OLE2.SET_PROPERTY(hFont, 'Name', 'Calibri');
OLE2.SET_PROPERTY(hFont, 'Size', 11);
OLE2.SET_PROPERTY(hFont, 'Bold', FALSE );
OLE2.INVOKE(hSelection, 'TypeParagraph');
hParagraphFormat := OLE2.GET_OBJ_PROPERTY(hSelection, 'ParagraphFormat');
OLE2.SET_PROPERTY(hParagraphFormat, 'Alignment', wdAlignParagraphLeft);
OLE2.RELEASE_OBJ(hParagraphFormat);
args := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(args, 'Hello World');
OLE2.INVOKE(hSelection, 'TypeText', args);
OLE2.DESTROY_ARGLIST(args);
OLE2.INVOKE(hSelection, 'TypeParagraph');
htables := ole2.get_obj_property (hdocument, 'Tables');
hrange := ole2.get_obj_property (hselection, 'Range');
args := ole2.create_arglist;
ole2.add_arg_obj (args, hrange); --Range
ole2.add_arg (args, 1); --NumRows
ole2.add_arg (args, 6); --NumColumns
ole2.add_arg (args, wdword9tablebehavior); --DefaultTableBehavior
ole2.add_arg (args, wdautofitfixed); --FitBehavior
htable := ole2.invoke_obj (htables
,'Add'
,args
args := ole2.create_arglist;
ole2.add_arg (args, wdcharacter);
ole2.add_arg (args, 1);
ole2.add_arg (args, wdmove);
ole2.invoke (hselection
,'MoveLeft'
,args
ole2.destroy_arglist (args);
args := ole2.create_arglist;
ole2.add_arg (args, 'CellValue');
ole2.invoke (hselection
,'TypeText'
,args
ole2.destroy_arglist (args);
ole2.RELEASE_OBJ (happlication);
ole2.RELEASE_OBJ (hdocuments);
ole2.RELEASE_OBJ (hdocument);
ole2.RELEASE_OBJ (hfont);
ole2.RELEASE_OBJ (hparagraphformat);
ole2.RELEASE_OBJ (htables);
ole2.RELEASE_OBJ (hrange);
END;Once again thanks for the help John. Unfortunately I cannot use only bookmarks, because the text to be entered from the application is of undetermined length and therefore since the possibility of wrapping exists, it would not be able to give me the same formatting abilty as using a table.
However, the good news is that I have been able to find the solution. I am posting my code here so that it is available to anyone else who might have the same issue. Thanks again.
Here is my code and my comments in it explain what it does.
PROCEDURE extract_to_word
IS
/* First of all I would like to acknowledge the help I have got from experts who have posted a lot of this code on the web which I have used here. Special thanks go to someone by the name of sfvb
found here http://www.tek-tips.com/userinfo.cfm?member=sfvbsfvb
This procedure does the following:
1. Opens a word document.
2. Creates a header and pastes a picture in the header e.g your company logo with address. Please note that the image should have both the address and the logo in it. It can be created using paint where you can write your address at one end and paste a bmp or jpg picture of your logo at the other end.
3. Writes text with specified font and size. It calls a separate procedure PRINT_LINE to do this.
4. Creates a table on the document with specified number of columns with fixed width.
5. Populates the cells of the table-
first with headers written by calls to WRITE_HEADINGS procedure.
next with data from a block of the Forms application by calls to WRITE_DATA procedure
6. Comes out of the table and continues to write text.
The three procedures that are repeatedly called are described after the end of this procedure.
Note: While I have made every attempt to ensure that the code does not generate error on account of my writing the explanatory notes, I cannot be sure of having made some typos. If the code does not compile, it is most probably be on account of something I have missed in entering the comments and explanation.
Disclaimer:
I am not the sole author of this code. I have taken help from other open sources and copyright infringement if any is entirely unintentional.
happlication ole2.obj_type;
hwindow ole2.obj_type;
hpane ole2.obj_type;
hview ole2.obj_type;
hdocuments ole2.obj_type;
hdocument ole2.obj_type;
hselection ole2.obj_type;
hparagraphformat ole2.obj_type;
hrange ole2.obj_type;
hfields ole2.obj_type;
hfont ole2.obj_type;
hinlineshapes ole2.obj_type;
hpars ole2.obj_type;
hpar ole2.obj_type;
htabstops ole2.obj_type;
hactivedocument ole2.obj_type;
htables ole2.obj_type;
htable ole2.obj_type;
hcolumns ole2.obj_type;
hcells ole2.obj_type;
hrows ole2.obj_type;
hshading ole2.obj_type;
hinsertrow ole2.obj_type;
hborders ole2.obj_type;
hshading ole2.obj_type;
args ole2.list_type;
wdalignparagraphleft CONSTANT NUMBER (3) := 0;
wdalignparagraphcenter CONSTANT NUMBER (3) := 1;
wdalignparagraphright CONSTANT NUMBER (3) := 2;
wdseekcurrentpageheader CONSTANT NUMBER (3) := 9;
wdseekcurrentpagefooter CONSTANT NUMBER (3) := 10;
wdseekmaindocument CONSTANT NUMBER (3) := 0;
wdfieldpage CONSTANT NUMBER (3) := 33;
wdfieldnumpages CONSTANT NUMBER (3) := 26;
wdpagebreak CONSTANT NUMBER (3) := 7;
wdstory CONSTANT NUMBER (3) := 6;
wdword CONSTANT NUMBER (5) := 2;
wdsentence CONSTANT NUMBER (5) := 3;
wdword8tablebehavior CONSTANT NUMBER (5) := 0;
wdword9tablebehavior CONSTANT NUMBER (5) := 1;
wdautofitcontent CONSTANT NUMBER (5) := 1;
wdautofitfixed CONSTANT NUMBER (5) := 0;
wdautofitwindow CONSTANT NUMBER (5) := 2;
wdunderlinesingle CONSTANT NUMBER (5) := 1;
---- wdUnits Class members
wdcell CONSTANT NUMBER (5) := 12;
wdcharacter CONSTANT NUMBER (5) := 1;
wdword CONSTANT NUMBER (5) := 2;
wdsentence CONSTANT NUMBER (5) := 3;
wdline CONSTANT NUMBER (5) := 5;
---- wdMovementType Class members
wdextend CONSTANT NUMBER (5) := 1;
wdmove CONSTANT NUMBER (5) := 0;
--wdBorderType Class members
wdborderleft CONSTANT NUMBER := -2;
wdborderright CONSTANT NUMBER := -4;
wdbordertop CONSTANT NUMBER := -1;
wdborderbottom CONSTANT NUMBER := -3;
--WdLineStyle Class member
wdlinestylenone CONSTANT NUMBER := 0;
mytab CONSTANT VARCHAR2 (1) := CHR (9);
myblue CONSTANT NUMBER (8) := 16711680; --FF0000
mygreen CONSTANT NUMBER (8) := 65280; --00FF00
myred CONSTANT NUMBER (8) := 255; --0000FF
mydkgreen CONSTANT NUMBER (8) := 32768; --008000
myblack CONSTANT NUMBER (8) := 0; --000000
mytext VARCHAR2 (2000);
BEGIN
happlication := ole2.create_obj ('Word.Application');
ole2.set_property (happlication
,'Visible'
,1
hdocuments :=
ole2.get_obj_property (happlication, 'Documents');
hdocument := ole2.invoke_obj (hdocuments, 'Add');
-------- Create Header and Footer --------
hwindow :=
ole2.get_obj_property (happlication, 'ActiveWindow');
hpane := ole2.get_obj_property (hwindow, 'ActivePane');
hview := ole2.get_obj_property (hpane, 'View');
---- Header Section ---
ole2.set_property (hview
,'SeekView'
,wdseekcurrentpageheader
hselection :=
ole2.get_obj_property (happlication, 'Selection');
hfont := ole2.get_obj_property (hselection, 'Font');
ole2.set_property (hfont
,'Name'
,'Calibri'
ole2.set_property (hfont
,'Size'
,10
ole2.set_property (hfont
,'Bold'
,FALSE
ole2.set_property (hfont
,'Color'
,myblack
ole2.RELEASE_OBJ (hfont);
args := ole2.create_arglist;
--Below is the location of your jpg file that contains the logo and address
ole2.add_arg (args, 'C:\temp\AMHeader2.jpg');
hinlineshapes :=
ole2.get_obj_property (hselection, 'InlineShapes');
ole2.invoke (hinlineshapes
,'AddPicture'
,args
ole2.destroy_arglist (args);
ole2.RELEASE_OBJ (hinlineshapes);
ole2.set_property (hview
,'SeekView'
,wdseekmaindocument
ole2.RELEASE_OBJ (hview);
ole2.RELEASE_OBJ (hpane);
ole2.RELEASE_OBJ (hwindow);
-------- Insert Text --------
hfont := ole2.get_obj_property (hselection, 'Font');
ole2.set_property (hfont
,'Name'
,'Calibri'
ole2.set_property (hfont
,'Size'
,9
ole2.set_property (hfont
,'Bold'
,FALSE
ole2.set_property (hfont
,'Color'
,myblack
ole2.invoke (hselection, 'TypeParagraph');
hparagraphformat :=
ole2.get_obj_property (hselection, 'ParagraphFormat');
ole2.set_property (hparagraphformat
,'Alignment'
,wdalignparagraphleft
ole2.RELEASE_OBJ (hparagraphformat);
print_line (hselection
, 'Date ' || TO_CHAR (TRUNC (SYSDATE), 'MM/DD/YYYY')
,NULL
print_line (hselection
,NULL
--The following prints the address of the recipient of the letter.
print_line (hselection
,addr_line1
,NULL
print_line (hselection
,addr_line2
,NULL
print_line (hselection
,addr_line3
,NULL
print_line (hselection
,addr_line4
,NULL
print_line (hselection
,addr_line5
,NULL
--Call like the one below are to insert blank lines
hselection :=
ole2.get_obj_property (happlication, 'Selection');
print_line (hselection
,NULL
,NULL
print_line (hselection
,'Your salutation'
,NULL
print_line (hselection
,NULL
,'NULL
print_line (hselection
,'Ref: '
,NULL
print_line (hselection
,NULL
,NULL
print_line
(hselection
,'Whatever text you want to appear on this line.'
,NULL
print_line (hselection
,NULL
,NULL
-------- Create Table --------
htables := ole2.get_obj_property (hdocument, 'Tables');
hrange := ole2.get_obj_property (hselection, 'Range');
args := ole2.create_arglist;
ole2.add_arg_obj (args, hrange); --Range
ole2.add_arg (args, 1); --NumRows The rest of the rows are created later as and when required
ole2.add_arg (args, 6); --NumColumns This creates a table of 6 columns.
ole2.add_arg (args, wdword9tablebehavior); --DefaultTableBehavior
ole2.add_arg (args, wdautofitfixed); --FitBehavior
htable := ole2.invoke_obj (htables
,'Add'
,args
ole2.destroy_arglist (args);
-- [Borders removal start]The following piece of code removes all the borders. Use of this is optional.
hborders := ole2.get_obj_property (htable, 'Borders');
ole2.set_property (hborders
,'OutsideLineStyle'
,wdlinestylenone
ole2.set_property (hborders
,'InsideLineStyle'
,wdlinestylenone
ole2.RELEASE_OBJ (hborders);
--[Borders removal end]
--The following code makes the cursor enter the table. I took quite some time
--figuring this out.
hselection := ole2.get_obj_property (hdocument, 'Tables');
hselection := ole2.get_obj_property (happlication, 'Selection');
--WRITE_HEADINGS is the procedure called each time only to write headings.
write_headings (hselection
,'Heading 1 on cell at row 1 column 1'
,8
--The following moves the cursor to the next cell on the right.
args := ole2.create_arglist;
ole2.add_arg (args, wdcell);
ole2.add_arg (args, 1);
ole2.add_arg (args, wdmove);
ole2.invoke (hselection
,'MoveRight'
,args
ole2.destroy_arglist (args);
write_headings (hselection
,'Heading 1 on cell at row 1 column 2'
,7
args := ole2.create_arglist;
ole2.add_arg (args, wdcell);
ole2.add_arg (args, 1);
ole2.add_arg (args, wdmove);
ole2.invoke (hselection
,'MoveRight'
,args
ole2.destroy_arglist (args);
write_headings (hselection
,'Heading 1 on cell at row 1 column 3'
,7
args := ole2.create_arglist;
ole2.add_arg (args, wdcell);
ole2.add_arg (args, 1);
ole2.add_arg (args, wdmove);
ole2.invoke (hselection
,'MoveRight'
,args
ole2.destroy_arglist (args);
write_headings (hselection
,'Heading 1 on cell at row 1 column 4'
,8
args := ole2.create_arglist;
ole2.add_arg (args, wdcell);
ole2.add_arg (args, 1);
ole2.add_arg (args, wdmove);
ole2.invoke (hselection
,'MoveRight'
,args
ole2.destroy_arglist (args);
write_headings (hselection
,'Heading 1 on cell at row 1 column 5'
,5
args := ole2.create_arglist;
ole2.add_arg (args, wdcell);
ole2.add_arg (args, 1);
ole2.add_arg (args, wdmove);
ole2.invoke (hselection
,'MoveRight'
,args
ole2.destroy_arglist (args);
write_headings (hselection
,'Heading 1 on cell at row 1 column 6'
,8
--The following moves the cursor back to the first cell on row 1 column 1
args := ole2.create_arglist;
ole2.add_arg (args, wdcell);
ole2.add_arg (args, 6);
ole2.add_arg (args, wdmove);
ole2.invoke (hselection
,'MoveLeft'
,args
ole2.destroy_arglist (args);
--Now we need to write data sourced from a multi record block in Oracle Forms
GO_BLOCK ('your_block');
FIRST_RECORD;
record_cnt := 0;
LOOP
record_cnt := record_cnt + 1;
---In my application I gave the choice to the user to put a check mark on those records that he would want to print ------on the document and so the following.
IF :your_block.cb_print = 'Y'
THEN
--This creates a new row below the first row that contains the column headers.
args := ole2.create_arglist; ole2.add_arg (args, 1);
ole2.invoke (hselection
,'InsertRowsBelow'
,args
ole2.destroy_arglist (args);
--WRITE_DATA is called each time to write the data in the cells.
write_data (hselection
, :your_block.item);
args := ole2.create_arglist;
ole2.add_arg (args, wdcell);
ole2.add_arg (args, 1);
ole2.add_arg (args, wdmove);
ole2.invoke (hselection
,'MoveRight'
,args
ole2.destroy_arglist (args);
write_data (hselection
, :your_block.item);
args := ole2.create_arglist;
ole2.add_arg (args, wdcell);
ole2.add_arg (args, 1);
ole2.add_arg (args, wdmove);
ole2.invoke (hselection
,'MoveRight'
,args
ole2.destroy_arglist (args);
write_data (hselection
,:your_block.item);
args := ole2.create_arglist;
ole2.add_arg (args, wdcell);
ole2.add_arg (args, 1);
ole2.add_arg (args, wdmove);
ole2.invoke (hselection
,'MoveRight'
,args
ole2.destroy_arglist (args);
write_data (hselection
,:your_block.item);
args := ole2.create_arglist;
ole2.add_arg (args, wdcell);
ole2.add_arg (args, 1);
ole2.add_arg (args, wdmove);
ole2.invoke (hselection
,'MoveRight'
,args
ole2.destroy_arglist (args);
write_data (hselection
,:your_block.item);
args := ole2.create_arglist;
ole2.add_arg (args, wdcell);
ole2.add_arg (args, 1);
ole2.add_arg (args, wdmove);
ole2.invoke (hselection
,'MoveRight'
,args
ole2.destroy_arglist (args);
write_data (hselection
,:your_block.item);
END IF;
EXIT WHEN :SYSTEM.LAST_RECORD = 'TRUE';
NEXT_RECORD;
END LOOP;
--The following makes the cursor exit the table and back on document for any further
--writing of text.
args := ole2.create_arglist;
ole2.add_arg (args, wdline);
ole2.add_arg (args, 1);
ole2.add_arg (args, wdmove);
ole2.invoke (hselection
,'MoveDown'
,args
print_line (hselection --As mentioned earlier, this enters a blank line.
,NULL
,NULL
print_line (hselection
,'Boilerplate text: '
,your_variable
print_line (hselection
,'Boilerplate text: '
,your_variable
--You can print as many lines as required by making call to the PRINT_LINE procedure.
ole2.RELEASE_OBJ (htables);
ole2.RELEASE_OBJ (hfont);
ole2.RELEASE_OBJ (hselection);
ole2.RELEASE_OBJ (hdocument);
ole2.RELEASE_OBJ (hdocuments);
ole2.RELEASE_OBJ (happlication);
END;
PROCEDURE PRINT_LINE
( v_sel OLE2.OBJ_TYPE
, v_text VARCHAR2
, v_field varchar2)
IS
/* This procedure takes in three arguments.
The first v_sel is the VB selection object.
v_text is the static or boilerplate text that needs to be printed on the document.
v_field is the value of the item or variable from the program.
v_args OLE2.LIST_TYPE;
hTab CONSTANT varchar2(1) := chr(9); --This is the vb constant for tabstop
BEGIN
v_args := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(v_args, v_text);
OLE2.INVOKE(v_sel, 'TypeText', v_args);
OLE2.DESTROY_ARGLIST(v_args);
--The following replicates tabbing. This was used so that the field values are aligned at a tabstop.
--When printing a blank line NULL is passed in as the argument
v_args := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(v_args, hTab);
OLE2.INVOKE(v_sel, 'TypeText', v_args);
OLE2.DESTROY_ARGLIST(v_args);
--The following writes the value of the variable at the tabstop.
v_args := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(v_args, v_field);
OLE2.INVOKE(v_sel, 'TypeText', v_args);
OLE2.DESTROY_ARGLIST(v_args);
OLE2.INVOKE(v_sel, 'TypeParagraph');
END;
PROCEDURE WRITE_HEADINGS (SELIN OLE2.OBJ_TYPE, TEXTIN VARCHAR2, COUNTIN NUMBER)
IS
/* This procedure is used to write headings in the first row of the table.
SELIN is the Selection object
TEXTIN is the boilerplate text to be written as the header of a column.
COUNTIN is the number of characters in the header text. This is required
to replicate the action bolding the font of the header.
hFont OLE2.OBJ_TYPE;
v_args OLE2.LIST_TYPE;
wdCharacter CONSTANT number(5) := 1; --Default
--wdUnderline Class members
wdUnderlineSingle CONSTANT NUMBER(5) := 1;
---- wdMovementType Class members
wdExtend CONSTANT number(5) := 1;
wdMove CONSTANT number(5) := 0; --Default
---- WdParagraphAlignment Class members
wdAlignParagraphCenter CONSTANT number(5) := 1;
wdAlignParagraphLeft CONSTANT number(5) := 0;
wdAlignParagraphRight CONSTANT number(5) := 2;
---- HexColor = BBGGRR
myLightBlue CONSTANT number(8) := 16755370; --FFAAAA
BEGIN
hFont := OLE2.GET_OBJ_PROPERTY(selin, 'Font');
OLE2.SET_PROPERTY(hFont, 'Name', 'Calibri');
OLE2.SET_PROPERTY(hFont, 'Size', 10);
OLE2.SET_PROPERTY(hFont, 'Bold', True);
OLE2.RELEASE_OBJ(hFont);
v_args := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(v_args, textin);
OLE2.INVOKE(selin, 'TypeText', v_args);
OLE2.DESTROY_ARGLIST(v_args);
v_args := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(v_args, wdCharacter);
OLE2.ADD_ARG(v_args, countin);
OLE2.ADD_ARG(v_args, wdMove);
OLE2.INVOKE(selin, 'MoveLeft', v_args);
OLE2.DESTROY_ARGLIST(v_args);
v_args := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(v_args, wdCharacter); --Unit
OLE2.ADD_ARG(v_args, countin); --Count
OLE2.ADD_ARG(v_args, wdExtend); --Extend
OLE2.INVOKE(selin, 'MoveRight', v_args);
OLE2.DESTROY_ARGLIST(v_args);
hFont := OLE2.GET_OBJ_PROPERTY(selin, 'Font');
OLE2.SET_PROPERTY(hFont, 'Underline', wdUnderlineSingle);
OLE2.RELEASE_OBJ(hFont);
END;
PROCEDURE WRITE_DATA (SELIN OLE2.OBJ_TYPE, TEXTIN VARCHAR2)
IS
/*This procedure writes data in the cells of the table
hFont OLE2.OBJ_TYPE;
v_args OLE2.LIST_TYPE;
wdCharacter CONSTANT number(5) := 1; --Default
--wdUnderline Class members
wdUnderlineSingle CONSTANT NUMBER(5) := 0;
---- wdMovementType Class members
wdExtend CONSTANT number(5) := 1;
wdMove CONSTANT number(5) := 0; --Default
---- WdParagraphAlignment Class members
wdAlignParagraphCenter CONSTANT number(5) := 1;
wdAlignParagraphLeft CONSTANT number(5) := 0;
wdAlignParagraphRight CONSTANT number(5) := 2;
---- HexColor = BBGGRR
myLightBlue CONSTANT number(8) := 16755370; --FFAAAA
BEGIN
hFont := OLE2.GET_OBJ_PROPERTY(selin, 'Font');
OLE2.SET_PROPERTY(hFont, 'Name', 'Calibri');
OLE2.SET_PROPERTY(hFont, 'Size', 10);
OLE2.SET_PROPERTY(hFont, 'Bold', False);
OLE2.SET_PROPERTY(hFont, 'Underline', wdUnderlineSingle);
OLE2.RELEASE_OBJ(hFont);
v_args := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(v_args, textin);
OLE2.INVOKE(selin, 'TypeText', v_args);
OLE2.DESTROY_ARGLIST(v_args);
END;
Edited by: smilingbandit on 31-Mar-2010 7:05 PM
Edited by: smilingbandit on 31-Mar-2010 8:23 PM
Edited by: smilingbandit on Apr 1, 2010 6:14 AM: Reason - Fixed formatting of comments. -
Im trying to use hash table in a program but Im gettin an error I cant understand...
DATA gt_kna1 TYPE HASHED TABLE OF kna1 WITH UNIQUE KEY kunnr.
SELECT kunnr INTO TABLE gt_kna1
FROM kna1.
Im gettin this error:
An entry was to be entered into the table "\PROGRAM=ZTABLA_HASH\DATA=GT_KNA1" (which should havehad a unique table key (UNIQUE KEY)).
However, there already existed a line with an identical key.
But this is impossible, the field kunnr is key in table kna1.
Does Anybody know why Im gettin this dump?
RegardsTry this way
TYPES: BEGIN OF TY_KUNNR,
KUNNR LIKE KNA1-KUNNR.
TYPES: END OF TY_KUNNR.
DATA: IT_KUNNR TYPE HASHED TABLE OF TY_KUNNR WITH UNIQUE KEY KUNNR.
SELECT KUNNR INTO TABLE IT_KUNNR
FROM KNA1
a® -
Showing total of PRICE using 3 tables PROBLEM, please help URGENT??
Hi i am trying to calculate the order total in my database for a given order number.
I need to use 3 tables for this:
customer table:
CREATE TABLE customer
(custid NUMBER(5),
last VARCHAR2(30) CONSTRAINT customer_last_nn NOT NULL,
first VARCHAR2(30),
mid_initial CHAR(1),
cadd VARCHAR2(30),
town VARCHAR2(30),
city VARCHAR2(30),
postcode VARCHAR2(10),
dphone VARCHAR2(10),
ephone VARCHAR2(10),
CONSTRAINT customer_custid_pk PRIMARY KEY (custid));
orders table:
CREATE TABLE orders
(orderid NUMBER(8),
orderdate DATE CONSTRAINT orders_orderdate_nn NOT NULL,
methpmt VARCHAR2(10) CONSTRAINT orders_methpmt_nn NOT NULL,
custid NUMBER(5),
ordersource VARCHAR2(20),
CONSTRAINT orders_orderid_pk PRIMARY KEY (orderid),
CONSTRAINT orders_custid_fk FOREIGN KEY (custid) REFERENCES customer(custid),
CONSTRAINT orders_ordersource_fk FOREIGN KEY (ordersource) REFERENCES ordersource(ordersource));
And finally orderline table:
CREATE TABLE orderline
(orderid NUMBER(8) CONSTRAINT orderline_orderid_nn NOT NULL,
invid NUMBER(10) CONSTRAINT orderline_invid_nn NOT NULL,
order_price NUMBER(6,2) CONSTRAINT orderline_order_price_nn NOT NULL,
quantity NUMBER(4) CONSTRAINT orderline_quantity_nn NOT NULL,
CONSTRAINT orderline_pk PRIMARY KEY (orderid, invid),
CONSTRAINT orderline_orderid_fk FOREIGN KEY (orderid) REFERENCES orders(orderid),
CONSTRAINT orderline_invid_fk FOREIGN KEY (invid) REFERENCES inventory(invid));
INSERT INTO CUSTOMER VALUES (107, 'HARRIS', 'PAULA', 'E', '1156 WATER STREET', 'KENSINGTON','LONDON', 'SW1 6DS', 02071555589, 02071555590);
INSERT INTO ORDERs VALUES (1057, TO_Date('05/29/2001 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), 'CC', 107, '152');
INSERT INTO ORDERLINE VALUES (1058, 11824, 15.99, 1);
Here is my code:
SET SERVEROUTPUT ON;
DECLARE
v_odNum NUMBER(8):= &sv_orderNum;
v_price NUMBER(7,2);
v_quantity NUMBER(5);
v_fname VARCHAR2(30);
v_lname VARCHAR2(30);
v_add VARCHAR2(30);
BEGIN
SELECT first, last, cadd, order_price, quantity, SUM(order_price * quantity) AS TOTAL
INTO v_fname, v_lname, v_add, v_price, v_quantity
FROM customer c, orders o, orderline ordl
WHERE c.custid = o.custid AND o.orderid = ordl.orderid
AND v_odNum = o.orderid
DBMS_OUTPUT.PUT_LINE('The total order for' ||v_odNum|| ' '|| 'is' || TOTAL);
END;
Is there anyway of using the SUM function so that i can store the result in a variable and display it similar to the ouput code??
P.S sorry for the length coding, but there is no code tage in the thread that i can see to make it more managable.A procedure with an OUT parameter which returns the total order cost should work.
-
CL_GUI_ALV_GRID Problems when using enter and f4 in one ALV
Hi guys,
i have the following problem:
I Use a ALV, which has a column MATNR. The ALV provides the standard search help for this field automatically. so far so good. BUT i also need to read additional data, such as GLD, Material shortext etc, when the users presses the Enter Key.
Here is my coding:
CLASS lcl_events DEFINITION
CLASS lcl_events_0300 DEFINITION.
PUBLIC SECTION.
METHODS:
handle_data_changed
FOR EVENT data_changed OF cl_gui_alv_grid
IMPORTING er_data_changed sender.
ENDCLASS. "lcl_events DEFINITION
The problem that occurs: if i select a material via f4, i just can add one material to the alv. if i place the cursor into the second line, press f4 again, the alv overwrites the MATNR in the first line
i think the problem has to do with the fact, that the alv runs throug my enter event, when pressing f4.
thats how i registered my event:
g_o_alv_grid_bart_0300->register_edit_event(
EXPORTING
" i_event_id = g_o_alv_grid->MC_EVT_MODIFIED ).
i_event_id = g_o_alv_grid->mc_evt_enter ).
...und EventHandler zuweisen
CREATE OBJECT g_o_alv_events_0300.
SET HANDLER g_o_alv_events_0300->handle_data_changed FOR g_o_alv_grid_bart_0300.
kind regards, mark
Edited by: Mark Wagener on Aug 19, 2010 11:39 AM
Edited by: Mark Wagener on Aug 19, 2010 11:40 AMSorry for forgetting the impl. part of the class!
CLASS lcl_events_0300 IMPLEMENTATION
CLASS lcl_events_0300 IMPLEMENTATION.
METHOD handle_data_changed.
HandleDataChanged ***
DATA: ls_good TYPE lvc_s_modi.
FIELD-SYMBOLS: .
alle Inhalte der geänderten Zellen in die interne Tabelle schreiben
LOOP AT er_data_changed->mt_good_cells INTO ls_good.
Dazu auf die richtige Zeile in der ITAB positionieren:
READ TABLE INDEX ls_good-row_id.
IF sy-subrc = 0.
Und das geänderte Feld dem Feldsymbol zuweisen
ASSIGN COMPONENT ls_good-fieldname OF STRUCTURE .
IF sy-subrc = 0.
Feldwert zuweisen
-matnr
AND bwkey = werks.
ENDLOOP.
Und neu ausgeben
g_o_alv_grid_bart_0300->refresh_table_display( ).
ENDMETHOD. "handle_data_changed
Maybe you are looking for
-
hey i've decided to up grade my powerbook g4 to a macbook. however im a little scared to find out that dreamweaver will not work with the intel chips and with leppard. i've tried to search to see if there was any problems, and it was kinda hard to fi
-
Getting while Installing 11.5.10.2 on OEL 5 update 3 64 bit
Hi, Can one help to install 11.5.10.2 on OEL5 64 bit. i got below error while installing apps side. runProcess_8 Creating link for iAS ORACLE_HOME/6iserver pointing to 8.0.6 Home runProcess_9 Statusstring Registering iAS ORACLE_HOME with OUI inventor
-
Mac OS X snow leopard on Macbook
Hi, I want to know if my macbook can support snow leopard. I have the earlier version on macbook white, though it is a intel chipset, but it is intel core Duo. Do i need a core 2 Duo system? Also, my graphics card is Intel GMA 950. Is it supported? W
-
Hello buddies and first of all Happy new year as it is my first thread for this year. The bloody problem is with nokia PC suite. With the older version I could copy the contacts from the phone to PC and the program would ask me if I would like to sav
-
Can anyone send me TCS XI running projects clients ?
can anyone send me TCS XI running projects clients? please send ASAP..