2013 Jun 25 12:09 PM
Hi Experts,
I am facing a strange problem.
I have exposed a function module as a web service. It returns a list of material numbers.
When I execute it in SAP, it works fine. But when the external application (a ruby program) calls the web service it returns the table as blank.
I have used the structure “BAPIMATLST” and passing the data under the Tables tab of function module.
Regards,
Gopal
2013 Jun 25 4:24 PM
Hi Gopal,
Whenever we create any web service for Material no,Sales Order no,PO no etc based search scenarios,if such a web services are used by other systems like JAVA,.NET in your case Ruby the leading zeros also need to be passed to those fields in external system .
For example lets take Material no in SAP D.B as '000000000000001111' if we run web service inside SAP system and pass MATNR as '1111', internally web service will automatically convert '1111' into '000000000000001111' because of conversion routines which are inside R/3.
But where as in external system consuming web service if we pass just '1111' the Web service will not automatically convert into leading zeros format so we need to pass MATNR along with leading zeros as input parameter to webservice as '000000000000001111' then it will execute.
Try again your web service passing leading zeros.If it works then handle adding leading zeros functionality by calling conversion routines for MATNR inside the F.M itself..
Thanks,
Nandi.
2013 Jun 25 2:37 PM
Hi,
Try to check and replace your RFC in below
class SapMaterial < SAP4Rails::NW::Base
function_module :RFC_READ_TABLE
class << self
def find_stock(options={})
material = options[:material]
return nil if material.blank?
rfc = self.RFC_READ_TABLE.new_function_call
rfc.QUERY_TABLE = "yourtable"
rfc.DELIMITER = "|"
rfc.OPTIONS = [{'TEXT' => "MATNR EQ '#{material}'"}]
# optional set of fields to return from the table
#rfc.FIELDS = [{'FIELDNAME' => 'MATNR'}, {'FIELDNAME' => ...}]
rfc.invoke
rfc.DATA
end
end
end
2013 Jun 25 4:24 PM
Hi Gopal,
Whenever we create any web service for Material no,Sales Order no,PO no etc based search scenarios,if such a web services are used by other systems like JAVA,.NET in your case Ruby the leading zeros also need to be passed to those fields in external system .
For example lets take Material no in SAP D.B as '000000000000001111' if we run web service inside SAP system and pass MATNR as '1111', internally web service will automatically convert '1111' into '000000000000001111' because of conversion routines which are inside R/3.
But where as in external system consuming web service if we pass just '1111' the Web service will not automatically convert into leading zeros format so we need to pass MATNR along with leading zeros as input parameter to webservice as '000000000000001111' then it will execute.
Try again your web service passing leading zeros.If it works then handle adding leading zeros functionality by calling conversion routines for MATNR inside the F.M itself..
Thanks,
Nandi.
2013 Jun 26 1:28 PM
Hi Nandi,
The web service is called using leading zeros. moreover I have also added a conversion routine before i query the table. I am able to debug it through external break point. The data is in the table till it leaves the function module.
Regards,
Gopal
2013 Jun 27 9:05 AM
The data is in the table till it leaves the function module.
Hello Gopal,
'Tables' tab in FM builder is SAP design for handling tables. It may be possible that your third party system Ruby is not identifying it.
Try it : Remove parameter from Tables tab and add a Table type parameter under 'Export' tab.
Many Thanks,
Jitendra
2013 Jun 27 12:41 PM
2013 Jun 28 12:18 PM
Hello Gopal,
If you got the answer , please mark the question Answered.
2013 Jun 26 8:54 AM
Hello Gopal S,
Check for the leading zeros as suggested by Nandi.
For tracking what is coming in SAP and what is going out of SAP , you can use transaction
SRT_UTIL. here you will get all the calls to SAP via Web service(Provider + Consumer).
Many Thanks,
Jitendra Soni
2014 Sep 04 4:43 AM
I am facing this issue even after putting the table as export parameter...please help
2014 Sep 04 4:48 AM
Hi Unnati,
Please test your webservice with tooll like SOAP UI.
2014 Sep 24 6:48 AM
Hi Ranjana ,
Until now i had been testing the web service from SOAP UI in our corporate network which gets the response as required.
A third party , trying to test it using chrome poster , get the following error :
I then decided to test it from an external network (on SOAPUI) and below is the error i am receiving
I tried a lot to search about this error. Cant find what the problem is .
Also , id like to mention , previously there was a similar web service which has been consumed and is working fine , but receives the same response if tested from SOAP UI from an external network.
Any suggestions?
Thanks,
Unnati