Este ejemplo es un formulario de impresión de una lista de participantes a un curso.



Documentos relacionados
Imprimir PDF en WebDynpro para JAVA sin utilizar Interactive Forms en llamadas RFC.

Son objetos cuya función es el tratamiento de varios registros exclusivamente durante la ejecución de un programa.

Batch Input (online ofline archivos.prn)

SolutionsSAP. paso a paso.

Parametrizacion del programa de control y del formulario

MANUALES Y TUTORIALES Manual de Smartforms - Exequiel Lopez -

Tip en detalle Nro. 06

A partir de la información anterior haremos varios programas que utilicen los diferentes elementos del diccionario.

Notas técnicas - Tips de SAP Netweaver ABAP JAVA Tip en detalle Nro. 24. (Lo nuevo, lo escondido, o simplemente lo de siempre pero bien explicado)

Tablas internas 1-12

En el presente tip definimos el procedimiento para crear esas variables y su manejo posterior. DATA: v_data_ref TYPE REF TO data.

Ahora después de ver las múltiples herramientas de desarrollo de ABAP, podemos ver los detalles del lenguaje:

1. Módulos de Funciones

MÁS SOBRE LAS FUNCIONES ALV

Solución al Ejercicio de Práctica

Notas técnicas de SAP / ABAP Tip en detalle Nro. 23. (Lo nuevo, lo escondido, o simplemente lo de siempre pero bien explicado)

SENTENCIAS DEL LENGUAJE PROGRAMACION ABAP /4

Creating your Single Sign-On Account for the PowerSchool Parent Portal

Kaldeera Advanced Forms 2009 Guía del usuario

Estructuraremos el código con el condicional CASE-ENDCASE que vimos anteriormente, para controlar las diferentes funciones.

Control interno del flujo de un programa 1-14

BASE DE DATOS LOGICAS... 2 ESTRUCTURA... 3 SELECCIONES... 5 PROGRAMA BASE DE DATOS... 7 RELACIONAR UNA BDD LÓGICA CON UN ABAP MATCHCODE...

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Marta Soler Tel: Fax: TUTORIAL DEL GESTOR DE CONTENIDOS DOTNETNUKE

BASES DE DATOS EN VISUAL BASIC ACCESS + SQL

Los bloques DLL (Figura A.1) externos permiten al usuario escribir su propio código y

LEGACY SYSTEM MIGRATION WORKBENCH

INTRODUCCION A LA PROGRAMACION SAP

Administración Básica de Oracle9i.

Curso de PHP con MySQL Gratis

Cómo crear un fichero de ayuda para tus aplicaciones?

Diseño de bases de datos

1. CONTENIDO 1. CONTENIDO

DICCIONARIO DE DATOS

Tip en detalle Nro. 09

Iniciando con Oracle. Índice de contenido. Ingresando a Oracle. Cambiando Su Contraseña. Ingresando un Comando SQL en SQL*Plus

CHECKLIST. Universidad Panamericana Checklist. Descripción. Objetivos

Bases de datos. 1. Introducción

MANUAL EASYCHAIR. A) Ingresar su nombre de usuario y password, si ya tiene una cuenta registrada Ó

Race Manager by Master Timing Guía del usuario GUIA RACE MANAGER. Eventronic, SL

Sección 7: Guía del analista de datos (incluye Epi Info) Presentación general

9- Procedimientos almacenados.

Manual de uso del Tracker (Gestor de Actividad)

Instrumentación Virtual con LabVIEW

ABAP orientado a objetos

Manual de Desarrollado de Módulos en Español. Version Beta. Escrito por: Bruno Macias V.

MANUAL SISTEMA RESERVAS TEM V1.2

Sesión No. 4. Contextualización INFORMÁTICA 1. Nombre: Procesador de Texto

Manual de Instalación del sistema administrativo PremiumSoft Extended 7

Programa diseñado y creado por Art-Tronic Promotora Audiovisual, S.L.

Tutorial de Unity 3D Tema 52 Bases de Datos. Tutorial de Unity 3D. Bases de Datos

