‎2007 Feb 12 2:56 PM
Hi everybody,
I'm trying to call RFC SAP Z-function from ASP page:
<%Response.Buffer = false
Response.Expires = -1
Response.CacheControl ="no-cache"
Session.CodePage = "65001"
Response.charset = "UTF-8"
%>
The result string is '####' , the problem in codepage?...
We works 640 Final Release - Unicode system.
Have any idea to help me.
Thanks, Natalia.
‎2007 Feb 12 3:14 PM
How are you making the call ? Are you having RFC Request and Response objects ?
What did you mean by result string?
In an FM interface, the importing,changing and table parameters form part of the request and exporting,changing and table parameters form part of response.
Please let us know the details as to how the call to the Function is made...
Thanks.
‎2007 Feb 13 7:05 AM
Hi,
<b>The way I connect to SAP:</b>
(include file)
Set SapLogon = CreateObject("SAP.LogonControl.1")
Set SapConn = SapLogon.NewConnection
SapConn.Client = "<Client>"
SapConn.Language = "HE"
SapConn.HostName = "<HostName>"
SapConn.destination = "<destination>"
SapConn.user = "<user>"
SapConn.password = "<password>"
If SapConn.LogOn(0, True) <> True Then ' LogOn WithOut dialog
Set SapConn = Nothing
SAP_LogOn = false
else
SAP_LogOn = true
End If
<b>The way I call RFC SAP Z-Function:</b>
(ASP page)
<!#include file="include/SAP_CONNECTION.INC">
<%Response.Buffer = false
Response.Expires = -1
Response.CacheControl ="no-cache"
Session.CodePage = "65001"
Response.charset = "UTF-8"
%>
<%
DIM SEARCHCRITERIA
DIM SEARCHQUERY
SEARCHCRITERIA = Request.QueryString("SEARCHCRITERIA")
SEARCHQUERY = Request.QueryString("SEARCHQUERY")
if SAP_LogOn then
response.write Z_SAP_SEARCH
SAP_LogOff
else
response.write "error on Sap LogOn"
end if
Public Function Z_SAP_SEARCH()
Z_SAP_SEARCH = False
Dim dieFunc, strXmlGetData, oFunctionCtrl,TABR, i
strXmlGetData = ""
'Create Function Object
Set oFunctionCtrl = CreateObject("SAP.Functions")
Set oFunctionCtrl.Connection = SapConn
Set dieFunc = oFunctionCtrl.Add("<RFC SAP Z-Function name>")
dieFunc.Exports("SEARCHCRITERIA") = SEARCHCRITERIA
dieFunc.Exports("SEARCHQUERY") = SEARCHQUERY
If dieFunc.Call = True Then
Set TABR = dieFunc.tables.Item("T_XML_STRING")
If TABR.rows.Count > 0 Then
For i = 1 To TABR.rows.Count
strXmlGetData = strXmlGetData & TABR.Value(i, "XML_STRING")
Next
End If
Else
strXmlGetData = "<ERROR>Z_SAP_SEARCH connection error</ERROR>"
End If
Z_SAP_SEARCH = strXmlGetData
End Function
%>
As you seen I receive from SAP RFC Z-Function table of strings .
I receive right result strings, but Instead of Hebrew letters I see #:
When I run the function in SAP I don't see #.
Thanks, Natalia.
‎2007 Feb 17 7:37 PM
is the z- function module returning XML in utf-8 encoded format,
is the xml is returned (from z FM) as string or Xstring?
Raja
‎2007 Feb 18 6:05 AM
Hi,
RFC Z-function returns the table of strings type CHAR 30000 in default codepage (UTF-8).
Natalia
‎2007 Feb 18 6:26 AM
i would suggest two changes.
1. change the return table type to XSTRING_TABLE
2 . before returning the xml do the following conversion and then pass it to XSTRING_TABLE
data: app_type(50) .
data: xml_string type string ,
xl_content type xstring .
app_type = 'text/xml; charset=utf-8'.
call function 'SCMS_STRING_TO_XSTRING'
exporting
text = xml_string " xml in string format
mimetype = app_type
importing
buffer = xl_content. " xml in xstring format
concatenate cl_abap_char_utilities=>byte_order_mark_utf8
xl_content
into xl_content in byte mode.
Regards
Raja
‎2007 Feb 18 7:27 AM
Hi,
My problem is not in SAP (ABAP part), I don't receive tha value that I send from ASP page in suitable (for SAP) codepage.
I think that the problem in:
<%Response.Buffer = false
Response.Expires = -1
Response.CacheControl ="no-cache"
<b>Session.CodePage = "65001"</b>
Response.charset = "UTF-8"
%>
Thanks, Natalia.
‎2007 Feb 18 7:40 AM
then run the following FM in R/3 and use the returned code page number in your .net application.
SCP_GET_CODEPAGE_NUMBER
‎2007 Feb 18 7:50 AM
Hi,
First of all thank you for help.
I don't know what changes I must to do to ASP page.
SAP pagecode = 4103.
Natalia.
‎2007 Feb 18 7:53 AM
Sorry. i am not a ASP person. I dont know what needs to be done on ASP side.
‎2007 Feb 18 8:08 AM