¡Caminando hacia el éxito!

Aprende en Comunidad

Avalados por :

Como gerar um arquivo .csv diretamente de um relatório ABAP

  • Creado 01/03/2024
  • Modificado 01/03/2024
  • 85 Vistas
0
Cargando...

Olá

Temos um requisito para gerar um arquivo .csv a partir de um relatório abap.

Atualmente, o usuário salva os dados do relatório abap em uma planilha (.xls) na área de trabalho. Em seguida, abre o arquivo do Excel e o salva no formato .csv. É necessária a opção de salvar diretamente no formato .csv em vez de .xls.

Por favor, avise-me se houver alguma função padrão disponível para criar um arquivo .csv.

Saudações

Uma

Pedro Pascal
Se unió el 07/03/2018
Pinterest
Telegram
Linkedin
Whatsapp

4 Respuestas

0
Cargando...

Desculpe,

substituir

data: csv_converted_table type table of TRUXS_T_TEXT_DATA.

com

data: csv_converted_table TYPE  truxs_t_text_data.

Editado por: alessandro spadoni em 22 de março de 2011 às 14:41

Respondido el 15/04/2024
LUCIANO RIOJA GHIOTTO
Se unió el 13/07/2019
0
Cargando...

Tente com seu código e vai falhar

REPORT ZTEMP101 message-id 00.

tables: lfa1.

types: begin of t_lfa1,

lifnr like lfa1-lifnr,

name1 like lfa1-name1,

end of t_lfa1.

data: i_lfa1 type standard table of t_lfa1,

wa_lfa1 type t_lfa1.

types truxs_t_text_data(4096) type c occurs 0.

data: csv_converted_table type table of TRUXS_T_TEXT_DATA.

select-options: s_lifnr for lfa1-lifnr.

select lifnr name1 from lfa1 into table i_lfa1

where lifnr in s_lifnr.

CALL FUNCTION 'SAP_CONVERT_TO_CSV_FORMAT'

EXPORTING

I_FIELD_SEPERATOR = ';'

  • I_LINE_HEADER =

  • I_FILENAME =

  • I_APPL_KEEP = ' '

TABLES

I_TAB_SAP_DATA = I_LFA1

CHANGING

I_TAB_CONVERTED_DATA = csv_converted_table

EXCEPTIONS

CONVERSION_FAILED = 1

OTHERS = 2

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

CALL FUNCTION 'WS_DOWNLOAD'

EXPORTING

  • BIN_FILESIZE = ' '

  • CODEPAGE = ' '

FILENAME =

'C:\Documents and Settings\ps12\Desktop\Test folder\exl.cvs'

  • FILETYPE = 'DAT'

  • MODE = ' '

  • WK1_N_FORMAT = ' '

  • WK1_N_SIZE = ' '

  • WK1_T_FORMAT = ' '

  • WK1_T_SIZE = ' '

  • COL_SELECT = ' '

  • COL_SELECTMASK = ' '

  • NO_AUTH_CHECK = ' '

  • IMPORTING

  • FILELENGTH =

TABLES

DATA_TAB = csv_converted_table

  • FIELDNAMES =

  • EXCEPTIONS

  • FILE_OPEN_ERROR = 1

  • FILE_WRITE_ERROR = 2

  • INVALID_FILESIZE = 3

  • INVALID_TYPE = 4

  • NO_BATCH = 5

  • UNKNOWN_ERROR = 6

  • INVALID_TABLE_WIDTH = 7

Respondido el 15/04/2024
LUCIANO RIOJA GHIOTTO
Se unió el 13/07/2019
0
Cargando...

Olá Uma, aqui está um exemplo:


types truxs_t_text_data(4096) type c occurs 0.
data: csv_converted_table type table of TRUXS_T_TEXT_DATA.

START-OF-SELECTION.

call function 'SAP_CONVERT_TO_CSV_FORMAT'
 exporting
   i_field_seperator          = ';'
*   I_LINE_HEADER              =
*   I_FILENAME                 = ''
*   I_APPL_KEEP                = ' '
  tables
    i_tab_sap_data             = internal_table
 changing
   i_tab_converted_data       = csv_converted_table
 exceptions
   conversion_failed          = 1
   others                     = 2
          .

CALL FUNCTION 'GUI_DOWNLOAD'
  EXPORTING
filename                        = 'C:\example.csv'
  tables
    data_tab                        = csv_converted_table.


Editado por: Alessandro Spadoni em 22 de março de 2011 às 12:43 PM

Respondido el 15/04/2024
LUCIANO RIOJA GHIOTTO
Se unió el 13/07/2019
0
Cargando...

Olá Uma, aqui está um exemplo


types truxs_t_text_data(4096) type c occurs 0.
data: csv_converted_table type table of TRUXS_T_TEXT_DATA.

START-OF-SELECTION.

call function 'SAP_CONVERT_TO_CSV_FORMAT'
 exporting
   i_field_seperator          = ';'
*   I_LINE_HEADER              =
*   I_FILENAME                 = ''
*   I_APPL_KEEP                = ' '
  tables
    i_tab_sap_data             = internal_table
 changing
   i_tab_converted_data       = csv_converted_table
 exceptions
   conversion_failed          = 1
   others                     = 2
          .

CALL FUNCTION 'GUI_DOWNLOAD'
  EXPORTING
filename                        = 'C:\example.csv'
  tables
    data_tab                        = csv_converted_table.


Editado por: Alessandro Spadoni em 22 de março de 2011 às 12:43 PM

Respondido el 15/04/2024
LUCIANO RIOJA GHIOTTO
Se unió el 13/07/2019

contacto@primeinstitute.com

(+51) 1641 9379
(+57) 1489 6964

© 2024 Copyright. Todos los derechos reservados.

Desarrollado por Prime Institute

¡Hola! Soy Diana, asesora académica de Prime Institute, indícame en que curso estas interesado, saludos!
Hola ¿Puedo ayudarte?