Notas técnicas de SAP / ABAP Tip en detalle Nro. 18. (Lo nuevo, lo escondido, o simplemente lo de siempre pero bien explicado)

Oracle básico (IV): Programación en PL/SQL

UNIVERSIDAD DE MEDELLÍN NUEVO PORTAL WEB MANUAL DE USUARIO GESTOR DE CONTENIDOS

Nueva confirmación de pedido de compra con cambios: proveedor ES

Servicio de verificación del número de Seguro Social. (SSNVS, siglas en inglés)

SAP Business Workflow

COBHTTPD Tutorial COBHTTPD. Servidor de Aplicaciones para COBOL. Tutorial Ver Page - 1 -

T12 Vistas y tablas temporales

1 DISEÑO WEB de ANCHO FIJO con 2 COLUMNAS FLOTANTES

MANUAL DE CREACIÓN DE CARPETAS PARA ACCESO POR FTP DE CLIENTES EN UN NAS

La pestaña Inicio contiene las operaciones más comunes sobre copiar, cortar y pegar, además de las operaciones de Fuente, Párrafo, Estilo y Edición.

Conceptos Fundamentales sobre UNIX Laboratorio Administrador de Archivos del CDE Avanzado (Tiempo estimado: 30 min.)

Todos los equipos RADWIN5000 vienen por defecto con la dirección IP y mascara de subred , por tanto se debe configurar la

La Video conferencia con Live Meeting

MANUAL DE FACTURACIÓN TOUCH SCREEN

Conectar Flash con Access usando MDM Zinc

Portal para Padres CPS - Parent Portal. Walter L. Newberry Math & Science Academy Linda Foley-Acevedo, Principal Ed Collins, Asst.

RESELLER MANAGER SBS

MANUAL DEL USUARIO: EDITOR E-COMMERCE

MANUAL DE LA APLICACIÓN HELP DESK

MANUAL DE USUARIO INTRANET CONSULTA DE INVENTARIOS ( I C I )

PR.T5. GESTORES BIBLIOGRÁFICOS

UNIVERSIDAD DEL ISTMO CAMPUS IXTEPEC LIC. INFORMATICA GRUPO 508 PROCEDIMIENTOS ALMACENADOS EN SQL SERVER 2000

Manual básico de administración de Joomla

Práctica 02. Formularios

MINITUTORIAL PARA EL MANEJO DE TABLEAU

Puede pagar facturas y gastos periódicos como el alquiler, el gas, la electricidad, el agua y el teléfono y también otros gastos del hogar.

Visual Basic 1. Empleo de módulos y Procedimientos. Procedimientos definidos por el usuario

Unidad III: Lenguaje de manipulación de datos (DML) 3.1 Inserción, eliminación y modificación de registros

Cuando hablamos de presentaciones, como las de Powerpoint, Keynote o similares, encontramos dos corrientes estéticas muy distintas:

GUÍA DE PROGRAMACIÓN DE LECTOR ICLOCK 360 DAR DE ALTA LECTOR EN EL SOFTWARE ATTENDANCE MANAGEMENT

Select table data Insert table data Update table data Delete table data Create table

Manual Sistema de Afiliados Lomas Travel

En primera instancia Estos son los pasos para descargar LV.

APLICACIÓN DE PRESENTACIONES POWER POINT NIVEL BÁSICO

Tutorial Oracle SQL Developer 1.2.1

Resolver triángulos en Visual Basic. Parte 3/3

MANUAL DE CAPACITACIÓN Sistema Joomla WEB CMS 2.5. HogarPara. SusNiños.

Formas de Pago y Efectos en Facturas de Venta WhitePaper Febrero de 2007

Manual de usuario de Banca por Internet Factura Digital

Glogster EDU. Y cubrí los datos que me pedían. Las siguientes veces que se entre habrá que pinchar en log in Primera vez: Sign up Después: Log in

5- Uso de sentencias avanzadas

Capítulo 3 Usando GUIDE. 3.1 Acerca de GUIDE

Tutorial Básico de vbscript

