on ‎2011 Jun 22 6:25 AM
hello experts,
i want to run my abap program using JAVA program , i am new all this ,
I know JAVA programming and ABAP programming also but i dont Know
how to connect both these thing .
So that through JAVA i can call my abap program , to perform some data fetching things and return the ans back to JAVA
i searched google a lot but nt getting any stuff,
if any books or articles are available no this plz let me.
your efforts will realy be of great help to me .
Thank you.
Request clarification before answering.
Hi Dakshaini,
To call ABAP from Java you can use the SAP Java Connector (aka SAP JCo).
See here: https://websmp104.sap-ag.de/~form/sapnet?_SHORTKEY=01100035870000719346&;
Essentially the JCo allows you to call RFC-enabled function modules in an SAP system from Java.
Regards,
Chris Carruthers.
<removed_by_moderator>
*You can post your personal URL in your profile
Edited by: Juan Reyes on Aug 4, 2011 10:11 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hello cris,
I have create a RFC enabled function module in the development named (Found) this function call my abap program
i have written a syntax in the source section of this function (Call programme zrun and return.)
but when i try to find the function is sap through it gives msg the program is there but when i try to execute the function through java it is giving me error/ exception.if u want i will send u my code.
com.sap.conn.jco.JCoException: (104) JCO_ERROR_SYSTEM_FAILURE: Screen output without connection to user. (raised by system TRD|SAPDEV)
at com.sap.conn.jco.rt.MiddlewareJavaRfc.generateJCoException(MiddlewareJavaRfc.java:662)
at com.sap.conn.jco.rt.MiddlewareJavaRfc$JavaRfcClient.execute(MiddlewareJavaRfc.java:1818)
at com.sap.conn.jco.rt.ClientConnection.execute(ClientConnection.java:1115)
at com.sap.conn.jco.rt.ClientConnection.execute(ClientConnection.java:948)
at com.sap.conn.jco.rt.RfcDestination.execute(RfcDestination.java:913)
at com.sap.conn.jco.rt.RfcDestination.execute(RfcDestination.java:884)
at com.sap.conn.jco.rt.AbapFunction.execute(AbapFunction.java:302)
at testrun.callfunction(testrun.java:43)
at testrun.main(testrun.java:78)
Caused by: RfcException: [TRD|SAPDEV]
message: Screen output without connection to user.
Return code: RFC_SYS_EXCEPTION(3)
error group: 104
key: RFC_ERROR_SYSTEM_FAILURE
Exception raised by TRD|SAPDEV
at com.sap.conn.rfc.engine.RfcIoOpenCntl.RfcReceive(RfcIoOpenCntl.java:2081)
at com.sap.conn.jco.rt.MiddlewareJavaRfc$JavaRfcClient.execute(MiddlewareJavaRfc.java:1766)
... 7 more
Caused by: com.sap.conn.rfc.exceptions.RfcGetException: Screen output without connection to user.
at com.sap.conn.rfc.engine.RfcGet.rfcget_gethead(RfcGet.java:482)
at com.sap.conn.rfc.engine.RfcGet.rfcget_run(RfcGet.java:40)
at com.sap.conn.rfc.engine.RfcGet.ab_rfcget(RfcGet.java:23)
at com.sap.conn.rfc.engine.RfcRcv.ab_rfcreceive(RfcRcv.java:33)
at com.sap.conn.rfc.engine.RfcIoOpenCntl.RfcReceive(RfcIoOpenCntl.java:1981)
... 8 more
Caused by:
>RfcIoException:
message: Screen output without connection to user.
Return code: RFCIO_ERROR_DEALLOCATED_REMOTE_ERROR(33)<
at com.sap.conn.rfc.engine.RfcIoOpenCntl.ab_rfcread(RfcIoOpenCntl.java:691)
at com.sap.conn.rfc.engine.RfcGet.rfcget_gethead(RfcGet.java:478)
... 12 more
Hi Dakshaini,
That error indicates that there is some sort of report or screen output being generated during the function call. This won't work over an RFC connection. You need to ensure that the code in the function module, and anything it calls, doesn't write to the screen (e.g. use WRITE statements), or do anything else that requires a GUI. All output should be returned via the function parameters (export, tables etc.).
Regards,
Chris Carruthers.
Hi Chris,
Ohk then to test whether execution is working or not what should i try, if no write statements allowed.
but in future if i want that the function module should return alv list data then how should i store in function modules parameters.
Thanx for your answers they are really helpfull.
Hi Dakshaini,
Your questions are very broad. You need to learn about the basics of function module and RFC programming.
See the SAP help documentation: http://help.sap.com/saphelp_nw70ehp2/helpdata/en/22/0425f2488911d189490000e829fbbd/frameset.htm
Regards,
Chris Carruthers.
Hello Chris,
I saw your site it was quite Knowladge full.
Actually i want to run my abap program from my java code can i do that, i am not able to find it on google.
I was succesfull in executing the FM from java and the effect was my data went into the SAP tables succesfully.
or is there any way to access SAP Tables through JAVA code using JCO3.
Hi Dakshaini,
If I understand you correctly, you have two options:
1) Write your own function module that reads the data you want and returns it in the function module parameters; or
2) Call function module RFC_READ_TABLE, a generic SAP-delivered table reading function module.
You can view the RFC_READ_TABLE function module, like any other, in transaction SE37. Also Google it, you will find several discussions and examples about it.
Regards,
Chris Carruthers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.