10.05.2013 Views

Manual de programador _ControlsSAP.pdf

Manual de programador _ControlsSAP.pdf

Manual de programador _ControlsSAP.pdf

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>ControlsSAP</strong> Framework ®<br />

Public Class Contract<br />

Inherits <strong>ControlsSAP</strong>.SAPObject<br />

End Sub<br />

Public Sub New(ByVal Company As SAPbobsCOM.Company)<br />

MyBase.New(Company, "@GSP_CNTR")<br />

End Sub<br />

Protected Overri<strong>de</strong>s Function InitializeLines() As Long<br />

End Function<br />

Protected Overri<strong>de</strong>s Sub ModifyingObject()<br />

Listado 1: Ejemplo <strong>de</strong> creación <strong>de</strong> un objeto <strong>de</strong> negocio maestro.<br />

Después solamente <strong>de</strong>beremos crear una propiedad por cada campo <strong>de</strong> la tabla que vayamos a<br />

publicar. Para obtener o asignar el valor <strong>de</strong>l campo <strong>de</strong>l registro actual utilizaremos la función<br />

FilaActual(nombre_campo).<br />

Public ReadOnly Property Co<strong>de</strong>() As String<br />

Get<br />

Return Me.FilaActual("Co<strong>de</strong>")<br />

End Get<br />

End Property<br />

Public Property CardCo<strong>de</strong>() As String<br />

Get<br />

Return Me.FilaActual("U_GSP_CardCo<strong>de</strong>")<br />

End Get<br />

Set(ByVal value As String)<br />

Me.FilaActual("U_GSP_CardCo<strong>de</strong>") = Value<br />

End Set<br />

End Property<br />

Listado 2: Ejemplo <strong>de</strong> creación <strong>de</strong> propieda<strong>de</strong>s en objeto <strong>de</strong> negocio.<br />

Si no se especifica ningún valor para el campo Name (que crea en todas las tablas SAP) se le<br />

asignará el mismo valor que contenga el campo Co<strong>de</strong>, que por <strong>de</strong>fecto será el campo clave.<br />

2.3 Creación <strong>de</strong> los objetos <strong>de</strong>talle (SAPLines)<br />

Para crear un objeto <strong>de</strong>talle <strong>de</strong>beremos crear una nueva clase que here<strong>de</strong> <strong>de</strong><br />

<strong>ControlsSAP</strong>.SAPLines. Esta clase será muy parecida a la <strong>de</strong>l SAPObject pero con las<br />

particularida<strong>de</strong>s <strong>de</strong> trabajar con objetos <strong>de</strong> líneas parecidos a los <strong>de</strong> la DI <strong>de</strong> SAP.<br />

8

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!