Writing Code using SQVI
Hi Experts ,
Can we write a Abap code (query ) using the Tcode SQVI?
Apart from doing table joins and getting the report output .
I know we can do it using SQ01 , but i do not have the access for the same.
Thanks in Advance ,
Harshit Rungta
Hi,
it is not possible to add ABAP code in SQVI.
Regards
Similar Messages
-
Using SQVI To Generate Program in DEV
I have read a lot about the merits of using SQVI for simple queries and then generating the code and assigning to a transaction code so that others can run the query/report. I have found posts in this forum that suggest using SE93 to create a transaction code and assign the SQVI generated program is the only way that an SQVI query can be shared. I certainly hope they were not assuming that users have SE93 in a production environment??
My question is, if I create this query and generate the program in our DEV environment and then assign it to a transaction code, can this be transported from DEV to TST to PRD intact? Will this work?
One other question, when the program is generated does it also create the required authorization checks? I am using USR* tables for this report, nothing considered sensitive, would any additional authorizations be required to allow just about any user to run the transaction?
Disclosure, I am a power user and not an ABAP specialist.
I appreciate a speedy reply if that is possible.
Thanks
MarkHi Mark,
I have faced same requirement. I am not sure about transporting to TST and PROD. I done by this way.
After generating SQVI program in DEV , I assigned that program to a transaction and tested in DEV. Later i have regenarated SQVI in Production. then I assigned the generated Program to same transaction in DEV. And transported the Tcode assignment of program to Production..
About authorization , if its not sensitive report, BASIS can restrict at transaction level.
Regards,
Ravi. -
Performance effects of writing code in Application Package
Hi all,
I just have this strange doubt about the performance of the system if we write the code in "Application Package". Writing code in application package is a good practice as it is good in trems of readability but I am wondering whether performance is effected apart from the advantages of reusability, readability etc.
I have to create a application class object(Import as well) whenever I need to call a method in the class or any property,during this process the application class object has to be loaded which consumes component buffer which is considerable. So if I am calling in amethod which has say some 20 lines of code in a class of some 1000 odd lines of code. How best is to write that 20 lines of code directly rather than calling a method in the application class.
Please give your views if my assumptions are wrong.
Thanks
Vamsi.You ask a good question and you are using a good thought process. It seems that if you write 20 lines of code inline, you will have less memory overhead and less CPU cycles (no construction overhead) than if you write that same 20 lines in an App Class and then create an instance of an object for each row. Is this true? I'm not sure, but using the debugger, etc, it seems logical. It seems logical enough for me to just assume that is the case. Besides performance, however, you have to think about upgrades. If you are modifying a delivered component, then it is usually preferable to write your code outside the delivered code, and then import that code using an App Class or FUNCLIB.
I think there are some more important questions to answer:
1. If you have an App Class with 1,000 lines of code and you are only using 20, then why are those 20 lines in the same class as the other 1,000 lines? It seems as though the "big" class with 1,000 lines should use the class that has only 20 (composition), but not be included in the class's code base. Classes should be small. A 1,000 line class is probably too complex and should be broken down anyway. A 1,000 line class may be necessary, but I would take a good look at it and consider refactoring.
2. If you are iterating over rows and creating an instance for each row, only to execute a method, then perhaps you should consider creating an instance outside the loop and then just execute the method, passing in values, much as you would a Java static method. If you are using a field level event, like RowInit, then this isn't possible. It might be tempting to apply the same approach using component scoped variables, but I cringe at anything other than local scope. I would rather take the minimal performance hit of a small class than use a scope other than local.
3. If you are only creating an object for the sole purpose of executing a method, then you may be using OOP wrong anyway, and may be better served by a FUNCLIB.
These are just some thoughts I have. Properly designed App Classes make your PeopleCode easier to write and maintain, but won't add much, if anything to the the number of CPU cycles and memory consumption. In fact, some may argue that the discipline and design afforded by good OOP (composition, TDD, etc) would result in better performing programs. -
Help me writing - Writing Code at InfoPackage
Hi Experts,
Please help me out writing code at the info package level. For some reasons my generic Extractor supports only Full upload. So now I need to extract data on daily basis for an individual day.
Eg: If I triigger Info package then it has to extract the data (present day -1) means if I trigger on Tuesday then it has to extract the sales orders which are generated on Monday.
Please guide me as how to write this code and where to write in the Info package? Help me with the code as well..
I Appreciate your help in this regard.
thanks
BUlliHello Bulli
I don't know why the generic extraction in your case is not supporting delta, there are three options in RS02 to create delta anyway comming to your point
You can use your 0CALDAY IO in infoPackage selection condition. Restrict its value on current day and previous day, write a ABAP code, for this you have to select transformation type 6( which means ABAP code).
To calculate previous day you can use directly
data: w_previous_day type D.
w_previous_day = sy-datum - 1.
Assign points if it helps.
Thanks -
Scale-to-fit compositions without writing code
When will Edge make scale-to-fit compositions without writing code?
Hey Yuval,
Glad you found the tutorial useful!
This is because the code targets the #Stage div, not the body which is where your menu is appended to.
Trying $("#Stage").append(sym.$('Menu')) might do the trick. Give that a shot.
Sarah -
Assert & writing code that should never be reached
hi dudes,
i thing i got that assertion-stuff right BUT there is one thing confusing me:
from my book:
"The following idiom can be employed to explicitly test that certain locations in the code will never be reached.
assert false : "This line should never be reached.";
but what is the point of writing code(at all) that will never be reached?
i mean if it should never be reached ill simply never write it.
even in this tricky EXAMPLE
int someMthd(int trinityMember)
switch (trinityMember) {
case THE_FATHER:
return psalm101;
case THE_SON:
return psalm102;
case THE_HOLY_GHOST:
return psalm103;
default:
assert false: trinityMember; //Ok BETTER WOULD BE throw new AssertionError(trinityMember);
}if no case match i would get COMPILE TIME error so that will indicate me that method could(possible) never return an int. So if a i can compile it it will be ok!?
so again what is the point of writing code that should never be reached[\b]?if no case match i would get COMPILE TIME error so
that will indicate me that method could(possible)
never return an int. So if a i can compile it it will
be ok!?But without the default case you can't compile it, so you have to write a default case (or some other code). What code would it make sense to put there other than throwing an exception of some sort or returning a default value?
so again what is the point of writing code that
should never be reached[\b]?You probably believe the code should never be reached in your example because to you it only makes sense to pass either THE_FATHER, THE_SON or THE_HOLY_GHOST as a parameter. But what if somebody were to pass THE_FIRESTARTER to your someMthd method, having not realised that you haven't coded for that argument? What should your code do then? It can't do nothing, so it makes sense to provide a default case that lets the user know (by throwing an exception), that something unexpected has happened. Or, you might decide to return a default value that is useful and perhaps somehow informs client code of the unusual circumstance (for example a return value of -1 might indicate that there is no relevant psalmX).
So this is about robustness - making sure that in unexpected circumstances, your application does something reasonable. -
Derivation of juristriction code using state in customer master record
Hi All
Is there any way to derive juristriction code using state field in the customer master record without writing abap code.
For exmple:
If state of cutomer is NY then juristriction code should be defaulted as NY000000
Thanks in advanceHi,
It appears by your question, like there is one to one relationship between the state and the jurisdiction code. I am curious to know if you can create a CATT or LSMW program for customer master general data (KNA1) and just fill in state and jurisdiction code (fill in the values in excel) and then upload. You can easily apply an IF condition in excel for if state = NY then jurisdiction is xxxx. You may need one create program and one edit program. This is an easy solution rather than trying to automatically derive in SAP.
Regards
Sharabh -
Sending an ESC code using the serial port
I have a motor control aplication that requires sending an ESC character using the serial port. LabView has several built-in functions (end of line, line return, etc.) but I just do not know how to send this particular code using the serial port. Any ideas?
The hex code for ESC character is 1b, Try writing it in a 8 bit unsigned number and then change that byte to charachter using labview function "byte Array to string". In this way you can pass this charachter.
-
Urgent! Urgent! - Problem writing unicode using ServletOutputStreamream
Hi,
I have a string of unicode for Japanese character, I am trying to write that using ServletOutputStream() or PrintWrite() but it doesn't show what I want to see.
My code is like this
private ServletOutputStream output;
response.setContentType("text/plain;charset="ISO-2022-JP");
output = response.getOutputStream();
output.println(nodeValue "_MENU_" i "_NAME=" treeBundle.getString(menuItem.getName()));
where treeBundle.getString(menuItem.getName()); returns a unicode stream from the properties file which is in the form of \u6a5f\u5668\u69cb\u6210\u60c5\u5831
This is an urgent,
Thanks,
pbode stream from the properties file which is in the form of \u6a5f\u5668\u69cb\u6210\u60c5\u5831
This is an urgent,
Thanks,
pbThings are not as simple, I have a jsp file which writes the applet, a part of applet is written from the jsp which displays japanese character fine but the popup menu which is being generated dynamically by a servlet doesn't show the japanese character correctly.
I am writing this popup menu's code using ServletOutput stream.
In the jsp I did not set the font but the font-family as,
A {font-size: 8pt; color: #0C2D79; text-decoration: none; font-family: gothic, mincho, arial unicode ms;}
And it works fine as the applet code generated by jsp shows japanese code very well but not the code written by servlet.
Hope it explains! -
From Oracle vers. 8i on it's possible to write procedures and packages in SQLJ, that is using Java embedded in PL/SQL. Can someone tell me why should a programmer learn to develop in SQLJ? Which are the advantages?.
I usually write on one side stored procedures or packages in pure PL/SQL stored on Oracle Server and on the other side code in JSP on Client where JSP calls my stored procedures which get the data back to my web page. At this point I'd like to understand which might be the advantage of writing code in SQLJ (Java embedded in PL/SQL). What I mean is why I should take advantages in writing code with Java/PLSQL instead of keeping on writing the Java side only in JSP and writing code on Oracle always in pure PL/SQL.
Thanks!Hello Mark,
you don't always have a JSP for your Java code. A popular example is reading the contents of a directory. This function is not available in PL/SQL, but can be easily implemented with embedded Java. Or imagine creating or manipulating an image or handling binary Excel files with POI.
There are many Java functionalities available that are not implemented in PL/SQL and you don't have to reimplement the wheel.
Regards
Marcus
Edited by: Marwim on 12.07.2011 15:10 -
Using SQVI to generate report of open and released delivery schedule lines
All,
I'm using SQVI to generate an excel spreadsheet for some buyers to show open released schedule lines because they are a 1 line item per scheduling agreement company.
I used the logical database MEPOLDB instead of a table joint and pulled fields from EKKO(vendor, SA #,&purchasing group), EKPO(Material Number), EKEH(schedule line type), and EKET(delivery date, scheduled qty,previous qty).
Does this sound like I'll get the results I want on paper as long as I use the right selection criteria, because the report I'm getting isn't quite what I expect? I am unable to identify which lines are authorized to ship vs. trade-off zone, planning, etc. in the report thus far.Hi Mark,
I have faced same requirement. I am not sure about transporting to TST and PROD. I done by this way.
After generating SQVI program in DEV , I assigned that program to a transaction and tested in DEV. Later i have regenarated SQVI in Production. then I assigned the generated Program to same transaction in DEV. And transported the Tcode assignment of program to Production..
About authorization , if its not sensitive report, BASIS can restrict at transaction level.
Regards,
Ravi. -
Creating a service report using SQVI
Hi experts
I am creating a service report using SQVI
The report should have the following fiels
SrvPO No | SrvPO Data | vendor | Stata | City | Type of Srv (Ad\banner|maintnc.) | Amount | Status(open or closed)
I am using the following tables using table join fnc
1. EKKO
EBELN-PO No
AEDAT - PO Data
LIFNR - Vendor
PROCSTAT - Status of PO doc
2.LIFNR
REGIO - State
ORTO1 - City
3. ESSR
TXZ01 - Type of Service (Short text)
4.EKPO
NETWE - Net amount of PO
All the tables are legally join but after executing I am not able to fetch any data or hardly one service PO.
And the selection field will be only From Date and To date.or the Service PO No.
Immediate response is urgent
Regards
ParthaModerator message: you said your issue is solved but did not mark your discussion as such, please see
How to close a discussion and why -
[b]Tutorial:[/b] Simplify Developing OLE Automation Code Using VBA
INTRODUCTION
Automating Office applications from Oracle Forms can be a tedious, frustrating, and time-consuming process. Because the OLE2 and CLIENT_OLE2 built-ins do not validate the automation commands that they relay, code that compiles without errors often dies at runtime with a not-so-helpful error code. This tutorial will demonstrate how to simplify the development of automation code using a tool that ships with all Microsoft Office editions -- the Visual Basic for Applications (VBA) IDE.
The VBA IDE, a core Office component, is a full-fledged development environment featuring code completion, basic syntax highlighting, context-driven help and a runtime debugger. Its Object Browser provides a convenient means of browsing the Word object model, as well as searching by keyword.
For those who may not interested in following this tutorial in detail, I would like to stress the usefulness of the Object Browser as a tool for inspecting the functions supported by OLE server applications and, perhaps more importantly, valid values for function arguments. Whether/not anyone buys the assertion that starting with VBA prototypes is far more productive than pounding out OLE2 code from the very start, they will find the Object Browser invaluable as a reference -- I rely on it exclusively for this sort of documentation.
A BRIEF INTRODUCTION TO THE VBA IDE & THE OBJECT BROWSER UTILITY
Try this:
1. Open Word
2. Launch the VBA IDE by pressing <Alt><F11>
3. Open the Object Browser by pressing <F2>
The Object Browser allows you to visually navigate Word's class hierarchy. Its user interface is a bit crowded, so controls are unlabeled. Hovering the mouse cursor above a control will display a tooltip explaining that control's purpose. The browser's scope can be narrowed by using the Project/Library combo. Typing a keyword or substring in the Search Text combo and clicking on the Search button will cause all classes/members whose name contains the specified search text to be listed in the Search Results pane. Selecting an item from this list will update the two panes below it, showing the selected class, and its members. Beneath the Classes and Members panes is an untitled pane, gray in color, which displays details for the selected class/member, including hyperlinks to relevant information such as arguments, their types and allowable values. If Visual Basic Help is installed, pressing <F1> will display help on a selected class/member. (This feature can be installed from your Office install CD, if necessary.)
NOTE: While it is possible to cut-and-paste the code examples that follow, I highly recommend that they be typed in by hand. Doing so will provide a better understanding of how the IDE's code completion behaves. Use code completion most efficiently by not using the mouse or <Enter> key when selecting from completion lists. Instead, just type enough letters to select the desired list element, then continue along as if you had typed the entire element, typing the next operator in your statement. It really is slick!
HELLO WORLD - VBA-STYLE
1. Open Word
2. Launch the VBA IDE by pressing <Alt><F11>
3. Select Module from the Insert menu.
4. In the blank area that appears, enter the following code:
Public Sub HelloWorld()
Documents.Add
Selection.TypeText ("Hello, world!")
End Sub5. Press <F5> to run the code.
If you switch back to Word by pressing <Alt><F11>, there should appear a newly-created document containing the text Hello, world!.
A MORE AMBITIOUS EXAMPLE
In this example, we will launch Word, type some text, and alter its formatting. For the purposes of this tutorial, consider it the process we wish to automate from within Forms.
1. If Word is running, close it.
2. Open any Office application except Word, such as Excel, Outlook or PowerPoint
3. Launch the VBA IDE by pressing <Alt><F11>.
4. Select References from the Tools menu -- a dialog should pop up.
5. From within this dialog, locate and select Microsoft Word <version> Object Library, then click OK.
6. Select Module from the Insert menu.
7. In the blank area that appears, enter the following code:
Public Sub LaunchWord()
Dim app As Word.Application
Set app = CreateObject("Word.Application")
app.Visible = True '!!! IMPORTANT !!!
app.Documents.Add
With app.Selection
.TypeText "This is paragraph 1."
.TypeParagraph
.TypeText "This is paragraph 2."
.TypeParagraph
.TypeText "This is paragraph 3."
End With
With ActiveDocument
.Paragraphs(1).Range.Words(3).Bold = True
.Paragraphs(2).Range.Words(3).Italic = True
.Paragraphs(3).Range.Words(3).Underline = True
End With
End Sub8. Press <F5> to run the code.
A new Word session should have been launched. Switch to it, to view the results of our handiwork!
TAILORING VBA CODE INTENDED FOR OLE2 CONVERSION
Now, things get a bit uglier. The code listed above gives a good idea of how concise VBA code can be, but With blocks and chained object references do not translate readily into OLE2 code. Here's the same process, rewritten in a more OLE2-friendly style. Note the numerous intermediate object references that have been declared.
Public Sub LaunchWord()
Dim app As Word.Application
Dim doc As Word.Document
Dim docs As Word.Documents
Dim pars As Word.Paragraphs
Dim par As Word.Paragraph
Dim wrds As Word.Words
Dim sel As Word.Selection
Dim rng As Word.Range
Set app = CreateObject("Word.Application")
app.Visible = True '!!! IMPORTANT !!!
Set doc = app.Documents.Add
Set sel = app.Selection
sel.TypeText "This is paragraph 1."
sel.TypeParagraph
sel.TypeText "This is paragraph 2."
sel.TypeParagraph
sel.TypeText "This is paragraph 3."
Set pars = doc.Paragraphs
'select third word of first paragraph and make it bold
Set par = pars.Item(1)
Set rng = par.Range
Set wrds = rng.Words
Set rng = wrds.Item(3)
rng.Bold = True
'select third word of second paragraph and italicize it
Set par = pars.Item(2)
Set rng = par.Range
Set wrds = rng.Words
Set rng = wrds.Item(3)
rng.Italic = True
'select third word of second paragraph and underline it
Set par = pars.Item(3)
Set rng = par.Range
Set wrds = rng.Words
Set rng = wrds.Item(3)
rng.Underline = True
End Sub
TRANSFORMATION: CONVERTING VBA CODE INTO PL/SQL
Here is the PL/SQL counterpart to our previous VBA routine. Compare printouts of the two and note their similarities. Notice the need for argument lists -- this causes the code to fluff up quite a bit, and really interferes with readability.
PROCEDURE LAUNCH_WORD IS
v_app OLE2.OBJ_TYPE; -- Application
v_doc OLE2.OBJ_TYPE; -- Document
v_docs OLE2.OBJ_TYPE; -- Documents collection
v_pars OLE2.OBJ_TYPE; -- Paragraphs collection
v_par OLE2.OBJ_TYPE; -- Paragraph
v_wrds OLE2.OBJ_TYPE; -- Words collection
v_sel OLE2.OBJ_TYPE; -- Selection
v_rng OLE2.OBJ_TYPE; -- Range
v_args OLE2.LIST_TYPE; -- OLE2 argument list
BEGIN
/* launch Word and MAKE IT VISIBLE!!! */
v_app := OLE2.CREATE_OBJ('Word.Application');
OLE2.SET_PROPERTY(v_app, 'Visible', TRUE);
/* initialize key object references */
v_docs := OLE2.GET_OBJ_PROPERTY(v_app, 'Documents');
v_doc := OLE2.INVOKE_OBJ(v_docs, 'Add');
v_sel := OLE2.GET_OBJ_PROPERTY(v_app, 'Selection');
/* type first paragraph */
v_args := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(v_args, 'This is paragraph 1.');
OLE2.INVOKE(v_sel, 'TypeText', v_args);
OLE2.DESTROY_ARGLIST(v_args);
OLE2.INVOKE(v_sel, 'TypeParagraph');
/* type second paragraph */
v_args := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(v_args, 'This is paragraph 2.');
OLE2.INVOKE(v_sel, 'TypeText', v_args);
OLE2.DESTROY_ARGLIST(v_args);
OLE2.INVOKE(v_sel, 'TypeParagraph');
/* type third paragraph */
v_args := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(v_args, 'This is paragraph 3.');
OLE2.INVOKE(v_sel, 'TypeText', v_args);
OLE2.DESTROY_ARGLIST(v_args);
/* set reference to Paragraphs collection */
v_pars := OLE2.GET_OBJ_PROPERTY(v_doc, 'Paragraphs');
/* select third word of first paragraph and make it bold */
v_args := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(v_args, 1);
v_par := OLE2.INVOKE_OBJ(v_pars, 'Item', v_args);
OLE2.DESTROY_ARGLIST(v_args);
v_rng := OLE2.GET_OBJ_PROPERTY(v_par, 'Range');
v_wrds := OLE2.GET_OBJ_PROPERTY(v_rng, 'Words');
v_args := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(v_args, 3);
v_rng := OLE2.INVOKE_OBJ(v_wrds, 'Item', v_args);
OLE2.SET_PROPERTY(v_rng, 'Bold', TRUE);
/* select third word of second paragraph and italicize it */
v_args := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(v_args, 2);
v_par := OLE2.INVOKE_OBJ(v_pars, 'Item', v_args);
OLE2.DESTROY_ARGLIST(v_args);
v_rng := OLE2.GET_OBJ_PROPERTY(v_par, 'Range');
v_wrds := OLE2.GET_OBJ_PROPERTY(v_rng, 'Words');
v_args := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(v_args, 3);
v_rng := OLE2.INVOKE_OBJ(v_wrds, 'Item', v_args);
OLE2.SET_PROPERTY(v_rng, 'Italic', TRUE);
/* select third word of second paragraph and underline it */
v_args := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(v_args, 3);
v_par := OLE2.INVOKE_OBJ(v_pars, 'Item', v_args);
OLE2.DESTROY_ARGLIST(v_args);
v_rng := OLE2.GET_OBJ_PROPERTY(v_par, 'Range');
v_wrds := OLE2.GET_OBJ_PROPERTY(v_rng, 'Words');
v_args := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(v_args, 3);
v_rng := OLE2.INVOKE_OBJ(v_wrds, 'Item', v_args);
OLE2.SET_PROPERTY(v_rng, 'Underline', TRUE);
END;
REFACTORING FOR REUSABILITY AND READABILITY
While the previous procedure runs without errors, it suffers from poor readability which, in turn, makes it difficult to maintain. Here, we address those issues by moving repetetive low-level operations into separate procedures.
PROCEDURE LAUNCH_WORD IS
v_app OLE2.OBJ_TYPE; -- Application
v_doc OLE2.OBJ_TYPE; -- Document
v_docs OLE2.OBJ_TYPE; -- Documents collection
v_sel OLE2.OBJ_TYPE; -- Selection
v_args OLE2.LIST_TYPE; -- OLE2 argument list
BEGIN
/* launch Word and MAKE IT VISIBLE!!! */
v_app := OLE2.CREATE_OBJ('Word.Application');
OLE2.SET_PROPERTY(v_app, 'Visible', TRUE);
/* create a new Word document */
v_docs := OLE2.GET_OBJ_PROPERTY(v_app, 'Documents');
v_doc := OLE2.INVOKE_OBJ(v_docs, 'Add');
v_sel := OLE2.GET_OBJ_PROPERTY(v_app, 'Selection');
/* add a few paragraphs */
PRINT_PARAGRAPH(v_sel, 'This is paragraph 1.');
PRINT_PARAGRAPH(v_sel, 'This is paragraph 2.');
PRINT_PARAGRAPH(v_sel, 'This is paragraph 3.');
/* apply formatting */
APPLY_FORMATTING(v_doc, 1, 3, 'Bold', TRUE);
APPLY_FORMATTING(v_doc, 2, 3, 'Italic', TRUE);
APPLY_FORMATTING(v_doc, 3, 3, 'Underline', TRUE);
END;
PROCEDURE APPLY_FORMATTING(
v_doc OLE2.OBJ_TYPE,
v_paragraph_num NUMBER,
v_word_num NUMBER,
v_attribute VARCHAR2,
v_value BOOLEAN) IS
v_pars OLE2.OBJ_TYPE; -- Paragraphs collection
v_par OLE2.OBJ_TYPE; -- Paragraph
v_wrds OLE2.OBJ_TYPE; -- Words collection
v_rng OLE2.OBJ_TYPE; -- Range
v_args OLE2.LIST_TYPE; -- OLE2 argument list
BEGIN
/* set reference to Paragraphs collection */
v_pars := OLE2.GET_OBJ_PROPERTY(v_doc, 'Paragraphs');
/* get specified paragraph */
v_args := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(v_args, v_paragraph_num);
v_par := OLE2.INVOKE_OBJ(v_pars, 'Item', v_args);
OLE2.DESTROY_ARGLIST(v_args);
/* get words for specified paragraph */
v_rng := OLE2.GET_OBJ_PROPERTY(v_par, 'Range');
v_wrds := OLE2.GET_OBJ_PROPERTY(v_rng, 'Words');
/* apply formatting to word found at specified index */
v_args := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(v_args, v_word_num);
v_rng := OLE2.INVOKE_OBJ(v_wrds, 'Item', v_args);
OLE2.SET_PROPERTY(v_rng, v_attribute, v_value);
END;
PROCEDURE PRINT_PARAGRAPH(v_sel OLE2.OBJ_TYPE, v_text VARCHAR2) IS
v_args OLE2.LIST_TYPE;
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);
OLE2.INVOKE(v_sel, 'TypeParagraph');
END;
CONCLUSION
It is my hope that this tutorial, despite it's introductory nature, has demonstrated the value of the VBA IDE, the ease with which automation processes can be prototyped using VBA, the noticeable similarity between VBA automation routines and their Forms PL/SQL counterparts, and the advantages of testing automation processes within the VBA IDE. Please feel free to follow up with any specific questions or concerns you may have.
Thanks,
Eric Adamson
Lansing, Michigan
FINAL NOTE: These examples use the OLE2 built-in, and will operate correctly when called from forms running in the Form Builder OC4J. Deploying them to an Oracle Application Server will launch Word on the server itself (if available), which is usually not the developer's intent! Automating Word client-side via web forms requires adding WebUtil support. Adapting the code for WebUtil is trivial -- just replace all instances of OLE2 with CLIENT_OLE2. Adapting forms for WebUtil and configuring OLE support into your Oracle Application Server, however, are beyond the scope of this tutorial.
REVISION HISTORY
This promises to be something of a 'living document'. I've snuck changes through without comment in the past, but in the future, I'll try to document significant changes here.
2006-08-21
* Prefaced boring subject line with text: 'Tutorial:' to clarify purpose
* Added emphasis on value of Object Browser as a referenceThanks James, for your kind words. I do hope this information will help folks out. I honestly believe that tinkering around in the VBA IDE will prove highly gratifying for automation developers. It can be assured that learning to make Word jump through hoops is much more straight-forward in this environment. I'm not one for mottos, but if I were pressed for a cheesy motto, I would say: First, make it work. Then, make it work in Oracle!
Once the idea has sunk in, that Visual Basic routines for automating Word are exact analogs to their OLE2 counterparts, we can remove keywords like Oracle and PL/SQL from our Google searches on Word automation which, at least in this context, are the proverbial kiss of death. Suddenly we find ourselves liberated by the possibility of steal-, ahem... borrowing ideas from the Visual Basic* community!
As for links, my link of choice is invariably http://groups.google.com -- if you don't already use it at least ten times a day, you must try it. This is the venerable USENET archive, including the holdings of now-extinct DejaNews. Another possible site of interest is http://word.mvps.org/FAQs/MacrosVBA, which may serve as a good starting point for those who wish to learn how to do fancy tricks with Word using VBA.
If these links don't prove immediately helpful, please feel free to give specifics on the sort of operations you are interested in automating, and I'll see if I can post an example that addresses it.
Regards,
Eric Adamson
Lansing, Michigan
PS: I do hope, as people read my posts, with every other acronym being VBA, that they are not mistakenly hearing a call to learn Visual Basic. I say this, not because I believe learning VB would be a Bad Thing, but because I assume that few of us feel we have the time to learn a new programming language. Despite having come to the Oracle camp already knowing VB/VBA, and having acquired a fair bit of experience with automating Office applications as an Access developer, I remain confident that what I am suggesting people attempt does not rise to the level of learning a language. What I am suggesting is that they learn enough of the language to get by.
*VB vs. VBA
Just a quick word on this, as readers may wonder why I seem to use these terms interchangeably. Visual Basic (VB) can refer to either a development platform or a programming language. Visual Basic for Applications (VBA) is a language -- more precisely, it is a subset of the Visual Basic language. One purchases VB, usually quite intentionally. VBA is included with Microsoft Office, as is VBA's development environment, the VBA IDE. The key distinction between VB and VBA is that VBA cannot be used to create self-contained executables. Rather, VBA relies on VBA-enabled applications, such as Microsoft Office applications, to serve as a container for VBA code, and to provide a runtime environment for that code. For the purposes of discussing OLE Automation, VB and VBA are quite interchangeable. -
Error in linking C++ STL code using CC 5.0 on Solaris 2.6
Hi All,
When building a shared dynamic library from C/C++ code using
STL features, I get an a link error, referring to the STL objects in
use.
I use CC WorkShop C++ Compiler 5.0 running on Solaris 2.6.
For example:
using a vector<int> we get :
Undefined Symbol
__1cDstdGvector4Cin0AJallocator4Ci___M__insert_aux6Mpirki_v_
In File aaa.o
using a multimap<int,int> we get :
Undefined Symbol
__1cH__rwstdJ__rb_tree4CinDstdEpair4CkiCi__n0AL__select1st4n0C_Ci__n0BEless4Ci__n0BJallocator4n0C____U__deallocate_buffers6M_v_
In File aaa.o
etc.
Switching (for testing) from shared lib to an exe does not seem
to solve this issue.
Same goes for toggling libCstd & libCrun's link mode (dyn/stat).
Any suggestions would be appreciated!
Thank you,
GiladHi Gilad,
I have a suggestion concerning the std::vector::__insert_aux error:
http://forum.java.sun.com/thread.jspa?forumID=850&threadID=5069680
Some recommended link options are provided in:
http://forum.java.sun.com/thread.jspa?forumID=850&threadID=5104725
Hope this is useful.
Bye. -
Creation of New company code using EC01
Hi
While creating a new company code using EC01, I am getting several messages relating to Number ranges. All the message relate to number range object type 5 & 6. After all these messages, the final message says that 86 number ranges have not been copied. Can some one throw some light on this?
Regards
RaviHi,
You can ignore these messages; if you use EC01 the system copies all possible tables that are registered as company-dependent. Some of these tables might be not in use at all.
Regards,
Eli
Maybe you are looking for
-
Epson Stylus Photo R2880 feeds paper straight through without printing
So I recently got an Epson R2880 at work, and it at first it was awesome. After a few days, it started feeding paper straight through without printing (it doesn't even pretend to print) and telling me that the "Media [is] out or not loaded correctly"
-
Latest update no sound for text, email, plugging in ipad
since the latest update a couple of days ago my iPad sounds will not work. I mean the ones for incoming text messages, emails, plugging the iPad in- ALL STANDARD SOUNDS OFFERED BY APPLE NOT downloaded sounds! This is very frustrating. I have synced
-
Nullpointer Exception while running BPEL Sample Document Review application
Hi am getting the null pointer exception while instantiating the documentreview process(the sample/demo application). Am using Oracle SOA Suite 10.1.3.1.0. Can any one help me in this regard.. The following is the error message 08/04/09 11:14:22.968
-
Monitoring of messages (Out of Box)
Hi Experts, I have been developing critical interfaces with Legacy systems(MES) with PI7.11. I have question from my team like can we monitor centrally the messages out of box (PI), centrally the messages status in both outbound/inbound scenarios (As
-
Lightroom 2 sharpen settings for scanned slides
Hi, I'm catching up on scanning a large number of 35mm slides (shot mainly on Fuji Velvia 50, and scanned on a Nikon Coolscan 8000ED) and importing them into Lightroom so I can manage them from there. Can anyone provide advice on suitable sharpenin