Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 2800

Re: Lines in Massage Box

$
0
0

Solved,

 

Public Sub EnviaemailCancel(ByVal oDataTable As SAPbouiCOM.DataTable, ByVal sCardCode As String, ByVal ToCP As String, ByVal ToEmail As String, ByVal _subject As String, ByVal _message As String, ByVal Docnum As String, ByVal NomeUsuario As String)

    Dim oPedidos As New List(Of Item)

    Dim one As New Item

    one.DocEntry = "DocEntry"

    one.Dscription = "Pedido de Venda"

    oPedidos.Add(one)

 

 

 

 

    Try

 

 

 

 

      For i As Integer = 0 To oDataTable.Rows.Count - 1

        oPedidos.Add(New Item With {.DocEntry = oDataTable.Columns.Item("DocEntry").Cells.Item(i).Value, .Dscription = "Pedidos " & i.ToString})

      Next

 

 

 

 

      Dim oCmpSvc As SAPbobsCOM.CompanyService = oCompany.GetCompanyService()

      Dim oMsgSvc As SAPbobsCOM.MessagesService = oCmpSvc.GetBusinessService(ServiceTypes.MessagesService)

      Dim oMsg As SAPbobsCOM.Message = oMsgSvc.GetDataInterface(MessagesServiceDataInterfaces.msdiMessage)

      oMsg.Subject = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")

      oMsg.Text = "Cancelamento de Pedidos"

      Dim oMsgDataColumn As SAPbobsCOM.MessageDataColumn

      If oPedidos.Count > 0 Then

        oMsgDataColumn = oMsg.MessageDataColumns.Add()

        oMsgDataColumn.ColumnName = "Documentos Cancelados"

        oMsgDataColumn.Link = BoYesNoEnum.tYES

        'For Each onePedido As Item In oPedidos

        For i As Integer = 1 To oPedidos.Count - 1

          Dim oMsgDataLine As SAPbobsCOM.MessageDataLine = oMsgDataColumn.MessageDataLines.Add()

          oMsgDataLine.Object = "17"

          'oMsgDataLine.ObjectKey = onePedido.DocEntry

          'oMsgDataLine.Value = onePedido.Dscription

          oMsgDataLine.ObjectKey = oPedidos.Item(i).DocEntry

          oMsgDataLine.Value = oPedidos.Item(i).Dscription

        Next

        oMsgDataColumn = oMsg.MessageDataColumns.Add()

        oMsgDataColumn.ColumnName = "Cancelamento de Pedidos"

        oMsgDataColumn.Link = BoYesNoEnum.tNO

        For i As Integer = 1 To oPedidos.Count - 1

          Dim oMsgDataLine As SAPbobsCOM.MessageDataLine = oMsgDataColumn.MessageDataLines.Add()

          oMsgDataLine.Value = "Pedido de Venda Cancelado: Nº:'" & oPedidos.Item(i).DocEntry.ToString & "' "

        Next

      End If

      Dim oMsgRecipient As SAPbobsCOM.Recipient = oMsg.RecipientCollection.Add()

      oMsgRecipient.UserCode = sCardCode.ToString

      oMsgRecipient.SendInternal = BoYesNoEnum.tYES

      oMsgRecipient.SendEmail = BoYesNoEnum.tNO

      oMsgSvc.SendMessage(oMsg)

 

 

 

 

      MsgBox("SAP B1 internal Message sent...")

    Catch ex As Exception

      MsgBox(ex.ToString)

    End Try

 

 

 

 

  End Sub


Viewing all articles
Browse latest Browse all 2800

Trending Articles