PDA

Ver la Versión Completa : De SAP a Excel - Como copiar y pegar una fila


ademiv
05/06/08, 12:36:54
Mis estimados, tengo una consulta que me urge y no doy pie con bola, tengo que de SAP levantar un template excel y cargarle datos, este template consiste en una cabecera estatica y un cuerpo dinamico que puede tener uno o mas bloques, cuando cargo la cabecera lo cargo sin problemas, uso lo siguiente:

******************************************************
START-OF-SELECTION.

DATA: o_excel_f30 TYPE ole2_object,
o_worbook_30 TYPE ole2_object,
o_cell_30 TYPE ole2_object.

DATA: lv_linesc(3),
lv_lines_insert(6),
lv_tabix TYPE sy-tabix,
lv_lines LIKE sy-tfill,
lv_add_lines LIKE sy-tfill,
lv_basec(3).

*$ Create object Excel for f30
CREATE OBJECT o_excel_f30 'EXCEL.APPLICATION'.
IF sy-subrc <> 0.
MESSAGE s208(00) WITH 'ERROR OPENING EXCEL'(021). "&
LEAVE LIST-PROCESSING.
ENDIF.

*$ Create an Excel worbook object
CALL METHOD OF o_excel_f30 'WORKBOOKS' = o_worbook_30.

*$ Open F30 Template
CALL METHOD OF o_worbook_30 'OPEN'
EXPORTING
#1 = p_temp30.
IF sy-subrc NE 0.
MESSAGE s208(00) WITH 'ERROR OPENING TEMPLATE'(011). "&
LEAVE LIST-PROCESSING.
ENDIF.

**********************************
***** Fill document header *******

*$ Position to specific cell
CALL METHOD OF o_excel_f30 'Cells' = o_cell_30
EXPORTING
#1 = 3
#2 = 2.

* Set the value
SET PROPERTY OF o_cell_30 'Value' = '0001 - EMPREDMEI, S.L.'.

*$ Position to specific cell
CALL METHOD OF o_excel_f30 'Cells' = o_cell_30
EXPORTING
#1 = 4
#2 = 2.

* Set the value
SET PROPERTY OF o_cell_30
'Value' = 'Instancia de preparación'.

*$ Position to specific cell
CALL METHOD OF o_excel_f30 'Cells' = o_cell_30
EXPORTING
#1 = 5
#2 = 2.

* Set the value
SET PROPERTY OF o_cell_30
'Value' = 'Información general de ventas'. "Primer dato

*$ Position to specific cell
CALL METHOD OF o_excel_f30 'Cells' = o_cell_30
EXPORTING
#1 = 6
#2 = 2.

* Set the value
SET PROPERTY OF o_cell_30
'Value' = '31/12/08'. "Segundo dato
******************************************************

y lo hace perfecto, el problema es cuando quiero usar algun metodo que copie y pegue una fila, DESCONOZCO EL METODO para hacerlo, calculo que deberia ser algo asi como
CALL METHOD OF algo 'FUNCIO DE COPIAR' = o_cell_30
EXPORTING
#1 = 6 "Aca irian las celdas que copia
#2 = 2.


Resumiendo, necesitaria algun generoso que me indicara como copiar y pagar filas desde excel, el tema de insertar ya se como hacerlo, pero no aun el de copiar y pegar.

GRACIAS !!!!!!!!!!!!!!!!!!!!!

ballan
06/06/08, 10:47:21
Mira este post, no resuelve tu duda exactamente pero te puede ayudar

http://www.mundosap.com/foro/showthread.php?t=13134&highlight=excel+contrase%F1a