saprfc

package
v0.0.0-...-c4726eb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 10, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

gorfc wraps the SAP NetWeaver RFC library written in C. Its provides methods for maintaining a connection to an ABAP backend and calling remote enabled functions from Go. The functions of the library take and return Go data types.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetNWRFCLibVersion

func GetNWRFCLibVersion() (major, minor, patchlevel uint)

GetNWRFCLibVersion returnd the major version, minor version and patchlevel of the SAP NetWeaver RFC library used.

Types

type Connection

type Connection struct {
	// contains filtered or unexported fields
}

func ConnectionFromDest

func ConnectionFromDest(dest string) (conn *Connection, err error)

ConnectionFromDest creates a new connection with just the dest system id.

func ConnectionFromParams

func ConnectionFromParams(connParams ConnectionParameter) (conn *Connection, err error)

ConnectionFromParams creates a new connection with the given connection parameters and tries to open it. If this is successfull it returns the connection else it returns nil.

func (*Connection) Alive

func (conn *Connection) Alive() bool

Alive returns true if the connection is open else returns false.

func (*Connection) Call

func (conn *Connection) Call(goFuncName string, params interface{}) (result map[string]interface{}, err error)

Call calls the given function with the given parameters and wraps the results returned.

func (*Connection) Close

func (conn *Connection) Close() (err error)

Close closes the connection and sets alive to false.

func (*Connection) GetConnectionAttributes

func (conn *Connection) GetConnectionAttributes() (connAttr ConnectionAttributes, err error)

GetConnectionAttributes returns the wrapped connection attributes of the connection.

func (*Connection) GetFunctionDescription

func (conn *Connection) GetFunctionDescription(goFuncName string) (goFuncDesc FunctionDescription, err error)

GetFunctionDescription returns the wrapped function description of the given function.

func (*Connection) Open

func (conn *Connection) Open() (err error)

Open opens the connection and sets alive to true.

func (*Connection) Ping

func (conn *Connection) Ping() (err error)

Ping pings the server which the client is connected to and does nothing with the error if one occurs.

func (*Connection) PingAndAutoReconnect

func (conn *Connection) PingAndAutoReconnect(interval time.Duration) *time.Ticker

PingAndAutoReconnect tries to reconnect on an error, it checks by the duration defined by the interval param

func (*Connection) RStrip

func (conn *Connection) RStrip(rstrip bool) *Connection

RStrip sets rstrip of the given connection to the passed parameter and returns the connection right strips strings returned from RFC call (default is true)

func (*Connection) Reopen

func (conn *Connection) Reopen() (err error)

Reopen closes and opens the connection.

func (*Connection) ReturnImportParams

func (conn *Connection) ReturnImportParams(returnImportParams bool) *Connection

ReturnImportParams sets returnImportParams of the given connection to the passed parameter and returns the connection

type ConnectionAttributes

type ConnectionAttributes struct {
	Dest                  string // RFC destination
	Host                  string // Own host name
	PartnerHost           string // Partner host name
	SysNumber             string // R/3 system number
	SysId                 string // R/3 system ID
	Client                string // Client ("Mandant")
	User                  string // User
	Language              string // Language
	Trace                 string // Trace level (0-3)
	IsoLanguage           string // 2-byte ISO-Language
	Codepage              string // Own code page
	PartnerCodepage       string // Partner code page
	RfcRole               string // C/S: RFC Client / RFC Server
	Type                  string // 2/3/E/R: R/2,R/3,Ext,Reg.Ext
	PartnerType           string // 2/3/E/R: R/2,R/3,Ext,Reg.Ext
	Rel                   string // My system release
	PartnerRel            string // Partner system release
	KernelRel             string // Partner kernel release
	CpicConvId            string // CPI-C Conversation ID
	ProgName              string // Name of the calling APAB program (report, module pool)
	PartnerBytesPerChar   string // Number of bytes per character in the backend's current codepage. Note this is different from the semantics of the PCS parameter.
	PartnerSystemCodepage string // Partner system code page
	Reserved              string // Reserved for later use
}

func (ConnectionAttributes) String

func (connAttr ConnectionAttributes) String() string

type ConnectionParameter

type ConnectionParameter struct {
	Dest            string
	Client          string
	User            string // Username
	Passwd          string // Password
	Lang            string // Language
	Trace           string
	Ashost          string
	Sysnr           string
	Mshost          string
	Msserv          string
	Sysid           string
	Group           string
	Snc_qop         string
	Snc_myname      string
	Snc_partnername string
	Snc_lib         string
	Mysapsso2       string
	Saprouter       string
}

ConnectionParameter holds all the connection parameters possible (at the moment).

type FieldDescription

type FieldDescription struct {
	Name      string
	FieldType string
	NucLength uint
	NucOffset uint
	UcLength  uint
	UcOffset  uint
	Decimals  uint
	TypeDesc  TypeDescription
}

type FunctionDescription

type FunctionDescription struct {
	Name       string
	Parameters []ParameterDescription
}

func (FunctionDescription) String

func (funcDesc FunctionDescription) String() (result string)

type ParameterDescription

type ParameterDescription struct {
	Name          string
	ParameterType string
	Direction     string
	NucLength     uint
	UcLength      uint
	Decimals      uint
	DefaultValue  string
	ParameterText string
	Optional      bool
	TypeDesc      TypeDescription
}

func (ParameterDescription) String

func (paramDesc ParameterDescription) String() string

type RfcError

type RfcError struct {
	Description string
	ErrorInfo   rfcSDKError
}

func (RfcError) Error

func (err RfcError) Error() string

type TypeDescription

type TypeDescription struct {
	Name      string
	NucLength uint
	UcLength  uint
	Fields    []FieldDescription
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL