![]() |
alv block
hola alguien me puede echar una mano con un alv block.
Tengo datos en 3 tablas que se tienen que agrupar por un codigo y por un tipo. y lo tengo que mostrar todo en un alv block. un bloque por cada codigo. la estructura de como teng que mostrar cada bloque viene de otra tabla. Me gustaria que me dijerais las funciones que tengo que usar y mas o menos que parametros necesitaria para usarlas. muchs gracias. |
mira este codigo para unir mas de un alv
*----------------------------------------------------------------------* *Declaración de variables alv *----------------------------------------------------------------------* CONSTANTS: gc_formname_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE', gc_formname_top_of_page1 TYPE slis_formname VALUE 'TOP_OF_PAGE1'. DATA: g_exit, g_save. DATA: gt_fieldcat TYPE slis_t_fieldcat_alv, gs_layout TYPE slis_layout_alv, gs_print TYPE slis_print_alv, gt_events TYPE slis_t_event, gt_sp_group TYPE slis_t_sp_group_alv, g_repid LIKE sy-repid, gx_variant LIKE disvariant, g_variant LIKE disvariant. *------------------------------------------------* * Inicializamos el Bloque de la Lista ALV * *------------------------------------------------* CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT' EXPORTING I_callback_program = g_repid. * I_CALLBACK_PF_STATUS_SET = 'SET_STATUS' * I_CALLBACK_USER_COMMAND = 'USER_COMMAND'. PERFORM fieldcat_init_res USING gt_fieldcat. *------------------------------------------------* * Imprimimos los Bloques del ALV * *------------------------------------------------* gs_print-reserve_lines = 1. CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY' EXPORTING IS_PRINT = gs_print. ENDIF. *---------------------------------------------------------------------* * FORM fieldcat_init_res * *---------------------------------------------------------------------* * ........ * *---------------------------------------------------------------------* * --> LT_FIELDCAT * *---------------------------------------------------------------------* FORM fieldcat_init_res USING lt_fieldcat TYPE slis_t_fieldcat_alv. DATA: ls_fieldcat TYPE slis_fieldcat_alv. DATA: l_tabname LIKE ls_fieldcat-tabname, l_fieldname LIKE ls_fieldcat-fieldname. DATA: WFIELD(5) TYPE C, WDESC(10) type c. FIELD-SYMBOLS: <field> . * Nombre de la tabal interna a visualizar l_tabname = 'TI_DATARES'. * Grupo de Material CLEAR ls_fieldcat. ls_fieldcat-fieldname = 'MATKL'. ls_fieldcat-tabname = l_tabname. ls_fieldcat-ref_tabname = 'MARA'. ls_fieldcat-ref_fieldname = 'MATKL'. APPEND ls_fieldcat TO lt_fieldcat. *Descripción del grupo de material CLEAR ls_fieldcat. ls_fieldcat-fieldname = 'WGBEZ'. ls_fieldcat-tabname = l_tabname. ls_fieldcat-ref_tabname = 'T023T'. ls_fieldcat-ref_fieldname = 'WGBEZ'. ls_fieldcat-outputlen = '33'. APPEND ls_fieldcat TO lt_fieldcat. * Valor Total x mes LOOP AT TI_FEC. CONCATENATE 'POS' TI_FEC-POS INTO WFIELD. CONCATENATE TI_FEC-FEC+4(2) '.' TI_FEC-FEC(4) INTO WDESC. CLEAR ls_fieldcat. ls_fieldcat-fieldname = WFIELD. ls_fieldcat-tabname = l_tabname. ls_fieldcat-seltext_l = WDESC. ls_fieldcat-seltext_m = WDESC. ls_fieldcat-seltext_s = WDESC. ls_fieldcat-datatype = 'CURR'. ls_fieldcat-do_sum = 'X'. APPEND ls_fieldcat TO lt_fieldcat. ENDLOOP. *Valor Total CLEAR ls_fieldcat. ls_fieldcat-fieldname = 'TOTAL'. ls_fieldcat-tabname = l_tabname. ls_fieldcat-seltext_l = TEXT-T01. ls_fieldcat-seltext_m = TEXT-T01. ls_fieldcat-seltext_s = TEXT-T01. ls_fieldcat-datatype = 'CURR'. ls_fieldcat-do_sum = 'X'. APPEND ls_fieldcat TO lt_fieldcat. PERFORM eventtab_build USING gt_events[]. CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND' EXPORTING is_layout = GS_layout it_fieldcat = lt_fieldcat[] it_events = gt_events[] i_tabname = 'TI_DATARES' TABLES t_outtab = TI_DATARES EXCEPTIONS PROGRAM_ERROR = 1 MAXIMUM_OF_APPENDS_REACHED = 2 OTHERS = 3. * ncol = 0. * nrow = 1. * add 1 to ncol. clear lt_fieldcat. refresh lt_fieldcat. l_tabname = 'TI_DATARESVF'. CLEAR ls_fieldcat. ls_fieldcat-fieldname = 'TEXTO'. ls_fieldcat-tabname = l_tabname. ls_fieldcat-outputlen = '31'. APPEND ls_fieldcat TO lt_fieldcat. CLEAR ls_fieldcat. ls_fieldcat-fieldname = 'PORCEN'. ls_fieldcat-tabname = l_tabname. ls_fieldcat-outputlen = '12'. ls_fieldcat-seltext_l = '%'. ls_fieldcat-seltext_m = '%'. ls_fieldcat-seltext_s = '%'. ls_fieldcat-datatype = 'CURR'. ls_fieldcat-do_sum = 'X'. APPEND ls_fieldcat TO lt_fieldcat. LOOP AT TI_FECVF. CONCATENATE 'POS' TI_FECVF-POS INTO WFIELD. CONCATENATE TI_FECVF-FEC+4(2) '.' TI_FECVF-FEC(4) INTO WDESC. CLEAR ls_fieldcat. ls_fieldcat-fieldname = WFIELD. ls_fieldcat-tabname = l_tabname. ls_fieldcat-seltext_l = WDESC. ls_fieldcat-seltext_m = WDESC. ls_fieldcat-seltext_s = WDESC. ls_fieldcat-datatype = 'CURR'. ls_fieldcat-do_sum = 'X'. APPEND ls_fieldcat TO lt_fieldcat. ENDLOOP. *Valor Total CLEAR ls_fieldcat. ls_fieldcat-fieldname = 'TOTAL'. ls_fieldcat-tabname = l_tabname. ls_fieldcat-seltext_l = TEXT-T01. ls_fieldcat-seltext_m = TEXT-T01. ls_fieldcat-seltext_s = TEXT-T01. ls_fieldcat-datatype = 'CURR'. ls_fieldcat-do_sum = 'X'. APPEND ls_fieldcat TO lt_fieldcat. PERFORM eventtab_build1 USING gt_events[]. CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND' EXPORTING is_layout = GS_layout it_fieldcat = lt_fieldcat[] it_events = gt_events[] i_tabname = 'TI_DATARESVF' TABLES t_outtab = TI_DATARESVF EXCEPTIONS PROGRAM_ERROR = 1 MAXIMUM_OF_APPENDS_REACHED = 2 OTHERS = 3. ENDFORM. "fieldcat_init |
ok. muchas gracias por la ayuda.
|
Hola, cuando me sale el segundo y sucesivos bloques me salen todas las columnas repetidas. Sera por el catalogo no?
igual no hago el clear cada vez que hago un append. Supongo que sea por eso no? gracias |
Alv en bloque
Gracias por la ayuda. Excelente el ejemplo y solucione un problema que tenia con el libro de compras. Quiesiera saber si se pueden colocar en una misma columna los titulos en varias filas para poder colocarlos mas claros y resumirlos. Mil gracias.
|
Husos Horarios son GMT. La hora en este momento es 20:59:46. |
www.mundosap.com 2006 - Spain
software crm, crm on demand, software call center, crm act, crm solutions, crm gratis, crm web