If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.
Tu puedes convertir los formatos de fecha y hora a numérico depositando una variable de tipo fecha (u hora) en uno de tipo entero.... El resultado será cómo internamente SAP maneja los campos...
Ahora si quieres pasar el literal a número, es decir, si la fecha de hoy es 01.12.2008 que se guarda como 20081201 y deseas efectivamente obtener este número; entonces deberás depositar primero la variable fecha (u hora) en uno de tipo 'c' ó string, y éste último, depositarlo en un entero...
Prueba el siguiente código para ver cómo funcionan ambos métodos...
Saludos...
REPORT YMG_PRUEBA.
DATA: fecha TYPE dats.
DATA: hora TYPE tims.
DATA: sfecha TYPE string.
DATA: shora TYPE string.
DATA: nfecha TYPE i.
DATA: nhora TYPE i.
DATA: nfecha2 TYPE i.
DATA: nhora2 TYPE i.
Si los datos son de tipo Hora y fecha no hay problema...
Ejemplo:
DATA W_fecha TYPE sy-datum.
DATA W_hora TYPE sy-uzeit.
DATA w_fecha_entera TYPE i.
DATA w_hora_entera TYPE i.
w_fecha = sy-datum.
W_hora = sy-uzeit.
w_fecha_entera = w_fecha.
W_hora_entera = w_hora.
El dato sera:
w_fecha_entera = 20081201 "que respresenta a 2008/12/01
W_hora_entera = 133644 " que representa a 13:36:44
esta es tu duda???
Nota: se pueden asignar a los enteros directamete el valor de sy-datum y sy-uzeit, en el ejemplo usamos variables de tipo fecha y hora para que sea mas claro.
Comentario