Guía paso a paso para el uso de CengageNOW

Kiara Celeste Contreras Feliz. Matricula: Sistema Operativo III. 5- Creación de usuarios y grupos

SIMPLE Cuentas Corrientes

SYMBALOO 1º.- QUÉ ES? 2º.-Darse de alta en Symbaloo

Transcripción:

Este ejemplo es un formulario de impresión de una lista de participantes a un curso. Los datos del formulario ahora los pasas como parámetros de una función SAP(SE37)

standares Propios del usuario si observas existen parámetros standares que son propios de los smartforms, donde seteas una serie de parámetros de impresión. Estos parámetros se llenan en el programa de impresión. Los otros parámetros son propios del usuario, de esta forma le indicas al smartform los campos a imprimir. También le puedes pasar una tabla como parámetro de entrada:

En este caso la tabla indica una lista de participantes al curso. en datos globales puedes definir variables que te pueden ser de utilidad en el procesamiento del smartform, tal cual tu defines variables en un programa ABAP, con la sentencia DATA. Los smartforms tambien se constituyen por páginas, ventanas, párrafos, etc. En este caso : En este caso existe un tipo de Página con 4 ventanas: PAGINA, HEADER, TITULO, y MAIN. Existe la opción de insertar un mono que en este caso es el logo de la empresa. Como insertas ventanas?, fácil:

O sea te colocas en la página, botón derecho y listo. Para el logo seleccionas función gráfica, el grafico lo subes con otra transacción(se78) con tipo BMP. Ahora para ver la disposición de las páginas presionas Form Painter

Ahora, como paso los parámetros al smartform?, evidente, igual que en los formularios

si te fijas acá en la ventana HEADER tu creas un texto (te paras en la ventana, botón derecho, crear, crear texto). Y le colocas los datos a imprimir. Obviamente estaban declarados en la parte de Interface formulario. UNA DE LAS GRANDES ventajas que tiene el smartforms son la impresión de listas, como el detalle de una factura, para ello se utiliza el objeto TABLA. Si vemos la salida de este formulario observas que hay una impresión de una lista, cuyo contenido lo pasamos en la parte de Interface formulario como una tabla te acuerdas?. Para ello usamos las tablas. En este caso la tabla esta en la ventana MAIN, posicionas boton derecho, crear tabla,

columnas en los atributos especificas el ancho de la línea de la tabla. En tipo líneas colocas el tipo de línea que va a tener la tabla y las columnas. En el 90% siempre hay un solo tipo de línea, en este ejemplo hay mas porque la cantidad de columnas es dinámica. OJO que la suma de las columnas debe ser igual al ancho de la tabla. El loop de la tabla lo colocas en DATOS

fijate que el contenido de la tabla lo pasa a la variable wa_course_partic, la cual la definimos en Definiciones globales, se estila así pues. En ambito de cabecera defines los textos de cabecera de la tabla. Por ejemplo

por ejemplo esta cabecera es para colocar N, ojo que tienes que especificar el tipo de línea al que pertenece la cabecera.

pero como te explique casi siempre es un tipo de linea. En resumen creas tantos objetos como columnas tiene el tipo de línea. Ojo que salen en el orden que se ven en la pantalla. Las lineas las especificas de la siguiente forma

osea colocas la variable con el campo especifico, igual que en caso anterior especificas el orden tal como se ven en la pantalla. Los smartforms se llaman de programas ABAP como una función común y silvestre, en este caso el programa a utilizar es el siguiente: REPORT ZESC_PPE_ATTEN_LIST MESSAGE-ID pv. *********************************************************************** * PROGRAM # * * LEVEL # 4.6C * * VERSION # 1.0 * * DATE WRITTEN # March 2003 * * SYSTEM # P - PE Training and Event Management * TYPE # ONLINE * * AUTHOR # TAPIPA9 * * TITLE # Print Atten List * PURPOSE # * * * COPIED FROM # n/a * * * * ASSOCIATED PROG # ZESC_PPE_TRAINING_REPORT_EMP * * * RESTRICTIONS # * * * * DESCRIPTION # Print Attendance List * * * * AMENDMENTS # * * VER DATE LEVEL CHANGE# CHANGE DESC WHO * * 0001 01/04/03 46C GHDK987620 new program TAPIPA9 *

