* & ------------------------------------------------ --------------------- *
* & Report Z_AFL_ALV_ATUALIZAVEL
* &
* & ------------------------------------------------ --------------------- *
* &
* &
* & ------------------------------------------------ --------------------- *
RELATÓRIO Z_AFL_ALV_ATUALIZAVEL.
* ALV Editável / Tab Atualização. Transparente
"Conjunto de TIPOS
TIPO-PISCINAS: SLIS.
"TIPOS
TIPOS:
COMEÇAR DE ty_selfield,
índice TYPE slis_selfield-tabindex,
FIM DO ty_selfield.
"Estruturas e Tabelas Internas
DATA:
it_out TYPE TABLE OF SFLIGHT,
st_out TIPO SFLIGHT,
it_index TYPE TABLE OF ty_selfield,
st_index TIPO ty_selfield.
"Estruturas e Tabelas intenas (ALV)
DATA:
it_fieldcat TYPE TABLE OF slis_fieldcat_alv,
st_layout TIPO slis_layout_alv.
"fiels-símbolos
* O campo-símbolos:
* TIPO slis_fieldcat_alv.
START-OF-SELECTION.
"Faz o seleccionar da Tabela.
EXECUTAR: f_select,
"Mostra ALV com sistema operacional Dados
f_alv.
FIM DE SELEÇÃO.
* & ------------------------------------------------ --------------------- *
* & Form F_SELECT
* & ------------------------------------------------ --------------------- *
F_select FORM.
SELECIONE *
DE SFLIGHT
INTO TABLE it_out
ONDE carrid = 'AA'.
ENDFORM. "F_SELECT
* & ------------------------------------------------ --------------------- *
* & Form F_ALV
* & ------------------------------------------------ --------------------- *
F_alv FORM.
"Criação da Tabela Contendo como Informations dos Campos Que Serao mostrados não ALV
EXECUTAR: f_fieldcat,
"Criação da Estrutura Contendo Informations que fazer o layout ALV
f_layout.
"Criação fazer ALV
EXECUTAR: f_relatorio TABELAS it_fieldcat
it_out
UTILIZAÇÃO sy-repid
'F_SET_PF_STATUS'
'F_USER_COMMAND'
st_layout.
ENDFORM. "F_ALV
* & ------------------------------------------------ --------------------- *
* & Form F_FIELDCAT
* & ------------------------------------------------ --------------------- *
F_fieldcat FORM.
"Função de para trazer OS Dados dos Campos fazer ALV baseada n'uma Tabela transparente.
Função de chamada de 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTAÇÃO
i_structure_name = 'SFLIGHT'
MUDANÇA
ct_fieldcat = it_fieldcat
EXCEÇÕES
inconsistent_interface = 1
Program_Error = 2
OUTROS = 3.
IF sy-SUBRC <> 0.
MENSAGEM ID sy-msgid tipo de número sy-MSGTY sy-MSGNO
COM sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. "F_FIELDCAT
* & ------------------------------------------------ --------------------- *
* & Form F_LAYOUT
* & ------------------------------------------------ --------------------- *
F_layout FORM.
st_layout-zebra = 'X'.
st_layout-colwidth_optimize = 'X'.
ENDFORM. "F_LAYOUT
* & ------------------------------------------------ --------------------- *
* & Form F_FUNCTION
* & ------------------------------------------------ --------------------- *
FORMULÁRIO f_relatorio TABELAS fieldcat
outtab
UTILIZAÇÃO repid
estado
comando
traçado
.
Função de chamada de 'REUSE_ALV_GRID_DISPLAY'
EXPORTAÇÃO
i_callback_program = repid
i_callback_pf_status_set = Estado
i_callback_user_command = comando
is_layout = disposição
it_fieldcat fieldcat = []
i_save = 'X'
TABELAS
t_outtab = outtab
EXCEÇÕES
Program_Error = 1
OUTROS = 2.
IF sy-SUBRC <> 0.
MENSAGEM ID sy-msgid tipo de número sy-MSGTY sy-MSGNO
COM sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. "F_FUNCTION
* & ------------------------------------------------ --------------------- *
* & Form SET_PF_STATUS
* & ------------------------------------------------ --------------------- *
* Ajuste personalizado PF-Estado
* ------------------------------------------------- --------------------- *
* -> Mesa RT_EXTAB Excluindo
* ------------------------------------------------- --------------------- *
FORMULÁRIO DE USAR f_set_pf_status rt_extab TIPO slis_t_extab.
SET PF-STATUS 'Z_STANDARD'.
ENDFORM. "SET_PF_STATUS
* & ------------------------------------------------ --------------------- *
* & Form user_command
* & ------------------------------------------------ --------------------- *
* Códigos de função personalizado Manipulação
* ------------------------------------------------- --------------------- *
* -> Valor de código R_UCOMM Função
* -> RS_SELFIELD Info. da posição do cursor em ALV
* ------------------------------------------------- --------------------- *
FORMULÁRIO f_user_command USAR COMO vl_ucomm sy-ucomm
st_selfield TIPO slis_selfield.
"Declarações das Variáveis CRP
DATA:
it_out_temp TYPE TABLE OF SFLIGHT,
st_out_temp TIPO SFLIGHT,
it_fieldcat_temp TYPE TABLE OF slis_fieldcat_alv,
st_fieldcat_temp TIPO slis_fieldcat_alv.
BREAK-POINT.
"Verifica uma Ação Favoritos Looks Favoritos.
Vl_ucomm CASE.
"Caso o Looks Favoritos tenha selecionado hum Registro não ALV.
QUANDO 'e IC1.
* Trata fieldcat parágrafos corrediças abertas parágrafos Edição de Todos os campos EXCETO OS campos chaves
it_fieldcat_temp = it_fieldcat.
st_fieldcat_temp-edit = 'X'.
MODIFICAR it_fieldcat_temp DE st_fieldcat_temp
TRANSPORTE edição
ONDE ESTÁ chave inicial.
* Dados Trata do Registro selecionado.
Ler a tabela it_out INTO st_out
ÍNDICE st_selfield-tabindex.
APPEND st_out TO it_out_temp.
* Cria hum novo ALV usando o MESMO executar tão Que da SEM User_command e Com. Tabelas <>.
EXECUTAR: f_relatorio TABELAS it_fieldcat_temp
it_out_temp
UTILIZAÇÃO sy-repid
''
''
st_layout.
BREAK-POINT.
Não "Se o Botão 'SALVAR' para pressionado entao uma modificação Localidade: Não Ira serviços
"Atualizado na Tabela 'IT_OUT_TEMP'.
"Verifica O Primeiro (e Unico) Registro da Tabela
Ler a tabela it_out_temp INTO st_out_temp
ÍNDICE 1.
"Verifica se ESSE FOI Registro Modificado.
IF st_out_temp <> st_out.
"Atualiza com a Tabela interna como Informations modificadas
MODIFICAR it_out DE st_out_temp
ÍNDICE st_selfield-tabindex.
"Mover A Informação da Linha do Registro parágrafo UMA Estrutura Opaco aliemnta uma Tabela
MOVER st_selfield-tabindex TO st_index-index.
APPEND st_index TO it_index.
ENDIF.
"Muito Importante Este Comando POIs ISSO atualiza como alterações feitas na Tabela,
"Mostra e não ALV.
st_selfield-refresh = 'X'.
"Caso o Looks Favoritos tenha clicado no Botão" SALVAR ".
QUANDO "SAVE".
"Verifica se alteração Teve.
SE NÃO É it_index INICIAL.
LOOP AT it_index INTO st_index.
"Lê a principal Tabela não Informado Registro na Tabela de Registros modiicados.
Ler a tabela it_out INTO st_out
ÍNDICE st_index-index.
"Mover OS Dados da Estrutura Modificada parágrafo UMA Estrutura Temporária local.
Move-CORRESPONDENTE AO st_out st_out_temp.
"Alimenta UMA TABELA COM REGISTROS auxiliar OS ALTERADOS.
APPEND st_out_temp TO it_out_temp.
ENDLOOP.
"Usa uma Tabela alimentada com sistema operacional Registros Modificados e atualiza a Tabela transparente.
"Muito Cuidado EM USAR essas Coisas de atualizar, Incluir e excluir Dados de Tabelas
"Transparente.
MODIFICAR SFLIGHT DE TABELA it_out_temp.
MENSAGEM 'A Tabela SFLIGHT FOI alterada com Sucesso' TYPE 'S'.
"Caso nao Teve alteração - Mostra uma MENSAGEM
MAIS.
MENSAGEM 'A Tabela SFLIGHT Localidade: Não Teve alteração! TIPO 'W'.
ENDIF.
"Caso o Looks Favoritos tenha clicado no Botão 'SAIR' 'BACK' UO
QUANDO 'BACK' OR 'SAIR'.
Sair do programa.
"QUALQUÉR Outro Caso.
QUANDO OUTROS.
ENDCASE.
ENDFORM. "User_command
* & Report Z_AFL_ALV_ATUALIZAVEL
* &
* & ------------------------------------------------ --------------------- *
* &
* &
* & ------------------------------------------------ --------------------- *
RELATÓRIO Z_AFL_ALV_ATUALIZAVEL.
* ALV Editável / Tab Atualização. Transparente
"Conjunto de TIPOS
TIPO-PISCINAS: SLIS.
"TIPOS
TIPOS:
COMEÇAR DE ty_selfield,
índice TYPE slis_selfield-tabindex,
FIM DO ty_selfield.
"Estruturas e Tabelas Internas
DATA:
it_out TYPE TABLE OF SFLIGHT,
st_out TIPO SFLIGHT,
it_index TYPE TABLE OF ty_selfield,
st_index TIPO ty_selfield.
"Estruturas e Tabelas intenas (ALV)
DATA:
it_fieldcat TYPE TABLE OF slis_fieldcat_alv,
st_layout TIPO slis_layout_alv.
"fiels-símbolos
* O campo-símbolos:
* TIPO slis_fieldcat_alv.
START-OF-SELECTION.
"Faz o seleccionar da Tabela.
EXECUTAR: f_select,
"Mostra ALV com sistema operacional Dados
f_alv.
FIM DE SELEÇÃO.
* & ------------------------------------------------ --------------------- *
* & Form F_SELECT
* & ------------------------------------------------ --------------------- *
F_select FORM.
SELECIONE *
DE SFLIGHT
INTO TABLE it_out
ONDE carrid = 'AA'.
ENDFORM. "F_SELECT
* & ------------------------------------------------ --------------------- *
* & Form F_ALV
* & ------------------------------------------------ --------------------- *
F_alv FORM.
"Criação da Tabela Contendo como Informations dos Campos Que Serao mostrados não ALV
EXECUTAR: f_fieldcat,
"Criação da Estrutura Contendo Informations que fazer o layout ALV
f_layout.
"Criação fazer ALV
EXECUTAR: f_relatorio TABELAS it_fieldcat
it_out
UTILIZAÇÃO sy-repid
'F_SET_PF_STATUS'
'F_USER_COMMAND'
st_layout.
ENDFORM. "F_ALV
* & ------------------------------------------------ --------------------- *
* & Form F_FIELDCAT
* & ------------------------------------------------ --------------------- *
F_fieldcat FORM.
"Função de para trazer OS Dados dos Campos fazer ALV baseada n'uma Tabela transparente.
Função de chamada de 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTAÇÃO
i_structure_name = 'SFLIGHT'
MUDANÇA
ct_fieldcat = it_fieldcat
EXCEÇÕES
inconsistent_interface = 1
Program_Error = 2
OUTROS = 3.
IF sy-SUBRC <> 0.
MENSAGEM ID sy-msgid tipo de número sy-MSGTY sy-MSGNO
COM sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. "F_FIELDCAT
* & ------------------------------------------------ --------------------- *
* & Form F_LAYOUT
* & ------------------------------------------------ --------------------- *
F_layout FORM.
st_layout-zebra = 'X'.
st_layout-colwidth_optimize = 'X'.
ENDFORM. "F_LAYOUT
* & ------------------------------------------------ --------------------- *
* & Form F_FUNCTION
* & ------------------------------------------------ --------------------- *
FORMULÁRIO f_relatorio TABELAS fieldcat
outtab
UTILIZAÇÃO repid
estado
comando
traçado
.
Função de chamada de 'REUSE_ALV_GRID_DISPLAY'
EXPORTAÇÃO
i_callback_program = repid
i_callback_pf_status_set = Estado
i_callback_user_command = comando
is_layout = disposição
it_fieldcat fieldcat = []
i_save = 'X'
TABELAS
t_outtab = outtab
EXCEÇÕES
Program_Error = 1
OUTROS = 2.
IF sy-SUBRC <> 0.
MENSAGEM ID sy-msgid tipo de número sy-MSGTY sy-MSGNO
COM sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. "F_FUNCTION
* & ------------------------------------------------ --------------------- *
* & Form SET_PF_STATUS
* & ------------------------------------------------ --------------------- *
* Ajuste personalizado PF-Estado
* ------------------------------------------------- --------------------- *
* -> Mesa RT_EXTAB Excluindo
* ------------------------------------------------- --------------------- *
FORMULÁRIO DE USAR f_set_pf_status rt_extab TIPO slis_t_extab.
SET PF-STATUS 'Z_STANDARD'.
ENDFORM. "SET_PF_STATUS
* & ------------------------------------------------ --------------------- *
* & Form user_command
* & ------------------------------------------------ --------------------- *
* Códigos de função personalizado Manipulação
* ------------------------------------------------- --------------------- *
* -> Valor de código R_UCOMM Função
* -> RS_SELFIELD Info. da posição do cursor em ALV
* ------------------------------------------------- --------------------- *
FORMULÁRIO f_user_command USAR COMO vl_ucomm sy-ucomm
st_selfield TIPO slis_selfield.
"Declarações das Variáveis CRP
DATA:
it_out_temp TYPE TABLE OF SFLIGHT,
st_out_temp TIPO SFLIGHT,
it_fieldcat_temp TYPE TABLE OF slis_fieldcat_alv,
st_fieldcat_temp TIPO slis_fieldcat_alv.
BREAK-POINT.
"Verifica uma Ação Favoritos Looks Favoritos.
Vl_ucomm CASE.
"Caso o Looks Favoritos tenha selecionado hum Registro não ALV.
QUANDO 'e IC1.
* Trata fieldcat parágrafos corrediças abertas parágrafos Edição de Todos os campos EXCETO OS campos chaves
it_fieldcat_temp = it_fieldcat.
st_fieldcat_temp-edit = 'X'.
MODIFICAR it_fieldcat_temp DE st_fieldcat_temp
TRANSPORTE edição
ONDE ESTÁ chave inicial.
* Dados Trata do Registro selecionado.
Ler a tabela it_out INTO st_out
ÍNDICE st_selfield-tabindex.
APPEND st_out TO it_out_temp.
* Cria hum novo ALV usando o MESMO executar tão Que da SEM User_command e Com. Tabelas <>.
EXECUTAR: f_relatorio TABELAS it_fieldcat_temp
it_out_temp
UTILIZAÇÃO sy-repid
''
''
st_layout.
BREAK-POINT.
Não "Se o Botão 'SALVAR' para pressionado entao uma modificação Localidade: Não Ira serviços
"Atualizado na Tabela 'IT_OUT_TEMP'.
"Verifica O Primeiro (e Unico) Registro da Tabela
Ler a tabela it_out_temp INTO st_out_temp
ÍNDICE 1.
"Verifica se ESSE FOI Registro Modificado.
IF st_out_temp <> st_out.
"Atualiza com a Tabela interna como Informations modificadas
MODIFICAR it_out DE st_out_temp
ÍNDICE st_selfield-tabindex.
"Mover A Informação da Linha do Registro parágrafo UMA Estrutura Opaco aliemnta uma Tabela
MOVER st_selfield-tabindex TO st_index-index.
APPEND st_index TO it_index.
ENDIF.
"Muito Importante Este Comando POIs ISSO atualiza como alterações feitas na Tabela,
"Mostra e não ALV.
st_selfield-refresh = 'X'.
"Caso o Looks Favoritos tenha clicado no Botão" SALVAR ".
QUANDO "SAVE".
"Verifica se alteração Teve.
SE NÃO É it_index INICIAL.
LOOP AT it_index INTO st_index.
"Lê a principal Tabela não Informado Registro na Tabela de Registros modiicados.
Ler a tabela it_out INTO st_out
ÍNDICE st_index-index.
"Mover OS Dados da Estrutura Modificada parágrafo UMA Estrutura Temporária local.
Move-CORRESPONDENTE AO st_out st_out_temp.
"Alimenta UMA TABELA COM REGISTROS auxiliar OS ALTERADOS.
APPEND st_out_temp TO it_out_temp.
ENDLOOP.
"Usa uma Tabela alimentada com sistema operacional Registros Modificados e atualiza a Tabela transparente.
"Muito Cuidado EM USAR essas Coisas de atualizar, Incluir e excluir Dados de Tabelas
"Transparente.
MODIFICAR SFLIGHT DE TABELA it_out_temp.
MENSAGEM 'A Tabela SFLIGHT FOI alterada com Sucesso' TYPE 'S'.
"Caso nao Teve alteração - Mostra uma MENSAGEM
MAIS.
MENSAGEM 'A Tabela SFLIGHT Localidade: Não Teve alteração! TIPO 'W'.
ENDIF.
"Caso o Looks Favoritos tenha clicado no Botão 'SAIR' 'BACK' UO
QUANDO 'BACK' OR 'SAIR'.
Sair do programa.
"QUALQUÉR Outro Caso.
QUANDO OUTROS.
ENDCASE.
ENDFORM. "User_command
Nenhum comentário:
Postar um comentário