cancel
Showing results for 
Search instead for 
Did you mean: 

JCO call to RFC returns incorrect value

former_member286225
Participant
0 Kudos

Hello Experts,

I am using JCO to call an RFC from java.

One of the returned fields is a timestamp.

When I invoke the RFC from within the SAP system, I get a correct timestamp value.

But, when I invoke the RFC using JCO, the timestamp value returned has less 2 hours.

Does anybody know what might be the reason for that?

Regards,

Effi.

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member286225
Participant
0 Kudos

A GMT problem synch.

Former Member
0 Kudos

Hi Effi,

I'm facing an almost identical problem as you did. Can you elaborate as to how you solved it? What do you mean by GMT synchronization problem?

-Thanks

Arvind

Former Member
0 Kudos

Please check the Date and time stamp of SAP server from where you are getting this time.

Former Member
0 Kudos

>Please check the Date and time stamp of SAP server from where you are getting this time.

Hello Puneet,

Thanks for your reply. I got around to this issue again and it is still confusing me. I have provided snapshots of 2 different SAP systems where I am seeing this 'issue'. Both Systems are in windows boxes.

1.)

CTS

====

Box time 14:01:57 (19/3/2007 - for testing)

Sap time 09:31:57 (sap system time)

Diff time = 4:30 hrs

User Timezone CET (UTC+1)

Box timezone IST (UTC + 5:30)

System Timezone CET

alert monitor timestamp values obtained using jco client = 1 hr + corresponding timestamp seen using sapGUI

2.)

NSP

===

Box time 14:27:38 (29/4/2011)

Sap time 10:57:38 (sap system time)

Diff time = 3:30 hrs

User timezone CET

Box timezone IST (UTC + 5:30)

System timezone CET

timestamp from jco

alert monitor timestamp values obtained using jco client = 2 hrs + corresponding timestamp seen using sapGUI

CTS system, which is NW 04 with Java, uses Oracle RDBMS and NSP system which is NW 7.01 with ABAP, uses a Max DB backend. Both systems seem to have the same timezone settings (but different box times). Given that 'diff time' is the difference between box time and sap system time, I am assuming the difference between the 2 systems is because CTS is in Central European Standard Time (GMT + 1) and NSP is in Central European Summer Time (GMT + 2)

So, when I get timestamps from CCMS alert monitor using a JCO client, is it correct that all these timestamps will be in UTC only and I have to get the user timezone and convert each timestamp to the JCO user's timezone?

Even if that is the case, how would I go about getting the user's timezone? I heard about the system fields sy-timlo, sy-datlo etc., but I only know about the method MSS_GET_SY_DATE_TIME which get the SYSTEM date and time. Are there other functions that can help me get USER related fields like sy-timlo, sy-datlo, sy-tzone etc.? I want the timestamps in my JCO code to eventually match what I see in alert monitor using sapGUI.

Please help!

-Arvind

Edited by: ArvindKrish on Apr 29, 2011 2:07 PM

Former Member
0 Kudos

Hi

What do you mean by the statement "less by 2 hrs'.

Try to print the returned value of the model node to see wht value RFC is returning.

Regards

Vineet

former_member286225
Participant
0 Kudos

Hello Vineet,

I mean:

The value returned using direct call to the RFC is - 2009/01/08 16:10:00

The value returned using JCo call to the RCC is - 2009/01/08 14:10:00

Regards,

Effi.

former_member182374
Active Contributor
0 Kudos

Hi,

Add the following method to your WD application and call it

private String getDate() {
  Calendar cal = Calendar.getInstance();
  SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss.SSS");
  return (sdf.format(cal.getTime())).toString();
}

Do you see the correct hour?

If not check the date & time on the OS of the J2EE

Also, check the timezone in the Java parameters of the J2EE (in config tool).

Regards,

Omri

former_member286225
Participant
0 Kudos

Hi Omri,

Thanks for your reply.

I checked the timezones and time on all relevant servers and they are in sync.

I would like to check the timezone in the Java parameters of the J2EE (in config tool).

Can you direct me on how to get to this parameter?

Regards,

Effi.

former_member182374
Active Contributor
0 Kudos

Hi,

Open ConfigTool

instance_ID<XXX> --> Servers General tab and see if you have an entry for -Duser.timezone='XX'

Omri

former_member286225
Participant
0 Kudos

>

> Hi,

>

> Open ConfigTool

>

> instance_ID<XXX> --> Servers General tab and see if you have an entry for -Duser.timezone='XX'

>

> Omri

Hi Omri,

Thanks for the info.

I will give it a try.