infotypes: 0002 mode n, 0001 mode n, 0008 mode n. INCLUDE ZESC_PPE_ATTEN_LIST_TOP. *INCLUDE zesc_ppe_atten_quali_upd_top. data num_attendes type i. data cdays(2) type n. data aux_nhours type ATTHR. data delete_all type i. data tb_days like p0041. parameters: pa_plvar like plog-plvar default '01' no-display, pa_event LIKE plog-objid obligatory, pa_kmaco LIKE pchdy-seark no-display, pa_prnt like usr01-spld no-display. AT SELECTION-SCREEN ON VALUE-REQUEST For pa_event. PERFORM objid_request USING pa_plvar 'E' CHANGING pa_kmaco pa_event. initialization. * Default the user's printer on the selection screen SELECT SINGLE spld INTO pa_prnt FROM usr01 WHERE bname EQ sy-uname. * If the select fails, then default it to the local printer IF sy-subrc <> 0 OR pa_prnt IS INITIAL. pa_prnt = 'LOCL'. ENDIF. start-of-selection. perform get_data. end-of-selection. perform header. * Invoke the ALV to display the eligble employees perform display_atten. * FORM get_data * *... * form get_data. data cont(2) type n. perform get_course_data tables course_schedule course_partic course_text course_price using event_type organizer location pa_plvar pa_event. clear num_attendes. sort course_partic by partx. loop at course_partic where eveid = pa_event and evbeg = course_schedule-begda and evend = course_schedule-endda and PATYP = 'P'. add 1 to cont. clear tb_aux. tb_aux-pernr = course_partic-parid. perform read_personal_infotype_0002 tables p0002 using course_schedule-begda

course_partic-plvar = cont. write p0002-zzzcrut to course_partic-kosht. clear course_partic-kostl. clear course_partic-partx. course_schedule-endda tb_aux-pernr. concatenate p0002-nachn P0002-NAME2 P0002-VORNA into course_partic-partx separated by space. modify course_partic. tb_aux-nachn = p0002-nachn. tb_aux-name2 = P0002-NAME2. tb_aux-vorna = P0002-VORNA. tb_aux-zzzcrut = p0002-zzzcrut. tb_aux-midnm = p0002-midnm. append tb_aux. endloop. data num type i. num = cont div max_lin. num = num + 1. max_lin = max_lin * num. add 1 to cont. while cont <= max_lin. clear course_partic. course_partic-plvar = cont. append course_partic. add 1 to cont. endwhile. sort course_partic by plvar. append lines of tb_aux to tb_atten. data caux_date(10) type c. data caux_hour(8) type c. data aux_date type d. data char(1) type c. write course_schedule-begda to caux_date. course_days-stext = 'de'(100). concatenate course_days-stext caux_date into course_days-stext separated by space. write course_schedule-endda to caux_date. concatenate course_days-stext 'a'(101) caux_date into course_days-stext separated by space. field-symbols <f>. data campo(13) value 'tb_days-dat01'. cont = 1. loop at course_schedule. if aux_date <> course_schedule-evdat. campo+11(2) = cont. assign (campo) to <f>. <f> = course_schedule-evdat. add 1 to cont. endif. aux_date = course_schedule-evdat. char = ','. endloop. read table course_schedule index 1. aux_date = course_schedule-evdat. char = ' '.

