on 04-16-2007 4:36 PM
Hi,
I have installed the SAP RFC library and SAP4Rails.
Now I want to call one of our RFCs with the name "ZFM_ATLAS_SEARCH_FE"
The definition for the function is:
*"----
""Local Interface:
*" IMPORTING
*" VALUE(IS_FORCE_ATLAS) TYPE /ISDFPS/FORCE_TAB_GIS
*" VALUE(READINESS) TYPE /ISDFPS/READINESS OPTIONAL
*" VALUE(TASK) TYPE ZATLAS_TASK_S OPTIONAL
*" TABLES
*" ET_FORCE TYPE /ISDFPS/FORCE_TAB_GIS
*" ET_IT1000 TYPE /ISDFPS/FORCE_IT1000_TAB
*" ET_IT1950 TYPE /ISDFPS/FORCE_IT1950_TAB
*" ET_IT1952 TYPE /ISDFPS/P1952_T
*" ET_IT1951 TYPE /ISDFPS/FORCE_IT1951_TAB
*" EXCEPTIONS
*" FORCE_READ_ERROR
*" IT1952_READ_ERROR
*" IT1000_READ_ERROR
*" IT1950_READ_ERROR
*" IT1951_READ_ERROR
*"----
So I followed the instructions on Piers' Blog (/people/piers.harding/blog/2006/05/18/ruby-on-rails-with-ajax)
My model class looks like that:
-
require "SAP4Rails"
class Unit < SAP4Rails::Base
#You must define a list of RFCs to preload
function_module :ZFM_ATLAS_SEARCH_FE,
class << self
def list
Unit.ZFM_ATLAS_SEARCH_FE.call()
return Unit2.ZFM_ATLAS_SEARCH_FE.et_force.rows()
end
end
end
-
When I call the list method, I get an error that "et_force" is nil.
So I looked into the trace file, to see what's going on.
There I found the following lines in the response from the server:
***Discarding unrequested T:ET_FORCE
==== Delta 0 7 REG. (dummy entry)
==== Delta 0 7 LOG REJECT LINE 0 INFO 0
***Discarding unrequested T:ET_IT1000
==== Delta 0 8 REG. (dummy entry)
==== Delta 0 8 LOG REJECT LINE 0 INFO 0
***Discarding unrequested T:ET_IT1950
==== Delta 0 9 REG. (dummy entry)
==== Delta 0 9 LOG REJECT LINE 0 INFO 0
***Discarding unrequested T:ET_IT1951
==== Delta 0 10 REG. (dummy entry)
==== Delta 0 10 LOG REJECT LINE 0 INFO 0
***Discarding unrequested T:ET_IT1952
So, why are the tables unrequested and discarded. How I can make the RFC call expose the tables?
Thanks very much in advance!
Hi - can you try using LIKE instead of TYPE in your table assignments in the interface definition, and see if this makes a difference.
Cheers,
Piers Harding
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I cannot change the Type Specification to LIKE. The SAP system says "Tables using LIKE may only reference flat structures."
I also want to call another RFC, that has an Export parameter, that seemst to be a a deep structure. When I preload this RFC, I get an error. The trace file contains this line "RfcGetStructureInfoAsTable(ZATLAS_FE_DETAILS_S ) exception UNSUPPORTED_TYPE". In other forums I read, that the description should be requested as RFCTYPE_XMLDATA instead of RFCTYPE_STRUCTURE. Does SAP4Rails / SAP RFC support this?
Kind regards
Bernd
Hello,
me again 😄
I slightlz changed the Export parameter of my second RFC, so that is no longer a deep structure (this won't satisfy me in the end, but for testing it is ok). However no the RFC can be preloaded, but when calling it I get the error from Ruby:
"private method `sub!' called for 0:Fixnum"
It occurs in "C:/INSTAN1/INSTAN1/ruby/lib/ruby/gems/1.8/gems/saprfc-0.35-mswin32/lib/SAP/Rfc.rb:1594:in `chop'"
Any help please?
Bernd
Hi -
It occurs to me in this that you are using SAP::Rfc (saprfc) instead of the new sapnwrfc. This will not cope with deep structures at all in the way that you need. You need to switch to using sapnwrfc for this.
you must use sapnwrfc version 0.12 and get the latest version of sap4rails - 0.12.
Cheers,
Piers Harding.
Thank you very much for the answer! This kind of support really rocks!
Actually I have saprfc and sapnwrfc installed, as the download page of sap4rails indicates both as required dependency. The versions I have installed are saprfc 0.35, sapnwrfc 0.12 and sap4rails 0.12.
sap4rails definitely tries to access the SAP RFCs via saprfc, because when I uninstall it, I get an error, that it cannot be accessed.
I am a little bit confused. I read, that the saprfc will not be developed any more and the sapnwrfc will substitute it. But I see, that the latest version of saprfc is from 14-Mar-2007 (and it still has problems, when table fields have a numeric value, instead of a string, the famous line 1594).
How can I tell sap4rails, that it shall use sapnwrf instead of saprfc?
Best regards
Bernd
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.