Example of using ASP to call RFC

Source: Internet
Author: User

The example of ASP calling RFC has never been found. On the internet, Asp.net calls RFC,

I have no idea about ASP code, but the Code involved here is relatively simple.

<% @ Language = VBScript %>

<HTML>

<Head>

<%

Dim ologoncontrol

Dim obapicontrol

Dim oconn

Dim ocompanycode

Dim otabcompanycodes

Dim oreturn

Dim ocol

Dim orow

Dim itab

Dim ofun

Dim func

Dim iCall

Dim I

 

Sub main ()

'Set obapicontrol = Createobject ("sap. bapi.1 ″)

Set ologoncontrol = Createobject ("sap. logoncontrol.1 ″)

Set oconn = ologoncontrol. newconnection

Oconn. applicationserver = "IPaddress" 'IP address

Oconn. System = "00" 'system number

Oconn. Client = "600" 'System

Oconn. User = "user" 'User Name

Oconn. Password = "password" 'Password

Oconn. Language = "en"

Retcm = oconn. Logon (0, true)

Response. Write (retcm)

Response. Write ("<br> ")

If (retcdtrue) then

Response. Write ("No Logon ")

Stop

Else

'Obapicontrol. Connection = oconn

'Set ocompanycode = obapicontrol. getsapobject ("companycode ")

Set ofun = Createobject ("sap. Functions ")

Set ofun. Connection = oconn

Set func = ofun. Add ("z_pp_proodr3") 'Here is the rfc I called (take the production order)

Func. Exports ("inidat") = "20101124 ″'Input parameters

Func. Exports ("enddat") = "20101128 ″'Input parameters

ICall = func. Call

Set itab = func. Tables. Item ("zafpo") 'internal table in my RFC (obtained production order)

Response. Write ("<br> ")

For I = 1 to itab. Rows. Count

For each ocol in itab. Columns

Response. Write ocol. Value (I)

Response. Write ("")

Next

Response. Write ("<br> ")

Next

End if

End sub

 

%>

</Head>

<Body>

<% Call main () %>

</Body>

</Html>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.