Activity 1 - Inbound & outbound by using csv file

Activity 1: Inbound and outbound process by using csv file:

Steps and hints:

1. Create records

2. pages,

3. components- search record as our physical record

4. When you going to write code in you project , USE UR RECORD And FIELD names , otherwise it’ll execute

Flow of Objects:

This is that page after designed our requirement:

/*INBOUND CODE*/

/*To RETREIVE the datas from our own file to db*/

/*Inbound push button - fieldchange*/ -to write

Local File &MYFILE;

Local Record &REC;

Local array of string &ARRAY;

&MYFILE = GetFile("C:\Documents and Settings\raghavr\Desktop\SSIN.CSV", "R", "A", %FilePath_Absolute);

&REC = CreateRecord(Record.Z_ACT1_INBOUND);

&ARRAY = CreateArrayRept("", 0);

If &MYFILE.IsOpen Then

If &MYFILE.SetFileLayout(FileLayout.Z_ACT1_FL) Then

While &MYFILE.ReadLine(&STR);

&ARRAY = Split(&STR, ",");

For &I = 1 To &REC.FieldCount

&REC.GetField(&I).Value = &ARRAY [&I];

End-For;

&REC.Insert();

End-While;

End-If;

End-If;

/*Outbound code*/

/*To transfer the datas from db to our own file */

/*outbound push button - fieldchange*/- to write

Local File &MYFILE;

Local Record &RECLINE;

Local SQL &SQL;

&MYFILE = GetFile("C:\Documents and Settings\raghavr\Desktop\SSOUT.CSV", "W", "A", %FilePath_Absolute);

If &MYFILE.IsOpen Then

If &MYFILE.SetFileLayout(FileLayout.Z_ACT1_FL) Then

&RECLINE = CreateRecord(Record.Z_ACT1_INBOUND);

&SQL = CreateSQL("%SELECTALL (:1)", Record.Z_ACT1_INBOUND);

While &SQL.Fetch(&RECLINE);

&V1 = &RECLINE.EMPLID.Value;

&V2 = &RECLINE.NAME1.Value;

&V3 = &RECLINE.JOBCODE.Value;

&STR = &V1 | "," | &V2 | "," | &V3;

&MYFILE.WriteLine(&STR);

End-While;

End-If;

End-If;

/*Another way of code:*/

Local File &MYFILE;

Local Rowset &RS1, &RS2;

&MYFILE = GetFile("C:\Documents and Settings\raghavr\Desktop\SSOUT.CSV", "W", "A", %FilePath_Absolute);

If &MYFILE.IsOpen Then

If &MYFILE.SetFileLayout(FileLayout.Z_ACT1_FL) Then

&RS1 = CreateRowset(Record.Z_ACT1_INBOUND);

&RS1.Fill();

&RS2 = &MYFILE.CreateRowset();

&RS1.CopyTo(&RS2);

&MYFILE.WriteRowset(&RS2);

End-If;

End-If;

&MYFILE.Close();

With this Project we’re doing some extra activity:

Code:

DoSave();

Write this code in SAVE button- field change.

**********************************************************

Try and Do this in practice with this above hints …

SHARE

peoplesoft

  • Image
  • Image
  • Image
  • Image
  • Image
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment

Phaniraavi@gmail.com