Foro de programacion ABAP
Bienvenido(a),
Visitante
. Por favor,
ingresa
o
regístrate
. ¿Perdiste tu
email de activación
?
1 Hora
1 Día
1 Semana
1 Mes
Siempre
Ingresar con nombre de usuario, contraseña y duración de la sesión
Noticias:
Los 100 libros mas vendidos de la informática
Inicio
Ayuda
Buscar
Ingresar
Registrarse
Foro de programacion ABAP
»
Código abierto
»
Informes
»
Informe: Flujo de documentos
« anterior
próximo »
Imprimir
Páginas: [
1
]
Ir Abajo
Autor
Tema: Informe: Flujo de documentos (Leído 21969 veces)
0 Usuarios y 1 Visitante están viendo este tema.
oscar
Administrador
Usuario Sr.
Mensajes: 112
Informe: Flujo de documentos
«
en:
01 de Agosto de 2008, 01:44:10 pm »
En este informe se muestra el flujo entre varios documentos...
Pedido -> Entrega -> Transporte -> etc...
En
Include ZALV
lo podéis descargar desde
Aquí
.
*&---------------------------------------------------------------------*
*& Report zflujo_pedidos
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT zflujo_pedidos.
************************************************************************
* INCLUDE
************************************************************************
INCLUDE: zalv.
************************************************************************
*DATA
************************************************************************
DATA: BEGIN OF gt_flujo OCCURS 0,
vbeln LIKE vbak-vbeln,
vkorg LIKE vbak-vkorg,
vtweg LIKE vbak-vtweg,
spart LIKE vbak-spart,
vdatu LIKE vbak-vdatu,
entrega LIKE likp-vbeln,
tknum LIKE vttk-tknum,
daten LIKE vttk-daten,
fknum LIKE vfkk-fknum,
budat LIKE vfkp-budat,
tdlnr LIKE vfkp-tdlnr,
tdlnr_txt LIKE lfa1-name1,
netwr LIKE vfkp-netwr,
waers LIKE vfkp-waers,
ebeln LIKE vfkp-ebeln,
END OF gt_flujo.
************************************************************************
*SELECTION-SCREEN
************************************************************************
SELECTION-SCREEN SKIP 1.
SELECT-OPTIONS: s_vbeln FOR gt_flujo-vbeln OBLIGATORY
MATCHCODE OBJECT vmva.
SELECT-OPTIONS: s_vkorg FOR gt_flujo-vkorg NO-DISPLAY.
SELECT-OPTIONS: s_vtweg FOR gt_flujo-vtweg NO-DISPLAY.
SELECT-OPTIONS: s_spart FOR gt_flujo-spart NO-DISPLAY.
SELECT-OPTIONS: s_vdatu FOR gt_flujo-vdatu NO-DISPLAY.
SELECTION-SCREEN SKIP 2.
PARAMETERS: p_vari LIKE variant-variant.
************************************************************************
*AT SELECTION-SCREEN ON VALUE-REQUEST
************************************************************************
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.
DATA: spec_layout TYPE disvariant,
gf_exit TYPE c.
CLEAR variant.
MOVE sy-repid TO variant-report.
CALL FUNCTION 'LVC_VARIANT_F4'
EXPORTING
is_variant = variant
i_save = 'A'
IMPORTING
e_exit = gf_exit
es_variant = spec_layout
EXCEPTIONS
not_found = 1
OTHERS = 2.
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
IF gf_exit NE 'X'.
p_vari = spec_layout-variant.
variant = spec_layout.
ENDIF.
ENDIF.
************************************************************************
*START-OF-SELECTION
************************************************************************
START-OF-SELECTION.
PERFORM tomar_datos.
************************************************************************
*END-OF-SELECTION
************************************************************************
END-OF-SELECTION.
PERFORM mostrar_listado.
************************************************************************
*FORMS
************************************************************************
*&---------------------------------------------------------------------*
*& Form tomar_datos
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM tomar_datos .
DATA: BEGIN OF lt_vbfa_entregas OCCURS 0,
vbelv LIKE vbfa-vbelv,
vbeln LIKE vbfa-vbeln,
vkorg LIKE vbak-vkorg,
vtweg LIKE vbak-vtweg,
spart LIKE vbak-spart,
vdatu LIKE vbak-vdatu,
END OF lt_vbfa_entregas.
DATA: lt_vbfa_transportes LIKE vbfa OCCURS 0 WITH HEADER LINE.
DATA: lt_lfa1 LIKE lfa1 OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF lt_datos_gasto OCCURS 0,
rebel LIKE vfkp-rebel,
fknum LIKE vfkk-fknum,
tdlnr LIKE vfkp-tdlnr,
budat LIKE vfkp-budat,
netwr LIKE vfkp-netwr,
waers LIKE vfkp-waers,
ebeln LIKE vfkp-ebeln,
END OF lt_datos_gasto.
DATA: BEGIN OF lt_datos_transporte OCCURS 0,
tknum LIKE vttk-tknum,
daten LIKE vttk-daten,
dtabf LIKE vttk-dtabf,
END OF lt_datos_transporte.
SELECT vbfa~vbelv vbfa~vbeln
vbak~vkorg vbak~vtweg vbak~spart vbak~vdatu
INTO TABLE lt_vbfa_entregas
FROM vbfa JOIN vbak ON vbfa~vbelv = vbak~vbeln
WHERE vbfa~vbelv IN s_vbeln
AND vbfa~vbtyp_n = 'J'
AND vbfa~vbtyp_v = 'C'
AND vbak~vkorg IN s_vkorg
AND vbak~vtweg IN s_vtweg
AND vbak~spart IN s_spart
AND vbak~vdatu IN s_vdatu.
CHECK sy-subrc = 0.
SORT lt_vbfa_entregas BY vbelv vbeln.
DELETE ADJACENT DUPLICATES FROM lt_vbfa_entregas
COMPARING vbelv vbeln.
SELECT * INTO TABLE lt_vbfa_transportes
FROM vbfa
FOR ALL ENTRIES IN lt_vbfa_entregas
WHERE vbelv = lt_vbfa_entregas-vbeln
AND vbtyp_n = '8'
AND vbtyp_v = 'J'.
SELECT tknum daten dtabf
INTO CORRESPONDING FIELDS OF TABLE lt_datos_transporte
FROM vttk
FOR ALL ENTRIES IN lt_vbfa_transportes
WHERE tknum = lt_vbfa_transportes-vbeln.
SELECT vfkp~rebel vfkk~fknum vfkp~tdlnr vfkp~budat
vfkp~netwr vfkp~waers vfkp~ebeln
INTO CORRESPONDING FIELDS OF TABLE lt_datos_gasto
FROM vfkk JOIN vfkp ON vfkk~mandt = vfkp~mandt
AND vfkk~fknum = vfkp~fknum
FOR ALL entries IN lt_vbfa_transportes
WHERE vfkp~rebel = lt_vbfa_transportes-vbeln.
LOOP AT lt_vbfa_entregas.
CLEAR gt_flujo.
gt_flujo-vbeln = lt_vbfa_entregas-vbelv.
gt_flujo-vkorg = lt_vbfa_entregas-vkorg.
gt_flujo-vtweg = lt_vbfa_entregas-vtweg.
gt_flujo-spart = lt_vbfa_entregas-spart.
gt_flujo-vdatu = lt_vbfa_entregas-vdatu.
gt_flujo-entrega = lt_vbfa_entregas-vbeln.
LOOP AT lt_vbfa_transportes WHERE vbelv = lt_vbfa_entregas-vbeln.
gt_flujo-tknum = lt_vbfa_transportes-vbeln.
CLEAR lt_datos_transporte.
READ TABLE lt_datos_transporte WITH KEY tknum = gt_flujo-tknum.
IF lt_datos_transporte-daten IS INITIAL.
gt_flujo-daten = lt_datos_transporte-dtabf.
ELSE.
gt_flujo-daten = lt_datos_transporte-daten.
ENDIF.
LOOP AT lt_datos_gasto WHERE rebel = lt_vbfa_transportes-vbeln.
gt_flujo-fknum = lt_datos_gasto-fknum.
gt_flujo-tdlnr = lt_datos_gasto-tdlnr.
gt_flujo-budat = lt_datos_gasto-budat.
gt_flujo-netwr = lt_datos_gasto-netwr.
gt_flujo-waers = lt_datos_gasto-waers.
gt_flujo-ebeln = lt_datos_gasto-ebeln.
COLLECT gt_flujo.
ENDLOOP.
IF sy-subrc <> 0.
COLLECT gt_flujo.
ENDIF.
ENDLOOP.
IF sy-subrc <> 0.
COLLECT gt_flujo.
ENDIF.
ENDLOOP.
IF NOT gt_flujo[] IS INITIAL.
* Agente de servicios
SELECT * INTO TABLE lt_lfa1
FROM lfa1
FOR ALL ENTRIES IN gt_flujo
WHERE lifnr = gt_flujo-tdlnr.
LOOP AT lt_lfa1.
gt_flujo-tdlnr_txt = lt_lfa1-name1.
MODIFY gt_flujo TRANSPORTING tdlnr_txt
WHERE tdlnr = lt_lfa1-lifnr.
ENDLOOP.
ENDIF.
ENDFORM. " tomar_datos
*&---------------------------------------------------------------------*
*& Form mostrar_listado
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM mostrar_listado .
repname = sy-repid.
* Descripción estándar de campos
PERFORM obt_descrip_campos_tabla USING repname 'GT_FLUJO'.
* Se realizan los cambios de descripciones
PERFORM cambio_descripcion USING:
'TDLNR_TXT' 'Nombre agente'(l01) 'Nombre agente'(l01)
'Nombre agente'(l01) 'Nombre agente'(l01) 'M',
'VBELN' 'Pedido'(l02) 'Pedido'(l02)
'Pedido'(l02) 'Pedido'(l02) 'M',
'FKNUM' 'Nº Gasto'(l03) 'Nº Gasto'(l03)
'Nº Gasto'(l03) 'Nº Gasto'(l03) 'M',
'TDLNR' 'Agente'(l04) 'Agente'(l04)
'Agente'(l04) 'Agente'(l04) 'M',
'EBELN' 'Ped. compras'(l05) 'Ped. compras'(l05)
'Ped. compras'(l05) 'Ped. compras'(l05) 'M',
'DATEN' 'Fin/Despacho'(l06) 'Fin/Despacho'(l06)
'Fin/Despacho'(l06) 'Fin/Despacho'(l06) 'M'.
* Características generales del listado
PERFORM carac_gen_listado.
* Asignamos campos moneda
PERFORM asignar_moneda_columna USING: 'NETWR' 'WAERS'.
* Asignamos/eliminamos campos clave
PERFORM asign_o_quitar_campo_clave USING: 'VBELN' ' ',
'ENTREGA' ' ',
'TKNUM' ' ',
'FKNUM' ' '.
* Asignamos Hotspot
PERFORM activar_hotspot USING: 'VBELN' 'X',
'ENTREGA' 'X',
'TKNUM' 'X',
'FKNUM' 'X',
'TDLNR' 'X',
'EBELN' 'X'.
* Eliminar campos de visualización
PERFORM elim_campos_de_visualizacion USING: 'VKORG',
'VTWEG',
'SPART',
'VDATU'.
* Variante de visualización
variant-report = repname.
variant-variant = p_vari.
* Asignación de User Command
PERFORM asignar_user_command.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = repname
is_layout = layout
it_fieldcat = fieldtab[]
i_save = 'A'
it_events = events[]
is_variant = variant
TABLES
t_outtab = gt_flujo
EXCEPTIONS
program_error = 1
OTHERS = 2.
ENDFORM. " mostrar_listado
*---------------------------------------------------------------------*
* FORM user_command *
*---------------------------------------------------------------------*
* Interprete de comandos para las opciones no estándar de
* usuario sobre el listado
*---------------------------------------------------------------------*
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
DATA: lf_ebeln LIKE vfkp-ebeln.
CASE r_ucomm.
WHEN '&IC1'.
CASE rs_selfield-fieldname.
WHEN 'VBELN'.
CHECK NOT rs_selfield-value IS INITIAL.
SET PARAMETER ID 'AUN' FIELD rs_selfield-value.
CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
WHEN 'ENTREGA'.
CHECK NOT rs_selfield-value IS INITIAL.
SET PARAMETER ID 'VL' FIELD rs_selfield-value.
CALL TRANSACTION 'VL03N' AND SKIP FIRST SCREEN.
WHEN 'TKNUM'.
CHECK NOT rs_selfield-value IS INITIAL.
SET PARAMETER ID 'TNR' FIELD rs_selfield-value.
CALL TRANSACTION 'VT03N' AND SKIP FIRST SCREEN.
WHEN 'FKNUM'.
CHECK NOT rs_selfield-value IS INITIAL.
SET PARAMETER ID 'FKK' FIELD rs_selfield-value.
CALL TRANSACTION 'VI03' AND SKIP FIRST SCREEN.
WHEN 'TDLNR'.
CHECK NOT rs_selfield-value IS INITIAL.
SET PARAMETER ID 'LIF' FIELD rs_selfield-value.
SET PARAMETER ID 'KDY' FIELD '/130/380/110/120'.
CALL TRANSACTION 'MK03' AND SKIP FIRST SCREEN.
WHEN 'EBELN'.
CHECK NOT rs_selfield-value IS INITIAL.
lf_ebeln = rs_selfield-value.
CALL FUNCTION 'ME_DISPLAY_PURCHASE_DOCUMENT'
EXPORTING
i_ebeln = lf_ebeln
* i_ebelp =
* I_ENJOY = 'X'
* I_PREVIEW =
* I_DATA_FROM_BUFFER =
* I_BSTYP =
i_display_only = 'X'
* I_EDIT = ' '
* i_etenr =
* I_DOC_INITIATOR =
EXCEPTIONS
not_found = 1
no_authority = 2
invalid_call = 3
preview_not_possible = 4
OTHERS = 5
.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDCASE.
ENDCASE.
ENDFORM. "user_command
*&---------------------------------------------------------------------*
*& Form cambio_descripcion
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM cambio_descripcion USING pf_fieldname
pf_scrtext_l
pf_scrtext_m
pf_scrtext_s
pf_coltext
pf_ddictxt.
READ TABLE fieldtab WITH KEY fieldname = pf_fieldname
ASSIGNING <fs>.
IF sy-subrc EQ 0.
<fs>-seltext_l = pf_scrtext_l.
<fs>-seltext_m = pf_scrtext_m.
<fs>-seltext_s = pf_scrtext_s.
<fs>-reptext_ddic = pf_coltext.
<fs>-ddictxt = pf_ddictxt.
ENDIF.
ENDFORM. " cambio_descripcion
*&---------------------------------------------------------------------*
*& Form eliminar_col_seleccion
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM eliminar_col_seleccion USING pf_fieldname.
READ TABLE fieldtab WITH KEY fieldname = pf_fieldname
ASSIGNING <fs>.
IF sy-subrc EQ 0.
<fs>-no_out = 'X'.
<fs>-tech = 'X'.
ENDIF.
ENDFORM. " eliminar_col_seleccion
Saludos...
En línea
Ecabacksis
Novato
Mensajes: 1
Re:Informe: Flujo de documentos
«
Respuesta #1 en:
24 de Diciembre de 2018, 11:24:46 am »
I have come to read useful information that makes me feel good at this time.
En línea
Imprimir
Páginas: [
1
]
Ir Arriba
« anterior
próximo »
Foro de programacion ABAP
»
Código abierto
»
Informes
»
Informe: Flujo de documentos