loop at course_schedule. if aux_date = course_schedule-evdat. write course_schedule-beguz to caux_hour. concatenate course_hour-stext caux_hour+0(5) into course_hour-stext separated by char. write course_schedule-enduz to caux_hour. concatenate course_hour-stext caux_hour+0(5) into course_hour-stext separated by '-'. char = '/'. else. exit. endif. aux_date = course_schedule-evdat. endloop. * FORM get_course_data * * get data from the course, in this case the participant and the * schedule data of the course, and put into itables course_partic and * course_schedule * --> PLVAR : Plan variant * * --> OBJID : Id of the course * form get_course_data tables course_schedule structure hrvsched course_partic structure hrvpartic course_text structure p1000 course_price structure p1021 using p_event_type structure objec p_organizer structure objec p_location structure objec p_plvar p_objid. clear: course_schedule, course_partic, course_text, course_price. refresh: course_schedule, course_partic, course_text, course_price. call function 'RH_GET_EVENT_DATA' exporting planversion = p_plvar eventid = p_objid * with_schedule = 'X' * with_participants = 'X' ** with_cancellation = 'X' WITH_TEXT = 'X' WITH_CAPACITY = ' ' WITH_OCCUPATION = ' ' WITH_DESCRIPTION = ' ' WITH_PRICE = 'X' WITH_EXTRAS = ' ' WITH_SCHEDULE = 'X' WITH_URL = ' ' WITH_KNOWLEDGE = ' ' WITH_RESOURCES = ' ' WITH_PARTICIPANTS = 'X' WITH_ORGANIZER = 'X' WITH_EVENTTYPE = 'X' WITH_LOCATION = 'X' WITH_CANCELLATION = ' ' WITH_QUALIFICATIONS = ' ' WITH_REQUIREMENTS = ' ' WITH_TARGETGROUP = ' ' WITH_OTHER_INFTYS = ' ' IMPORTING EVENTTYPE = p_event_type organizer = p_organizer location = p_location tables price = course_price schedule = course_schedule participants = course_partic text = course_text exceptions

no_infty_found = 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. * FORM read_personal_infotype_0002 * read personal infotype 0002( Personal Data) * for personal PERNR * --> BEGDA : start of period * --> ENDDA : end of period * --> PERNR : employee number form read_personal_infotype_0002 tables p0002 structure p0002 using begda like p0002-begda endda like p0002-endda pernr like p0002-pernr. clear p0002. refresh p0002. call function 'HR_READ_INFOTYPE' exporting tclas = 'A' pernr = pernr infty = '0002' begda = begda endda = endda bypass_buffer = ' ' * IMPORTING * SUBRC = tables infty_tab = p0002 exceptions infty_not_found = 1 others = 2. * Create event catalog table for ALV *----------------------------------------------------------------------* form create_eventcat. eventcat-name = 'TOP_OF_PAGE'. eventcat-form = 'TOP_OF_PAGE'. append eventcat. eventcat-name = 'END_OF_LIST'. eventcat-form = 'LIST_FOOTER'. append eventcat. eventcat-name = 'DATA_CHANGED'. eventcat-form = 'DATA_CHANGED2'. append eventcat. " create_eventcat * FORM BUILD_SORTCAT * * Fill the ALV structure sorcat * * --> SPOS * * --> FIELDNAME * * --> UP * * --> SUBTOT * form build_sortcat using spos fieldname up subtot. data sortcat_ln like sortcat. sortcat_ln-spos = spos. sortcat_ln-fieldname = fieldname.

sortcat_ln-up = up. sortcat_ln-down = space. sortcat_ln-subtot = subtot. append sortcat_ln to sortcat. *& Form create_fieldcat_runtbl *& Create Table with names of all fields which are to be displayed *& on the list, this fieldcat is modified in form modify_fieldcat form create_fieldcat_runtbl. data tbl(30) value 'TB_ATTEN'. refresh fieldcat. repid = sy-repid. * function to create field catalog for display call function 'REUSE_ALV_FIELDCATALOG_MERGE' EXPORTING i_program_name = repid i_inclname = repid i_internal_tabname = tbl i_bypassing_buffer = 'X' CHANGING ct_fieldcat = fieldcat[] EXCEPTIONS inconsistent_interface = 1 program_error = 2 others = 3. *perform set_edit_cols USING TBL. perform data_no_out using tbl. perform set_field_names using tbl. change_fieldcat edit 'RATE_0001' 'X' tbl. perform build_sortcat using '00' 'NACHN' 'X' ' '. "'X' suma perform build_sortcat using '00' 'NAME2' 'X' ' '. "'X' suma perform build_sortcat using '00' 'VORNA' 'X' ' '. "'X' suma perform build_sortcat using '00' 'ZZZCRUT' 'X' ' '. "'X' suma " create_fieldcat_runtbl *& Form display_atten * call ALV function to display list *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* form display_atten. refresh sortcat. refresh eventcat. * Create the Event Catagories for ALV8 perform create_eventcat. * Create the field catalog for ALV perform create_fieldcat_runtbl. * Adjust the layout information

