Calling BAPI from java screen
Hi All
I want to develop Order entry form in PDK, in that i need to call BAPI...namely "BAPI_SALESORDER_CREATEFROMDAT2".
Can anybody send me the sample code...
[email protected]
Thanks for ur help
Pradeep
In PDK you can import RFC modules. For that you have to create a jco connection. The code for calling an simple rfc ....
package com.satyam.callrfc;
import com.sap.mw.jco.JCO;
import com.sapportals.portal.prt.component.*;
public class rfc extends AbstractPortalComponent
private JCO.Client jcoClient;
// proxy for rfc you already assigned...
Insert_pgm_PortType insFunc=new Insert_pgm_PortType();
Zinsert_Pgm_Input ip=new Zinsert_Pgm_Input();
Zinsert_Pgm_Output op=new Zinsert_Pgm_Output();
public void doContent(IPortalComponentRequest request, IPortalComponentResponse response)
this.connect();
insFunc.messageSpecifier.setJcoClient(jcoClient);
//setting input params
ip.setAssociate_Id1("44");
ip.setCourse_Objt1(2);
ip.setQlty_Content1(5);
ip.setSeq_Content1(2);
ip.setTraining_Id1("22");
try{
//calling rfc
op=insFunc.zinsert_Pgm(ip);
}catch(Exception e){}
//display output
response.write(op.getMessage());
this.disconnect();
private void connect() {
try {
jcoClient =
JCO.createClient("client","userid","password","EN","application_system","system_no");
jcoClient.connect();
} catch (Exception e) {
System.out.println("Error connecting to SAP ::" + e.getMessage());
e.printStackTrace();
private void disconnect() {
try {
jcoClient.disconnect();
} catch (Exception e) {
System.out.println(
"Error dis-connecting to SAP ::" + e.getMessage());
e.printStackTrace();
Hope this helps
gEorgE
Similar Messages
-
Any program for calling bapi from ABAP step by step
any program for calling bapi from ABAP step by step
points will be rewarded,
thank you,
Jagrut BharatKumar ShuklaHi Jagrut,
BAPI stands for Business API(Application Program Interface).
A BAPI is remotely enabled function module ie it can be invoked from remote programs like standalone JAVA programs, web interface etc..
You can make your function module remotely enabled in attributes of Function module but
A BAPI are standard SAP function modules provided by SAP for remote access. Also they are part of Businees Objest Repository(BOR).
BAPI are RFC enabled function modules. the difference between RFc and BAPI are business objects. You create business objects and those are then registered in your BOR (Business Object Repository) which can be accessed outside the SAP system by using some other applications (Non-SAP) such as VB or JAVA. in this case u only specify the business object and its method from external system in BAPI there is no direct system call. while RFC are direct system call Some BAPIs provide basic functions and can be used for most SAP business object types. These BAPIs should be implemented the same for all business object types. Standardized BAPIs are easier to use and prevent users having to deal with a number of different BAPIs. Whenever possible, a standardized BAPI must be used in preference to an individual BAPI.
The following standardized BAPIs are provided:
Reading instances of SAP business objects
GetList ( ) With the BAPI GetList you can select a range of object key values, for example, company codes and material numbers.
The BAPI GetList() is a class method.
GetDetail() With the BAPI GetDetail() the details of an instance of a business object type are retrieved and returned to the calling program. The instance is identified via its key. The BAPI GetDetail() is an instance method. BAPIs that can create, change or delete instances of a business object type
The following BAPIs of the same object type have to be programmed so that they can be called several times within one transaction. For example, if, after sales order 1 has been created, a second sales order 2 is created in the same transaction, the second BAPI call must not affect the consistency of the sales order 2. After completing the transaction with a COMMIT WORK, both the orders are saved consistently in the database.
Create( ) and CreateFromData! ( )
The BAPIs Create() and CreateFromData() create an instance of an SAP business object type, for example, a purchase order. These BAPIs are class methods.
Change( )
The BAPI Change() changes an existing instance of an SAP business object type, for example, a purchase order. The BAPI Change () is an instance method.
Delete( ) and Undelete( ) The BAPI Delete() deletes an instance of an SAP business object type from the database or sets a deletion flag.
The BAPI Undelete() removes a deletion flag. These BAPIs are instance methods.
Cancel ( ) Unlike the BAPI Delete(), the BAPI Cancel() cancels an instance of a business object type. The instance to be cancelled remains in the database and an additional instance is created and this is the one that is actually canceled. The Cancel() BAPI is an instance method.
Add<subobject> ( ) and Remove<subobject> ( ) The BAPI Add<subobject> adds a subobject to an existing object inst! ance and the BAPI and Remove<subobject> removes a subobject from an object instance. These BAPIs are instance methods.
ex BAPI:
API_SALESORDER_CREATEFROMDAT1
BAPI_SALESORDER_CREATEFROMDAT2
You can get good help form the following links,
BAPI-step by step
http://www.sapgenie.com/abap/bapi/example.htm
list of all bapis
http://www.planetsap.com/LIST_ALL_BAPIs.htm
for BAPI's
http://www.sappoint.com/abap/bapiintro.pdf
http://www.sappoint.com/abap/bapiprg.pdf
http://www.sappoint.com/abap/bapiactx.pdf
http://www.sappoint.com/abap/bapilst.pdf
http://www.sappoint.com/abap/bapiexer.pdf
http://service.sap.com/ale
http://service.sap.com/bapi
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCMIDAPII/CABFAAPIINTRO.pdf
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/CABFABAPIREF/CABFABAPIPG.pdf
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCFESDE8/BCFESDE8.pdf
http://www.planetsap.com/Bapi_main_page.htm
http://www.topxml.com/sap/sap_idoc_xml.asp
http://www.sapdevelopment.co.uk/
http://www.sapdevelopment.co.uk/java/jco/bapi_jco.pdf
Also refer to the following links..
www.sappoint.com/abap/bapiintro.pdf
www.sap-img.com/bapi.htm
www.sap-img.com/abap/bapi-conventions.htm
www.planetsap.com/Bapi_main_page.htm
www.sapgenie.com/abap/bapi/index.htm
Checkout !!
http://searchsap.techtarget.com/originalContent/0,289142,sid21_gci948835,00.html
http://techrepublic.com.com/5100-6329-1051160.html#
http://www.sap-img.com/bapi.htm
http://www.sap-img.com/abap/bapi-conventions.htm
http://www.sappoint.com/abap/bapiintro.pdf
http://sap-img.com/bapi.htm
<b>EG::</b>
<b>Here is the step by step procedure for creating BAPIs.</b>
There are 5 different steps in BAPI.
- Create BAPI Structure
- Create BAPI Function Module or API Method.
- Create BAPI object
- Release BAPI Function Module.
- Release BAPI object.
Step1. Creating BAPI Structure:
- Go to <SE11>.
- Select Data Type & Enter a name.
- Click on Create.
- Note: Always BAPI should be in a development class with request number (Not Local Object).
- Select Structure & hit ENTER.
- Enter the fields from your database. Make sure that the first field is the Primary Key Field.
- Then SAVE & ACTIVATE.
Step 2. Creating BAPI module:
- Enter TR.CODE <SE37>.
- Before entering any thing, from the present screen that you are in, select the menu
Goto -> Function Groups -> Create Group.
Enter a name (Note: This name Must start with ZBAPI)
Let this screen be as it is and open another window and there, enter TR.CODE <SE80).
Click on the Third ICON that says Inactive Objects.
Select the group that you just created and click on Activate.
Notice that the group you created will disappear from the list of inactive objects.
- Go back to ><SE37> screen and enter a name and hit <ENTER>. Then enter the group name that you just created and activated.
NOTE: When you release a function module the respective group will be attached to that particular application. It cannot be used for any other application. NEVER include an already existing group that is attached to another module.
Now click on the first Tab that says [ATTRIBUTES] and select the radio button that says remote-enabled module since we will be accessing this from any external system.
Then click on the second tab that says [IMPORT].
Enter a PARAMETER NAME, TYPE and the structure you created in the first step. Also select the check box Pa. All remotely enabled functional modules MUST be Pa enabled, where Pa means Passed by Value and if you dont select Pa, then that means it will be passed by reference..
Then click on tab that says [EXPORT].
Enter the following as is in the first three fields
RETURN TYPE BAPIRETURN (These 3 field values are always same)
Here also select Pa meaning Pass by value.
Note: BAPIRETURN contains structure with message fields.
Then SAVE and ACTIVATE.
Step 3. Creating BAPI object:
- Enter Tr.Code <SWO1> (Note. It is letter O and not Zero).
- Enter a name and then click on create. Enter details.
NOTE: Make sure that that Object Type and Program name are SAME.
- Enter Application M, if you are using standard table Mara. If you are using your own database then select Z at the bottom.
- Then hit <ENTER>.
- Now we have to add Methods. High light METHODS and then select the following from the menu:
Goto Utilities -> API Methods -> Add Methods.
- Enter function Module name and hit <ENTER>.
- Select the second FORWARD ARROW button (>)to go to next step.
- Check if every thing looks ok and again click on FORWARD ARROW button (>).
- Then select YES and click on <SAVE>.
- Now on a different screen goto TR.CODE <SE37>. Enter Function Module name and select from the top menu Function Module -> Release -> Release.
- Goback to TR.CODE <SWO1>.
Here select the menu combination shown below in the same order.
- Edit -> Change Release Status -> Object Type Component -> To Implemented.
- Edit -> Change Release Status -> Object Type Component -> To Released.
- Edit -> Change Release Status -> Object Type -> To Implemented.
- Edit -> Change Release Status -> Object Type -> To Released.
- Then click on <SAVE>.
- Then click on Generate Button (4th button from left hand side looks like spinning wheel).
- Then Click on the button that says PROGRAM to see the source code.
To check if this is present in work flow goto TR.CODE <BAPI>.
Here it shows business object repository.
- First click on the middle button and then select ALL and hit ENTER.
- Goto tab [ALPHABETICAL] and look for the object that you created. This shows that the BAPI object has been created successfully
<b>Reward pts if found usefull :)</b>
regards
Sathish -
How to find particular CRM BAPIs from Java code of ISA B2B application?
Hi Guys,
I am newbie in CRM ISA field. I am supporting CRM ISA 5.0 B2B application.
Basically I had a question about how to go about finding the BAPIs which are getting called from the Java side of ISA.
I know that the framework uses JCO connection in order to execute BAPIs in the back-end and usually these BAPIs are standard.
So I can put a break-point on the CRM bapis and see which is called when.
But if I want to track BAPIs from Java code, what should be my approach?
Please help.
Thanks!Hi,
To setup the trace logs you need to use the following URL.
https://<system domain name>:port/<application_name>/admin
typically it should look like as below:
https://abc.com:50001/b2b/admin
Here there is an option to start and stop the logs and after stopping it will generate a Zip file which you need to download and from there you can easily find out the BAPI's or teh RFC calls.
Also when you search you should alwways keep one thing mind that these FM's normally start with CRM_ISA*
Hope it helps.
Regards
Sidd -
"ReferenceError: "myIpAddr" is not defined, when call JavaScript from java
Hi developers,
My java application was trying to issue a http request via proxy auto-config. So, I did below jobs
1. Read URL of *.pac from registry
2. Call FindProxyForURL from java, the code is like below
ScriptEngineManager factory = new ScriptEngineManager();
ScriptEngine engine = factory.getEngineByName("JavaScript");
engine.eval(autoProxyScript);
Invocable inv = (Invocable) engine;
Object obj = inv.invokeFunction("FindProxyForURL",
"http://java.sun.com/",
"java.sun.com");
However, I got "ReferenceError: "myIpAddress" is not defined
I can not change the script on server to add a function like "myIpAddress", I am wordering why IE or mozilla can call it successfully and get proxy server, while Java failed to do that.
I got a ugly solution by calling "pacparser" by jni. But I really hope I can get a better solution.A .pac file is a JavaScript, but it requires some functions to be defined in the executing context to work (i.e. you must define those).
From the example on the Wikipedia page there's at least "shExpMatch" and "isInNet". "myIpAddress" seems to be another such candidate. -
Hi',
I am trying to call OSB from java client,
The OSB proxy Service type is "WSDL Web Service", I am able to get response from SOAP UI with below request, Please help me with Java code,
I have been Googling a lot for this however didnt got enough.
Thanks
Yatan
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v1="http://core.xxx.com/schema/ServiceHeader/V1.0" xmlns:v11="http://core.xxx.com/schema/Customer/V1.0" xmlns:v12="http://core.xxx.com/schema/Customer/V1.0">
<soapenv:Header>
<wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsse:UsernameToken wsu:Id="UsernameToken-2" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsse:Username>weblogic</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">welcome1</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
<v1:GMWSHeader>
<v1:SourceId>String</v1:SourceId>
<v1:TransactionId>String</v1:TransactionId>
<v1:TransactionTimeStamp>1967-08-13</v1:TransactionTimeStamp>
<v1:ServiceVersion>LATEST</v1:ServiceVersion>
</v1:GMWSHeader>
</soapenv:Header>
<soapenv:Body>
<v11:GetDetailsRequest>
<v11:Condition>
<v12:SellingSource>?</v12:SellingSource>
<v12:FulfillingFCNNbr>?</v12:FulfillingFCNNbr>
</v11:Condition>
</v11:GetDetailsRequest>
</soapenv:Body>
</soapenv:Envelope>Thanks Guys, I tried the ways you mentioned I am getting below error, this error is coming in both weblogic clientgen and webservice proxy from jdeveloper,
I understand that this error has something to do with my process however not sure why is it coming, I will really appreciate if you can provide me some pointers.
error:
Buildfile: C:\JDeveloper\OSBClient\TestOSBClient\build.xml
javaFromWSDL:
[clientgen]
*********** jax-ws clientgen attribute settings ***************
wsdlURI: http://localhost:8001/xx/som/contracts/CustomerContract?wsdl
packageName : com.osb.client
destDir : C:\OSB
*********** jax-ws clientgen attribute settings end ***************
[clientgen] Consider using <depends>/<produces> so that wsimport won't do unnecessary compilation
[clientgen] parsing WSDL...
[clientgen]
[clientgen]
[clientgen] [ERROR] A class/interface with the same name "com.osb.client.SOMMessage" is already in use. Use a class customization to resolve this conflict.
[clientgen] line 89 of http://localhost:8001/xx/som/contracts/CustomerContract?SCHEMA%2FSOMResources%2FXSD%2FSOMCommon
[clientgen]
[clientgen] [ERROR] (Relevant to above error) another "SOMMessage" is generated from here.
[clientgen] line 51 of http://localhost:8001/xx/som/contracts/CustomerContract?SCHEMA%2FSOMResources%2FXSD%2FSOMCommon
[clientgen]
[clientgen] [ERROR] A class/interface with the same name "com.osb.client.TaskCompletionMessage" is already in use. Use a class customization to resolve this conflict.
[clientgen] line 82 of http://localhost:8001/xx/som/contracts/CustomerContract?SCHEMA%2FSOMResources%2FXSD%2FSOMCommon
[clientgen]
[clientgen] [ERROR] (Relevant to above error) another "TaskCompletionMessage" is generated from here.
[clientgen] line 76 of http://localhost:8001/xx/som/contracts/CustomerContract?SCHEMA%2FSOMResources%2FXSD%2FSOMCommon
[clientgen]
[clientgen] [ERROR] Two declarations cause a collision in the ObjectFactory class.
[clientgen] line 89 of http://localhost:8001/xx/som/contracts/CustomerContract?SCHEMA%2FSOMResources%2FXSD%2FSOMCommon
[clientgen]
[clientgen] [ERROR] (Related to above error) This is the other declaration.
[clientgen] line 51 of http://localhost:8001/xx/som/contracts/CustomerContract?SCHEMA%2FSOMResources%2FXSD%2FSOMCommon
[clientgen]
[clientgen] [ERROR] Two declarations cause a collision in the ObjectFactory class.
[clientgen] line 82 of http://localhost:8001/xx/som/contracts/CustomerContract?SCHEMA%2FSOMResources%2FXSD%2FSOMCommon
[clientgen]
[clientgen] [ERROR] (Related to above error) This is the other declaration.
[clientgen] line 76 of http://localhost:8001/xx/som/contracts/CustomerContract?SCHEMA%2FSOMResources%2FXSD%2FSOMCommon
[clientgen]
BUILD FAILED
weblogic.wsee.tools.WsBuildException: Error running JAX-WS clientgen: null
at weblogic.wsee.tools.clientgen.jaxws.ClientGenImpl.execute(ClientGenImpl.java:175)
at weblogic.wsee.tools.anttasks.ClientGenFacadeTask.execute(ClientGenFacadeTask.java:244)
at weblogic.wsee.tools.anttasks.ClientGenTask.execute(ClientGenTask.java:365)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatinxxethodAccessorImpl.invoke(DelegatinxxethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
at org.apache.tools.ant.Main.runBuild(Main.java:758)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.Main.start(Main.java:179)
at org.apache.tools.ant.Main.main(Main.java:268)
Caused by: Error starting wsimport:
at com.sun.tools.ws.ant.WsImport2.execute(WsImport2.java:757)
at weblogic.wsee.tools.clientgen.jaxws.ClientGenImpl.execute(ClientGenImpl.java:169)
... 19 more
Caused by: com.sun.tools.ws.wscompile.AbortException
at com.sun.tools.ws.processor.modeler.wsdl.JAXBModelBuilder.bind(JAXBModelBuilder.java:136)
at com.sun.tools.ws.processor.modeler.wsdl.WSDLModeler.buildJAXBModel(WSDLModeler.java:2255)
at com.sun.tools.ws.processor.modeler.wsdl.WSDLModeler.internalBuildModel(WSDLModeler.java:194)
at com.sun.tools.ws.processor.modeler.wsdl.WSDLModeler.buildModel(WSDLModeler.java:140)
at com.sun.tools.ws.wscompile.WsimportTool.buildWsdlModel(WsimportTool.java:261)
at com.sun.tools.ws.wscompile.WsimportTool.run(WsimportTool.java:203)
at com.sun.tools.ws.wscompile.WsimportTool.run(WsimportTool.java:188)
at com.sun.tools.ws.ant.WsImport2.execute(WsImport2.java:738)
... 20 more
Total time: 3 seconds -
How to call BAPI from R/3 system
hi,
i am doing small application by using Model. that is calling BAPI from R/3 system. but i am not able to get data from the back end system. please suggest me regarding this problem
thanx
tanvisteps:
1) create Model
2) bind Model to component controller ( you can use data modeler.) 2.1) open data modeler; if your model is not there, you can add by clicking add existing model;
2.2) create data link between model and controller, it will open map dialog.
2.3) click and drag BAPI_xxx_Input to context of controller and select all nodes inside
- if there is any duplicate nodes, just rename it.
3) map context to view controller
3.1) map input parameters separately ( which takes value for IMPORT to BAPI. select only that fields
3.2) do map for output (exact node which contains BAPI output)
coding:
1) in component controller you need to instantiate model and bind to context
BAPI_xxx_Input my_input = new BAPI_xxx_input();
wdContext.nodeBAPI_xxx_Input my_input().bind( my_input);
2) create a method in the component controller so that we can execute it from any of views used.
try{
wdContext.currentBAPI_xxx_Input my_input().modelObject().execute();
}catch(WDRFCException e) {
e.printStackTrace();
wdContext.node<ExactOutput>().invalidate();
// this stmt will reflect new values
3) Go to view and bind values to UI Elements
in wdDoInit()
IPrivate<Comp_Name>View.I<ExactOutput>Element input = wdContext.create<BAPI_xxx_Input>Element();
// see if this may demand model instance as parameter
wdContext.node<BAPI_xxx_Input>().addElement( input);
4) In OnAction you just executes the component controller method
wdThis.wdGet<Com_Name>Controller().executeMyBapi();
// executeMyBapi() is the method contains the mentioned try..catch code
nikhiL -
Can any one help me in calling an ABAP program from Java.
The version of SAP with me is 4.7.
Thanks in advance.
Regards ,
Nagaraju DonikenaTo call ABAP from Java when I tried doing it from sample code given in help I was getting the following error. Can any one help in this regard.
Exception in thread "main" java.lang.ExceptionInInitializerError: JCO.classIniti
alize(): Could not load middleware layer 'com.sap.mw.jco.rfc.MiddlewareRFC'
JCO.nativeInit(): Could not initialize dynamic link library sapjcorfc [no sapjco
rfc in java.library.path]. java.library.path
at com.sap.mw.jco.JCO.<clinit>(JCO.java:735)
at TestConnect.<init>(TestConnect.java:8)
at TestConnect.main(TestConnect.java:25) -
Hi All,
We are Trying to upload Bapi's From Dot Net.
When we are uploading Sales Order upload i will get this error ""ERROR: Sales document type DG-1 is not defined"" ,But If i Call Again It is not giving the any error and simply its updating the SAP data base.Not only Sales Order upload but Customer Master upload also First time iam getting :"" Invalid form of address text"" This Error...After Second Exectuion I am getting Sucess Message.
Why My Bapi Call is Not Sucess for First Call and why it is Getting sucess in Second Exection When i am calling bapi from .Net
how can i solve my Problem?
Thank you,
Madhu
Edited by: madhubabu rao on Oct 24, 2008 8:20 AMHello,
Refer to the below Thread & Link respectively.
Re: Call BAPI WS from .NET
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/12f6d390-0201-0010-e18d-cdb4554a9e75
Thought it might give you some inputs.
Thanks and Regards,
Venkat Phani Prasad Konduri -
Calling BDC from Java using JCO
Hello Everyone,
Is it possible to call a BDC from Java program using JCO ?Are you serious with that question? Did you try to build the web service client before? Because this is exactly the same. Try to find "building web service clients" instead "Calling BPEL from java". By default (probably) every BPEL process has both WSIF and SOAP end points, just use correct WSDL address.
-
Hi everybody,
I need to call Matlab from Java, run some programs in matlab and get the standard output.
I know I can start matlab with:
Process proc = Runtime.getRuntime().exec("matlab");
But then how do i run a program in matlab? (For example, if I have "myprogram.m", I would run it in matlab by typing "myprogram")
If I start a new process [Process proc2 = Runtime......exec("myprogram")], it does not start in matlab.
Any ideas?
thanx in advance.Sounds like myprogram is just a parameter of a call to matlab.
Try some variations on
exec("matlab myprogram");
There is also - I believe - an exzec call that takes an array of parameters. -
Hi,
I am calling xsql from Java.
Can I set FOPserializer with help of oraclesql like i can set other attribute of xsql.
e.g
OracleXMLQuery ors = new OracleXMLQuery(conn, selectStmt);
ors.setRaiseNoRowsException(false);
ors.setSkipRows(skipRows);
ors.setMaxRows(maxRows);
an example would be helpful.
Thanks in advance
RajuThe FOPSerializer (and the concept of serializers in general) is a feature of the XSQL Pages Framework. Your code example here is using the XML SQL Utility's OracleXMLQuery class. To use XSQL programmatically, you should use the oracle.xml.xsql.XSQLRequest class, documented in the XSQL Online Documentation
hope this helps. -
public static void main(String[] args) {
String arr[] = null;
arr = new String[2];
arr[0] = "-buildfile";
arr[1] = "C:\\workspace\\my projects\\ANTTASKS\\bin\\build.xml";
try {
Launcher launcher = new Launcher();
launcher.main(arr);
} catch (Exception e) {
System.out.println(e.getMessage());
// TODO: handle exception
I tried calling ant from java. But the problem is that, i am not sure how to get the handle of error & input stream from this.
I also need to know how do I kill the ant executable if there is some kind of exception like ConnectionTimeOut or is there any some kind of timeout mechanism.
Earlier i was calling ant as an external process like Process P = new Process(), where p.execute("ant.bat xxxxx"). I used to get the error & input stream from the process itself.
Please help!!!
thanksA better approach would be to use the classes provided in Ant. The API documentation for Ant has all the necessary information.
The sample code would look like:
Project ant = new Project();
ProjectHelper helper = new ProjectHelperImpl();
ant.init();
helper.parse(ant, new File("build.xml"));
ant.executeTarget("clean"); -
Calling searchadminctl from Java failing
I am trying to call searchadminctl from a Java application, to make some automation around installing thesaurus. The searchadminctl batch file gets called alright and its own Java application gets started, but it gives me this error:
16:48:26:812 INFO main url:null user:eqsys
16:48:27:530 INFO main cmd mode=1
16:48:27:546 INFO main thesaurus:default:null:null
16:48:27:546 INFO main delete:thesaurus:default
16:48:27:593 INFO main thesaurus delete:1
16:48:27:890 INFO main url:null user:eqsys
16:48:28:609 INFO main cmd mode=1
16:48:28:609 INFO main thesaurus:null:null:null
16:48:28:609 INFO main create:thesaurus:C:/ses-thesaurus-importer/export/thesaurus.xml:null
16:48:28:749 DEBUG main thesaurus:null
16:48:28:749 INFO main thesaurus null null
16:48:28:843 DEBUG main ThesaurusDBAdapter insert to run command:ctxload userName:eqsys
16:48:30:812 DEBUG output ThesaurusDBAdapter$1 Enter user: Connecting...
16:48:30:827 DEBUG output ThesaurusDBAdapter$1 Creating thesaurus DEFAULT...
16:48:30:843 DEBUG output ThesaurusDBAdapter$1 Thesaurus DEFAULT created...
16:48:30:843 DEBUG output ThesaurusDBAdapter$1 Processing...
16:48:30:843 DEBUG output ThesaurusDBAdapter$1 0 lines processed successfully
16:48:30:843 DEBUG output ThesaurusDBAdapter$1 Beginning insert...DRG-50857: oracle error in drzmiai
16:48:30:843 DEBUG output ThesaurusDBAdapter$1 ORA-20000: Oracle Text-fejl:
16:48:30:843 DEBUG output ThesaurusDBAdapter$1 ORA-04002: INCREMENT skal være et heltal forskelligt fra nul
16:48:30:843 DEBUG output ThesaurusDBAdapter$1 ORA-06512: ved "CTXSYS.DRUE", linje 160
16:48:30:843 DEBUG output ThesaurusDBAdapter$1 ORA-06512: ved "CTXSYS.DRITHSL", linje 129
16:48:30:843 DEBUG output ThesaurusDBAdapter$1 ORA-06512: ved linje 1
16:48:30:843 DEBUG output ThesaurusDBAdapter$1
16:48:30:859 DEBUG output ThesaurusDBAdapter$1 Disconnected
16:48:30:952 DEBUG main ThesaurusDBAdapter finish command with status 1
16:48:30:952 ERROR main Error creating thesaurus: the NLS_LANG environment variable may be inconsistent with the thesaurus encoding java.lang.Exception oracle.search.admin.db.ThesaurusDBAdapter:insert:310 oracle.search.admin.manager.JDBCDataManagerService:create:148 oracle.search.admin.manager.AbstractAdminDataManager:create:54 oracle.search.admin.manager.ThesaurusManager:create:52 oracle.search.admin.cmd.AdminCMDHandler:create:334 oracle.search.admin.cmd.AdminConsole:runAdminModuleJob:672 oracle.search.admin.cmd.AdminConsole:runAdminComand:541 oracle.search.admin.cmd.AdminConsole:main:227
As you can see, the delete operation goes well, but create fails. The NLS_LANG message seems to be shown no matter what the real error was though.
The funny thing is, that I have tried to take the EXACT command with the EXACT parameters my Java application calls, and call it manually, and then it works just fine. Any ideas on how to get this to work? Any ideas what these ORA-XXXXX errors is?
Thank you
SørenLast night when I was somewhere between this world and dream world I scanned through my code in my mind and found the error, and it is my bad... I called the searchadminctl with my thesaurus file as argument, just before I closed my OutputStream to the file, which we all know is quite a bad idea.
So the answer is: it is absolutly no problem to call searchadminctl from Java :)
/Søren -
Can we call bapi from SAP or ABAP How? Pls Step by step
Can we call bapi from SAP How? Pls Step by step
thank you,
Regards,
Jagrut BharatKumar ShuklaHi,
Do you mean you want to access BAPI in ABAP report?
If yes, then YES we can call,
1.Create a report -> In pattern write your BAPI name.
2. It is like your FM , Read correspoding BAPI documentation
3. Fill required parametes.
4. Test run and if successful , final run it.
And from Outside,
You have to establish a connection and create a wrapper and access using avaialble APIs.
Reward if useful! -
Dear All,
Due to project requirement, I have a customer who wants to call ESB from java/unix
i am aware of java calling BPEL but I have never seen a java calling ESB ?
does any body about it ?
Is it possible ?
Appreciate your response.
Best Regards
ArcHi, for BPEL there is a really good API to invoke processes externally. For ESB there is not (as far as I know). But each ESB process is just invokable like any other web service. So it would be an option to use javax.xml.rpc package and create Service and Call objects. You can then make use of DII (Dynamic invoking) and there is no need to specify parameters as long payload for the ESB process is valid XML for the Routing Service.
Jos Baan
Maybe you are looking for
-
RAID Virtual Volumes Server 2008 R2 (Dell H200)
Hi all, I am hoping someone can point me in the right direction. I am deploying a Dell R410 server with a Dell PERC H200 Controller with 4 X 300GB SAS Drives in two RAID1 arrays. I have loaded Server 2008 R2 onto the first volume. Unfortunately when
-
I tried to install Selenium IDE and I am getting the message: '''Selenium IDE Java formatter could not be installed because it is not compatible with Firefox 5.0''
-
I need help with my iMac g5!
Hello everyone, This is my first time with a Mac so i don't know much about them yet. I just bought a used imac g5 running Mac OS X 10.3.5. The previous owner had a password but turned it off and somehow i turned it back on some i'm locked out. So i
-
I can not get mozilla firefox on my pc desktop
i have downloaded mozilla firefox on my desktop pc, i con has appeared on my pc, when i double click on i con, p c loads but mozilla firefox does not load, in the adress bar , www.searchqu.com/406 appears, please can you help, des weaver
-
i think ther's something wrong with the iphones battery? but technically if im on the phone and i notice the battery has 20 percent left or half full the phone wont charge as im on a phone call... is that normal for the iphone or is ther something wr