Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Function Module to get the TIMESTAMP

naveen_inuganti2
Active Contributor
0 Kudos

Hi,

Is there any function module to get the TIMESTAMP as Outout , if i give input Time and Date.

Or,

If I go for the concatenate statement.. Do I need to concate the commas in to the target field?

Because,

I am not getting the proper result with this concatenate statement where I concatenated the YYYYMMDDHHMMSS in to the DECIMAL 15 Variable.

Thanks,

Naveen Inuganti.

1 ACCEPTED SOLUTION

Former Member

Hi Naveen,

Check with below

for Date + time -- > time stamp

ABI_TIMESTAMP_CONVERT_INTO

for time stamp ---> date + time

ABI_TIMESTAMP_CONVERT_FROM

Thanks!

9 REPLIES 9

Former Member

Hi Naveen,

Check with below

for Date + time -- > time stamp

ABI_TIMESTAMP_CONVERT_INTO

for time stamp ---> date + time

ABI_TIMESTAMP_CONVERT_FROM

Thanks!

former_member188829
Active Contributor
0 Kudos

Hi Naveen,

Try this function module.

LTRM_TIMESTAMP_CONVERT_INTO

GauthamV
Active Contributor
0 Kudos

Check this.

LTRM_TIMESTAMP_CONVERT_INTO

RKE_TIMESTAMP_CONVERT_INPUT

Former Member
0 Kudos

Hi Naveen,

LTRM_TIMESTAMP_CONVERT_INTO

or

OII_CALC_DIFF_BT_TIMESTAMPS try this FM

Use FM CCU_TIMESTAMP_DIFFERENCE

It gives you the difference between two timestamps in seconds.

which you can divide by 3600 to get hours.

or

G_BIW_CONVERT_INTO_TIMESTAMP

Regards,

Venkat M.

0 Kudos

Thanks for your inputs.

There are more than one record for same date in one of my tables,

But there is no date field in that table. There is a TIMESTAMP.

And my report selection screen can have DATE field only.

So based on that date I need to fetch all the records in that table.

As we know before that select I need to modify selection screen DATE as the TIMESTAMP.

And that should fetch all records...as there is no time restriction.

Finally we need to create Ranges where lower limit with DAY START TIME

and upper limit with DAY END TIME.

I tried to modify the SY_UZEIT before passing to above function modules.

as SY-UZEIT = 000000 for lower limit.

as SY_UZEIT = 125959 for upper limit.

Its not giving the proper time stamp, what would you suggest.

Thanks,

Naveen.I

0 Kudos

Hi use

IB_CONVERT_INTO_TIMESTAMP' or IB_CONVERT_FROM_TIMESTAMP'

Example:

* Declaring the work variables.......................
DATA :
  timestamp like TZONREF-TSTAMPS,
  time      like sy-uzeit,
  date      like sy-datum.

* The following function module is used to convert the
* time and date into GMT timestamp

CALL FUNCTION 'IB_CONVERT_INTO_TIMESTAMP'
  EXPORTING
    i_datlo           = sy-datum
    i_timlo           = sy-uzeit
    I_TZONE           = 'INDIA'
 IMPORTING
   E_TIMESTAMP       = timestamp.

* The following function module is used to convert the
* above obtained timestamp to PST time zone date and time.

CALL FUNCTION 'IB_CONVERT_FROM_TIMESTAMP'
  EXPORTING
    i_timestamp       = timestamp
    I_TZONE           = 'PST'
 IMPORTING
    E_DATLO           = date
    E_TIMLO           = time.

write 😕 'Date and Time at PST zone is ',date, time.

Former Member
0 Kudos

ABI_TIMESTAMP_CONVERT_INTO can be used

Regards,

SG

0 Kudos

No Srinivas,

Its Not working,

data: lv_timestamp type TZNTSTMPS,
      lv_date type SY-DATLO,
      lv_time type SY-TIMLO.

sy-uzeit = 000000.

call function 'ABI_TIMESTAMP_CONVERT_INTO'
  exporting
    iv_date                = sy-datum
    iv_time                = sy-uzeit
 IMPORTING
   EV_TIMESTAMP           = lv_timestamp
* EXCEPTIONS
*   CONVERSION_ERROR       = 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.

write:/ lv_timestamp.

Output:

> 20,090,512,220,000

But it should be:

> 20,090,513,000,000

--Naveen

Former Member
0 Kudos

Hi,

Try using this instead of a function module

  • Convert dates to timestamp

CONVERT DATE sy-datum TIME sy-uzeit

INTO TIME STAMP g_timestmp1 TIME ZONE sy-zonlo.

Regards,

Hema.