08-03-2011 4:17 PM
Hi all,
I have installed JCO & created the RFC in SAP. i have used below code to test my RFC connection & it's working fine.
But In the below report, where to call the JAVA Program & what code i should use to call java code .
Actually my ABAP requirement is to download a file. Then i need to call JAVA program, inside ABAP, to encrypt the downloaded file. Here, Java program is used to encrypt the file. Now question is, how to call the Java program inside the ABAP code. Please advice with the code sample. Thanks a lot.
REPORT z_jco_test.
PARAMETERS: requtext LIKE sy-lisel.
DATA: echotext LIKE sy-lisel,
resptext LIKE sy-lisel,
rfctest TYPE TABLE OF rfctest,
wa_rfctest TYPE rfctest.
wa_rfctest-rfcdata1 = requtext.
wa_rfctest-rfcdata2 = 'Hello World'.
APPEND wa_rfctest TO rfctest.
CALL FUNCTION 'RFC_PING'
DESTINATION 'JCO'.
CALL FUNCTION 'STFC_CONNECTION'
DESTINATION 'JCO'
EXPORTING
requtext = requtext
IMPORTING
echotext = echotext
resptext = resptext
TABLES
rfctest = rfctest.
WRITE: 'Echo Text: ', echotext.
WRITE: 'Response Text: ', resptext.
LOOP AT rfctest INTO wa_rfctest.
WRITE: / 'rfcdata1: ', wa_rfctest-rfcdata1.
WRITE: / 'rfcdata2: ', wa_rfctest-rfcdata2.
ENDLOOP.
08-04-2011 7:25 AM
08-04-2011 7:25 AM
08-04-2011 11:05 AM
08-04-2011 2:12 PM
Hi pabitra,
perhaps a bit more complex. You will have to distribute a HTTP Request Using the SAP Web Dispatcher. Check here for more details: [SAP Web Application Server with ABAP and J2EE|http://help.sap.com/saphelp_47x200/helpdata/EN/53/97583c2439e66fe10000000a114084/frameset.htm]
Didn't you ask yesterday? ([Calling Java program from ABAP|]).
Regards
Clemens
08-04-2011 8:08 PM
Hi,
You might accomplish your goal using external operating system commands.
1) Define in SM69 an external command, letu2019s say ZJAVA. This command will execute a script on the operating system, letu2019s call it calljava.sh.
2) In script calljava.sh you just call java, passing some parameters. For example, java $1 $2 $3 $4 $5 $6 $7
3) In your ABAP program you call the ZJAVA external command and pass parameters to it. Of course, one of the parameters must be your Java program name.
CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
EXPORTING
commandname = l_command
additional_parameters = l_param
trace = 'X'
IMPORTING
status = l_status
exitcode = l_exitcode
TABLES
exec_protocol = l_exec_protocol_itab
EXCEPTIONS
no_permission = 1u2026
08-06-2011 6:09 AM
Hi Clemens,
Thanks for your information. what are the things i should install so that i can use SSF function modules in ABAP to encrypt the file.
Thnak a lot.
pabi