Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

RFC function results with CodePage

Former Member
0 Likes
1,734

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.

10 REPLIES 10
Read only

Former Member
0 Likes
1,439

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.

Read only

0 Likes
1,439

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.

Read only

0 Likes
1,439

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

Read only

0 Likes
1,439

Hi,

RFC Z-function returns the table of strings type CHAR 30000 in default codepage (UTF-8).

Natalia

Read only

0 Likes
1,439

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

Read only

0 Likes
1,439

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.

Read only

0 Likes
1,439

then run the following FM in R/3 and use the returned code page number in your .net application.

SCP_GET_CODEPAGE_NUMBER

Read only

0 Likes
1,439

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.

Read only

0 Likes
1,439

Sorry. i am not a ASP person. I dont know what needs to be done on ASP side.

Read only

0 Likes
1,439

Hi,

Thank you for help.

Natalia.