MUNDOSAP

MUNDOSAP (foro/index.php)
-   Programación ABAP IV (foro/forumdisplay.php?f=4)
-   -   Armar fecha (foro/showthread.php?t=39690)

jorgeABAP29 02/11/10 13:28:55

Armar fecha
 
Tengo os siguientes datos de tipo int año, mes y hora y los quiero formatear al tipo dats (fecha) como hago??

agv1976 02/11/10 13:34:14

Convertir fecha
 
Prueba con estos modulos de funciones,

SE37 y pones:

CONVERT_DATE_TO_INTERN_FORMAT (Convierte una fecha a formato interno)

CONVERT_DATE_FORMAT (Convert date from yyyymmdd to ddmmyyyy format)

ONVERT_DATE_TO_EXTERNAL Conversion: Internal to external date (like screen conversion)
ONVERT_DATE_TO_INTERNAL Conversion: External to internal date (like screen conversion)

CA_CALENDAR_CONVERSION Calendar Conversion Routines
ONVERT_CALENDAR_DATE

CON Conversión visualización int./externa
ONVERT_DATE_INPUT Conversion of a date from external to internal format
ONVERT_DATE_WITH_THRESHOLD Date conversion from external to internal format with time threshold

BMD
ONVERT_DATE_BY_PERIOD_INPUT
ONVERT_DATE_BY_PERIOD_OUTPUT

jorgeABAP29 02/11/10 13:49:56

solucion
 
DATA mydate TYPE dats.
DATA: year(4) TYPE i VALUE 2010,
month(2) TYPE i VALUE 12,
day(2) TYPE i VALUE 5.


mydate(4) = year.

IF month GT 0 AND month LT 10.
mydate+4(1) = '0'.
mydate+5(1) = month.
ELSE.
mydate+4(2) = month.
ENDIF.

IF day GT 0 AND day LT 10.
mydate+6(1) = '0'.
mydate+7(1) = day.
ELSE.
mydate+6(2) = day.
ENDIF.

WRITE mydate.
saludos.

agv1976 02/11/10 14:14:21

Fechas
 
Declarate un variable tipo DATS, y pones:

DATA: mivariable type DATS.

CONCATENATE 'Ano' 'mes' 'dia' into mivariable.

Pero con la primera funcion que te envie le pasas los tres parametros y te lo pone en una variable sino lo haces como te he dicho,

El saber no ocupa lugar pero te quita muchas penas.


Husos Horarios son GMT. La hora en este momento es 07:00:26.

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