cancel
Showing results for 
Search instead for 
Did you mean: 

Doctime in Crystal Report

former_member487237
Participant
0 Kudos

Hi all,

Doctime field in SAP is showing as 12:33PM. But if I'm trying to fetch the doctime field in CR, it is showing as 1233(numeric).

How to convert this into TIME?

Thanks&Regards,

Saikrishna.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi

in the Crystal report you should use the print time from the special fields it will look fine

shachar

frank_wang6
Active Contributor
0 Kudos

CREATE FUNCTION [dbo].[ConvertSapTS2TimeString]

(

  -- Add the parameters for the function here

  @SapTS int

)

RETURNS varchar(8)

AS

BEGIN

  -- Declare the return variable here

  DECLARE @TimeString varchar(8)

  DECLARE @Str varchar(6);

  -- Add the T-SQL statements to compute the return value here

  SET @Str = CAST(@SapTS AS VARCHAR(6));

  IF @SapTS < 100000

  BEGIN

  SET @TimeString = '0' + SUBSTRING(@STR, 1, 1) + ':' + SUBSTRING(@STR, 2, 2) + ':' + RIGHT(@STR, 2);

  END

  ELSE

  BEGIN

  SET @TimeString = LEFT(@STR, 2) + ':' + SUBSTRING(@STR, 3, 2) + ':' + RIGHT(@STR, 2);

  END;

  -- Return the result of the function

  RETURN @TimeString

END