Como Usar a Função FWGetSX5 Para Obter Registros da SX5 do Protheus

Tempo de leitura: 2 minutos

Olá, no post de hoje iremos falar da função FWGetSX5 do ADVPL. A função FWGetSX5 é uma das funções de manipulação das tabelas genéricas SX5 do Protheus e tem por finalidade obter o registros da SX5 de acordo com os parâmetros passados. Ela retorna um array bidimensional conforme o exemplo abaixo:

  • Array com os dados do SX5 retornado:
    • [n][1] FILIAL
    • [n][2] TABELA
    • [n][3] CHAVE
    • [n][4] DESCRICAO

Objetivo:

Retornar registros das tabelas genéricas SX5 do Protheus.

Sintaxe:

FWGetSX5 ( < cTab >, [ cChave ] , [cIdiom] ) → aDadosSX5

Parâmetros:

Retorno
aDadosSX5 (Array de caracteres)

Logo abaixo temos um código ADVPL explicando a utilização da função FWGetSX5:

#include 'protheus.ch'
#include "tbiconn.ch"
#DEFINE CRLF Chr(13)+Chr(10)

/*{Protheus.doc} User Function fFWGSX5
    (Essa função tem por finalidade mostrar a função FWGetSX5 em ADVPL/TL++ para 
obter o conteúdo de registros das tabelas genéricas SX5 do TOTVS Protheus)
    @type  Function
    @author Adilio Costa
    @since 27/06/2023
    @version Protheus 12.1.2210
    @site https://www.protheusadvpl.com.br
    @canal https://www.youtube.com/protheusadvpl
    @instagram https://www.instagram.com/protheusadvpl
    @Portal ProtheusAdvpl:https://hotmart.com/pt-br/marketplace/produtos/portal-protheusadvpl/O10336806O
*/

User Function fFWGSX5()
	Local aDadosSX5 := {}
	Local nX
	Local cFil := ""
	Local cTab := ""
	Local cChave := ""
	Local cDesc := ""

//Abro o ambiente
	//RpcSetType(3)
//PREPARE ENVIRONMENT EMPRESA "99" FILIAL "01" MODULO "COM"

//Obtém os dados da tabela 01 na SX5
	aDadosSX5 := FWGetSX5("01")

	For nX:=1 To Len(aDadosSX5)
		//Obtém a filial(X5_FILIAL)
		cFil := aDadosSX5[nX][1]
		//Obtém a tabela(X5_TABELA)
		cTab := aDadosSX5[nX][2]
		//Obtém a chave(X5_CHAVE)
		cChave := aDadosSX5[nX][3]
		//Obtém a descrição(X5_DESCRI)
		cDesc := aDadosSX5[nX][4]

		//Exibe no console.log
		ConOut("SX5->X5_FILIAL:'" + cFil + "', SX5->X5_TABELA:'" + cTab + "', SX5->X5_CHAVE:'" + cChave + "' , SX5->X5_DESCRI:'" + cDesc + "'")
	Next nX

Return

Abaixo temos o console.log(gerado dentro do TOTVS AppServer) mostrando os registros da SX5 através da função FWGetSX5:

Registros da SX5 sendo mostrado no console.log

 

Bem, por hoje finalizamos mais um post aqui do Blog/Site ProtheusAdvpl. Espero que você tenha entendido. Se tiver ficado alguma dúvida deixe seu comentário ou mande um e-mail para adiliocosta@protheusadvpl.com.br. Grande abraço e fica com Deus.

 

Links de referências:

Receba as últimas atualizações do ProtheusAdvpl
Deixe seu melhor email
Nós respeitamos sua privacidade.

17 Comentários


  1. What’s up, after reading this awesome piece of writing i am too glad to share my familiarity here with friends.


  2. I am extremely inspired together with your writing skills and alsosmartly as with the layout for your blog. Is this a paid subject or did you customize it yourself? Either way stay up the nice quality writing, it’s rare to see a nice blog like this one these days..


  3. It is appropriate time to make some plans for the future and it is time to be happy. I have read this post and if I could I want to suggest you few interesting things or suggestions. Perhaps you could write next articles referring to this article. I want to read more things about it!


  4. If some one needs expert view about blogging after that i propose him/her to pay a visit this website, Keep up the nice job.


  5. Howdy! I know this is kinda off topic however I’d figured I’d ask. Would you be interested in exchanging links or maybe guest writing a blog article or vice-versa? My site discusses a lot of the same subjects as yours and I feel we could greatly benefit from each other. If you are interested feel free to send me an e-mail. I look forward to hearing from you! Superb blog by the way!


  6. I’ve read some good stuff here. Definitely worth bookmarking for revisiting. I wonder how so much attempt you set to create any such magnificent informative web site.


  7. Hey there, I think your blog might be having browser compatibility issues. When I look at your blog in Firefox, it looks fine but when opening in Internet Explorer, it has some overlapping. I just wanted to give you a quick heads up! Other then that, fantastic blog!


  8. I’ve been exploring for a little for any high-quality articles or blog posts in this kind of space . Exploring in Yahoo I finally stumbled upon this web site. Reading this info So i’m glad to exhibit that I have a very just right uncanny feeling I came upon exactly what I needed. I such a lot definitely will make certain to don?t put out of your mind this web site and give it a look on a constant basis.


  9. Hi there, I log on to your new stuff regularly. Your writing style is awesome, keep up the good work!


  10. Hmm is anyone else having problems with the images on this blog loading? I’m trying to figure out if its a problem on my end or if it’s the blog. Any feedback would be greatly appreciated.


  11. I am curious to find out what blog system you are working with? I’m experiencing some minor security problems with my latest site and I would like to find something more safe. Do you have any suggestions?


  12. Good day! I could have sworn I’ve been to this blog before but after reading through some of the post I realized it’s new to me. Anyways, I’m definitely happy I found it and I’ll be bookmarking and checking back often!


  13. My spouse and I stumbled over here different web page and thought I might check things out. I like what I see so now i’m following you. Look forward to looking over your web page for a second time.

Comentários encerrados.