W Pub: ABAP Rut ALV Demo

  1. *--[ Programa que limpia el buffer de los ALV antiguos
  2. * BALVBUFDEL
  3. *
  4. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  5. * Descripcin  : Plantilla para crear ALVs
  6. * Autor        : MGUTIERREZ
  7. * Ultima Modif : 04.03.2005
  8. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  9. * P A S O S:
  10. *
  11. *  ALV.1. Definir las variables y tablas para el ALV.
  12. *      ALV.1.1. Creamos pantalla de seleccin
  13. *  ALV.2. Creamos la estructura que aparecer en el ALV.
  14. *  ALV.3. Inicializamos el ALV:
  15. *      ALV.3.1. Creamos el catlogo de campos.
  16. *          ALV.3.1.1 Catlogo de campos esttico
  17. *          ALV.3.1.2 Catlogo de campos dinmico
  18. *      ALV.3.2. Redefinimos los eventos:
  19. *          ALV.3.2.1. Status.
  20. *              ALV.3.2.1.1. Preparamos el status.
  21. *                           Se puede copiar del grupo de funciones
  22. *                           SLVC_FULLSCREEN status STANDARD_FULLSCREEN
  23. *          ALV.3.2.2. Top of page.
  24. *          ALV.3.2.3. User command.
  25. *              ALV.3.2.3.1. Preparamos el User-Command.
  26. *      ALV.3.3. Ordenamos la tabla por estos criterios.
  27. *  ALV.4. Rellena la tabla interna con los datos.
  28. *      ALV.4.1. Colores de lnea/columna/registro.
  29. *  ALV.5. Sacamos el listado:
  30. *      ALV.5.1. Creamos la cabecera del listado.
  31. *      ALV.5.2. Definimos el layout. (colores)
  32. *      ALV.5.3. Llamamos a la funcin que saca al ALV.
  33. *  ALV.6. Coloreamos las diferentes lineas/celdas en la carga de datos.
  34. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  35. * Buscar y reemplazar
  36. * 1.- QQQQQ : Nombre de la estructura que aparecer en el ALV
  37. * 2.- TTTTT : Ttulo del GRID si fuese necesario
  38. * 3.- KKKK1 : Campo de ordenacin #1
  39. * 3.- KKKK2 : Campo de ordenacin #2
  40. * 4.- LLLLL : Imagen de logotipo
  41. * 5.- SSSSS : Nombre de tu status
  42. * 6.- XMARK : Nombre del campo para marcar en la tabla
  43. *
  44. * º`ºø,,øº`ºø,,øº`ºø,,øº`ºø,,øº`ºø,,øº *
  45. REPORT z NO STANDARD PAGE HEADING LINE-SIZE 255 LINE-COUNT 65.
  46.  
  47. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  48. *  ALV.1. Definir las variables y tablas para el ALV
  49. TYPE-POOLS: slis.
  50.  
  51. DATA: ALV_layout              TYPE slis_layout_alv,
  52.       ALV_fieldcat            TYPE slis_t_fieldcat_alv,
  53.       ALV_top_of_page         TYPE slis_t_listheader,
  54.       alv_sort                TYPE slis_t_sortinfo_alv,
  55.       ALV_event               TYPE slis_t_event,
  56.       g_top_of_page           TYPE slis_formname  VALUE 'TOP_OF_PAGE',
  57.       g_user_command          TYPE slis_formname  VALUE 'USER_COMMAND',
  58.       g_pf_status             TYPE slis_formname  VALUE 'PF_STATUS_SET',
  59.       g_slis_fieldname-marca  TYPE slis_fieldname,
  60.       g_slis_fieldname-tabla  TYPE slis_tabname,
  61.       g_repid                 LIKE sy-repid,
  62.       g_variant               LIKE disvariant,
  63.       g_variante              LIKE g_variant-variant,
  64.       cg_activo               VALUE 'X',
  65.       cg_checkbox             LIKE g_slis_fieldname-marca VALUE 'XMARK'.
  66. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  67. * ALV.2. Creamos la estructura que aparecera en el ALV
  68. * XMARK             --> marca para seleccionar registros
  69. * INCLUDE STRUCTURE --> nombre de la tabla base del ALV
  70. * COLOR / TABCOLOR  --> para modificar los colores tanto de las celdas
  71. *                       como de las filas o columnas del ALV
  72. DATA: BEGIN OF i_datos OCCURS 0.
  73. DATA:   xmark(01) TYPE c.
  74. *        INCLUDE STRUCTURE QQQQQ.
  75. DATA:   color(4)  TYPE c,
  76.         tabcolor  TYPE lvc_t_scol.
  77. DATA: END OF i_datos.
  78.  
  79. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  80. * ALV.1.1. Creamos pantalla de seleccin
  81. SELECTION-SCREEN BEGIN OF BLOCK bloque WITH FRAME TITLE text-001.
  82.   parameters: test as checkbox.
  83. SELECTION-SCREEN END OF BLOCK bloque.
  84.  
  85. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  86. *  ALV.3. Inicializamos el ALV.
  87. INITIALIZATION.
  88.   PERFORM ALV_3.
  89.  
  90. START-OF-SELECTION.
  91. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  92. * ALV.4. Rellena la tabla interna con los datos.
  93.   PERFORM ALV_4.
  94. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  95. * ALV.4.1. Colores de lnea/columna/registro.
  96.   PERFORM ALV_4_1.
  97.  
  98. END-OF-SELECTION.
  99. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  100. *  ALV.5. Sacamos el listado
  101.   PERFORM ALV_5.
  102.  
  103. * º`ºø,,øº`ºø,,øº`ºø,,øº`ºø,,øº`ºø,,øº
  104. *    R U T I N A S     A L V                                      
  105. * º`ºø,,øº`ºø,,øº`ºø,,øº`ºø,,øº`ºø,,øº
  106. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  107. *  ALV.3. Inicializamos el ALV:
  108. FORM ALV_3.
  109.   g_repid                = sy-repid.
  110.   g_variant-report       = g_repid.
  111.   g_variant-variant      = g_variante.
  112.   g_slis_fieldname-marca = cg_checkbox.
  113. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  114. * ALV.3.1. Creamos el catlogo de campos
  115.   PERFORM ALV_3_1 USING ALV_fieldcat[].
  116. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  117. * ALV.3.2. Redefinimos los eventos
  118.   PERFORM ALV_3_2 USING ALV_event[].
  119. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  120. * ALV.3.3 Ordenamos la tabla por estos criterios
  121.   PERFORM ALV_3_3  CHANGING alv_sort.
  122. ENDFORM.
  123.  
  124. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  125. * ALV.3.1. Creamos el catlogo de campos
  126. FORM ALV_3_1 USING p_t_fieldcat_alv TYPE slis_t_fieldcat_alv.
  127. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  128. * ALV.3.1.1 Creamos el catlogo de campos esttico
  129.    perform ALV_3_1_1 using p_t_fieldcat_alv.
  130. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  131. * ALV.3.1.2 Creamos el catlogo de campos dinmico
  132.    perform ALV_3_1_2 using p_t_fieldcat_alv.
  133. endform.
  134.  
  135. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  136. * ALV.3.1.1 Creamos el catlogo de campos esttico
  137. FORM ALV_3_1_1 USING
  138.                    p_t_fieldcat_alv TYPE slis_t_fieldcat_alv.
  139.   DATA: ls_fieldcat         TYPE slis_fieldcat_alv.
  140.   CLEAR ls_fieldcat.
  141. * Esta funcin crea el catlogo automticamente.
  142. * ponemos el nombre de la estructura que hemos creado, I_datos
  143. * y de la tabla a la que hace referencia.
  144.   CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
  145.   EXPORTING i_program_name         = g_repid
  146.             i_internal_tabname     = 'i_datos'
  147.             i_structure_name       = 'QQQQQ'
  148.             i_client_never_display = cg_activo
  149.   CHANGING  ct_fieldcat            = p_t_fieldcat_alv[].
  150.  
  151.   LOOP AT p_t_fieldcat_alv INTO ls_fieldcat.
  152.     CASE ls_fieldcat-fieldname.
  153. *      WHEN 'XMARK'.
  154. *        ls_fieldcat-fix_column = 'X'.
  155.       WHEN 'KKKKK1'.
  156. *        ls_fieldcat-hotspot    = 'X'.
  157. *        ls_fieldcat-key        = 'X'.
  158. *        ls_fieldcat-fix_column = 'X'.
  159. *        ls_fieldcat-outputlen  = '000008'.
  160. *        ls_fieldcat-qfieldname = space.
  161. *        ls_fieldcat-do_sum     = 'X'.
  162. **       Columna de color: VALORES --> space, 'X', 'Cxyz':
  163. **        x: Color number --> x:'1'-'9'
  164. **        y: Intensified  --> '0'= off '1'= on
  165. **        z: Inverse      --> '0'= off '1'= on
  166. *        ls_fieldcat-emphasize  = 'C600'.
  167. *        ls_fieldcat-no_out     = 'X'.
  168. *        ls_fieldcat-checkbox   = 'X'.
  169.     ENDCASE.
  170.     MODIFY p_t_fieldcat_alv INDEX sy-tabix FROM ls_fieldcat.
  171.   ENDLOOP.
  172. ENDFORM.
  173.  
  174. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  175. * ALV.3.1.2 Creamos el catlogo de campos dinmico o mejor dicho a mano
  176. FORM ALV_3_1_2 USING p_t_fieldcat_alv TYPE slis_t_fieldcat_alv.
  177.   DATA: ls_fieldcat         TYPE slis_fieldcat_alv.
  178.   CLEAR ls_fieldcat.
  179.   clear p_t_fieldcat_alv. refresh p_t_fieldcat_alv.
  180.   add 1                 to ls_fieldcat-col_pos.
  181.   ls_fieldcat-fieldname = 'KKKK1'.
  182.   ls_fieldcat-tabname   = 'I_DATOS'.
  183.   ls_fieldcat-ddictxt   = 'S'.                 " (S)hort (M)iddle (L)ong
  184.   ls_fieldcat-seltext_s = 'Campo #1'.                   " short key word
  185. *  ls_fieldcat-cfieldname type slis_fieldname,            " Campo Moneda
  186. *  ls_fieldcat-key(1)         type c,            " column with key-color
  187. *  ls_fieldcat-icon(1)        type c,                          " as icon
  188. *  ls_fieldcat-symbol(1)      type c,                        " as symbol
  189. *  ls_fieldcat-checkbox(1)    type c,                      " as checkbox
  190. *  ls_fieldcat-just(1)        type c,           " (R)ight (L)eft (C)ent.
  191. *  ls_fieldcat-lzero(1)       type c,                     " leading zero
  192. *  ls_fieldcat-no_sign(1)     type c,                    " write no-sign
  193. *  ls_fieldcat-no_zero(1)     type c,                    " write no-zero
  194. *  ls_fieldcat-no_convext(1)  type c,
  195. *  ls_fieldcat-edit_mask      type slis_edit_mask,
  196. *  ls_fieldcat-emphasize(4)   type c,                        " emphasize
  197. *  ls_fieldcat-fix_column(1)  type c,                  " Spalte fixieren
  198. *  ls_fieldcat-do_sum(1)      type c,                           " sum up
  199. *  ls_fieldcat-no_out(1)      type c,                " (O)blig.(X)no out
  200. *  ls_fieldcat-tech(1)        type c,                  " technical field
  201. *  ls_fieldcat-outputlen      like dd03p-outputlen,
  202. *  ls_fieldcat-offset         type dd03p-outputlen,             " offset
  203. *  ls_fieldcat-ctabname       type slis_tabname," Tabla del campo Moneda
  204. *  ls_fieldcat-seltext_l      like dd03p-scrtext_l,      " long key word
  205. *  ls_fieldcat-seltext_m      like dd03p-scrtext_m,    " middle key word
  206. *  ls_fieldcat-rollname       like dd03p-rollname,
  207. *  ls_fieldcat-datatype       like dd03p-datatype,
  208. *  ls_fieldcat-inttype        like dd03p-inttype,
  209. *  ls_fieldcat-intlen         like dd03p-intlen,
  210. *  ls_fieldcat-lowercase      like dd03p-lowercase,
  211.   append ls_fieldcat to p_t_fieldcat_alv.
  212. endform.
  213.  
  214. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  215. * ALV.3.2. Redefinimos los eventos:
  216. FORM ALV_3_2 USING e03_lt_events TYPE slis_t_event.
  217.   DATA: ls_event TYPE slis_alv_event.
  218. * Aqu leemos los eventos predefinidos!
  219.   CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
  220.   EXPORTING i_list_type = 0
  221.   IMPORTING et_events   = e03_lt_events.
  222.   LOOP AT e03_lt_events INTO ls_event WHERE name EQ g_pf_status.
  223.     case ls_event-name.
  224. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  225. * ALV.3.2.1. Status.
  226.        when g_pf_status.    ls_event-form = 'ALV_3_2_1_1'.
  227. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  228. * ALV.3.2.2. Top of page.
  229.        when g_top_of_page.  ls_event-form = 'ALV_3_2_2'.
  230. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  231. * ALV.3.2.3. User command.
  232.        when g_user_command. ls_event-form = 'ALV_3_2_3_1'.
  233.     endcase.
  234.     MODIFY e03_lt_events FROM ls_event.
  235.   ENDLOOP.
  236. ENDFORM.
  237.  
  238. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  239. * ALV.3.2.3.1. Preparamos el User-Comand.
  240. FORM ALV_3_2_3_1 USING r_ucomm     LIKE sy-ucomm
  241.                         rs_selfield TYPE slis_selfield.
  242. *  CASE r_ucomm.
  243. *    WHEN 'SAVE'. PERFORM guardar_modificaciones.
  244. *    WHEN '&IC1'. perform double_click.                     "Doble click
  245. *  ENDCASE.
  246. ENDFORM.
  247.  
  248. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  249. * ALV.3.2.1.1. Preparamos el status.
  250. FORM ALV_3_2_1_1 USING extab TYPE slis_t_extab.
  251.   DATA: ls_extab TYPE slis_extab.
  252. *  CLEAR ls_extab.
  253. *  ls_extab-fcode = '&VEXCEL'.
  254. *  APPEND ls_extab TO extab.
  255. * Otros ejemplos: &AQW %SL &ABC &INFO
  256.   SET PF-STATUS 'SSSSS' EXCLUDING extab.
  257. ENDFORM.
  258.  
  259. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  260. * ALV.3.3 Ordenamos la tabla por estos criterios
  261. FORM ALV_3_3 CHANGING ct_sort TYPE slis_t_sortinfo_alv.
  262.   DATA: ls_sort TYPE slis_sortinfo_alv.
  263. * Primer criterio de ordenacin ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  264.   ls_sort-spos         = 1.
  265.   ls_sort-fieldname    = 'KKKK1'.         "nombre del campo de la estruc
  266.   ls_sort-up           =
  267.   ls_sort-group        =
  268.   ls_sort-subtot       = 'X'.              "debe aparecer o no sumatorio
  269.   ls_sort-tabname      =
  270.   ls_sort-down         =
  271.   ls_sort-comp         =
  272.   ls_sort-expa         =
  273.   ls_sort-obligatory   = space.
  274.   APPEND ls_sort TO ct_sort.
  275. * Segundo criterio de ordenacin ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  276.   ls_sort-spos         = 2.
  277.   ls_sort-fieldname    = 'KKKK2'.
  278.   ls_sort-group        =
  279.   ls_sort-subtot       =
  280.   ls_sort-up           = 'X'.
  281.   ls_sort-comp         =
  282.   ls_sort-expa         =
  283.   ls_sort-tabname      =
  284.   ls_sort-down         =
  285.   ls_sort-obligatory   = space.
  286.   APPEND ls_sort TO ct_sort.
  287. ENDFORM.
  288.  
  289. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  290. * ALV.3.2.2. Top of page.
  291. FORM ALV_3_2_2.
  292.   CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
  293.   EXPORTING it_list_commentary = ALV_top_of_page
  294.             i_logo             = 'LLLLL'.
  295. ENDFORM.
  296.  
  297. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  298. *  ALV.4. Rellena la tabla interna con los datos.
  299. FORM ALV_4.
  300.   DATA: ls_outtab   LIKE i_datos.
  301.   DATA: ls_tabcolor TYPE lvc_s_scol.
  302. ENDFORM.
  303.  
  304. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  305. * ALV.4.1. Colores de lnea/columna/registro.
  306. form ALV_4_1.
  307.   DATA: ls_outtab   LIKE i_datos.
  308.   DATA: ls_tabcolor TYPE lvc_s_scol.
  309. * Ejemplo para toda la lnea
  310. *  LOOP AT i_datos.
  311. *    CASE i_datos-texto(1).
  312. *      WHEN 'A'. i_datos-color = 'C600'.
  313. *                MODIFY i_datos.
  314. *    ENDCASE.
  315. *  ENDLOOP.
  316.  
  317. * Ejemplo para solo una celda
  318. *  LOOP AT i_datos INTO ls_outtab.
  319. *    IF ls_outtab-s_curso IS INITIAL.
  320. *      ls_tabcolor-fname     = 'KKKK1'.
  321. *      ls_tabcolor-color-col = 6.
  322. *      ls_tabcolor-color-int = 0.
  323. *      ls_tabcolor-color-inv = 1.
  324. *      INSERT ls_tabcolor INTO TABLE ls_outtab-tabcolor.
  325. *      MODIFY i_datos INDEX sy-tabix FROM ls_outtab
  326. *                       TRANSPORTING tabcolor.
  327. *    ENDIF.
  328. *  ENDLOOP.
  329. ENDFORM.
  330.  
  331. FORM ALV_5.
  332. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  333. * ALV.5.1. Creamos la cabecera del listado.
  334.   PERFORM ALV_5_1 USING ALV_top_of_page[].
  335. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  336. * ALV.5.2. Definimos el layout
  337.   PERFORM ALV_5_2.
  338. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  339. * ALV.5.3. Llamamos a la funcin que saca al ALV
  340.   PERFORM ALV_5_3.
  341. ENDFORM.
  342.  
  343. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  344. * ALV.5.2. Definimos el layout
  345. FORM ALV_5_2.
  346. * BLOQUE 1 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  347.   ALV_layout-no_colhead = ' '.                    "Sin cabeceras
  348.   ALV_layout-no_hotspot = 'X'.            "Cabeceras sin hotspot
  349.   ALV_layout-zebra      = 'X'.     "Sale a rayas blancas /azules
  350.   ALV_layout-no_vline   = ' '.   "Separacin columnas por spacio
  351.   ALV_layout-no_keyfix  = ' '.             "Columnas fijas o no!
  352.   ALV_layout-expand_all = 'X'.         "Expandir todas las filas
  353.   ALV_layout-edit       = ' '.       "Modificar contenido celdas
  354. *ALV_layout-cell_merge = 'X'.    "not suppress field Replication
  355. *ALV_layout-edit_mode  = 'X'.                     "for grid only
  356. *ALV_layout-numc_sum   = 'X'.     "totals for NUMC-Fields possib
  357. *ALV_layout-no_input   = 'X'.               "only display fields
  358. *ALV_layout-f2code like sy-ucomm,
  359. *ALV_layout-reprep     = 'X'.    "report report interface active
  360. *ALV_layout-no_author  = 'X'.       "No standard authority check
  361. *ALV_layout-def_status = ' '.      "default status  space or 'A'
  362. *ALV_layout-item_text(20) type c,          "Text for item button
  363. * Display options ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  364.   ALV_layout-colwidth_optimize = 'X'.        "Optimizar columnas
  365.   ALV_layout-min_linesize    = 255.      "Tamaño minimo de linea
  366.   ALV_layout-max_linesize    = 250.                 "Default 250
  367.   ALV_layout-window_titlebar = sy-title.             "Titulo ALV
  368.   ALV_layout-no_uline_hs     = ' '.               "Sin cabeceras
  369. *ALV_layout-no_min_linesize  = ' '.     "line size = width eLIST
  370. * Exceptions (semaforos) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  371. *ALV_layout-lights_fieldname type slis_fieldname,
  372. *ALV_layout-lights_tabname   type slis_tabname,
  373. *ALV_layout-lights_rollname  like dfies-rollname,
  374. *ALV_layout-lights_condense(1) type c,
  375. * Sums ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  376.  ALV_layout-totals_before_items = ' '. "Total: X:arriba|'':abajo
  377. *ALV_layout-no_sumchoice = ' '.        "no choice for summing up
  378. *ALV_layout-no_totalline = ' '.                   "no total line
  379. *ALV_layout-no_subchoice = ' '.         "no choice for subtotals
  380. *ALV_layout-no_subtotals = ' '.           "no subtotals possible
  381. *ALV_layout-no_unit_splitting = ' '.  "no sep.tot.lines by units
  382. *ALV_layout-totals_only = 'X'                  "show only totals
  383. *ALV_layout-totals_text(60),     "text for 1st col.in total line
  384. *ALV_layout-subtotals_text(60),  "text for 1st col. in subtotals
  385. * Interaction ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  386.   ALV_layout-box_fieldname = g_slis_fieldname-marca.   "checkbox
  387.   ALV_layout-box_tabname   = g_slis_fieldname-tabla.   "checkbox
  388.   ALV_layout-confirmation_prompt = 'X'.            "Desea salir?
  389.   ALV_layout-key_hotspot   = ' '.    "Campos claves como hotspot
  390. *ALV_layout-box_rollname ,                      "rollname for CB
  391. *ALV_layout-expand_fieldname  = 'X'     "fieldname flag 'expand'
  392. *ALV_layout-hotspot_fieldname = 'X'.     "fieldname flag hotspot
  393. *ALV_layout-flexible_key  = 'X'.            "key columns movable
  394. *ALV_layout-group_buttons = 'X'.        "buttons for COL1 - COL5
  395. *ALV_layout-get_selinfos  = 'X'.          "read selection screen
  396. *ALV_layout-group_change_edit = 'X'.  "Sett. by user for new grp
  397. *ALV_layout-no_scrolling  = 'X'.                   "no scrolling
  398. * Detailed screen ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  399. *ALV_layout-detail_popup = 'X'.            "show detail in popup
  400. *ALV_layout-detail_initial_lines = 'X'. "show also initial lines
  401. *ALV_layout-detail_titlebar =    sy-title.  "Titlebar for detail
  402. * Display variants ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  403.   ALV_layout-info_fieldname    = 'COLOR'.               "Colores
  404.   ALV_layout-coltab_fieldname  = 'TABCOLOR'.            "Colores
  405. *ALV_layout-header_text(20) type c,      "Text for header button
  406. *ALV_layout-default_item       = ' '.          "Items as default
  407. * Others ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  408. *ALV_layout-list_append = ' '.                   "no call screen
  409. *ALV_layout-xifunckey type aqs_xikey,      "eXtended interaction
  410. *ALV_layout-xidirect type flag,            "eXtended INTeraction
  411. *ALV_layout-dtc_layout type dtc_s_layo,   "Layout config.Tabstip
  412. ENDFORM.
  413.  
  414. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  415. * ALV.5.3. Llamamos a la funcin que saca al ALV
  416. FORM ALV_5_3.
  417.   DATA: accion TYPE  slis_exit_by_user,
  418.         d_respuesta(1).
  419. *  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
  420.   CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
  421.   EXPORTING  i_callback_program       = g_repid
  422. * Eliminar esta linea si se desea PF-STATUS standard
  423.              i_callback_pf_status_set = g_pf_status
  424.              i_callback_user_command  = g_user_command
  425.              i_background_id          = 'ALV_BACKGROUND'
  426.              is_layout                = ALV_layout
  427. *             I_GRID_TITLE             = 'TTTTT'
  428.              i_save                   = cg_activo
  429.              is_variant               = g_variant
  430.              it_sort                  = alv_sort
  431.              it_events                = ALV_event[]
  432.              it_fieldcat              = ALV_fieldcat[]
  433.   IMPORTING  es_exit_caused_by_user   = accion
  434.   TABLES     t_outtab                 = i_datos
  435.   EXCEPTIONS program_error            = 1
  436.              OTHERS                   = 2.
  437.   case 'X'.
  438.     when accion-back or accion-exit or accion-cancel. EXIT.
  439.   endcase.
  440. ENDFORM.
  441.  
  442. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  443. * ALV.5.1. Creamos la cabecera del listado.
  444. FORM ALV_5_1 USING e04_lt_top_of_page TYPE slis_t_listheader.
  445.   DATA: ls_line TYPE slis_listheader.
  446.   CLEAR ls_line.
  447.   ls_line-typ      = 'H'.        " H = Header, S = Selection, A = Action
  448.   ls_line-info+20  = 'TTTTT'.
  449.   APPEND ls_line TO e04_lt_top_of_page.
  450. ENDFORM.