layout-box_fieldname = 'BOX'. * layout-group_change_edit = space. "user can format sort criteria * layout-detail_initial_lines = 'X'. "show initial values in detail * layout-min_linesize = 132. layout-colwidth_optimize = 'X'. layout-edit = 'X'. * layout-edit_mode = 'A'. layout-zebra = 'X'. * layout-detail_popup = 'X'. layout-group_buttons = 'X'. * adjust print parameters print_param-prnt_info = 'X'. print_param-no_print_listinfos = ' '. * ALV function for display call function 'REUSE_ALV_GRID_DISPLAY' EXPORTING i_callback_program = repid i_callback_pf_status_set = 'SET_STATUS' i_callback_user_command = 'USER_COMMAND' * it_special_groups = ht_alv_special_groups * it_special_groups = ht_alv_special_groups is_layout = layout it_fieldcat = fieldcat[] it_sort = sortcat[] it_events = eventcat[] i_default = 'X' i_save = 'A' is_print = print_param TABLES t_outtab = tb_atten EXCEPTIONS program_error = 1 others = 2. " display_atten *------------------------------------------------------------------ * FORM TOP_OF_PAGE *------------------------------------------------------------------ form top_of_page. * Write the header information to the output call function 'REUSE_ALV_COMMENTARY_WRITE' EXPORTING it_list_commentary = header_alv. *& Form SET_STATUS * Performed from ALV function - set GUI status *----------------------------------------------------------------------* form set_status using extab type slis_t_extab. data status(5) type c. * Set the screen GUI case company. when 'ESC'. status = 'LIST1'. when others. status = 'LIST1'. endcase. set pf-status status. " SET_STATUS * FORM USER_COMMAND * USER-COMMANDS are handled in this routine * --> R_UCOMM : User-command from list screen * * --> RS_SELFIELD : selected field * form user_command using r_ucomm LIKE SY-UCOMM

rs_selfield type slis_selfield. data tb_aux2 like tb_atten occurs 10 with header line. tb_aux2[] = tb_atten[]. * loop at tb_atten where pos <> 1. * aux_tabix = sy-tabix. * read table tb_aux2 with key pos = 1 * pernr = tb_atten-pernr. * tb_atten-rate = tb_aux2-rate. * tb_atten-atten_% = tb_aux2-atten_%. * tb_atten-bonus_pay = tb_aux2-bonus_pay. * modify tb_atten index aux_tabix. * endloop. data f type i. * Process User Commands case r_ucomm. when 'EXIT'. "Exit rs_selfield-exit = 'X'. when 'PRINT'. perform proc_smartform. when others. endcase. *& Form data_no_out * text *----------------------------------------------------------------------* * -->P_TBL text *----------------------------------------------------------------------* FORM data_no_out USING P_TBL. change_fieldcat tech 'BOX' 'X' p_tbl. ENDFORM. " data_no_out * FORM fieldcat_seltext_m * *... * * --> P_FIELD * * --> P_TEXT * * --> P_TABLE * form fieldcat_seltext_m using p_field p_text p_table. change_fieldcat seltext_m p_field p_text p_table. change_fieldcat ddictxt p_field 'M' p_table. * FORM set_field_names * *... * form set_field_names using tbl. * FORM list_footer *

