SAP .NET Connector 3.0 Sample

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
Welcome
Posts: 16
Joined: Mon May 08, 2017 3:15 pm

SAP .NET Connector 3.0 Sample

Post by Welcome » Wed Dec 27, 2017 4:17 pm

Hi. everybody.

I want to use sap .net connect 3.0 (SAPNCO 3.0) to connect SAP.
but I can't Code RDMLX to connect..

[c#]
RfcDestination SapRfcDestination = RfcDestinationManager.GetDestination(sapparms);

if You have a sample , would you give me reference ??

Thank you so much..

Welcome.

Welcome
Posts: 16
Joined: Mon May 08, 2017 3:15 pm

Re: SAP .NET Connector 3.0 Sample

Post by Welcome » Mon Jan 22, 2018 2:49 pm

* **************************************************
*
* COMPONENT: STD_FORM
*
* **************************************************
Function Options(*DIRECT)
Begin_Com Role(*EXTENDS #PRIM_FORM) Clientwidth(484) Clientheight(301) Componentversion(2)
Define_Com Class(#SAPNCO.SAP.Middleware.Connector.RfcConfigParameters) Name(#SAPPARMS) Reference(*DYNAMIC)

Define_Com Class(#SAPNCO.SAP.Middleware.Connector.RfcDestinationManager) Name(#SAPDestM) Reference(*DYNAMIC)
Define_Com Class(#SAPNCO.SAP.Middleware.Connector.RfcDestination) Name(#SAPDest) Reference(*DYNAMIC)

Define_Com Class(#SAPNCO.SAP.Middleware.Connector.RfcRepository) Name(#SAPREP) Reference(*DYNAMIC)
Define_Com Class(#SAPNCO.SAP.Middleware.Connector.IRfcFunction) Name(#SAPFUN) Reference(*DYNAMIC)
Define_Com Class(#SAPNCO.SAP.Middleware.Connector.IRfcTable) Name(#SAPTABLE) Reference(*DYNAMIC)

Define Field(#Count) Type(*DEC) Length(5) Decimals(0)
Define Field(#i) Type(*dec) Length(3) Decimals(0)

Define Field(#RESULT) Type(*BOOLEAN)
Evtroutine Handling(#com_owner.CreateInstance)
Set Com(#com_owner) Caption(*component_desc)

#SAPPARMS <= *New #SAPNCO.SAP.Middleware.Connector.RfcConfigParameters.RfcConfigParameters

Set_Ref Com(#SAPPARMS) To(*CREATE_AS #SAPNCO.SAP.Middleware.Connector.RfcConfigParameters.RFCCONFIGPARAMETERS)
#SAPPARMS.Add( 'NAME', "XXX" )
#SAPPARMS.Add( 'ASHOST', "XXX.XXX.XX.XX" )
#SAPPARMS.Add( 'CLIENT', "XXX" )
#SAPPARMS.Add( 'USER', "XXXX" )
#SAPPARMS.Add( 'PASSWD', "********" )
#SAPPARMS.Add( 'SYSNR', "XX" )
#SAPPARMS.Add( 'LANG', "XX" )
#SAPPARMS.Add( 'POOL_SIZE', "5" )
#SAPPARMS.Add( 'MAX_POOL_SIZE', "10" )
#SAPPARMS.Add( 'IDLE_TIMEOUT', "500" )
#SAPDestM.GetDestination#1 Parameters(#SAPPARMS) Returnvalue(#SAPDest)

Set_Ref Com(#SAPREP) To(*DYNAMIC #SAPDest.Repository)
#SAPREP <= #SAPDest.Repository
#SAPFUN <= #SAPREP.CreateFunction( 'XXXXXX')

#SAPFUN.SetValue#22 Name('CATEGORY') Value('X')
#SAPFUN.SetValue#22 Name('WERKS') Value('XXXX')

#SAPFUN.Invoke Destination(#SAPDest)
#SAPTABLE <= #SAPFUN.GetTable#2( 'XXXXX' )
#Count := #SAPTABLE.Count
Dowhile Cond(#i < #Count)
#XXVBELN := #SAPTABLE.Item<#i>.GetValue#1( 'VBELN' )
#XXPOSNR := #SAPTABLE.Item<#i>.GetValue#1( 'POSNR' )
#XXMAKTX := #SAPTABLE.Item<#i>.GetValue#1( 'MAKTX' )

#i := #i + 1
Endwhile
Endroutine

End_Com

Post Reply