Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Calling Java program from ABAP

former_member190312
Active Participant
0 Likes
2,841

Hi All,

my ABAP program downloads one file to one folder. Then one Java program is running to Encrypt the file.

Now , they want to call the JAVA program in ABAP, so that they can encrypt the file before downloading.

Is it possible to call a Java program from ABAP ? If Yes, please give me the detailed procedure.

Thanks

pabi

1 ACCEPTED SOLUTION
Read only

sreeramkumar_madisetty
Active Contributor
0 Likes
1,554

Pabi,

Using the RFC connection,we can establish a link between Java and SAP.

Afterwards,hope we can call Java program from ABAP.

Below is the sample piece of code to establish RFC connection(link) between Java and SAP.

DATA: REQUTEXT LIKE SY-LISEL,

RESPTEXT LIKE SY-LISEL,

ECHOTEXT LIKE SY-LISEL.

DATA: RFCDEST like rfcdes-rfcdest VALUE 'NONE'.

DATA: RFC_MESS(128).

REQUTEXT = 'HELLO WORLD'.

RFCDEST = 'JCOSERVER01'. "corresponds to the destination name defined in the SM59

CALL FUNCTION 'STFC_CONNECTION'

DESTINATION RFCDEST

EXPORTING

REQUTEXT = REQUTEXT

IMPORTING

RESPTEXT = RESPTEXT

ECHOTEXT = ECHOTEXT

EXCEPTIONS

SYSTEM_FAILURE = 1 MESSAGE RFC_MESS

COMMUNICATION_FAILURE = 2 MESSAGE RFC_MESS.

IF SY-SUBRC NE 0.

WRITE: / 'Call STFC_CONNECTION SY-SUBRC = ', SY-SUBRC.

WRITE: / RFC_MESS.

ENDIF.

Regards,

Sree

6 REPLIES 6
Read only

peter_ruiz2
Active Contributor
0 Likes
1,554

Hi Pabi,

I think this link can help you.

[Communication between ABAP and Non-ABAP Technologies|http://help.sap.com/saphelp_nw2004s/helpdata/en/6c/934a4278bbb56be10000000a155106/frameset.htm]

Regards,

Peter

Read only

sreeramkumar_madisetty
Active Contributor
0 Likes
1,555

Pabi,

Using the RFC connection,we can establish a link between Java and SAP.

Afterwards,hope we can call Java program from ABAP.

Below is the sample piece of code to establish RFC connection(link) between Java and SAP.

DATA: REQUTEXT LIKE SY-LISEL,

RESPTEXT LIKE SY-LISEL,

ECHOTEXT LIKE SY-LISEL.

DATA: RFCDEST like rfcdes-rfcdest VALUE 'NONE'.

DATA: RFC_MESS(128).

REQUTEXT = 'HELLO WORLD'.

RFCDEST = 'JCOSERVER01'. "corresponds to the destination name defined in the SM59

CALL FUNCTION 'STFC_CONNECTION'

DESTINATION RFCDEST

EXPORTING

REQUTEXT = REQUTEXT

IMPORTING

RESPTEXT = RESPTEXT

ECHOTEXT = ECHOTEXT

EXCEPTIONS

SYSTEM_FAILURE = 1 MESSAGE RFC_MESS

COMMUNICATION_FAILURE = 2 MESSAGE RFC_MESS.

IF SY-SUBRC NE 0.

WRITE: / 'Call STFC_CONNECTION SY-SUBRC = ', SY-SUBRC.

WRITE: / RFC_MESS.

ENDIF.

Regards,

Sree

Read only

0 Likes
1,554

Hi Sreeram,

Thanks for your help. After the Java connection is successful, what are the code to put , to call JAVA program.

Thanks

pabi

Read only

0 Likes
1,554

Can anybody have the detailed procedure to achieve this requirement ?

Read only

0 Likes
1,554

Hi pabitra,

JAVA or javascript? You can use the HTML viewer GUI control to run javascript.

But starting with ECC600, a SAP server has a JAVA stack by default which is used for purposes like PDF interactive form processing and the like. I do not know how to run any JAVA program there, your basis admin may have an idea.

On the long run, your company may consider to use digital signatures. SAP offers integrated solutions for signing and encrypting data, start here:

[Secure Store and Forward Mechanism (SSF) |http://help.sap.com/saphelp_nw70/helpdata/en/4d/bf6f77a2c5446a86e0152f1b309db6/frameset.htm]

Regards

Clemens

Read only

0 Likes
1,554

Hi pabita,

Just read your question. Actually I also got this kind of assignment; my abap to call javascript. and this script will extract the DME file from TEMSE and encrypt it and lastly store the file to the download folder. THis script given by bank and I need to pass the DME filename, TEMSE path and download path.

Have you found the solution for this? since I just started, so, roughly I have idea and might use class CL_JAVA_SCRIPT to call this javascript. you may refer to tcode ABAPDOCU and find DEMO_JAVA_SCRIPT_MINI_EDITOR. there are alot of sample abap coding to call the javascript.

if you don't mind, maybe you can share what you got for this? I still not sure either my idea is working or not since I need to understand the javascript given by the bank; i.e. input parameter, process and the output.

ok thanks