* Print the stadistic data in the footer of the report * form list_footer. DATA: IT_LIST_HEADER TYPE SLIS_T_LISTHEADER, IT_LIST_HEADER_LINE TYPE SLIS_LISTHEADER. DATA: WS_NUMBER(8). * FORM header * *... * form header. data aux_text(50) type c. data cdate(10). ************************************************************************ * Display the table tb_pbo in ALV format *********************************************************************** clear header_alv_wa. header_alv_wa-typ = 'H'. header_alv_wa-info = sy-title. append header_alv_wa to header_alv. concatenate course_text-objid course_text-stext into aux_text separated by space. clear header_alv_wa. header_alv_wa-typ = 'S'. header_alv_wa-info = aux_text. header_alv_wa-key = text-001. append header_alv_wa to header_alv. write course_schedule-begda DD/MM/YYYY to cdate. clear header_alv_wa. header_alv_wa-typ = 'S'. header_alv_wa-key = text-003. header_alv_wa-info = cdate. append header_alv_wa to header_alv. write course_schedule-endda DD/MM/YYYY to cdate. clear header_alv_wa. header_alv_wa-typ = 'S'. header_alv_wa-key = text-004. header_alv_wa-info = cdate. append header_alv_wa to header_alv. clear header_alv_wa. header_alv_wa-typ = 'A'. append header_alv_wa to header_alv. * FORM proc_smartform * *... * form proc_smartform. data: pa_form LIKE ssfscreen-fname. pa_form = 'ZESC_ATTENDANCE_LIST'. * determine the name of the generated function module for the SMartform CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME' EXPORTING formname = pa_form IMPORTING fm_name = func_module_name EXCEPTIONS no_form = 1 no_function_module = 2 OTHERS = 3. * Default printer options output_options-tddest = pa_prnt. output_options-tdnewid = 'X'. output_options-tdimmed = 'X'.

output_options-tddelete = 'X'. * control_parameters-no_open = space. * control_parameters-no_close = ''. * call the generated function module of the form CALL FUNCTION func_module_name EXPORTING control_parameters = control_parameters output_options = output_options user_settings = space COURSE_SCHEDULE = course_schedule COURSE_TEXT = course_text course_days = course_days course_hour = course_hour location = location days = tb_days TABLES course_partic = course_partic EXCEPTIONS formatting_error = 1 internal_error = 2 send_error = 3 user_canceled = 4 my_exception = 5 OTHERS = 6.. Fíjate que en este último form se imprime el formulario, o sea, analiza solo esta parte,

NOTA IMPORTANTE: el ejemplo siguiente se realizo en sap >= 4.7, el tutorial anterior es de la 46C, los cambios más notables son en la definición de las tablas ojo con eso Ejercicio N 1. El jefe quiere el listado de los usuarios que hay en Sap y quiere imprimir la siguiente carta: Santiago, 23 de Enero del 2006 LISTADO DE USUARIOS SAP Empresa GlobalSap consulting, tiene los siguientes usuarios registrados en SAP Codigo Usuario JVASQUEZ CRUIZ GGONZALEZ PTAPIA Nombre Jaime Vazquez Cristian Ruiz German Gonzalez Pablo Tapia Solución: Vamos a la transacción SMARTFORM, creamos el smartform y definimos la tabla de entrada usuarios

2. TABLAS 1. Interface form. 3. Def. Tabla USUARIOS En este ejemplo usaremos la ventana MAIN que se crea por defecto, acuérdense que el concepto de MAIN es el mismo que en el de los SAPSCRIPT. A la ventana main le definiremos un texto llamado HEADER para colocar el texto de cabecera de la tabla.

Crear texto, HEADER Fíjate en el botón Lista de campos, ahí en el extremo inferior izquierdo, salen todos los campos visibles para programa smartform, para poner la fecha utilizaremos la variable de sistema DATE, fíjate que esto es drag & drop, que bonito no.

1. Lista de campos 2. Lista de campos 3. variable de sistema DATE 4. drag & drop De ahí simplemente le colocas el texto tal cual como en un editor.

Ahora hay que definir la tabla para la impresión de los usuarios: Creamos tabla: Lo que hay que definir es lo siguiente, la cantidad de columnas que tendrá, Vamos a details

1. Details

