Resumen de la utilización de SAP Script
Iván Castillo
castillo.ivan@gmail.com
SapScript SE71
Creando Formulario Inicial
Se71
- Página inicial
- Crear una ventana
- Crear párrrafo por defecto
Opciones Creando el formulario.
- Cabecera: Definiremos los atributos del formulario como el tipo de formulario, tamaño, forma de visualización, fuentes, etc..
- Párrafos: Los párrafos son las principales unidades de edición en SAPscript. Cada texto creado en el editor está compuesto de varios párrafos. El comienzo de un párrafo va indicado por la marca de párrafo en la columna izquierda del editor. En el formulario se definen el nombre y las propiedades de los párrafos.
1.Creando Página inicial
MENU Crear Elemento
Por convención, simpre lapágina principal será llamada
MAIN.
Una Pagina -> Muchas ventanas
Un Formulario -> Mucha páginas.
2.- Crear una ventana en una página
Ventana es el espacio en el cual vamos a trabajar para poder crear nuestros formularios.
- Crear nuevo elemento en el menú
Por cada Ventana Página que creemos, deberemos llenar sus atributos en la siguiente ventana (Que está al final dela pantalla).
3. Crear párrafo por defecto
Con el menú elemento nuevo
Las Características al final de la pagina
Regresar con Cabecera
Finalizando
Seleccionamos Parametrizaciones básicas
Verificamos que la Pagina sea la principal.
Grabamos
Activamos el Formulario
…
Ver el Formulario
…
Datos de Conexión
- FORM: ZDUMMY_FORM
- PAGE: MAIN
- Ventana: MAIN
- Parrafo: MA
- Elemento ITEM
&<FS_PROGRAMAS>-ID_PROG& &<FS_PROGRAMAS>-NOMBRE_PROG&
- Elemento ITEM
- PAGE: MAIN
Creando un programa de impresión
[Pag 171] El arte de programar en SAP…
Para que un SAPScript pueda mostrar información, esta debe provenir de un programa. Este programa llama al formulario y le pasa toda la información necesaria. Es por eso, que vamos a crear un programa bastante sencillo para utilizar como ejemplo.
LLAMAR UN FORMULARIO
CALL FUNCTION 'OPEN_FORM'
EXPORTING
DEVICE = 'device'
FORM = V_FORM
LANGUAGE = 'S'
OPTIONS = ITCPO
ARCHIVE_INDEX = TOA_DARA
DEVICE = 'PRINTER'
DIALOG = 'X'
EXCEPTIONS
CANCELED = 01.
Device: Es por donde saldrá el formulario:
- printer
- screen
- telefax
- fax
form El nombre del formulario
ESCRIBIR EN UN FORMULARIO
Para enviar datos del programa al formulario se usa la función WRITE_FORM
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'ITEM'
WINDOW = 'MAIN'
EXCEPTIONS
OTHERS = 01.
ELEMENT es el nombre del elemento de textos que deseamos enviarle datos ITEM
Programa de ejemplo ZFORM.ABAP
Las tablas ITCPO, TOA_DARA y ITCPP son necesarias para poder ejecutar el SAPScript.
TABLES: ZPROGRAMAS,ITCPO,TOA_DARA,ITCPP.
La variable V_FORM contendrá el nombre del formulario, mientras que la variable V_SCRIPT nos sirve para determinar si el formulario está activo o no.
DATA: V_FORM(14) TYPE C,
V_SCRIPT.
Parámetro impresión, salida inmediata
Parámetro impresión, borrar tras salida
Parámetro impresión, tiempo de permanencia en SPOOL
Visualización de impresión.
ITCPO-TDIMMED = '*'.
ITCPO-TDDELETE = '*'.
ITCPO-TDLIFETIME = '7'.
ITCPO-TDPREVIEW = 'X'.
Iniciamos la ejecución del formulario.
CALL FUNCTION 'START_FORM'
EXPORTING
FORM= V_FORM
LANGUAGE= 'S'.
Si la variable V_SCRIPT está vacía, entonces debemos abrir el formulario, para esto utilizamos el módulo de funciones OPEN_FORM.
IFV_SCRIPT EQSPACE.
CALL FUNCTION 'OPEN_FORM'
EXPORTING
FORM= V_FORM
LANGUAGE= 'S'
OPTIONS= ITCPO
ARCHIVE_INDEX= TOA_DARA
DEVICE = 'PRINTER'
DIALOG = 'X'
EXCEPTIONS
CANCELED = 01.
IF SY-SUBRC NE 0.
EXIT.
ENDIF.
V_SCRIPT = 'X'.
ENDIF.
Hacemos un LOOPa la tabla interna T_ZPROGRAMAS y asignamos los valores al Field-Symbol
LOOP ATT_ZPROGRAMAS
ASSIGNING<FS_PROGRAMAS>.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT= 'ITEM'
WINDOW= 'MAIN'
EXCEPTIONS
OTHERS= 01.
ENDLOOP.
Con el módulo de funciones END_FORM indicamos que hemos terminado de utilizar la ventana. Si la variable V_SCRIPTno está vacía, cerramos el formulario con el módulo de funciones CLOSE_FORM.
CALL FUNCTION 'END_FORM'
IMPORTING
RESULT = ITCPP.
IFV_SCRIPT NESPACE.
CALL FUNCTION 'CLOSE_FORM'.
ENDIF.
Comandos SAPSCRIPT
Cadenas de caracteres:
Las cadenas de caracteres son elementos de edición para una parte de un párrafo y son insertadas directamente en el texto. El comienzo del ámbito de texto es marcado con
Sap Script Formatting options
Formatting Options help.sap
Output Length
&symbol(length)&
Omitting the Leading Sign
&symbol(S)&
Leading Sign to the Left
&symbol(<)&
Leading Sign to the Right
&symbol(>)&
Omitting Leading Zeros
&symbol(Z)&
Space Compression
&symbol(C)&
Number of Decimal Places
&symbol(.N)&
Omitting the Separator for ‘Thousands’
&symbol(T)&
Specifying an Exponent for Floating Point Numbers
&symbol(EN)&
Right-Justified Output
&symbol(R)&
Fill Characters
&symbol(Ff)&f = fill character
Example: &KNA1-UMSAT(F*)& -> **700.00
Suppressing Output of Initial Values
&symbol(I)&
Ignoring Conversion Routines
&symbol(K)&
Date Mask
/: SET DATE MASK = 'date_mask'
Example:
/: SET DATE MASK = 'MMMM DD, YYYY'
&DATE& -> March 01, 1997
Time Mask
/: SET TIME MASK = 'time_mask'
Example:
/: SET TIME MASK = 'HH:MM'
&TIME& -> 10:08
SAPscript Control Commands
help.SAP
BOX Command
Effect: draws a box of the specified size at the specified position.
Additions: For each of XPOS, YPOS, WIDTH, HEIGHT, and FRAME, you must specify both a measurement and a unit of measurement. Specify the INTENSITY parameter as a percentage between 0 and 100.
Unit: The following units of measurement may be used:
TW (twip)
PT (point)
IN (inch)
MM (millimeter)
CM (centimeter)
LN (line)
CH (character)
Conversion factors:
1 TW = 1/20 PT
1 PT = 1/72 IN
1 IN = 2.54 CM
1 CM = 10 MM
1 CH = height of a character relative to the CPI specification in the form header
1 LN = height of a line relative to the LPI specification in the form header
Example
/: BOX FRAME 10 TW
Draws a frame around the current window with a frame thickness of 10 TW (= 0.5 PT).
/: BOX INTENSITY 10
Fills the window background with shading having a grayscale of 10%.
/: BOX HEIGHT 0 TW FRAME 10 TW
Draws a horizontal line across the complete top edge of the window.
/: BOX WIDTH 0 TW FRAME 10 TW
Draws a vertical line along the complete height of the left hand edge of the window.
/: BOX WIDTH '17.5' CM HEIGHT 1 CM FRAME 10 TW INTENSITY 15
/: BOX WIDTH '17.5' CM HEIGHT '13.5' CM FRAME 10 TW
/: BOX XPOS '10.0' CM WIDTH 0 TW HEIGHT '13.5' CM FRAME 10 TW
/: BOX XPOS '13.5' CM WIDTH 0 TW HEIGHT '13.5' CM FRAME 10 TW
Draws two rectangles and two lines to construct a table of three columns with a highlighted heading.
POSITION Command
/: POSITION [XORIGIN] [YORIGIN] [WINDOW] [PAGE]
Effect: Sets the origin for the coordinate system used by the XPOS and YPOS parameters of the BOX command. When a window is first started, the POSITION value is set to refer to the upper left corner of the window (default setting).
Additions: If a parameter value does not have a leading sign, then its value is interpreted as an absolute value, in other words, as a value that specifies an offset from the upper left corner of the output page. If a parameter value is specified with a leading sign, then the new value of the parameter is calculated relative to the old value. If one of the parameter specifications is missing, then no change is made to this parameter.
- XORIGIN, YORIGIN: Origin of the coordinate system.
- WINDOW: Sets the values for the left and upper edges to match those of the current window (default setting).
- PAGE: Sets the values for the left and upper edges to match those of the current output page (XORIGIN = 0 cm, YORIGIN = 0 cm).
Example
/: POSITION WINDOW
Sets the origin for the coordinate system to the upper left corner of the window.
/: POSITION XORIGIN 2 CM YORIGIN '2.5 CM'
Sets the origin for the coordinate system to a point 2 cm from the left edge and 2.5 cm from the upper edge of the output page.
/: POSITION XORIGIN '-1.5' CM YORIGIN -1 CM
Shifts the origin for the left upper coordinate 1.5 cm to the left and 1 cm up.
Comandos
Impresión de Códigos de Barras
Impresión láser
- Creando un sistema de código de barras
- Incluyendo el sistema de código de barras en el SAPscript
- Creando un formato de caracter basado en el sistema de código de barras
- Introducir texto basado en el código de barras
- Cambiado el tamaño estándar del código de barras ( Ancho largo )
Sapscript Barcode Printing
Printing BAR Code in sap script
1. Creando un sistema de código de barras SE73
Lista de todos los CB
Incluyendo el CB en el SAPScript
Se creo una nueva ventana para el CB
Se creo el Formato del código de barras
C1 para el código de barras
Introducir el texto
Probando
- Imprimir físicamente
- Escanear con una Tablet
Impresión de salida
Escaneando
3. Cambiado el tamaño estándar del código de barras
- Crear una copia de del la formato C128A_0 ZC128_0
- Modificar el Formato de Carácter con el nuevo código de barras.
- Modificar el Layout
1 Crear una Copia y Modificar el tipo de código de barras del sistema.
-
Nueva
Nombre
Escojamos Rotado
Parámetros por defecto
Aparece nuestro CB
Modificar el Formato de Carácter con el nuevo código de barras.
Modificar el Layout
EL RESULTADO
SAP NOTA 45643 - Barcode control sequences for JetCAPS/Jetmobile BarDIMM
Impresión en Impresoras de ETIQUETAS
Crear el Texto Estándar S010
- Subir el texto estándar (formato ITF)
Insertar el texto estándar en el Form
Referencia al Texto
Conexión del texto estándar con las variables
Generando el texto desde Zebra Video
http://www.ibscanner.com/online-barcode-scanner
Impresión de Ubicaciones WM LM55
Form: LVSBINPRINT
Encontrando el Texto estándar de una FORM
SE71
Imprimir OTS
Filosofía
- El texto se debe acomodar de acuerdo al párrafo, linea a linea.
- Las imágenes BOX se acomodan por aparte con xpos ypos
Son máscaras diferentes
Bibliografia
Manual PDF *
SAPScript Important Programs
Barcodes and SAPscript forms
bar code printing
Comparing Smart Forms to SAPscript
Send Custom Mail after creation PO with SapScript PDF attachment