cancel
Showing results for 
Search instead for 
Did you mean: 

Fatal Error - Date & Time

Former Member
0 Kudos

Hi,

In BAPI_PRODORDCONF_CREATE_TT, the Date & Time are seperated into 2 different fields, for instance 'EXEC_START_DATE' & 'EXEC_START_TIME'. So, accordingly, I defined 2 transaction properties in my BLT - one for Date and the other for Time. But when I pass values for these parameters in my Xacute query, I get the following error -

Fatal Error

Cannot convert a value of '2008-07-14T16:47:42' from type java.lang.String to TIME at field EXEC_START_TIME

Could somebody tell me the proper way to handle this issue? Appreciate it.

Regards,

V M.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

I used 'DateTime' datatype for the transaction properties and type = 'xml' in JavaScript with the format as 'yyyy-MM-ddTHH:mm:ss'. Thanks.

Regards,

Venki.

Former Member
0 Kudos

Hi, VM

Pedro has given the right solutions.

and one more thing, u can see the functions available in the actions by doing this:

1, click the "configure link"

2, in the "link editor " dialog opened, click "show expression editor", and then u can see a function field.

Former Member
0 Kudos

Thanks for your ideas. I am still having some problem. Basically, I want to pass the date time values dynamically. The transaction is not accepting the value that I am passing dynamically. Instead, it is taking system default values. Heres what I did so far -

1. Declard 2 variables - Start & Finish both as String type.

2. In the JCo link editor, I mapped the respective fields to dateformat(Transaction.Start,"MM-dd-yyyy hh:mm:ss", "yyyyMMdd") and dateformat(Transaction.Start, "MM-dd-yyyy hh:mm:ss", "HHmmss"). Likewise for Finish.

I this ok? Please help.

Regards,

V M.

Former Member
0 Kudos

Venki,

please use the function datefromxmlformat instead the dateformat. You can use the example above from

my post.

Regards

Pedro

Former Member
0 Kudos

Pedro,

I keep getting the following error -

Expression Evaluation error: Invalid date format of parameter in: datefromxmlformat.

My link editor looks like this -

ProductionOrderConfirmation.Request{/BAPI_PRODORDCONF_CREATE_TT/TABLES/TIMETICKETS/item/EXEC_START_DATE} = datefromxmlformat(Transaction.SetupStart, "yyyyMMdd")

Is it correct?

V M.

Former Member
0 Kudos

Venki,

which format and value have your Transaction.SetupStart / Transaction.SetupTime?

Regards

Pedro

Former Member
0 Kudos

I didn't quite understand your question. Maybe, thats the part I am missing. I would like to have 2 variables - SetupStart and SetupFinish in the format "MM-dd-yyyy HH:mm:ss".

V M.

Former Member
0 Kudos

Declare your transaction properties - SetupStart and SetupFinish as of type datetime. Also.. I would suggest you to have a trace and verify the value of both datefromxmlformat(Transaction.SetupStart, "yyyyMMdd") and datefromxmlformat(Transaction.SetupFinish, "yyyyMMdd"). Likewise for time.

.

Former Member
0 Kudos

Venki,

insert in your transaction a Tracer Actionblock and link the following:

Tracer_0.Message = Transaction.SetupStart & " - " & Transaction.SetupFinish

Execute your Transaction and look in the Transaction Execution Window. What is the

values that the Tracer have?

Regards

Pedro

Former Member
0 Kudos

That will not help 'coz the program will accept the current date and time values. I want to pass my own values.

V M.

Former Member
0 Kudos

>>That will not help 'coz the program will accept the current date and time values. I want to pass my own >>values.

Thats is not right... when you pass the value dynamically, that will override the current values of the transacation properties.

Former Member
0 Kudos

Pedro / John,

Do I have to specify any expression when defining the transaction properties - SetupStart & SetupFinish. I declared them as datatype Xml. In the section where it says 'Value', do I have to type anything besides "<?xml version="1.0" encoding="UTF-8"?>"? Thanks.

V M.

Former Member
0 Kudos

I guess you are going in the wrong direction...you don't have to create a variable of type xml. You can very well achieve it by using a datetime time in which you can use date formatting functions. To the best of my knowledge you cannot use dateformat functions if you declare the property as string.

1) Do you want to pass the values of these varaibles from outside the transaction or do you generate the value within the transaction?

2) How are you testing it? Directly from the transaction or using a query template?

3) Have you tried adding a tracer to evaluate the value?

Former Member
0 Kudos

Good questions John.

1. I am passing the values from outside the transaction - they need not be the current date and time, it can very well be a past date and time.

2. I am using a webpage to test the transaction.

3. I used the tracer, but its still giving the same error - Invalid date format of parameter in dateformat.

Regards,

V M.

Former Member
0 Kudos

VM,

If you are testing this from a webpage, you can very well declare the Start and Finish properties as of type string and pass the value in YYMMDD and HHmmss fromat from the webpage (JavaScript) itself. In that way you don't have to use any date formatting functions within the transaction because the data is coming in the right format from outside the transaction.

