Buenos Dias Marcos,
Hay varias maneras de conectarte a las transacciones SAP, ( OLE, .Net , ServiceLayer, etc) y eso depende de la version de powerbuilder y la version de SAP que uses.
Por tu comentario anterior veo que es SAP 9.3 sobre SQL, faltaria saber la version de PowerBuilder que usas.
Creo que la solucion para la version de SAP que tienes, es crear un target .NET Windows Form (D) y referencial la DLL de SAP "SAPBusinessOneSDK.dll" , generarmente esta ubicada cuando instala SAP en la siguiente ruta C:\Program Files (x86)\sap\SAP Business One SDK\Lib\
un ejemplo seria algo asi:
//-----------------------------------------------------------------------------------------------------------------------
#if defined PBDOTNET then
TRY
// Instanciando Objeto SAP
SAPbobsCOM.CompanyClass vCompany;
vCompany = create SAPbobsCOM.CompanyClass;
vCompany.Server = gs_server_sap_new.trim();
vCompany.CompanyDB = gs_basedato_sap.trim();
vCompany.DbUserName = gs_dbusername.trim();
vCompany.DbPassword = gs_dbpassword.trim();
vCompany.UserName = gs_usuasap.trim();
vCompany.Password = gs_clavsap.trim();
vCompany.LicenseServer = gs_licenseserver.trim();
vCompany.language = SAPbobsCOM.BoSuppLangs.ln_Spanish;
// Rutina para Diferentes Base de datos
choose case gs_servertype.trim()
case "dst_MSSQL2005"
vCompany.DbServerType = SAPbobsCOM.BoDataServerTypes.dst_MSSQL2005;
case "dst_MSSQL2008"
vCompany.DbServerType = SAPbobsCOM.BoDataServerTypes.dst_MSSQL2008;
case "dst_MSSQL2012"
vCompany.DbServerType = SAPbobsCOM.BoDataServerTypes.dst_MSSQL2012;
case "dst_MSSQL2014"
vCompany.DbServerType = SAPbobsCOM.BoDataServerTypes.dst_MSSQL2014;
case "dst_MSSQL2016"
vCompany.DbServerType = SAPbobsCOM.BoDataServerTypes.dst_MSSQL2016;
case "dst_MSSQL2019"
vCompany.DbServerType = SAPbobsCOM.BoDataServerTypes.dst_MSSQL2019;
case "dst_HANA"
vCompany.DbServerType = SAPbobsCOM.BoDataServerTypes.dst_HANADB;
case else
vCompany.DbServerType = SAPbobsCOM.BoDataServerTypes.dst_MSSQL2012;
end choose
// Estableciendo conexion
Long ll_insID, lErrCode, lRetCode
string sErrMsg, st_mensaje_ok
if vCompany.Connected = false then
lRetCode = vCompany.Connect( );
If lRetCode <> 0 Then
st_espere.visible = true
vCompany.getlastError( lErrCode, sErrMsg);
MessageBox("Conexion con SAP",String(lRetCode) + ' - ' + sErrMsg ) ;
return
else
//MessageBox("Conexion", "EXITO" ) ;
End If
end if
String ls_error
catch (System.Exception ex)
ls_error = ex.Message
MessageBox('LogPass Exception Error', ls_error)
end try
#end if
//-----------------------------------------------------------------------------------------------------------------------
Saludos,
Daniel Giugliano
Gracias por tu ayuda!!
Marco