Existe el report standard para pasar órdenes de spool a PDF:
- RSTXPDFT4.
lunes, noviembre 30, 2009
viernes, noviembre 13, 2009
FS - Field-Symbols
Necesarios para recuperar datos de variables no accesibles en modo local.
FIELD-SYMBOLS: TYPE docubatch_data_s.
FIELD-SYMBOLS: TYPE docubatch_data_t.
DATA: l_wa_docubatch_com TYPE docubatch_screen_fields.
DATA: l_nombre_campo(100).
DATA: l_charg TYPE charg_d.
* Tabla sin cabecera, si tuviera cabecera habría que acceder por GT_DATA[].
l_nombre_campo = '(SAPLVBDOCUBATCH_DM)GT_DATA'.
ASSIGN (l_nombre_campo) TO.
l_subrc = sy-subrc.
*********
* Tabla *
*********
READ TABLE ASSIGNING
WITH KEY matnr = l_wa_mseg-matnr.
************************************************
* Tabla que contiene un campo que es una tabla *
************************************************
IF sy-subrc EQ 0.
CLEAR: l_wa_docubatch_com.
READ TABLE-t_docubatches INDEX 2
INTO l_wa_docubatch_com.
IF sy-subrc EQ 0.
l_charg = l_wa_docubatch_com-docubatch_charg.
ENDIF.
ENDIF.
FIELD-SYMBOLS:
FIELD-SYMBOLS:
DATA: l_wa_docubatch_com TYPE docubatch_screen_fields.
DATA: l_nombre_campo(100).
DATA: l_charg TYPE charg_d.
* Tabla sin cabecera, si tuviera cabecera habría que acceder por GT_DATA[].
l_nombre_campo = '(SAPLVBDOCUBATCH_DM)GT_DATA'.
ASSIGN (l_nombre_campo) TO
l_subrc = sy-subrc.
*********
* Tabla *
*********
READ TABLE
WITH KEY matnr = l_wa_mseg-matnr.
************************************************
* Tabla que contiene un campo que es una tabla *
************************************************
IF sy-subrc EQ 0.
CLEAR: l_wa_docubatch_com.
READ TABLE
INTO l_wa_docubatch_com.
IF sy-subrc EQ 0.
l_charg = l_wa_docubatch_com-docubatch_charg.
ENDIF.
ENDIF.
martes, noviembre 10, 2009
FICHEROS - Trabajar con nombres de rutas y ficheros
¿Qué tenemos?
C:\CARPETA1\CARPETA2\FICHERO.EXE
¿Qué queremos?
valor1 = C:\CARPETA1\CARPETA2\
valor2 = FICHERO.EXE
¿Además de la sentencia ABAP split que podemos utilizar?
CALL FUNCTION 'SO_SPLIT_FILE_AND_PATH'
EXPORTING
full_name = p_ruta_completa " C:\CARPETA1\CARPETA2\FICHERO.EXE
IMPORTING
stripped_name = v_exe " FICHERO.EXE
file_path = v_cd. " C:\CARPETA1\CARPETA2\
C:\CARPETA1\CARPETA2\FICHERO.EXE
¿Qué queremos?
valor1 = C:\CARPETA1\CARPETA2\
valor2 = FICHERO.EXE
¿Además de la sentencia ABAP split que podemos utilizar?
CALL FUNCTION 'SO_SPLIT_FILE_AND_PATH'
EXPORTING
full_name = p_ruta_completa " C:\CARPETA1\CARPETA2\FICHERO.EXE
IMPORTING
stripped_name = v_exe " FICHERO.EXE
file_path = v_cd. " C:\CARPETA1\CARPETA2\
miércoles, noviembre 04, 2009
FICHEROS - Listar ficheros de directorio local y del servidor SAP
Transacciones para trabajar con fichero del servidor SAP AL11, N2UX, CG3Y y CG3Z.
*****
PARAMETER: p_fdir TYPE pfeflnamel DEFAULT
*'/usr/sap/tmp'.
'C:\pruebas\xml'.
PARAMETER: p_local AS CHECKBOX DEFAULT 'X'.
DATA: BEGIN OF it_filedir OCCURS 10.
INCLUDE STRUCTURE salfldir.
DATA: END OF it_filedir.
DATA: l_it_file_table TYPE TABLE OF sdokpath WITH HEADER LINE.
DATA: l_it_dir_table TYPE TABLE OF sdokpath.
************************************************************************
START-OF-SELECTION.
************************************************************************
IF p_local EQ 'X'.
CALL FUNCTION 'TMP_GUI_DIRECTORY_LIST_FILES'
EXPORTING
directory = p_fdir
filter = '*.XML'
* IMPORTING
* FILE_COUNT =
* DIR_COUNT =
TABLES
file_table = l_it_file_table
dir_table = l_it_dir_table
EXCEPTIONS
cntl_error = 1
OTHERS = 2.
LOOP AT l_it_file_table.
WRITE: / l_it_file_table-pathname.
ENDLOOP.
ELSE.
* Get Current Directory Listing for OUT Dir
* OJO al probar el MF directamente en la SE37 (convierte a mayúsculas).
CALL FUNCTION 'RZL_READ_DIR_LOCAL'
EXPORTING
name = p_fdir
TABLES
file_tbl = it_filedir.
* List of files are contained within table it_filedir
LOOP AT it_filedir.
WRITE: / it_filedir-name.
ENDLOOP.
ENDIF.
*****
PARAMETER: p_fdir TYPE pfeflnamel DEFAULT
*'/usr/sap/tmp'.
'C:\pruebas\xml'.
PARAMETER: p_local AS CHECKBOX DEFAULT 'X'.
DATA: BEGIN OF it_filedir OCCURS 10.
INCLUDE STRUCTURE salfldir.
DATA: END OF it_filedir.
DATA: l_it_file_table TYPE TABLE OF sdokpath WITH HEADER LINE.
DATA: l_it_dir_table TYPE TABLE OF sdokpath.
************************************************************************
START-OF-SELECTION.
************************************************************************
IF p_local EQ 'X'.
CALL FUNCTION 'TMP_GUI_DIRECTORY_LIST_FILES'
EXPORTING
directory = p_fdir
filter = '*.XML'
* IMPORTING
* FILE_COUNT =
* DIR_COUNT =
TABLES
file_table = l_it_file_table
dir_table = l_it_dir_table
EXCEPTIONS
cntl_error = 1
OTHERS = 2.
LOOP AT l_it_file_table.
WRITE: / l_it_file_table-pathname.
ENDLOOP.
ELSE.
* Get Current Directory Listing for OUT Dir
* OJO al probar el MF directamente en la SE37 (convierte a mayúsculas).
CALL FUNCTION 'RZL_READ_DIR_LOCAL'
EXPORTING
name = p_fdir
TABLES
file_tbl = it_filedir.
* List of files are contained within table it_filedir
LOOP AT it_filedir.
WRITE: / it_filedir-name.
ENDLOOP.
ENDIF.
Suscribirse a:
Entradas (Atom)