Call function..Destination
Hi Experts,
My requirement is to call a RFC Java function in SAP. The Java function is an encryption function which has 4 parameters (Password, Message, Strength128, Strength256). I need to pass the data for the parameters from SAP to JAVA. With the help of SDN, I tried to call this function in ABAP. A destination named 'INTEGRATION' is created in SM59, with the registered Program ID 'ASEncryptionHelper'. ASEncryptionHelper is the Java function name and the program ID is registered with this name only. The following is the code I wrote in my report
DATA: XPASS TYPE STRING.
XPASS = 'PASS'.
CALL FUNCTION 'ASENCRYPTIONHELPER' DESTINATION 'INTEGRATION'
EXPORTING
PASSWORD = XPASS
MESSAGE = XML_RESULT
STRENGTH128 = ' '
STRENGTH256 = 'X'
I have created a RFC function module in my SAP system with the name ASENCRYPTIONHELPER
FUNCTION ASENCRYPTIONHELPER.
""Local Interface:
*" IMPORTING
*" VALUE(PASSWORD) TYPE STRING
*" VALUE(MESSAGE) TYPE STRING
*" VALUE(STRENGTH128) TYPE BOOLEAN
*" VALUE(STRENGTH256) TYPE BOOLEAN
ENDFUNCTION.
When I execute the program I get a runtime error "Bean ASENCRYPTIONHELPER not found on host HOSTNAME".
I am not able tofigure out the exact problem.
Also I wanted to know whether the way I am coding is right. Do I need to create a RFC function module in SAP also as I did above?
Does the Uppercase of the function 'ASENCRYPTIONHELPER' matter? In SM59 the program id is mentioned as 'ASEncryptionHelper'.
I tried to change the function name with 'ASEncryptionHelper' in the CALL FUNCTION, but then I get another error, "JCO.Server could not find server function 'ASEncryptionHelper' '. What is wrong? I am confused.
Please guide.
Thanks
Anu.
Hi,
I didn't get your requirement wxatly but you can do as below,
What I am assuming is you have a java batch file at your desktop and you want to encrypt the file through this batch file execution from SAP.
Now to execute the batch file at runtime and to pass data at runtime you can use below function module
W_RFCENCRY = 'C:\Encrypt\enc.exc C:\Encrypt\test.txt'.
W_RFCDEST = 'ZRFC'.
CALL FUNCTION 'RFC_REMOTE_PIPE'
DESTINATION W_RFCDEST
EXPORTING
COMMAND = W_RFCENCRY
EXCEPTIONS
COMMUNICATION_FAILURE = 1
SYSTEM_FAILURE = 2
OTHERS = 4.
Here ZRFC is the RFC created in SM59 as below
1) select TCP/IP and create ZRFC
in program option type as below C:\RfcSdk\bin\rfcexec.exe
Note: RFCDSK folder is required to execute the batch file at your workstation at path specified as above
2) In activation type select start on front end work station radio button.
Now save the RFC and check the connection, same will be there if RFC SDK folder is available as specified in the program option
In W_RFCENCRY give the inputs that you want to pass with the batch file.
here I have mentioned as 'C:\Encrypt\enc.exc C:\Encrypt\test.txt'. in the program where C:\Encrypt\enc.exc is the path for batch file and C:\Encrypt\test.txt is the path of the file on the work station which is to be encrypted.
Hope this will help you, I think at your end batch file can be different and inputs to be passed in the batch file can also be different.
Similar Messages
-
Call Function Destination in a background job
I am having a problem using:
CALL FUNCTION 'TABLE_ENTRIES_GET_VIA_RFC'
DESTINATION p_dest
in a background job.
I am working on a program that would compare the same table in 2 different systems and write the differences. It works when I run it in the foreground. However, I want to run this in a nightly background job. However, it is failing and I beleive that it is the result of the program needing a user to interactively logon to the remote system.
How can I bypass the logon screen or enter information into the logon screen using a background job?
Thanks.
JonHi Jonathan,
Would you like to reward some points to the poster to thank them as a part of SDN Contributor Recognition Program?
You can click on the yellow star on the right of each post header to reward points.
For more information:
https://www.sdn.sap.com/sdn/index.sdn?page=crp_help.htm
John. -
Call function destination XI exception
Hello,
in R3 i call to function in XI, it's follow:
call function 'XXX'
--destination 'XI'
--exporting
AA = aa
--importing
BB = bb
--exceptions
system_failure = 1
communication_failure = 2
other = 3
when this call produce a exception, why sometimes I can not see anything in XI - SXMB_MONI / runtime workbench -?
thank you very muchHI,
If in case the message failed at entry point i.e. RFC sender communication channel, then it would not be available in SXMB_MONI.
You may trace it from Communciation Channel Monitoring from RWB..
Thanks
Swarup -
Function module call with destination
Hi,
how can check if a function module call with destination works or not ?
How can I debug.
What can be the reason if it is not calles
regards
ertas* to chcek the rfc Destination By pass RFC destination name and Connection Type..
RFC_CHECK_DESTINATION
or
RFC_CHECK_DESTINATION_ID
or
You can use this FM RFC_VERIFY_DESTINATION if your release is greater than 4.6C.
Check this sample code from Craig Cmehil's weblog.
CALL FUNCTION 'RFC_VERIFY_DESTINATION'
EXPORTING
DESTINATION = TMP
TIMEOUT = 10
EXCEPTIONS
INTERNAL_FAILURE = 1
TIMEOUT = 2
DEST_COMMUNICATION_FAILURE = 3
DEST_SYSTEM_FAILURE = 4
UPDATE_FAILURE = 5
NO_UPDATE_AUTHORITY = 6
OTHERS = 7.
IF SY-SUBRC EQ '0'.
"* Do code here
ENDIF.
Prabhu -
Facing issue with tRFC (CALL FUNCTION in BACKGROUND TASK DESTINATION
In transcation CJ20N there is aBADI call ZCL_IM_CL_IM_PROJ_UPDATE in which there is a method
IF_EX_PROJECTDEF_UPDATE~AT_SAVE. My requirement is that when the status of the project is changed and saved then after the SAVE some actions are to be performed (BDC for transcation CJ30 & CJ9FS are to be called).
Since this method is called AT SAVE and i need to call the bdc after the comit (of SAVE) is done. So I have made a RFC FM in which I am calling the bdc. and then calling the FM as
CALL FUNCTION <FM> in BACKGROUND TASK DESTINATION <sy-sysid>.
For the txn. CJ9FS bdc this method is working fine and bdc is called after SAVE but for txn. CJ30, at times,the bdc is not working though if I run the BDC FM seperately using SE37 then its working fine.
Can any body guide me where I am going wrong.The scenario works fine for me. The issue was unable to create a proper test condition in the RFC.
CALL FUNCTION 'ZMY_RFCASYNC'
IN BACKGROUND TASK
EXPORTING...
TABLES...
EXCEPTIONS...
Simulated error condition in 'ZMY_RFCASYNC'
and got entry in SM58 by simply making an exception.
Thank you all. -
CALL FUNCTION STARTING NEW TASK DESTINATION
Hi All,
I have tried to use CALL FUNCTION 'ZWHV_TEST' STARTING NEW TASK 'TEST' DESTINATION 'NONE' But it didnt work.
Please explain me to use above statement and detail me more about NEW TASK 'TEST'.
How to declare TEST in new task ?
Thanks ,
Vinay.>
Vinay parakala wrote:
> ...But it didnt work.
Moderator message - Give more information please in a new thread - post locked -
Behaviour of CALL FUNCTION fname STARTING NEW TASK DESTINATION 'NONE'
As per ABAP help documentation, the statement CALL FUNCTION fname STARTING NEW TASK DESTINATION 'NONE' should create a new main session in same user session.The behaviour is wrong as per documentation.
But current behaviour:
The statement CALL FUNCTION fname STARTING NEW TASK DESTINATION 'NONE' is creating a new user session.
Any reason?Hi Prakash,
I'd agree with Suhas, that you're reading the documentation wrong. Here's your quote:
As per ABAP help documentation, the statement CALL FUNCTION fname STARTING NEW TASK DESTINATION 'NONE' should create a new main session in current user session.
If you look at the help, you can see that it says:
When the destination NONE is used, a new main session is opened for the current user session.
Do you see the difference? Also, note that in this context main session basically means that we're talking about a new external session:
Each task ID defines a separate RFC connection with its own context, meaning that, in the case of repeated function module calls of the same task ID, the global data of the relevant function group can be accessed, if the connection still exists.
In dialog processing, note that the maximum number of six main sessions cannot be exceeded, else an error message is displayed.
If you're still in doubt, check out the online ABAP documentation for [CALL FUNCTION - STARTING NEW TASK|http://help.sap.com/abapdocu_70/en/ABAPCALL_FUNCTION_STARTING.htm]. So I'd say the documentation is in line with the actual behavior.
Cheers, harald -
Remote call function and destination
Hi all @SAPforums,
I used to call remotely a custom function, in a report, from many backends:
CALL FUNCTION ZFOO destination mydest
where mydest is a string containing the name of an RFC destination.
My question is: is there a way, on the destination machine, to get the name/id of the "caller" ?
The question arises from this task: I have to use the caller ID in a WHERE clause of a SELECT statement I have to write in ZFOO. I can - of course - pass the caller ID by adding a new parameter to the function, but this would make necessary a change on the CALL FUNCTION in every backend (quite expensive task, in terms of time). So if it's possible, from the callee, to get the name of the caller, I could just modify the function leaving the calls in every backend as they are.
Thanks in advance>
Matteo Montalto wrote:
> Hello Wolfgang,
> sorry for the stupid question... what does "destination" stands for?
> Thanks for the help
Hi ,
they are two types of RFC calling is ther..
1......
CALL FUNCTION "function0module-name' DESTINATION "DEST"
--that means you are picking data from another r/3 sytem using detination from 'DEST'..
2....
CALL FUNCTION "function0module-name' IN BACKGROUND TASK DESTINATION "DEST"
--that means you are sending data to another r/3 sytem or any other sytem XI or and EDI
using detination from 'DEST'..
for 1 and 2..
--go to t-code SM59 and see the DEST what type of connection is and what system it is connected..
Regards,
Prabhudas -
Call Function using DESTINATION
Hi there!
Abapers, I'm needing some help here with RFCs.
My destinations (SM59):
ERP_100
ERP_120
ERP_130
PI_200
PI_300
I have to call a function in PI from ERP. I'm doing in this way:
CALL FUNCTION 'pi_function_module' DESTINATION 'PI_200' ...
It's working. But the destination can not be hard coded. With the program in ERP_100 (DEV) and ERP_120 (QAS) the destination is PI_200 (PI DEV) and with the program in ERP_130 (PRD) the destination is PI_300 (PI PRD).
How can I handle this?
Thanks in advance!
Best regards,
CharlesHi Charles,
Refer [this|Re: Deciding RFC destination dynamically; thread.
I quote the last post by Micky Oestreich - "This solely depends on the naming conventions you are using. Since the name of the RFC destination is arbitrary, there is 'no' way of determining the name of the destination."
So, your design approach could either be by building a customizing table where you maintain the destination values or use a 'CASE' statement in your code before calling the remote function module....something like:
DATA:
lv_own_system TYPE logsys,
lv_rfcdest TYPE rfcdest.
CALL FUNCTION 'OWN_LOGICAL_SYSTEM_GET'
IMPORTING
own_logical_system = lv_own_system
EXCEPTIONS
own_logical_system_not_defined = 1
OTHERS = 2.
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CASE lv_own_system.
WHEN 'ERP_100' or 'ERP_120'.
lv_rfcdest = 'PI_200'.
WHEN 'ERP_130'.
lv_rfcdest = 'PI_300'.
WHEN OTHERS.
ENDCASE.
"Now call the remote function
CALL FUNCTION 'pi_function_module' DESTINATION lv_rfcdest ...
Hope this helps,
Cheers,
Sougata. -
What is the use of CALL FUNCTION MODULE - AT BACKGROUND TASK?
Hi experts,
I found Call functional module in background task will make the FM run at the next commit work as some people said. So I have some questions:
1 if we use COMMIT WORK commend, the pending FM will be called? If there are several FMs called at background task, what is the sequence of them? How many conditions will trigger the running of these FMs?
2 Where can I find the log of this pending FMs? In SAP library, it says there are 2 tables. But I checked these tables and can only find the FM name and user of it. And I can not understand content of these tables. It seems one is for the main information of FM, and the other is for the data of the FM, maybe the parameters.
3 If I call a FM in this way, Can I canncel it before the next commit work in some way?
Finally, thanks for reading and help.HI,
When the COMMIT WORK statement is executed, the function modules registered for the current SAP-LUW are started in the order in which they were registered. ROLLBACK WORK deletes all previous registrations for the current SAP-LUW.
If the specified destination is not available when COMMIT WORK is executed, an executable program called RSARFCSE is started in background processing. By default, this tries to start the function modules registered for a SAP-LUW in their destination every 15 minutes and up to 30 times. These parameters can be changed in the transaction SM59. If the destination does not become available within the defined time, it is recorded in the database table ARFCSDATA as the entry "CPICERR". The entry in the database table ARFCSSTATE is deleted after a standard period of eight days -
Computer name in R3 when call function RFC from CRM to R3
Hi all,
i nead the computer name in R3 when I come to R3 from CRM .
In R3 i call function 'TERMINAL_ID_GET' in R3 but I don't retrieve the computer name.
i tried also to call function 'TERMINAL_ID_GET' in destination 'CRM' but I don't retrieve the computer name.
The code in R3:
CALL FUNCTION 'TERMINAL_ID_GET' DESTINATION 'R3GETCRM'
EXPORTING
username = sy-uname
IMPORTING
terminal = l_terminal_usr41
EXCEPTIONS
multiple_terminal_id = 1
no_terminal_found = 2
OTHERS = 3.
This function works ok when i call her direct from R3 or direct from CRM,
but not give me in R3 the computer name when i came to R3 From CRM.
Thanks for your cooperation.
danythats because 'TERMINAL_ID_GET' is not a RFC (check the attributes tab of the FM from SE37)
if you dont find a RFC to do t his you can wrap this FM with a custom RFC and use it.
if you want all the logged on users info (computer name and other info) then you can use THUSRINFO FM which a RFC
Raja -
CALL FUNCTION 'RFC_REMOTE_PIPE' throwing exception as 1
Hi Sapients,
I am using CALL FUNCTION 'RFC_REMOTE_PIPE' to rename a file at the UNIX level..Though this runs well... sometimes this is giving an exception as ''1'' (System Failure).. if we execute the same after 3 or 4 hours this RFC is again successfully executed...Can anyone throw some light on why this is happening and how we can avoid the same.
CALL FUNCTION 'RFC_REMOTE_PIPE'
DESTINATION 'SERVER_EXEC'
EXPORTING
COMMAND = l_command
READ = c_yes
EXCEPTIONS
system_failure = 1
communication_failure = 2
OTHERS = 3.
where the l_command is mv old_file_name New_file_name
and C_yes is XHi,
Maybe my answer comes too late.
Could be helpful for others anyway.
We got the same trouble and it was due to the RFCEXEC.SEC file.
Installing the SDK7.20 the RFCEXEC files were missing and old RFCEXEC.SEC was not in the same format...
Please look also to OSS notes #1592501 and #1581595
Thanks
//Philippe. -
CALL FUNCTION 'RFC_REMOTE_PIPE' throwin exception ''1''
Hi Sapients,
I am using CALL FUNCTION 'RFC_REMOTE_PIPE' to rename a file at the UNIX level..Though this runs well... sometimes this is giving an exception as ''1'' (System Failure).. if we execute the same after 3 or 4 hours this RFC is again successfully executed...Can anyone throw some light on why this is happening and how we can avoid the same.
CALL FUNCTION 'RFC_REMOTE_PIPE'
DESTINATION 'SERVER_EXEC'
EXPORTING
COMMAND = l_command
READ = c_yes
EXCEPTIONS
system_failure = 1
communication_failure = 2
OTHERS = 3.
where the l_command is mv old_file_name New_file_name
and C_yes is X
<promise removed by moderator>
Edited by: Thomas Zloch on Mar 16, 2011 1:00 PMHi,
Maybe my answer comes too late.
Could be helpful for others anyway.
We got the same trouble and it was due to the RFCEXEC.SEC file.
Installing the SDK7.20 the RFCEXEC files were missing and old RFCEXEC.SEC was not in the same format...
Please look also to OSS notes #1592501 and #1581595
Thanks
//Philippe. -
CALL FUNCTION func STARTING NEW TASK task
hi,
i developed rfc to extract data and send to xi
as my interface is Async
as per soem documents it was mentioned the syntax
CALL FUNCTION func STARTING NEW TASK task
wat is the task ? in the syntax
and how do i use it
jeffHi suresh,
this is the code of RFC. if i execute without RFCDESTINATION it executes successfully. when i use RFC DESTINATION it shows error
call to messaging system failed: com.sap.aii.af.ra.ms.api.DeliveryException
i created RFC destination using TCP/IP and registered program. same parameters i am mentioning in XI.
FUNCTION z_bank_reconciliation.
""Local interface:
*" IMPORTING
*" VALUE(COMP_CODE) TYPE BUKRS
*" VALUE(HOUSE_BANK) TYPE HBKID
*" VALUE(ACCOUNT_ID) TYPE HKTID
*" TABLES
*" CHQDETAILS STRUCTURE ZPAYR
DATA: itab LIKE payr OCCURS 0 WITH HEADER LINE.
DATA: jtab LIKE payr OCCURS 0 WITH HEADER LINE.
DATA: it_bank LIKE zbankrecon OCCURS 0 WITH HEADER LINE.
DATA: it_bank1 LIKE zpayr OCCURS 0 WITH HEADER LINE.
TYPES : BEGIN OF ty_bseg ,
bukrs LIKE bseg-bukrs,
hbkid LIKE bseg-hbkid,
belnr LIKE bseg-belnr,
zlsch LIKE bseg-zlsch,
kostl LIKE bseg-kostl,
hkont LIKE bseg-hkont,
bzdat LIKE bseg-bzdat,
END OF ty_bseg.
TYPES : BEGIN OF ty_t012 ,
bukrs LIKE t012-bukrs,
bankl LIKE t012-bankl,
bankn LIKE t012k-bankn,
END OF ty_t012.
TABLES : payr, t012, t012k, bseg.
DATA : itpayr LIKE zpayr OCCURS 0 WITH HEADER LINE,
itt012 TYPE STANDARD TABLE OF ty_t012,
itbseg TYPE STANDARD TABLE OF ty_bseg,
wa_itt012 TYPE ty_t012,
wa_itbseg TYPE ty_bseg,
total TYPE n.
SELECT * FROM zbankrecon INTO TABLE it_bank
FOR ALL ENTRIES IN itab
WHERE chequeno EQ itab-chect.
SELECT abukrs abankl b~bankn
INTO CORRESPONDING FIELDS OF TABLE
itt012 FROM t012 AS a
INNER JOIN t012k AS b ON bbukrs = abukrs AND b~hbkid =
house_bank AND b~hktid = account_id
WHERE abukrs = comp_code AND ahbkid = house_bank.
DELETE ADJACENT DUPLICATES FROM itt012.
SELECT zbukr hbkid hktid vblnr gjahr zaldt checf chect znme1 rwbtr
waers zaldt zbnkl FROM payr INTO CORRESPONDING FIELDS OF TABLE itpayr
WHERE ( zbukr = comp_code AND hbkid = house_bank ) AND hktid =
account_id.
SELECT bukrs hbkid belnr zlsch kostl hkont bzdat FROM bseg INTO TABLE
itbseg
WHERE bukrs = comp_code AND hbkid = house_bank.
SORT itt012 BY bankl.
SORT itbseg BY belnr.
READ TABLE itt012 INTO wa_itt012 INDEX 1.
LOOP AT itpayr.
read table itbseg into wa_itbseg with key bukrs = itpayr-zbukr
hbkid = itpayr-hbkid.
if sy-subrc = 0.
itpayr-kostl = wa_itbseg-kostl.
itpayr-hkont = wa_itbseg-hkont.
itpayr-bldat = wa_itbseg-bzdat.
itpayr-zlsch = wa_itbseg-zlsch.
endif.
itpayr-zbnkl = wa_itt012-bankl.
itpayr-zbnkn = wa_itt012-bankn.
MODIFY itpayr.
APPEND itpayr TO chqdetails.
ENDLOOP.
LOOP AT chqdetails.
READ TABLE it_bank WITH KEY chequeno = chqdetails-chect.
IF sy-subrc NE 0.
MOVE chqdetails TO it_bank1.
APPEND it_bank1.
CLEAR it_bank1.
ENDIF.
ENDLOOP.
REFRESH chqdetails.
chqdetails[] = it_bank1[].
LOOP AT it_bank1.
MOVE : it_bank1-chect TO zbankrecon-chequeno,
sy-datum TO zbankrecon-check_date,
sy-uzeit TO zbankrecon-check_time.
INSERT zbankrecon.
CLEAR zbankrecon.
ENDLOOP.
ENDFUNCTION. -
CALL FUNCTION WITH STARTING NEW TASK
Hi All,
i'm call a function module through
CALL FUNCTION 'Y_WIN' DESTINATION 'rfc_destination' then it's give right result but when i want to call with starting new task then
CALL FUNCTION 'Y_WIN' STARTING NEW TASK 'INFO' DESTINATION 'rfc_destination'
it does nt provide me any data. i have check in debugger call fm is wkging fine so pls clear me why i'm nt geeting result.
pls give ur suggestions,
AnujDid you use the PERFORMING <form> ON END OF TASK to get the results back; like in the following sample
CALL FUNCTION 'SAPWL_STATREC_READ_FILE'
STARTING NEW TASK taskname
DESTINATION list-name
PERFORMING read_outtab ON END OF TASK
EXPORTING
read_start_date = s_date
read_start_time = '000000'
read_end_date = s_date
read_end_time = '235959'
EXCEPTIONS " failure when calling RFC
communication_failure = 1 MESSAGE msg_text
system_failure = 2 MESSAGE msg_text
RESOURCE_FAILURE = 3.
and
FORM read_outtab USING taskname.
* Receive results back
RECEIVE RESULTS FROM FUNCTION 'SAPWL_STATREC_READ_FILE'
TABLES
v2_normal_records = outtab
EXCEPTIONS " from the called FM
nodata = 1.
Regards
Maybe you are looking for
-
Hello, I own a Macbook Pro 15" (late 2011) and I would like to upgrade the memory. I want to go with two 8gb sticks but if the motherboard only supports 8gb then I will have to stick with 8gb. Also, the ram that I have in currently, which is the 4gb
-
AD Access not working properly
Hi I'm fairly new to App V so please bear with me. I have sequenced several apps and want to control the access to them, I have found that no matter which AD group I grant access to, all users I am testing with get the app. This is true for package
-
How to send data back to publishing stream
Hi, Environment: ActionScript3.0, FMS, Flash Project created in Flash Develop How to send data back to publishing stream? I need to send data back to publishing stream. Using NetStream.send() we can send data to subscribers but is it possible to send
-
Trying to install elements 11 and it comes up with 18 errors in the payload
trying to install elements 11 and it comes up with 18 errors in the payload
-
When i use NI9505 to control step motor, use example code(closed loop), motor can run, but can not stop. for example, i want run 1000 steps, motor run and the encoder value may be a value close to 1000, but can not stop, why?