on 2019 May 06 10:02 AM
Olá amigos, sou novo aqui e estou com dificuldades em executar o script SAPGUI para conectar excel e sap, e transpor as informações corretamente.
Faço requisição pela transação ordem, preenchendo a aba operações colunas 3, 4, 5, 6 e 8 essas informações pego da planilha com script e lanço nas respetivas colunas acima no sap, até aqui beleza.
Na segunda vez, o script grava por cima da mesma linha, ou seja..
Conforme imagem exemplo abaixo, gostaria que o script localize a próxima linha vazia na coluna 8 Txt.breve operação. Para as informações da planilha ser preenchida sempre na próxima linha vazia.
Em resumo, sempre faço requisição na primeira linha vazia, preenchendo as colunas 3, 4, 5, 6 e 8, e depois tendo que selecionar esta mesma linha, para obter o registro gravado.
Acho que esta dúvida é também de outros, agradeço quem pode ajudar. 🙂

Request clarification before answering.
Boa Tarde !
Conseguiu resolver ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Bom dia!
Não sei se ainda precisa da resposta, mas eu estava com o mesmo problema descrito por você e consegui recentemente o código abaixo e para o meu caso deu certo.
O código eu consegui no ChatGPT e depois eu ajustei algumas coisas.
' Encontrar a primeira linha vazia para adicionar um novo e-mail
i = 0
Do While True
On Error Resume Next
Dim emailAtual As String
emailAtual = session.findById("wnd[1]/usr/tblSAPLSZA6T_CONTROL6/txtADSMTP-SMTP_ADDR[0," & i & "]").Text
' Se encontrar um campo vazio, insere o novo e-mail
If Err.Number <> 0 Or emailAtual = "" Then
On Error GoTo 0
Exit Do
End If
i = i + 1 ' Avança para a próxima linha
Loop
' Inserir o novo e-mail na primeira linha disponível
session.findById("wnd[1]/usr/tblSAPLSZA6T_CONTROL6/txtADSMTP-SMTP_ADDR[0," & i & "]").Text = Cells(linha, 2).Value '"ADM@xxxx.COM.BR"
session.findById("wnd[1]/usr/tblSAPLSZA6T_CONTROL6/txtADSMTP-REMARK[3," & i & "]").Text = Cells(linha, 3).Value '"FINANCEIRO"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Boa tarde Maicon, ainda não, pode me ajudar?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 11 | |
| 6 | |
| 6 | |
| 4 | |
| 3 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.