MUNDOSAP

Regresar   MUNDOSAP > DESARROLLO > Programación ABAP IV
Nombre de Usuario
Contraseña
Home Descargas Registrar FAQ Miembros Calendario Buscar Temas de Hoy Marcar Foros Como Leídos




 
Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Viejo 18/10/06, 07:53:50
flipeloflipa flipeloflipa is offline
Junior Member
 
Fecha de Ingreso: jun 2006
Mensajes: 10
Calcular diferencia de fechas

Hola,
mi problema es el siguiente, necesito conseguir las horas de difrencia entre la decha actual con la hora, por ejemplo 2006/10/18 10:00:00 con una feha anterior, por ejemplo 2006/10/17 12:00:00. Seguro que existe alguna funcion que lo haga, pero soy algo novato y la desconozco.

Muchas gracias, espero vuestra ayuda
Responder Con Cita
  #2  
Viejo 18/10/06, 08:46:42
Avatar de tomasm
tomasm tomasm is offline
Member
 
Fecha de Ingreso: jun 2006
Localización: Paraiso natural
Mensajes: 87
Thumbs up

SE37

Puedes utilizar la función:

SD_DATETIME_DIFFERENCE



__________________
Responder Con Cita
  #3  
Viejo 18/10/06, 09:10:21
flipeloflipa flipeloflipa is offline
Junior Member
 
Fecha de Ingreso: jun 2006
Mensajes: 10
Me da el siguiente error DUMP al llamar a la funcion:



Errores tiempo ejecucióCALL_FUNCTION_CONFLICT_GEN_TYP
Excepción CX_SY_DYN_CALL_ILLEGAL_TYPE
ocurrido el 18.10.2006 a 11:47:18


Type conflict when calling function module "SD_DATETIME_DIFFERENCE".


¿Qué ha sucedido?


Error in ABAP application program.

The current ABAP program "ZSD_ALMA_L_ALMACENES_AVL " had to be terminated
because one of the
statements could not be executed.

This is probably due to an error in the ABAP program.


¿Qué puede hacer?


Print out the error message (using the "Print" function)
and make a note of the actions and input that caused the
error.

To resolve the problem, contact your SAP system administrator.
You can use transaction ST22 (ABAP Dump Analysis) to view and administer
termination messages, especially those beyond their normal deletion
date.

La llamada a la funcion es la siguiente:


CALL FUNCTION 'SD_DATETIME_DIFFERENCE'
EXPORTING
DATE1 = l_fecha
TIME1 = l_hora
DATE2 = SY-DATUM
TIME2 = SY-UZEIT
IMPORTING
DATEDIFF = l_t_dias
TIMEDIFF = l_t_horas
EARLIEST = l_t_EARLIEST

EXCEPTIONS
INVALID_DATETIME = 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.

Que me ocurre? l_t_dias l_t_horas l_t_EARLIEST las tengo declaradas del tipo I
Responder Con Cita
  #4  
Viejo 18/10/06, 09:16:01
Avatar de tomasm
tomasm tomasm is offline
Member
 
Fecha de Ingreso: jun 2006
Localización: Paraiso natural
Mensajes: 87
Talking Definición correcta

FUNCTION SD_DATETIME_DIFFERENCE.
*"----------------------------------------------------------------------
*"*"Lokale Schnittstelle:
*" IMPORTING
*" VALUE(DATE1) TYPE D
*" VALUE(TIME1) TYPE T
*" VALUE(DATE2) TYPE D
*" VALUE(TIME2) TYPE T
*" EXPORTING
*" VALUE(DATEDIFF) TYPE P
*" VALUE(TIMEDIFF) TYPE P
*" VALUE(EARLIEST) TYPE C
*" EXCEPTIONS
*" INVALID_DATETIME
*"----------------------------------------------------------------------
Saludos !!!
__________________
Responder Con Cita
  #5  
Viejo 18/10/06, 09:26:13
flipeloflipa flipeloflipa is offline
Junior Member
 
Fecha de Ingreso: jun 2006
Mensajes: 10
Ya esta!!!

Muchisimas gracias tomasm, me has servido de gran ayuda!!!
Responder Con Cita
Respuesta


Herramientas Buscar en Tema
Buscar en Tema:

Búsqueda Avanzada
Desplegado

Reglas de Mensajes
no puedes crear nuevos temas
no puedes responder temas
no puedes adjuntar archivos
no puedes editar tus mensajes

El código vB está On
Las caritas están On
Código [IMG] está On
Código HTML está Off
Saltar a Foro


Husos Horarios son GMT. La hora en este momento es 22:32:42.


www.mundosap.com 2006 - Spain
software crm, crm on demand, software call center, crm act, crm solutions, crm gratis, crm web