Ojo con esto Definimos las columnas, en este caso son 2, una para usuario y otra para nombre, ojo con los largos que tiene que ser igual al ancho de tabla.

Para trabajar con la tabla tenemos que definir un work area, que definimos en definiciones globales

1. Datos globales Work area para la tabla Volvamos a la tabla

Fíjate que las tablas tienen áreas para Cabecera: típico que aquí definimos el nombre de las columnas. Principal: las líneas se imprimen aquí. Pie: Ejemplo, impresión de los totales

Entonces creamos Entrada en tabla, y definimos el tipo de linea

Fijate que en cada columna(cell), ponemos un campo de la work area y eso es todo Para que esto tengo sentido, hay que crear el programa ABAP de impresión, en este caso el YTEST_SMART, en la rutina siguiente se imprime: *& Form print_data * text *----------------------------------------------------------------------* form print_data. data: *smartforms related func_module_name type rs38l_fnam, control_parameters type ssfctrlop, output_options type ssfcompop. data: pa_form LIKE ssfscreen-fname. pa_form = 'YTEST_SMART'. output_options-tdnewid = 'X'. output_options-tdimmed = 'X'. output_options-tddelete = 'X'. control_parameters-no_dialog = ' '.

* determine the name of the generated function module for the SMartform CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME' EXPORTING formname = pa_form IMPORTING fm_name EXCEPTIONS no_form = 1 no_function_module = 2 OTHERS = 3. = func_module_name * call the generated function module of the form CALL FUNCTION func_module_name EXPORTING control_parameters = control_parameters output_options = output_options user_settings = space TABLES usuarios = user_name_address_tab EXCEPTIONS formatting_error = 1 internal_error = 2 send_error = 3 user_canceled = 4 my_exception = 5 OTHERS = 6. Ojo que un smartform es una función(se37), entonces aca le pasas el nombre del smartform y te pasa el nombre de la funcion. El nombre es del estilo /1BCDWB/SF00000172 Aca ejecutamos la llamada al smartform como una función, le pasamos los parámetros de impresión y la tabla USUARIOS para imprimir "print_data Lo ejecutamos y tah tan que bonito!!!!!!!!!!!!

*& Report YTEST_SMART *& *& *& REPORT YTEST_SMART. data data USER_NAME_TAB like standard table of USUSERS. USER_NAME_ADDRESS_TAB like standard table of USADDR3. start-of-selection. perform get_users. perform print_data. *& Form get_users * text *----------------------------------------------------------------------* form get_users. CALL FUNCTION 'SUSR_USER_ADDRESS_READ_ARRAY' EXPORTING ALL_USERS = 'X' * IMPORTING * RETURNCODE = TABLES USER_NAME_TAB = user_name_tab * USER_ADDRESS_TAB = USER_NAME_ADDRESS_TAB = user_name_address_tab * EXCEPTIONS * INTERNAL_ERROR = 1 * USER_NAME_TAB_IS_EMPTY = 2 * OTHERS = 3. IF SY-SUBRC <> 0. * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ENDIF. "get_users *& Form print_data * text *----------------------------------------------------------------------* form print_data. data: *smartforms related func_module_name type rs38l_fnam, control_parameters type ssfctrlop,

output_options type ssfcompop. data: pa_form LIKE ssfscreen-fname. pa_form = 'YTEST_SMART'. output_options-tdnewid = 'X'. output_options-tdimmed = 'X'. output_options-tddelete = 'X'. control_parameters-no_dialog = ' '. * determine the name of the generated function module for the SMartform CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME' EXPORTING formname = pa_form IMPORTING fm_name = func_module_name EXCEPTIONS no_form = 1 no_function_module = 2 OTHERS = 3. * call the generated function module of the form CALL FUNCTION func_module_name EXPORTING control_parameters = control_parameters output_options = output_options user_settings = space TABLES usuarios = user_name_address_tab EXCEPTIONS formatting_error = 1 internal_error = 2 send_error = 3 user_canceled = 4 my_exception = 5 OTHERS = 6. "print_data