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 />

• ExistDeletedLines.<br />

Ejemplo:<br />

Creamos un objeto Presupuesto e intentamos simular el mismo funcionamiento que un<br />

documento <strong>de</strong> la DI <strong>de</strong> SAP. Tendremos varios campos entre ellos el código <strong>de</strong> cliente y el<br />

nombre. Deberemos tener las siguientes restricciones:<br />

1. Para entrar una Presupuesto es obligatorio entrar el código <strong>de</strong> cliente.<br />

2. El código <strong>de</strong> cliente y el nombre no pue<strong>de</strong>n modificarse una vez creado el Presupuesto.<br />

3. El valor <strong>de</strong>l código <strong>de</strong> cliente <strong>de</strong>be existir en la tabla <strong>de</strong> clientes [OCRD.CardCo<strong>de</strong>]<br />

4. Una vez creado el Presupuesto no se permitirá añadir nuevas líneas ni eliminarlas.<br />

Public Class Presupuesto<br />

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

'...<br />

_<br />

_<br />

_<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 />

_<br />

Public Property CardName() As String<br />

Get<br />

Return Me.FilaActual("U_GSP_CardName")<br />

End Get<br />

Set(ByVal Value As String)<br />

Me.FilaActual("U_GSP_CardName") = Value<br />

End Set<br />

End Property<br />

Private Sub Oferta_Updating(ByVal Obj As SAPObject) Handles<br />

Me.Updating<br />

If Me.ExistAd<strong>de</strong>dLines(Me.Lines) Then<br />

Throw New ValidationException("No se pue<strong>de</strong> añadir<br />

una línea una vez creado el<br />

documento")<br />

End If<br />

If Me.ExistDeletedLines(Me.Lines) Then<br />

Throw New ValidationException("No se pue<strong>de</strong> borrar una<br />

fila una vez creado el<br />

documento ")<br />

12

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

Saved successfully!

Ooh no, something went wrong!