REPORT ZRFI_ANT_SAL_PROV LINE-SIZE 163 NO STANDARD PAGE HEADING. TABLES: BKPF, BSEG, LFA1. *----------------------------------------------------------------------* * Definición de Parámetros y Select-Options * *----------------------------------------------------------------------* SELECTION-SCREEN BEGIN OF BLOCK sele WITH FRAME TITLE text-t02. PARAMETERS: S_BUKRS LIKE BKPF-BUKRS OBLIGATORY default 'AL00', S_BELNR LIKE BKPF-BELNR default '*', S_LIFNR LIKE BSEG-LIFNR MATCHCODE object ZSH_001 default '*', S_BLART LIKE BKPF-BLART default 'PL', S_GJAHR LIKE BKPF-GJAHR, S_DATUM LIKE SY-DATUM OBLIGATORY default SY-DATUM. SELECTION-SCREEN END OF BLOCK sele. *----------------------------------------------------------------------* * Definición de Tablas Internas y Estructuras * *----------------------------------------------------------------------* DATA: BEGIN OF T_DATOS OCCURS 0, BUKRS LIKE BSEG-BUKRS, "COMPANY ZUONR LIKE BSEG-ZUONR, "ASSIGMENT XOPVW LIKE BSEG-XOPVW, "DOCUMENTO ABIERO O NO WRBTR LIKE BSEG-WRBTR, "MONTO REAL EN LA FACTURA MWSKZ LIKE BSEG-MWSKZ, "APLICACION DE IVA? LIFNR LIKE BSEG-LIFNR, "PROVEEDOR BELNR LIKE BSEG-BELNR, "NO. DOCUMENTO GENERADO POR SAP BLART LIKE BKPF-BLART, "TIPO DE DOCUMENTO BLDAT LIKE BKPF-BLDAT, "FECHA DE CARGA EN SAP WAERS LIKE BKPF-WAERS, "TIPO DE MONEDA EN LA FACTURA ZFBDT LIKE BSIK-ZFBDT, "FECHA EN FACTURA ZTERM LIKE BSIK-ZTERM, "TERMINOS DE PAGO NAME1 LIKE LFA1-NAME1, "DESCRIPCION PROVEEDOR NETDU LIKE BKPF-BLDAT, "FECHA LIMITE DE PAGO DIASV LIKE BKPF-GJAHR, "DIAS VENCIDOS SATOT LIKE BSEG-WRBTR, "TOTAL DE DOCUMENTO END OF T_DATOS. DATA: LT_DATOS LIKE LINE OF T_DATOS. DATA: L_OUT_DATE LIKE SY-DATUM. DATA: DIFF_D TYPE I. *----------------------------------------------------------------------* * Variables * *----------------------------------------------------------------------* DATA: CONTADOR TYPE I. DATA: CONTADOR2 TYPE I. DATA: CONTADOR3 TYPE I. DATA: CONTADOR4 TYPE I. *----------------------------------------------------------------------* * Evento Iniatialization * *----------------------------------------------------------------------* START-OF-SELECTION. PERFORM OBTENER_DATOS. PERFORM IMPRIMIR_DATOS. *----------------------------------------------------------------------* * Funciones * *----------------------------------------------------------------------*
*----------------------------------------------------------------------* * Forms * *----------------------------------------------------------------------* * Form OBTENER_DATOS * *----------------------------------------------------------------------* FORM OBTENER_DATOS. SELECT BUKRS ZUONR XOPVW WRBTR MWSKZ LIFNR BELNR INTO T_DATOS FROM BSEG WHERE BUKRS EQ S_BUKRS AND LIFNR = S_LIFNR AND XOPVW = 'X'. *AND BELNR EQ S_BELNR. APPEND T_DATOS. ENDSELECT. **---------------------------------------------------------------------- LOOP AT T_DATOS. CONTADOR = SY-TABIX. SELECT SINGLE BLART BLDAT WAERS INTO (T_DATOS-BLART, T_DATOS-BLDAT, T_DATOS-WAERS) FROM BKPF WHERE BUKRS EQ S_BUKRS AND BLART EQ S_BLART AND BELNR EQ T_DATOS-BELNR. MODIFY T_DATOS INDEX CONTADOR. ENDLOOP. **---------------------------------------------------------------------- LOOP AT T_DATOS. CONTADOR2 = SY-TABIX. SELECT SINGLE ZFBDT ZTERM INTO (T_DATOS-ZFBDT, T_DATOS-ZTERM) FROM BSIK WHERE BELNR EQ T_DATOS-BELNR. MODIFY T_DATOS INDEX CONTADOR2. ENDLOOP. **---------------------------------------------------------------------- LOOP AT T_DATOS. CONTADOR3 = SY-TABIX. SELECT SINGLE NAME1 INTO (T_DATOS-NAME1) FROM LFA1 WHERE LIFNR EQ T_DATOS-LIFNR. MODIFY T_DATOS INDEX CONTADOR3. ENDLOOP. **---------------------------------------------------------------------- LOOP AT T_DATOS. CONTADOR4 = SY-TABIX. *PERFORM ADD_TIME. PERFORM DAYS. *T_DATOS-NETDU = L_OUT_DATE. T_DATOS-DIASV = DIFF_D. T_DATOS-SATOT = T_DATOS-WRBTR. MODIFY T_DATOS INDEX CONTADOR4. ENDLOOP. ENDFORM. *----------------------------------------------------------------------* * Form IMPRIMIR_DATOS * *----------------------------------------------------------------------* FORM IMPRIMIR_DATOS. WRITE: /5 'REPORTE DE PAGO A PROVEEDORES' COLOR 1 ON. WRITE: 135 'FECHA ACTUAL : ' INVERSE COLOR 6, SY-DATUM INVERSE COLOR 6, SY-ULINE. SKIP 2. * WRITE: /2 'COMPAÑIA', * 'PROVEEDOR', * 'NOMBRE PROVEEDOR', * 'ASSIGMENT', * 'NO. DOC', * 'TIPO DE DOC', * 'POSTING DATE', * 'MONTO EN FACT', * 'MONEDA FACT', * 'IVA', * 'FECHA EN FACT', * 'TERMINOS', * 'FECHA LIMITE', * 'DIAS VENCIDOS', * 'TOTAL DOC'. LOOP AT T_DATOS. SORT T_DATOS BY LIFNR. IF T_DATOS-LIFNR <> '00000'. MOVE T_DATOS TO LT_DATOS. *CADA CAMBIO DE PROVEEDOR *AT NEW LIFNR. WRITE: /2 LT_DATOS-BUKRS, 8 LT_DATOS-LIFNR, 15 LT_DATOS-NAME1, /2 LT_DATOS-ZUONR, LT_DATOS-BELNR, * LT_DATOS-XOPVW, LT_DATOS-BLART, LT_DATOS-BLDAT, LT_DATOS-WRBTR, LT_DATOS-WAERS, LT_DATOS-MWSKZ, LT_DATOS-ZFBDT, LT_DATOS-ZTERM, LT_DATOS-NETDU, LT_DATOS-DIASV, LT_DATOS-SATOT INVERSE COLOR 2. SKIP 1. *ENDAT. **AL FINAL DE CADA PROVEEDOR AT END OF LIFNR. SUM. WRITE: /78 'MONTO TOTAL DEL PROVEEDOR:', 104 LT_DATOS-WRBTR COLOR 2 ON. SKIP 1. ENDAT. ***AL FINAL DE LOS PROVEEDORES **AT LAST. **SUM. **SKIP 2. **WRITE: /80 'M O N T O T O T A L A P A G A R:' INVERSE COLOR 6, **120 ZAV_REPORTE-MONTO INVERSE COLOR 6. **ENDAT. ENDIF. ENDLOOP. ENDFORM. *---------------------------------------------------------------------* * Form de FUNCION PARA AGREGAR LOS TERMINOS O DIAS DE PLAZO ALA FECHA * * DE FACTURACION * *---------------------------------------------------------------------* FORM ADD_TIME. CALL FUNCTION 'ADD_TIME_TO_DATE' EXPORTING I_IDATE = T_DATOS-ZFBDT I_TIME = T_DATOS-ZTERM I_IPRKZ = '' " ''=Day, 1=Week, 2=Month ,3 = Year IMPORTING O_IDATE = L_OUT_DATE EXCEPTIONS INVALID_PERIOD = 01 INVALID_ROUND_UP_RULE = 02 INTERNAL_ERROR = 03 . ENDFORM. *---------------------------------------------------------------------* * Form FUNCION PARA DETERMINAR CUANTOS DIAS LLEVA VENCIDA LA FACTURA * *---------------------------------------------------------------------* FORM DAYS. CALL FUNCTION 'DAYS_BETWEEN_TWO_DATES' EXPORTING I_DATUM_BIS = S_DATUM I_DATUM_VON = T_DATOS-ZFBDT IMPORTING E_TAGE = DIFF_D EXCEPTIONS DAYS_METOD_NOT_DEFINED = 1 OTHERS = 2. ENDFORM. *---------------------------------------------------------------------*
|