Application Development and Automation 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: 
Read only

Packed to time format

Former Member
0 Likes
769

hi

how can we convert from packed to time format.

for ex: 5.83(packed) = 05:50 (hh:mm)

Thanks,

1 ACCEPTED SOLUTION
Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
723

Hello Sami,

Plz try this bit of code:


DATA:
  V_TIME1 TYPE P DECIMALS 2 VALUE '5.83',
  V_TIME2 TYPE CHAR7,
  V_MINS  TYPE I.

V_MINS = V_TIME1 * 60.

CALL FUNCTION 'CONVERSION_EXIT_SDURA_OUTPUT'
  EXPORTING
    INPUT  = V_MINS
  IMPORTING
    OUTPUT = V_TIME2.

CLEAR V_MINS.

6 REPLIES 6
Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
724

Hello Sami,

Plz try this bit of code:


DATA:
  V_TIME1 TYPE P DECIMALS 2 VALUE '5.83',
  V_TIME2 TYPE CHAR7,
  V_MINS  TYPE I.

V_MINS = V_TIME1 * 60.

CALL FUNCTION 'CONVERSION_EXIT_SDURA_OUTPUT'
  EXPORTING
    INPUT  = V_MINS
  IMPORTING
    OUTPUT = V_TIME2.

CLEAR V_MINS.

Read only

Former Member
0 Likes
723

Thanks ,

but the output was in char format but i want in time format.

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
723

Hey Sami,

Did you check the output after the Conv. Exit call. Plz check & see. Its in HH:MM format )

BR,

Suhas

Read only

Former Member
0 Likes
723

Dear,

I check it when we execute it shoes time format but my requirement is to store in a ztable,when we stored in ztable it gives problem.

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
723

Hello Sami,

Wat is the data element for the TIME field in the Z-Table. Try to format the time from the Conv. Routine to that value & then store in Z-Table.

BR,

Suhas

Read only

Former Member
0 Likes
723

Hi Ali,

Declare the variable type as sy-uzeit.

Hope this will work.

Regards,

Nitin.