cancel
Showing results for 
Search instead for 
Did you mean: 

Default date in iGrid is 01-01-1970 when no date is available

Former Member
0 Kudos

Hi,

I have a problem when showing the ActualStartDate for Production orders in an iGrid. When the order hasn't started yet, the iGrid shows as default 01-01-1970, when instead I would like that the iGrid shows nothing or 'NA'. The ActualStartDate comes from a BAPI call: BAPI_PRODORD_GET_LIST. When there is no date available the BAPI respons gives:

<ACTUAL_START_TIME>00:00:00</ACTUAL_START_TIME>

The outputXML of my transaction gives:

<ActualStartDateTime/>

So I suppose the reason why the iGrid gives a default value is that the node of ActualStartDateTime is empty. I tried to solve this problem with JavaScript, but I didn't succeed. I tried to replace the 01-01-1970 in the iGrid by 'NA'.The JavaScript I inserted additionally you can see in Italic. Can someone help me to solve my problem?

function getList () {

var Orders = document.Orders;

var OrdersQuery = Orders.getQueryObject();

var OrdersGrid = Orders.getGridObject();

OrdersQuery.setParam(9,df.cbOrderRange.checked);

OrdersQuery.setParam(12,df.optOrderOption.value);

OrdersQuery.setParam(10,df.txtOrderLow.value);

OrdersQuery.setParam(11,df.txtOrderHigh.value);

OrdersQuery.setParam(13,df.optOrderSign.value);

OrdersQuery.setParam(4,df.cbMaterialRange.checked)

OrdersQuery.setParam(7,df.optMaterialOption.value);

OrdersQuery.setParam(5,df.txtMaterialLow.value);

OrdersQuery.setParam(6,df.txtMaterialHigh.value);

OrdersQuery.setParam(8,df.optMaterialSign.value);

OrdersQuery.setParam(14,df.OrderType.value);

OrdersQuery.setParam(15,df.Plant.value);

Orders.updateGrid(true);

for (i=0;i<OrdersGrid.getRowCount(); i)

+ {+

+ for (j=0;j<OrdersGrid.getColumnCount(); j+)

+ {+

+ if (OrdersGrid.getCellValue(i, j) = "01-01-1970" ||+

+ OrdersGrid.getCellValue(i, j) == "")+

+ {+

+ document.Orders.getGridObject.setCellValue(i, j, "NA");+

+ }+

+ }+

+ }+

Accepted Solutions (1)

Accepted Solutions (1)

jamie_cawley
Advisor
Advisor
0 Kudos

I would recommend handling this in the transaction. There's a function "nulldate" used in the expression editor that will show as "TimeUnavailable" in the grid.

Jamie

Former Member
0 Kudos

I've put follwing expression into my transaction for adding the ActualStartDate in the Row

stringif(ItemRepeater.Output{/item/ACTUAL_START_DATE}=="0000-00-00",nulldate,datetoxmlformat(ItemRepeater.Output{/item/ACTUAL_START_DATE}, "yyyy-MM-dd"))

I think this expression is correct, though it didn't work either. So I tested the function nulldate in the Expression editor, and it returned nothing, while 'TimeUnavailable' was expected. Afterwards I tested nullstring and nullnumber, which gave 'NA' and '---' as should be. So I thought maybe there is something wrong with function nulldate in MII 12.1.3. And indeed, as I tested this function in an older version of MII (12.0.5), the return was indeed 'TimeUnavailable'. So I guess there is something wrong in version 12.1.3, but how can I solve this problem, can I redefine this function somewhere?

jamie_cawley
Advisor
Advisor
0 Kudos

This was fixed in patch 1 for 12.1.3. 12.1.4 is available so I would recommend installing that.

Jamie

Former Member
0 Kudos

Thx

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

At the end(i.e after

document.Orders.getGridObject.setCellValue(i, j, "NA");

) you need to call again the below code.

Orders.updateGrid(true);

Even you have missed "=" in if condition.

One more suggestion you can check this in your BLS itsef.

Hope this helps you.

-Suresh

Edited by: Suresh Hiremath on Jan 21, 2010 12:54 PM

Former Member
0 Kudos

The iGrid indeed updates now, I can see this by the reload of my page, so this is one step forward, but the cells with 01-01-1970 are not overwritten by NA. It seems like the cells can't be overwritten with new values.