Skip to Content

My client requirements in File Adapter

Can any one guide me for the following requirements.

Case Studies - 1

Assume that you are in a class room and there are 10 students in it. The instructor then asks each student to prepare his/her the following personal details and save them in an XML file. The details are as follows:

  1. Student ID
  2. Name
  3. Mobile
  4. Email
  5. Gender

  There will be 10 files and the files are named as cv_1,2,3….10. The files are saved into the source directory. For test purposes following directories are created: 

Source directory:  c:\ibm\sap\training\input

Archive directory: c:\ibm\sap\training\archive

Error directory: c:\ibm\sap\training\error

Target directory: c:\ibm\sap\training\target

You are asked to develop scenarios in SAP PI which will read the source files from the source directory and write them to the target directory.  Once a file is successfully read from the source directory, it should be moved to the archive directory and if the file cannot be read for some error i.e. xml format not maintained, it should be moved to the error directory. The files moved to archive, error or target directory should have a time-stamp append to the file-name.

  1. i.e. filename+<time-stamp>.

Lesson-1

Prepare a scenario to read one single file i.e. file cv_1.xml from the source directory and write it to the target directory. The target file name should also be cv_1.xml with the time-stamp append to the name.

Lesson-2

Prepare a scenario to read all the files from the source directory and write them to the target directory. Similarly the target files should also be named as cv_1, 2 ..xml with the time-stamp append to each of them.

Lesson-3

The instructor then asks you all to add the following validation to the data.

  1. The mobile-number should have 10 numeric digits – if the mobile number is not of 10 digit then replace it with ‘error’
  2. The email should have one ‘@’ character and one ‘.’ character – if the email is not having the ‘@’ or ‘.’ character, then replace it with ‘error’

Before you run the scenario, in some of the source files, modify the mobile and the email so that they are in error as per the logic given above.

Lesson-4

Prepare a scenario to read all the source files and classify them according to their gender. The files for the men will be written in one directory and for the ladies to another directory. Two directories are created for the above purpose:

Target directory for men: c:\ibm\sap\training\target\men

Target directory for women: c:\ibm\sap\training\target\women

Suppose there are 6 men and 4 women in the class, then if all the source files are read successfully then the target directory for men should have 6 files and the target directory for women should have 4 files.

Case Studies - 2

The instructor then asks you all to prepare one single file with the personal details of each student in separate segments.

Lesson-5

Write a scenario which will read this file and produces 10 target files where each file should correspond to the personal data of each employee. The target files should be named as cv_<emp_ID>_<timestamp>

Lesson-6

Modify the above scenario so that it produces 2 target files instead of 10 where one target file for men and another target file for the ladies. The target file for men should have 6 segments for 6 men and the target file for ladies should have 4 segments for 4 women.

The target files should be named as

For men – men_<time-stamp>

For Ladies – women_<time_stamp>

Case Study -3

Same as case study – 1, the instructor ask each student to prepare his/her the personal details and save them in an XML file. There will be 10 files. The files are saved in the source directory.

Lesson-7

Prepare a scenario to read all the source files from the source directory and to create one single file in the target directory. The name of the target file will be output.xml with the time stamp append to the file-name. The target file will have all the details of each source file as sub-segment.

Lesson-8

Prepare a scenario to read the entire source files from the source directory and create two files in the target directory – one for the men and the other for the ladies. For 6 men, the men file should have six segments having each man’s details and for 4 women, similarly there should be 4 segments with each lady’s details.

Case Study - 4

The instructor now asks each of the students to prepare another set of details which will consist of his/her the following academic details:

  1. Student ID
  2. School Name
  3. College Name
  4. Department Name
  5. Admission Year

There will be 10 files and the files are named as ad_1, 2, 3….10. The files are saved into the source directory. So each student will now have a pair of files – one for the personal details and the other for the academic details. Two files are co-related with the Student ID. The input directory now consists of 10 personal files and 10 academic files.

Lesson - 9

You are asked to develop a scenario which will pick the source files and will process them in pair. The scenario will generate 10 target files. Each target file will consist of the personal and academic details of a student in separate segments. The target files will be named as res_1, 2, 10.

The target files will look like:

Lesson – 10

You are then asked to change the student ID in some of the files so that they do not have a matching academic or personal files and vice-versa. The scenario should run and if it found any files who does not have a matching corresponding file then the process should end after some period of time i.e. 2 min and those files will be moved to the error directory and there will be no corresponding target files for them.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Apr 21, 2014 at 06:04 AM

    Hi

    These are the exercise mentioned in the blog

    http://scn.sap.com/docs/DOC-41766

    In SCN , you will find many blogs on file adapter. Go through them, you will be able to do it by yourself.

    If you stuck somewhere, then post the problem, we will be happy to help you.

    Add comment
    10|10000 characters needed characters exceeded

  • Apr 21, 2014 at 06:20 AM

    Hi,

    You have a complete lesson with the main uses of the file adapter. As Indrajit said you should read first about the file adapter in order to know the main funtionalities. To start you can read the SAP.HELP documentation Configuring the File/FTP Adapter - Advanced Adapter Engine - SAP Library, later if you  have problems you can ask for a direct problem, you should think that you study cases are about all the file adapter and answer could be extremely large.

    Regards.

    Add comment
    10|10000 characters needed characters exceeded