JAVA Call BAPI - RFC_SYS_EXCEPTION
I have the problem when execute BAPI function. I'm not sure this error occur from JAVA or ABAP code. Please help me to solve this problem.
You can see log file "dev_rfc.trc" as below :
ERROR file opened at 20071003 205917 SE Asia Standa, SAP-REL 700,0,9 RFC-VER 3 756683 MT-SL
T:6068 ======> Value cannot be interpreted as a floating-point number.
T:6068 <* RfcReceive [4] : returns 3:RFC_SYS_EXCEPTION
T:6068 <* RfcCallReceive [4] : returns 3:RFC_SYS_EXCEPTION
Thank you
Sorapol H.
Hi,
It seems that you are getting typecasting exception.
May be there is a field which expects floating point numbers and you are not passing that parameter (or passing wrong values in it)
Check the RFC structure and pass values accordingly.
Also check RFC seperatly.
Ashu
Similar Messages
-
Creating webservice using webdynpro java calling bapi from r/3
hi all,
as i am new to this area can anyone provide me a guide to create a simple webservice using webdynpro java to call bapi's from r/3?
i want to consume the created webservice on a .net client.
Thanks in advance,
RaghunandanYou can use the SAP .NET Connector to do it.
Download from [http://service.sap.com/connectors|http://service.sap.com/connectors]. -
We are writing a Java web application that accesses BAPIs using SAP JCo.
We are facing a problem when we have multiple simultaneous calls from different web users using the same BAPI with the same parameters. Some of them get a message saying that "the material is locked by user XXX", where XXX is the SAP user used in JCo to connect to SAP.
I am not sure whether this is an SAP issue, or a Java issue, or if we should handle this by implementing some kind of JMS queue, so that we will never have two users calling the same BAPI with the same parameters at the
same time.
Does any of you have ever had this kind of problem?
Thank you
DovHi,
it is a standard functionality of the business logic implemented in SAP Material Management BPI - master data of materials are locked during warehouse operations.
You can send more parallel synchronize BAPI requests via JCo and ABAP Engine is able to process them in parallel - with described locks.
You have to take care of it on the JCo side or use asynchronous processing via qRFC or standard iDoc.
The queue is necessary - want to process your operations in the same order like in the non-SAP system.
Jiri -
Webdynpro java calling bapi function module
Hi all,
I am webdynpro java developer, In my application i created model using bapi function module and fetch those values using iviews mapping to custom controller . While running that application i got an error as shown below
**Application error occurred during request processing.**
Details: com.sap.tc.webdynpro.services.sal.core.DispatcherException: The requested deployable object 'ram.com/getdata' and application 'Searchapp' are not deployed on the server. Please check the used URL for typos.
Exception id: [BCAEC58D04E400870000019500000DF80004B20FE3921612]
Please help me anyone
Thanks in advance.Hi,
Have you deployed your application?because it is mentioned that the "Searchapp"(which i suppose is your application) is not deployed.
Take the "Deploy and Run" option by right clicking the application(i mn Seachapp). It will prompt you to enter the SDM password. Give the pwd and it will open the explorer and will show you the output.
Hope this helps you.
Regards,
Jithin -
Hi ,
Is there any way can we call BAPI's in java. If yes, could you pls tell me the required jar files for that or any useful sites.
Thanks in Advance
JMHi,
did you check:
http://service.sap.com/~form/sapnet?_SHORTKEY=01100035870000463654&
there's some sample code inside
https://websmp209.sap-ag.de/~sapdownload/011000358700007640702002E/SAPJCo.pdf
also blogs:
/people/tarun.telang2/blog/2005/10/03/debugging-a-rfc-call-using-jco-api-part-2
Regards,
michal -
Calling BAPI by using JAVA connector..
hi friend.. sorry for silly question..
can u guide me how i can call BAPI in JAVA ..
i know how to create JCO connection...
i need to create client for this or not??or not??
thanks
NARPAL.Hi Rajesh Paranjpe,
Here is sample code from SAP help:
import com.sap.mw.jco.*;
public class Bapi1 extends Object {
JCO.Client mConnection;
JCO.Repository mRepository;
public Bapi1() {
try {
// Change the logon information to your own system/user
mConnection =
JCO.createClient("001", // SAP client
"<userid>", // userid
"****", // password
null, // language
"<hostname>", // application server host name
"00"); // system number
mConnection.connect();
mRepository = new JCO.Repository("SAPJCo", mConnection);
catch (Exception ex) {
ex.printStackTrace();
System.exit(1);
JCO.Function function = null;
JCO.Table codes = null;
try {
function = this.createFunction("BAPI_COMPANYCODE_GETLIST");
if (function == null) {
System.out.println("BAPI_COMPANYCODE_GETLIST" +
" not found in SAP.");
System.exit(1);
mConnection.execute(function);
JCO.Structure returnStructure =
function.getExportParameterList().getStructure("RETURN");
if (! (returnStructure.getString("TYPE").equals("") ||
returnStructure.getString("TYPE").equals("S")) ) {
System.out.println(returnStructure.getString("MESSAGE"));
System.exit(1);
codes =
function.getTableParameterList().getTable("COMPANYCODE_LIST");
for (int i = 0; i < codes.getNumRows(); i++) {
codes.setRow(i);
System.out.println(codes.getString("COMP_CODE") + '\t' +
codes.getString("COMP_NAME"));
catch (Exception ex) {
ex.printStackTrace();
System.exit(1);
try {
codes.firstRow();
for (int i = 0; i < codes.getNumRows(); i++, codes.nextRow()) {
function = this.createFunction("BAPI_COMPANYCODE_GETDETAIL");
if (function == null) {
System.out.println("BAPI_COMPANYCODE_GETDETAIL" +
" not found in SAP.");
System.exit(1);
function.getImportParameterList().
setValue(codes.getString("COMP_CODE"), "COMPANYCODEID");
function.getExportParameterList().
setActive(false, "COMPANYCODE_ADDRESS");
mConnection.execute(function);
JCO.Structure returnStructure =
function.getExportParameterList().getStructure("RETURN");
if (! (returnStructure.getString("TYPE").equals("") ||
returnStructure.getString("TYPE").equals("S") ||
returnStructure.getString("TYPE").equals("W")) ) {
System.out.println(returnStructure.getString("MESSAGE"));
JCO.Structure detail =
function.getExportParameterList().
getStructure("COMPANYCODE_DETAIL");
System.out.println(detail.getString("COMP_CODE") + '\t' +
detail.getString("COUNTRY") + '\t' +
detail.getString("CITY"));
catch (Exception ex) {
ex.printStackTrace();
System.exit(1);
mConnection.disconnect();
public JCO.Function createFunction(String name) throws Exception {
try {
IFunctionTemplate ft =
mRepository.getFunctionTemplate(name.toUpperCase());
if (ft == null)
return null;
return ft.getFunction();
catch (Exception ex) {
throw new Exception("Problem retrieving JCO.Function object.");
public static void main (String args[]) {
Bapi1 app = new Bapi1(); -
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
PradeepIn 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 -
Error while calling BAPIs for DMS from Portal
Hi everybody,
We are developing a portal with Web Dynpro and trying to call from our java code BAPIs that deals with DMS:
BAPI_DOCUMENT_CREATE2 - to create a new DMS document and checkin an original.
CVAPI_DOC_CHECKIN - to checkin an original to an existing DMS document.
CVAPI_DOC_CHECKOUT - to checkout an original from the DMS.
While using other bapi's that deals with DMS but do not deals with originals (like creating a new document, retrieving metadata about documents and originals) we don't have any problem.
Only when trying to checkin or checkout originals we get the following message (from the DMS?): RFC_START_PROGRAM
the full message is: com.sap.aii.proxi.framework.core.BaseProxiException:RFC_START_PROGRAM error key:RFC_ERROR_PROGRAM.
does anybody knows the meaning of this message?
by the way - those BAPIs works well while called from the R/3. only when we call them from the portal we have this problem.
thanks for any information, Adi.Hi Adi,
Right now I have a similar problem. Did you find the cause/solution? -
Error while calling BAPIs of DMS from Portal
Hi everybody,
We are developing a portal with Web Dynpro and trying to call from our java code BAPIs that deals with DMS:
BAPI_DOCUMENT_CREATE2 - to create a new DMS document and checkin an original.
CVAPI_DOC_CHECKIN - to checkin an original to an existing DMS document.
CVAPI_DOC_CHECKOUT - to checkout an original from the DMS.
While using other bapi's that deals with DMS but do not deals with originals (like creating a new document, retrieving metadata about documents and originals) we don't have any problem.
Only when trying to checkin or checkout originals we get the following message (from the DMS?): RFC_START_PROGRAM
the full message is: com.sap.aii.proxi.framework.core.BaseProxiException:RFC_START_PROGRAM error key:RFC_ERROR_PROGRAM.
does anybody knows the meaning of this message?
by the way - those BAPIs works well while called from the R/3. only when we call them from the portal we have this problem.
thanks for any information, Adi.Hi Adi,
Right now I have a similar problem. Did you find the cause/solution? -
Java call rfc check in original:error while checking in and storing.
hi,experts.
java call rfc check in original:error while checking in and storing. BAPI in the RFC is "BAPI_DOCUMENT_CJANGE2",
the RFC was fine in SE37 and calling by Visual Basic. and in java,when mConnection.setAbapDebug(true), and runing by step and step, was fine too.
if mConnection.setAbapDebug(false) in JAVA, up error in title was displayed.
what cause this error?
Best Regards.Hi Priya
Please use Su53 after getting the error and find any authorization is missing for the user..
S_GUI Full Authorization is required..
Since by giving BASIS Authorization its rectificed, then it shud be mostly due to Auth issues only
Regards
Aby -
Calling BAPI from Adobe Interactive Form
Hi Guys,
I have a requirement from my client to work on interface using BAPI for creating Service notification. Idea is that users will fill an Adobe interactive form (AIF) on company INTRANET and as soon as user press a SUBMIT button on the adobe form, BAPI should be called to create a SERVICE NOTIFICATION (Tcode IW51). I have work with BAPIs and I know the BAPI name (BAPI_SERVNOT_CREATE) to create SERVICE NOTIFICATIONS, but not with this kind of interface. Please advice me how to go about it and if some one can share any documentations to accomplish this task.
Another developer is in charge of developing the AIF and I am responsible for ABAP side .
Thanks in advance.
miniHi Mini,
Kindly check the webDynpro ABAP section of Intercative form homepage. at - https://www.sdn.sap.com/irj/sdn/adobe.
You can create a portal application and call your BAPI. Other options include - webDynpro Java, calling webservice (if the call can be unsecured). You will be able to call secure web services from adobe forms from future versions afaik.
Thanks and Regards,
- anto -
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 -
ISchedulerTask and SAP JAVA call
Hi All,
Has anyone made a JAVA call to a SAP RFC from the SchedulerTasks?
The SAP JAVA Connector code requires the IPortalComponentRequest for it to work. However in the ISchedulerTask run() method, I believe that it can not be obtained.
I am interested to hear from other people with similar experiences or comments.
Cheers,
VicI have used ScheduleTasks to grab the data via BAPIs from BW. These requires you to write a portal service that executes the bapi and then the SchedulerTask calls the portal service.
Scheduler Task->Portal Service->RFC or BAPI
You still have one issue which is IPortalComponentRequest. Portal service doesn't have access to it but you can get around it by setting up a SAP system for usermapping and then mapping that userid to a generic userid. Example code:
private IConnection getConnection(
String alias)
throws Exception {
IUser user =
UMFactory.getUserFactory().getUserByLogonID("Administrator");
IConnectorGatewayService cgService = (IConnectorGatewayService) PortalRuntime.getRuntimeResources().getService(IConnectorService.KEY);
ConnectionProperties prop = new ConnectionProperties(user.getLocale(), user);
return cgService.getConnection(alias, prop); -
"Java and BAPI Technology for SAP" by by Ken Kroes - Is this book useful?
Howdy partners,
I've got a 'book' called "Java and BAPI Technology for SAP" by by Ken Kroes, Anil Thakur, Gareth M. deBruyn, Robert Lyfareff.
Now, does anyone know if the info in this book is still relevant to the modern SAP world? I mean its still talking about ITS and stuff like that?
Any input will be appreciated.With the blue cover? I have one with the something similar title, but it's quite out of date. There was lot of improvement on the Java side.
So I would prefer something newer from SAP-PRESS. Check the SAP-PRESS site.
BTW I don't consider ITS as an old technology...it was just integrated recently into WAS 640 to make it more powerful. This is the only available technology, which converts classic Dynpro to Webpage dynamically.
Peter -
Connect NDS to r3 for calling bapi
Hi,
How can I connect netweaver developer studio to r3 for calling bapi and rfc?
Many thanks,
I'm new, very new, in the portal development.HI,
How can I connect netweaver developer studio to r3 for calling bapi and rfc?
will you elaborate more about what you want.
1. If you wan to connect to R3 to create an RFC model for web dynpro project then.
After creating the project, when you say create an adaptive rfc model a wizard will open
where you can insert the information about server, as load balancing or single server.
2. there you need to give information about host name, instance no,client, username and password.
after that it will show you all the bapis.
But there is nothing like connecting R3 to NWDS and calling bapi and RFC. as it is a development studio, form where you can develope an application.
after deploying your application on J2EE server(WAS as Java), it will call a BAPI or RFC.
for that you need to create JCO connections between your WAS as JAVA and R3 server
Maybe you are looking for
-
Hello, I want to return all three arrays in this method. what�s wrong with this code.tnx public int prim(int arr[]) arr[0] = Integer.parseInt(textField1.getText()); arr[1] = Integer.parseInt(textField2.getText()); arr[3] = Integer.parseInt(textField3
-
iphoto has been importing photos for over n hour and I can't get it to stop. Can't get out of iphoto and can't shut down computer.
-
Urgent help with discoverer 4i installation
Hi All, I just started working on a discoverer upgrade process. I need help in installing discoverer 4i and them refering to a 10g database. Can any one guide to a reference doc which I may refer to finish the complete install. In other words I need
-
Hello, I'm a web designer by trade but I've been asked by a friend to create an advertisement that will appear in the rotation of slides that are played before a movie starts. The only information I have been able to get about image properties is th
-
Is it possible to attach a sound effect to a photo?
Hi, I was wondering if it is possible to attach an audio file sound effect to a photo i have in iphoto or any other application so that the file would play the sound when the photo is opened to view? Thanks Conor