export to excel

Hi Stan,

Please see screen shot :-

I added the code for “Unit Cost”, and also made another change, I made this report “Processing Only” so you don’t get the blanlk pages.

Go to the Item Table 27, and look for Field 22, just make sure its called “Unit Cost”.

Note I commented out the line that uses the field “NKS Lama” as I don’t have this field in Cronus.
Just take the // out

Try the below and let me know.

/TH

OBJECT Report 50021 Export Item By Location
{
OBJECT-PROPERTIES
{
Date=14/02/07;
Time=10:00:51;
Modified=Yes;
Version List=;
}
PROPERTIES
{
ProcessingOnly=Yes;
}
DATAITEMS
{
{ PROPERTIES
{
DataItemTable=Table27;
OnPreDataItem=BEGIN
Window.OPEN(
‘Stanley Bilang :’ + Text001 +
@1@@@@@@@@@@@@@@@@@@@@@’);
Window.UPDATE(1,0);
TotalRecNo := Item.COUNTAPPROX;
RecNo :=0;

TempExcelBuffer.DELETEALL;
CLEAR(TempExcelBuffer);
EnterCell(1, 1, Text000, TRUE, TRUE, FALSE);
EnterCell(3, 1, t00, TRUE, TRUE, FALSE);
EnterCell(3, 2, t01, TRUE, TRUE, FALSE);
EnterCell(3, 3, t02, TRUE,TRUE,FALSE);
EnterCell(3, 4, t03, TRUE,TRUE,FALSE);
EnterCell(3, 5, t04, TRUE,TRUE,FALSE);
EnterCell(3, 6, t05, TRUE,TRUE,FALSE);
EnterCell(3, 7, t06, TRUE,TRUE,FALSE);
EnterCell(3, 8, t07, TRUE,TRUE,FALSE);
EnterCell(3, 9, t08, TRUE,TRUE,FALSE);
EnterCell(3, 10, t09, TRUE,TRUE,FALSE);
EnterCell(3, 11, t10, TRUE,TRUE,FALSE);
Row := 3;
END;

OnAfterGetRecord=BEGIN
Row := Row + 1;

//EnterCell(Row, 1, “NKS Lama”, FALSE, FALSE, FALSE);
EnterCell(Row, 2, “No.”, FALSE, FALSE, FALSE);
EnterCell(Row, 3, Description, FALSE, FALSE, FALSE);
EnterCell(Row, 4, FORMAT(ROUND(“Unit Cost”,2)), FALSE, FALSE, FALSE);
RecNo := RecNo + 1;
Window.UPDATE(1,ROUND(RecNo / TotalRecNo * 10000,1));
END;

OnPostDataItem=BEGIN
Window.CLOSE;

TempExcelBuffer.CreateBook;
TempExcelBuffer.CreateSheet(Text000,Text000,COMPANYNAME,USERID);
TempExcelBuffer.GiveUserControl;
END;

}
SECTIONS
{
{ PROPERTIES
{
SectionType=Body;
SectionWidth=12000;
SectionHeight=846;
}
CONTROLS
{
}
}
}
}
{ PROPERTIES
{
DataItemTable=Table32;
DataItemTableView=SORTING(Item No.,Entry Type,Variant Code,Drop Shipment,Location Code,Posting Date)
WHERE(Location Code=CONST(GD));
DataItemVarName=GD;
DataItemLinkReference=Item;
DataItemLink=Item No.=FIELD(No.),
Posting Date=FIELD(Date Filter);
}
SECTIONS
{
{ PROPERTIES
{
SectionType=Body;
SectionWidth=12000;
SectionHeight=846;
}
CONTROLS
{
}
}
}
}
}
REQUESTFORM
{
PROPERTIES
{
Width=9020;
Height=3410;
}
CONTROLS
{
}
}
CODE
{
VAR
TempExcelBuffer@1000000004 : TEMPORARY Record 370;
Window@1000000003 : Dialog;
Row@1000000002 : Integer;
TotalRecNo@1000000001 : Integer;
RecNo@1000000000 : Integer;
Text000@1000000009 : TextConst ‘ENU=Daftar Item BY Location’;
Text001@1000000008 : TextConst ‘ENU=Analisa Data…’;
t00@1000000007 : TextConst ‘ENU=NKS Lama’;
t01@1000000006 : TextConst ‘ENU=NKS’;
t02@1000000005 : TextConst ‘ENU=Description’;
t03@1000000010 : TextConst ‘ENU=Harga’;
t04@1000000011 : TextConst ‘ENU=GD’;
t05@1000000012 : TextConst ‘ENU=DO’;
t06@1000000013 : TextConst ‘ENU=SEWA’;
t07@1000000014 : TextConst ‘ENU=EXT’;
t08@1000000015 : TextConst ‘ENU=BPDI’;
t09@1000000016 : TextConst ‘ENU=DO PENDING’;
t10@1000000017 : TextConst ‘ENU=TOTAL’;

PROCEDURE EnterCell@1000000000(RowNo@1000000005 : Integer;ColumnNo@1000000004 : Integer;CellValue@1000000003 : Text[250];Bold@1000000002 : Boolean;Italic@1000000001 : Boolean;UnderLine@1000000000 : Boolean);
BEGIN
TempExcelBuffer.INIT;
TempExcelBuffer.VALIDATE(“Row No.”,RowNo);
TempExcelBuffer.VALIDATE(“Column No.”,ColumnNo);
TempExcelBuffer.“Cell Value as Text” := CellValue;
TempExcelBuffer.Formula := ‘’;
TempExcelBuffer.Bold := Bold;
TempExcelBuffer.Italic := Italic;
TempExcelBuffer.Underline := UnderLine;
TempExcelBuffer.INSERT;
END;

BEGIN
END.
}
}

huehehehheh it works !!!
thanx!!! :))