¡Caminando hacia el éxito!

Aprende en Comunidad

Avalados por :

Como carregar um arquivo do Excel em uma tabela interna no SAP ABAP de forma eficiente

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

Olá,

Tenho um arquivo do Excel que precisa ser carregado na tabela interna.

Mas esta FM precisa do parâmetro de importação conforme mostrado abaixo:

CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'

EXPORTING

FILENAME = i_file

I_BEGIN_COL = C1

I_BEGIN_ROW = R1

I_END_COL = Cn

I_END_ROW = <b>??</b>

TABLES

INTERN = itab

.

Tenho o nome do arquivo, tenho a tabela interna. Mas para outros parâmetros, begin_col, begin_row e end_col, posso passar sem problemas.

Porém, não sei quantos registros haverá no arquivo do Excel a menos que seja carregado na minha tabela interna itab.

E é obrigatório fornecer <b>i_end_row</b>, o qual desconheço.

Por favor, sugira-me como posso carregar o conteúdo em itab.

Agradeço antecipadamente,

Ishaq.

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

4 Respuestas

0
Cargando...

°Olá!

Utilizei esta FM, onde forneci 200 para "End Column" e 5000 para a rowen

chamar a função 'ALSM_EXCEL_TO_INTERNAL_TABLE'

exportação

nome do arquivo = arquivo

i_begin_col = '1'

i_begin_row = '1'

i_end_col = '200'

i_end_row = '5000'.

Pode fornecer qualquer coisa, sem problemas..

Pontos de recompensa se for útil.

Obrigado,

Manjunath MS

intern = xcel

exceções

parâmetros inconsistentes = 1

upload_ole = 2

outros = 3.

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

DATA:iexcel TYPE TABLE OF alsmex_tabline WITH HEADER LINE.

CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'

EXPORTING

filename = path1

i_begin_col = 1

i_begin_row = 1

i_end_col = 4

i_end_row = 60000

TABLES

intern = iexcel

EXCEPTIONS

inconsistent_parameters = 1

upload_ole = 2

OTHERS = 3.

IF sy-subrc <> 0 .

WRITE :/15 'FILE NOT UPLOADED. INVALID FILE NAME OR PATH.' COLOR 6 .

EXIT.

ENDIF.

LOOP AT iexcel.

IF iexcel-col = '0001'.

itab-etsrk = iexcel-value.

ENDIF.

IF iexcel-col = '0002'.

itab-evbgd = iexcel-value.

ENDIF.

IF iexcel-col = '0003'.

itab-evend = iexcel-value.

ENDIF.

IF iexcel-col = '0004'.

itab-tlsrk = iexcel-value.

ENDIF.

AT END OF row.

APPEND itab.

ENDAT.

CLEAR iexcel.

ENDLOOP.

REFRESH iexcel.

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

Por favor, tente carregar os dados usando GUI_UPLOAD. Acredito que seu problema será resolvido.

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

DATA:iexcel TYPE TABLE OF alsmex_tabline WITH HEADER LINE.

CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'

EXPORTING

filename = path1

i_begin_col = 1

i_begin_row = 1

i_end_col = 4

i_end_row = 60000

TABLES

intern = iexcel

EXCEPTIONS

inconsistent_parameters = 1

upload_ole = 2

OTHERS = 3.

IF sy-subrc <> 0 .

WRITE :/15 'ARQUIVO NÃO CARREGADO. NOME DE ARQUIVO OU CAMINHO INVÁLIDO.' COLOR 6 .

EXIT.

ENDIF.

LOOP AT iexcel.

IF iexcel-col = '0001'.

itab-etsrk = iexcel-value.

ENDIF.

IF iexcel-col = '0002'.

itab-evbgd = iexcel-value.

ENDIF.

IF iexcel-col = '0003'.

itab-evend = iexcel-value.

ENDIF.

IF iexcel-col = '0004'.

itab-tlsrk = iexcel-value.

ENDIF.

AT END OF row.

APPEND itab.

ENDAT.

CLEAR iexcel.

ENDLOOP.

REFRESH iexcel.

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?