Exporting Record data using File Layout Object & Application Engine (Sample Outbound AE Program)
(Sample Outbound AE Program)
1) Create File Layout based on the Record being exported
2) Selecting the desired format; XML, Fixed or CSV.
3) Create Application Engine Program with one PeopleCode step
4) Single Record import PeopleCode. Replace FileLayout , Record., GetRow with Desired FLO and Record
rem *****************************************************************
rem * Method: WriteRowSet - CSV File *
rem * Description: Single Record *
rem *****************************************************************
Local File &FILE1;
Local Record &REC1;
Local SQL &SQL1;
Local Rowset &RS1;
&FILE1 = GetFile("C:\temp\simple.csv", "w", "a", %FilePath_Absolute);
&FILE1.SetFileLayout(FileLayout.CURRENCY_FL);
&REC1 = CreateRecord(Record.CURRENCY_CD_TBL);
&RS1 = CreateRowset(Record.CURRENCY_CD_TBL);
&SQL1 = CreateSQL("%Selectall(:1)", &REC1);
While &SQL1.Fetch(&REC1)
&REC1.CopyFieldsTo(&RS1.GetRow(1).CURRENCY_CD_TBL);
&FILE1.WriteRowset(&RS1);
End-While;
&FILE1.Close();
2) Selecting the desired format; XML, Fixed or CSV.
3) Create Application Engine Program with one PeopleCode step
4) Single Record import PeopleCode. Replace FileLayout , Record., GetRow with Desired FLO and Record
rem *****************************************************************
rem * Method: WriteRowSet - CSV File *
rem * Description: Single Record *
rem *****************************************************************
Local File &FILE1;
Local Record &REC1;
Local SQL &SQL1;
Local Rowset &RS1;
&FILE1 = GetFile("C:\temp\simple.csv", "w", "a", %FilePath_Absolute);
&FILE1.SetFileLayout(FileLayout.CURRENCY_FL);
&REC1 = CreateRecord(Record.CURRENCY_CD_TBL);
&RS1 = CreateRowset(Record.CURRENCY_CD_TBL);
&SQL1 = CreateSQL("%Selectall(:1)", &REC1);
While &SQL1.Fetch(&REC1)
&REC1.CopyFieldsTo(&RS1.GetRow(1).CURRENCY_CD_TBL);
&FILE1.WriteRowset(&RS1);
End-While;
&FILE1.Close();
Comments
Post a Comment