For example:

var NewDate = new Date("07/14/2008 11:22:20");

var StartDate = NewDate.format("yyyymmdd");

var StartTime = NewDate.format("HHMMss");

And then pass the StartDate and StartTime to the query template.

Hope this helps.

John

Edited by: John George on Jul 15, 2008 9:51 AM

Former Member
0 Kudos

Don't use type "String" for your transaction input parameters - use "DateTime".

Former Member
0 Kudos

Is it ok if I have in my JavaScript the following, since I am using a combination of a iframe and irpt -

function JCOCall2(){

var SetupStart = document.frmConfirmation2.txtCode5.value;

var SetupStart_1 = new Date(SetupStart);

var SetupStartDate = SetupStart_1.format("yyyyMMdd");

var SetupStartTime = SetupStart_1.format("HHmmss");

var SetupFinish = document.frmConfirmation2.txtCode6.value;

var SetupFinish_1 = new Date(SetupFinish);

var SetupFinishDate = SetupFinish_1.format("yyyyMMdd");

var SetupFinishTime = SetupFinish_1.format("HHmmss");

document.ifrJCO2.location.href="POConfExecute-1.irpt?SetupStartDate="SetupStartDate"&SetupStartTime="SetupStartTime"&SetupFinishDate="SetupFinishDate"&SetupFinishTime="+SetupFinishTime;

}

Regards,

V M.

Former Member
0 Kudos

This would also work..

var SetupStart = new Date(document.frmConfirmation2.txtCode5.value);

var SetupStartDate = SetupStart.format("yyyyMMdd");

var SetupStartTime = SetupStart.format("HHmmss");

var SetupFinish = new Date(document.frmConfirmation2.txtCode6.value);

var SetupFinishDate = SetupFinish.format("yyyyMMdd");

var SetupFinishTime = SetupFinish.format("HHmmss");

If you are doing a po confirmation, you are better off to call the Xacute query by using executeCommand().

If you need more info on how to use the 'executeCommand()', search the forum. There are plenty of posts on this.

Former Member
0 Kudos

I think I am almost there, but I get this error now -

Fatal Error

Cannot convert a value of 'Tue Jul 15 14:11:08 EDT 2008' from type java.lang.String to DATE at field EXEC_START_DATE

Sounds like some datatype incompatibility across the different software / languages.

Regards,

V M.

Former Member
0 Kudos

Since the bapi BAPI_PRODORDCONF_CREATE_TT expects the value for EXEC_START_DATE as YYYYMMDD (8 chars), you don't have to use any date formattting functions within the transaction if you pass the date as YYYYMMDD from the JavaScript. Your Transaction property that is mapped to EXEC_START_DATE must be of type String. Please verify that. Also have a tracer to verify the value before executing the BAPI.

agentry_src
Active Contributor
0 Kudos

Venki,

If you do your testing from the Web page, you lose the functionality of the Tracer action blocks. Try this approach:

Instead of testing from the web page, copy your current transaction and name it something like TrxCaller.

Delete all your current action blocks.

Add a Transaction Call action block and configure it to call your original transaction.

Go into Transaction Properties and give values to each of your Properties.

Link those properties to each of those of the called transaction. (Since you copied your original, you already have all the properties defined.)

Add a Tracer action block below it and link it to the called transaction's output.

You can also add tracers in your original transaction where desirable.

Then execute. You will be better able to see what is going on in the called transaction than by using the web page to test. Once you have your transaction working properly, you can then test it from the web page.

Good luck,

Mike

Former Member
0 Kudos

In BAPI_PRODORDCONF_CREATE_TT, the 'EXEC_START_DATE' expects the date in 'YYYYMMDD' format while 'EXEC_START_TIME' expects the value in 'hhmmss' format. Please try that.

You may use the dateformat function to convert the date.

For example: dateformat(Local.StartDate,"yyyy-MM-dd","yyyyMMdd")

John

Former Member
0 Kudos

I am still having some trouble. Is there a function to change the format of time as well?

Thanks,

V M.

Former Member
0 Kudos

Venki,

I think your Transaction Inputs for Date and for Time are in XML-DateTime format

(your Message above ...convert a value of '2008-07-14T16:47:42' from...), so

you can use the examples below.

Example for Date:

datefromxmlformat(Transaction.YourDate, "yyyyMMdd")

Example for Time:

datefromxmlformat(Transaction.YourTime, "hhmmss")

If your Transaction Inputs are not in XML-DateTime format, than use the link below:

http://help.sap.com/saphelp_xmii120/helpdata/en/45/bf7f3b692f52f5e10000000a1553f7/content.htm

Regards.

Pedro

Former Member
0 Kudos

Excellent Pedro, its working now! But, there is another problem. The time is showing in 12hr format, not in 24hr format. How can we fix it?

Thanks,

V M.

Former Member
0 Kudos

Venki,

use this:

datefromxmlformat(Transaction.YourTime, "HHmmss")

Regards

Pedro