Ayuda para ALV
1 Adjunto(s)
Buenas foro. Necesitaría una ayudita para hacer un ALV.
El problema es que no se como sacar al final del listado unos valores. Adjunto ejemplo.(Ejemplo.zip) Gracias a todos por adelantado. |
Si me especificas un poco más igual puedo ayudarte, que ultimamente he estado haciendo varias pruebas con alv's.
|
buenas, la cosa es facil de explicar, ya no se si sencillo (espero que si) de hacer.
Necesataría sacar despues de el listado típico de un ALV, unas líneas al final de la página: campo 1 campo 2 campo 3 campo 4 campo 5 campo 5 0,015 Conforme 25,0 Conforme 2,25 Ausencia 0,005 Conforme 62,3 Conforme 11,25 Ausencia 0,015 Conforme 25,0 Conforme 2,25 Ausencia cof.valiadación 6.35 3,75 Valor. medio 42.90 7,22 Espero que esto te aclare mi pregunta. Gracias |
Te había escrito una cosa pero creo que no sirve, había mirado mal el archvo adjunto.
Me temo que lo que quieres hacer no se puede hacer de forma estandar. |
Quieres poner unas lineas despues de que pintaste tu ALV ??
campo 1 campo 2 campo 3 campo 4 campo 5 resulta1 resulta2 resultado3 resultado4 resultado5 ???? si es asi... lo que podrias hacer es agregarle la lineas a la tabla que llenas para pintar al ALV.. saludos |
Eso creo yo. Creo que lo mejor que puedes hacer es pensar como pasar estas líneas con el formato de campos que ya tienes.
|
Gracias chicos.
Pensé que había alguna función ALV, al igual que se puede poner una cabecera TOP_OF_PAGE, poner un END_OF_PAGE con el final que quiero para mi listado. Gracias de todas formas, si no encuentro (o alguien me dice) una solución en breve, haré lo que me proponeis. |
y si la encuentras posteala para que la conozcamos ;)
Suerte. |
alv
La información que quieres del Modulo QM la puedes sacar a través de query uniendo algunas tablas o empezar a ver o transacción QM13 – QA10 – QM50 – QS28:eek:
|
Una idea sería crear dos custom control en tu dynpro, en una cargas tu ALV y en la otra las lineas resumen que quieras.
Saludos. Julio L. :-) El poder de los objetos |
Manuales de ALV y SMARTFORMS
Hola:
Espero que alguien me pueda apoyar, necesito urgentemente unos manuales de ALVS y Smartforms en español, tengo que dar una capacitación de esas dos herramientas y no tego el material, espero que alguno del foro me pueda apoyar. Mi correo es De antemano muchas gracias por su apoyo. Saludos............ |
Existe el evento END_OF_PAGE
Si se puede susar el evento END_OF_PAGE dentro de los ALV, te anexo un ejemplo
REPORT ztufi091 . *&---------------------------------------------------------------------* *& Report ZDEMO_ALVGRID * *& * *&---------------------------------------------------------------------* *& * *& Example of a simple ALV Grid Report * *& ................................... * *& * *& The basic requirement for this demo is to display a number of * *& fields from the EKKO table. * *&---------------------------------------------------------------------* *REPORT zdemo_alvgrid . TABLES: ekko, cdpos. TYPE-POOLS: slis. "ALV Declarations DATA: desc(25) TYPE c. **Iconos en el estatus DATA: status_icon TYPE icons-text, icon_name(20) TYPE c, icon_text(10) TYPE c. RANGES: fname FOR cdpos-fname. *Data Declaration *---------------- TYPES: BEGIN OF t_ekko, banfn TYPE eban-banfn, bnfpo TYPE eban-bnfpo, icon_a1 TYPE icons-text, ussap_a1 TYPE sy-uname, nombrea1(20) TYPE c, END OF t_ekko. DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0, wa_ekko TYPE t_ekko. *ALV data declarations DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE, gd_tab_group TYPE slis_t_sp_group_alv, gd_layout TYPE slis_layout_alv, gd_repid LIKE sy-repid, gt_events TYPE slis_t_event, gd_prntparams TYPE slis_print_alv. INITIALIZATION. refresh FNAME. *fname-sign = 'I'. *fname-option = 'EQ' *fname-low = 'ZESTADO'. *append fname. ************************************************************************ *Start-of-selection. START-OF-SELECTION. PERFORM data_retrieval. PERFORM build_fieldcatalog. PERFORM build_layout. PERFORM build_events. PERFORM build_print_params. PERFORM display_alv_report. *&---------------------------------------------------------------------* *& Form BUILD_FIELDCATALOG *&---------------------------------------------------------------------* * Build Fieldcatalog for ALV Report *----------------------------------------------------------------------* FORM build_fieldcatalog. * There are a number of ways to create a fieldcat. * For the purpose of this example i will build the fieldcatalog manualy * by populating the internal table fields individually and then * appending the rows. This method can be the most time consuming but can * also allow you more control of the final product. * Beware though, you need to ensure that all fields required are * populated. When using some of functionality available via ALV, such as * total. You may need to provide more information than if you were * simply displaying the result * I.e. Field type may be required in-order for * the 'TOTAL' function to work. fieldcatalog-fieldname = 'BANFN'. fieldcatalog-seltext_m = 'Sol. Pedido'. fieldcatalog-col_pos = 0. fieldcatalog-outputlen = 10. fieldcatalog-emphasize = 'X'. fieldcatalog-key = 'X'. * fieldcatalog-do_sum = 'X'. * fieldcatalog-no_zero = 'X'. APPEND fieldcatalog TO fieldcatalog. CLEAR fieldcatalog. fieldcatalog-fieldname = 'BNFPO'. fieldcatalog-seltext_m = 'Sol. Ped. Item'. fieldcatalog-col_pos = 1. APPEND fieldcatalog TO fieldcatalog. CLEAR fieldcatalog. * fieldcatalog-fieldname = 'STATU'. * fieldcatalog-seltext_m = 'Status'. * fieldcatalog-col_pos = 2. * APPEND fieldcatalog TO fieldcatalog. * CLEAR fieldcatalog. * * fieldcatalog-fieldname = 'AEDAT'. * fieldcatalog-seltext_m = 'Item change date'. * fieldcatalog-col_pos = 3. * APPEND fieldcatalog TO fieldcatalog. * CLEAR fieldcatalog. * * fieldcatalog-fieldname = 'MATNR'. * fieldcatalog-seltext_m = 'Material Number'. * fieldcatalog-col_pos = 4. * APPEND fieldcatalog TO fieldcatalog. * CLEAR fieldcatalog. * * fieldcatalog-fieldname = 'MENGE'. * fieldcatalog-seltext_m = 'PO quantity'. * fieldcatalog-col_pos = 5. * APPEND fieldcatalog TO fieldcatalog. * CLEAR fieldcatalog. * * fieldcatalog-fieldname = 'MEINS'. * fieldcatalog-seltext_m = 'Order Unit'. * fieldcatalog-col_pos = 6. * APPEND fieldcatalog TO fieldcatalog. * CLEAR fieldcatalog. * * fieldcatalog-fieldname = 'NETPR'. * fieldcatalog-seltext_m = 'Net Price'. * fieldcatalog-col_pos = 7. * fieldcatalog-outputlen = 15. * fieldcatalog-datatype = 'CURR'. * APPEND fieldcatalog TO fieldcatalog. * CLEAR fieldcatalog. * * fieldcatalog-fieldname = 'PEINH'. * fieldcatalog-seltext_m = 'Price Unit'. * fieldcatalog-col_pos = 8. * APPEND fieldcatalog TO fieldcatalog. * CLEAR fieldcatalog. * fieldcatalog-fieldname = 'ICON_A1'. fieldcatalog-seltext_m = 'A1'. fieldcatalog-col_pos = 9. fieldcatalog-icon = 'X'. APPEND fieldcatalog TO fieldcatalog. CLEAR fieldcatalog. fieldcatalog-fieldname = 'USSAP_A1'. fieldcatalog-seltext_m = 'Usuario SAP'. fieldcatalog-col_pos = 10. fieldcatalog-icon = 'X'. APPEND fieldcatalog TO fieldcatalog. CLEAR fieldcatalog. fieldcatalog-fieldname = 'NOMBREA1'. fieldcatalog-seltext_m = 'Nombre Responsable'. fieldcatalog-col_pos = 11. fieldcatalog-icon = 'X'. APPEND fieldcatalog TO fieldcatalog. CLEAR fieldcatalog. * fieldcatalog-fieldname = 'ICON_GC'. * fieldcatalog-seltext_m = 'GC'. * fieldcatalog-col_pos = 10. * fieldcatalog-icon = 'X'. * APPEND fieldcatalog TO fieldcatalog. * CLEAR fieldcatalog. * * fieldcatalog-fieldname = 'ICON_A2'. * fieldcatalog-seltext_m = 'A2'. * fieldcatalog-col_pos = 11. * fieldcatalog-icon = 'X'. * APPEND fieldcatalog TO fieldcatalog. * CLEAR fieldcatalog. * * fieldcatalog-fieldname = 'ICON_A3'. * fieldcatalog-seltext_m = 'A3'. * fieldcatalog-col_pos = 12. * fieldcatalog-icon = 'X'. * APPEND fieldcatalog TO fieldcatalog. * CLEAR fieldcatalog. * * fieldcatalog-fieldname = 'ICON_A4'. * fieldcatalog-seltext_m = 'A4'. * fieldcatalog-col_pos = 13. * fieldcatalog-icon = 'X'. * APPEND fieldcatalog TO fieldcatalog. * CLEAR fieldcatalog. * * * fieldcatalog-fieldname = 'ICON_A5'. * fieldcatalog-seltext_m = 'A5'. * fieldcatalog-col_pos = 14. * fieldcatalog-icon = 'X'. * APPEND fieldcatalog TO fieldcatalog. * CLEAR fieldcatalog. * * fieldcatalog-fieldname = 'ICON_A6'. * fieldcatalog-seltext_m = 'A6'. * fieldcatalog-col_pos = 15. * fieldcatalog-icon = 'X'. * APPEND fieldcatalog TO fieldcatalog. * CLEAR fieldcatalog. ENDFORM. " BUILD_FIELDCATALOG *&---------------------------------------------------------------------* *& Form BUILD_LAYOUT *&---------------------------------------------------------------------* * Build layout for ALV grid report *----------------------------------------------------------------------* FORM build_layout. gd_layout-no_input = 'X'. gd_layout-colwidth_optimize = 'X'. gd_layout-totals_text = 'Totals'(201). * gd_layout-totals_only = 'X'. * gd_layout-f2code = 'DISP'. "Sets fcode for when double * "click(press f2) * gd_layout-zebra = 'X'. * gd_layout-group_change_edit = 'X'. * gd_layout-header_text = 'helllllo'. ENDFORM. " BUILD_LAYOUT *&---------------------------------------------------------------------* *& Form DISPLAY_ALV_REPORT *&---------------------------------------------------------------------* * Display report using ALV grid *----------------------------------------------------------------------* FORM display_alv_report. gd_repid = sy-repid. CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' EXPORTING i_callback_program = gd_repid i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM i_callback_user_command = 'USER_COMMAND' * i_grid_title = outtext i_callback_html_end_of_list = 'END_OF_LIST_HTML' is_layout = gd_layout it_fieldcat = fieldcatalog[] * it_special_groups = gd_tabgroup it_events = gt_events is_print = gd_prntparams i_save = 'X' * is_variant = z_template TABLES t_outtab = it_ekko EXCEPTIONS program_error = 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. ENDFORM. " DISPLAY_ALV_REPORT *&------------------------------------------------------------------* *& Form end_of_list_html *&------------------------------------------------------------------* * output at the end of the list - not in printed output * *&------------------------------------------------------------------* FORM end_of_list_html USING end TYPE REF TO cl_dd_document. DATA: ls_text TYPE sdydo_text_element, l_grid TYPE REF TO cl_gui_alv_grid, f(14) TYPE c VALUE 'SET_ROW_HEIGHT'. ls_text = 'Footer title'. * adds and icon (red triangle) CALL METHOD end->add_icon EXPORTING sap_icon = 'ICON_MESSAGE_ERROR_SMALL'. * adds test (via variable) CALL METHOD end->add_text EXPORTING text = ls_text sap_emphasis = 'strong'. * adds new line (start new line) CALL METHOD end->new_line. * display text(bold) CALL METHOD end->add_text EXPORTING text = 'Bold text' sap_emphasis = 'strong'. * adds new line (start new line) CALL METHOD end->new_line. * display text(normal) CALL METHOD end->add_text EXPORTING text = 'Normal text'. * adds new line (start new line) CALL METHOD end->new_line. * display text(bold) CALL METHOD end->add_text EXPORTING text = 'Yellow triangle' sap_emphasis = 'strong'. * adds and icon (yellow triangle) CALL METHOD end->add_icon EXPORTING sap_icon = 'ICON_LED_YELLOW'. * display text(normal) CALL METHOD end->add_text EXPORTING text = 'More text'. *set height of this section CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR' IMPORTING e_grid = l_grid. CALL METHOD l_grid->parent->parent->(f) EXPORTING id = 3 height = 14. ENDFORM. "end_of_list_html. *&---------------------------------------------------------------------* *& Form DATA_RETRIEVAL *&---------------------------------------------------------------------* * Retrieve data form EKPO table and populate itab it_ekko *----------------------------------------------------------------------* FORM data_retrieval. DATA: it_cdpos LIKE cdpos OCCURS 0 WITH HEADER LINE. SELECT * FROM eban INTO CORRESPONDING FIELDS OF TABLE it_ekko WHERE banfn = '2200000041'. SELECT * INTO CORRESPONDING FIELDS OF TABLE it_cdpos FROM cdpos WHERE objectclas = 'BANF' AND objectid = '2200000041' AND fname in fname . LOOP AT it_ekko INTO wa_ekko. CASE wa_ekko-bnfpo. WHEN 1. desc = 'Pendiente'. icon_name = 'ICON_YELLOW_LIGHT'. PERFORM icon_create USING desc icon_name CHANGING wa_ekko-icon_a1. * WHEN 2. * desc = 'Aprobado'. * icon_name = 'ICON_GREEN_LIGHT'. * PERFORM icon_create USING desc icon_name * CHANGING wa_ekko-icon_gc. * WHEN OTHERS. * desc = 'Rechazado'. * icon_name = 'ICON_RED_LIGHT'. * PERFORM icon_create USING desc icon_name * CHANGING wa_ekko-icon_a2. ENDCASE. MODIFY it_ekko FROM wa_ekko. ENDLOOP. ENDFORM. " DATA_RETRIEVAL *-------------------------------------------------------------------* * Form TOP-OF-PAGE * *-------------------------------------------------------------------* * ALV Report Header * *-------------------------------------------------------------------* FORM top-of-page. *ALV Header declarations DATA: t_header TYPE slis_t_listheader, wa_header TYPE slis_listheader, t_line LIKE wa_header-info, ld_lines TYPE i, ld_linesc(10) TYPE c. * Title wa_header-typ = 'H'. wa_header-info = 'EKKO Table Report'. APPEND wa_header TO t_header. CLEAR wa_header. * Date wa_header-typ = 'S'. wa_header-key = 'Date: '. CONCATENATE sy-datum+6(2) '.' sy-datum+4(2) '.' sy-datum(4) INTO wa_header-info. "todays date APPEND wa_header TO t_header. CLEAR: wa_header. * Total No. of Records Selected DESCRIBE TABLE it_ekko LINES ld_lines. ld_linesc = ld_lines. CONCATENATE 'Total No. of Records Selected: ' ld_linesc INTO t_line SEPARATED BY space. wa_header-typ = 'A'. wa_header-info = t_line. APPEND wa_header TO t_header. * CLEAR: wa_header, t_line. CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE' EXPORTING it_list_commentary = t_header. * i_logo = 'Z_LOGO'. ENDFORM. *------------------------------------------------------------------* * FORM USER_COMMAND * *------------------------------------------------------------------* * --> R_UCOMM * * --> RS_SELFIELD * *------------------------------------------------------------------* FORM user_command USING r_ucomm LIKE sy-ucomm rs_selfield TYPE slis_selfield. * Check function code CASE r_ucomm. WHEN '&IC1'. ** Check field clicked on within ALVgrid report IF rs_selfield-fieldname = 'EBELN'. ** Read data table, using index of row user clicked on * READ TABLE it_ekko INTO wa_ekko INDEX rs_selfield-tabindex. ** Set parameter ID for transaction screen field * SET PARAMETER ID 'BES' FIELD wa_ekko-ebeln. ** Sxecute transaction ME23N, and skip initial data entry screen * CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN. ENDIF. ENDCASE. ENDFORM. *&---------------------------------------------------------------------* *& Form BUILD_EVENTS *&---------------------------------------------------------------------* * Build events table *----------------------------------------------------------------------* FORM build_events. DATA: ls_event TYPE slis_alv_event. CALL FUNCTION 'REUSE_ALV_EVENTS_GET' EXPORTING i_list_type = 0 IMPORTING et_events = gt_events[]. READ TABLE gt_events WITH KEY name = slis_ev_end_of_page INTO ls_event. IF sy-subrc = 0. MOVE 'END_OF_PAGE' TO ls_event-form. APPEND ls_event TO gt_events. ENDIF. READ TABLE gt_events WITH KEY name = slis_ev_end_of_list INTO ls_event. IF sy-subrc = 0. MOVE 'END_OF_LIST' TO ls_event-form. APPEND ls_event TO gt_events. ENDIF. ENDFORM. " BUILD_EVENTS *&---------------------------------------------------------------------* *& Form BUILD_PRINT_PARAMS *&---------------------------------------------------------------------* * Setup print parameters *----------------------------------------------------------------------* FORM build_print_params. gd_prntparams-reserve_lines = '3'. "Lines reserved for footer gd_prntparams-no_coverpage = 'X'. gd_prntparams-no_print_selinfos = 'X'. ENDFORM. " BUILD_PRINT_PARAMS *&---------------------------------------------------------------------* *& Form END_OF_PAGE *&---------------------------------------------------------------------* FORM end_of_page. DATA: listwidth TYPE i, ld_pagepos(10) TYPE c, ld_page(10) TYPE c. SKIP. WRITE:/40 'Page:', sy-pagno . ENDFORM. *&---------------------------------------------------------------------* *& Form END_OF_LIST *&---------------------------------------------------------------------* FORM end_of_list. DATA: listwidth TYPE i, ld_pagepos(10) TYPE c, ld_page(10) TYPE c. SKIP. WRITE:/40 'Page:', sy-pagno . ENDFORM. *---------------------------------------------------------------------* * FORM end_of_page * *---------------------------------------------------------------------* * ........ * *---------------------------------------------------------------------* *&---------------------------------------------------------------------* *& Form icon_create *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * -->P_DESC text * -->P_ICON_NAME text *----------------------------------------------------------------------* FORM icon_create USING desc icon_name CHANGING status_icon. CALL FUNCTION 'ICON_CREATE' EXPORTING name = icon_name text = desc info = 'Status' add_stdinf = 'X' IMPORTING result = status_icon EXCEPTIONS icon_not_found = 1 outputfield_too_short = 2 OTHERS = 3. ENDFORM. " icon_create |
gracias
Muchas gracias por el apoyo, esto me va a servir bastante para la capacitación.
Saludos...................:) |
Puedes usar el evento END-OF-LIST del alv tambien para imprimir las lineas que necesitas
|
Husos Horarios son GMT. La hora en este momento es 09:47:03. |
www.mundosap.com 2006 - Spain
software crm, crm on demand, software call center, crm act, crm solutions, crm gratis, crm web