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:
Student ID
Name
Mobile
Email
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.
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.
The mobile-number should have 10 numeric digits – if the mobile number is not of 10 digit then replace it with ‘error’
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:
Student ID
School Name
College Name
Department Name
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.

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.

Similar Messages

  • Typical Requirement in File Adapter

    Hi All,
              My scenario is File to Proxy.
    Now scenario to pick up the File (at sender) is like this:
    There is a file pick up from FTP Server daily. We will have two files on FTP server.First file is a blank file , which we call a FLAG File. Second file is DATA File containing required data to update in SAP.
    Its a conditional File pick up:
    1. If FLAG File (Blank) is present on FTP Server then pick up the data file and delete Flag File.
    else
    2.If FLAG File is not present on FTP server, dont pick up the DATA File and stop Processing.
    Please suggest some good solution to achieve the same using File Adapter.
    Also suggest, if same can be customised through Run Operating System before\after message processing.
    Please help.Its Urgent..
    Thanks,
    Anurag

    Suggestion 1: You need a BPM for this. Poll for the flag file and if present it gets into BPM. Inside the BPM check the content of the file. Remember only with latest SP you get the option to generate a message for an empty file. Use a conditional branch and proceed with the rest of the processing. You can use a dummy correlation.
    Suggestion 2: Use scripts and schedule this at OS level (independent of XI). In the script file do the vaildation of checking the flag file and if the validation is ucess move the data file to the foolder FIle adapter keeps polling.
    Regards,
    Jaishankar

  • Is a record ID field required for File Adapter (Header, Body, Trailer)?

    Hi,
    File to File scenario. The sender file is a text file i.e. .txt which needs a conversion on the sender file adapter. There are three structures in the file namely header (one), body (many) and Trailer (one). From what I can see I need a record Id field (with the same name) in all the structure types, can anyone confirm this for me?
    Thanks,
    Leanne

    That is correct. If you have a variable number of records of a particular type, then you need a way to accurately identify each type of record... and that is done via the key field (or Record ID)  which is present in each record type.
    Extract from SAP Online Help:
    <i>Key Field Name
    If you specified a variable number of substructures for Recordset Structure, in other words, at least one substructure has the value ‘*’, then the substructures must be identified by the parser from their content. A key field must be set with different constants for the substructures. In this case, you must specify a key field, and the field name must occur in all substructures.
    Specify the Key Field Type to be used to compare the predefined values. This entry is used if the key field name is defined.
    NameA.keyFieldValue: Specify the value of the key field for the structure. This entry is mandatory if the key field name is set. Otherwise, the entry is ignored.</i>
    For more info, refer to the SAP Help:
    http://help.sap.com/saphelp_nw04/helpdata/en/2c/181077dd7d6b4ea6a8029b20bf7e55/frameset.htm

  • Help required in File Adapter Module Development

    Hi All,
    I am working out a File to File scenario where my source file is in some different format. Please find the below sample:
    <Root>
    <ID>100</ID>
    <NAME>SAP</NAME>
    <END-Root>
    Before taking this into IS, I need to change the file to a proper XML format. I need to replace "END-" with "/".
    <?xml version="1.0" encoding="UTF-8" >
    <Root>
    <ID>100</ID>
    <NAME>SAP</NAME>
    </Root>
    I think I can achive this by developing Adapter Modules. I am new to Adapter Module development.
    Can you please tell me if there are any inbuilt Adapter Modules for this. If not please suggest me some relevant blogs to solve this issue. Thanks in Advance.

    Hi Phani Kumar
    There are more than one ways to do this. As per your timelines and skill set you can decide
    1. You can use the XMLAnonymizerBean this is an inbuilt module
    Check Stefen's blog
    Remove namespace prefix or change XML encoding with the XMLAnonymizerBean
    2. You can read this complete file in a single field and then you can create XSLT or Java mapping to parse it in a target XML you desire.
    Check these
    https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/3823 [original link is broken] [original link is broken] [original link is broken](XSLT mapping)
    Java Mapping (Part I) (Java Mapping)
    The specified item was not found. (Java Mapping helper DOM)
    The specified item was not found. (XML Node into string)
    3. You can develop Adapter modules for this
    Refer
    Check Guides
    XI 3.0
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/3bdc14e1-0901-0010-b5a9-a01e29d75a6a
    PI 7.0
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f013e82c-e56e-2910-c3ae-c602a67b918e
    PI 7.1
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/00838345-708c-2a10-1199-9514c0b0a91c

  • Suggestion required on File Adapter

    Hi,
    I have to implement 2 scenarios where the problem is such as
    1) XI server is writing the message content to a file by receiver Adapter. At the same time, the user is reading the file. How can I prevent the user? and other thing is How can the user will be notified that file has been uploaded completely at that moment?
    2) How can a user ensure that whether they received the exact source file or not from the XI server prospective apart from trailer record count?
    Your inputs are highly appreciated.
    Thanks
    Raja

    Hi,
    Have you tested the scenario or is it your assumption.
    >1) XI server is writing the message content to a file by >receiver Adapter. At the same time, the user is reading >the file. How can I prevent the user? and other thing is >How can the user will be notified that file has been >uploaded completely at that moment?
    how user is reading the file?is user using any Text editor?
    If you are talking interms of two scenarios.
    When File Adpater is writing to some FileSystem the operating system(on which file system is running) wont issue a status that there is a file until unless the file stream is closed on behalf of FileAdapter. It is a general Operating System feature.
    so you can happily run your two scenarios without any ambiguity as one scenario is writing to filesystem other scenario will poll the filesystem for files for its process as per the configuration.
    Thanks,
    Gujjeti

  • XI Sender file adapter - How to process data and control files.

    Hello all,
       I have the following requirement to fulfill: I am using an FTP client (XI Sender file adapter) to retrieve data from an FTP site. To make sure I am not picking up a data file that is currently being written to, 2 files are actually present on the FTP site (for each data file):
    1. abc.ctrl (control file with no data in it. Indicates that the data file has been completely written).
    2. abc.dat (actual data file).
      I want the file/ftp connector in XI to retrieve the data file (abc.dat) only if the control file (abc.ctrl) is present. After the processing of the data file is finished, both files (.dat and .ctrl) should be deleted.
      Is there an elegant and robust way to accomplish this?
    Thanks for your help.

    Hi Yves,
    in my opinion there's no problem with files currently being written in combination with a polling file adapter because the final file name should be available only when the file is transferred completely. I'm using different file sender adapters very often and never had any problems. After picking up the files I move them to the corresponding archive folders mentioned in the adapters so that a second processing cannot occur.
    Regards
    Ralph

  • Sener file adapter has read/pick the files first in first out method.

    HI
    In my Interface I am Using Sender as File adapter. As per my requirement Sender file adapter has to read the file from file directory. This directory having 1000u2019s of files with some files are same name (time stamp is different) and some files are different name here file adapter has to pick the file with mentioned name   in File sender adapter like ZMPSMSGSTATUSMST-.xml .
    But source file name is like <TABLENAME>-<TIME_STAMP>.XML (ZMPSWRKFLOWHIST-20090527-150522-628) in file directory.
    The file adapter in XI will poll to this directory and picks the file in first- in first-out by sorting according to timestamp.
    To do this configuration what I have to do in sender file adapter please give me your valuable inputs.

    HI Abhi,
    Thank you for your spot replay.
    I tested now but i am geting below error.
    Putting message into send queue failed, due to: com.sap.aii.af.ra.ms.api.DuplicateMessageException: Message ID f4ca4f86-9c5d-4bdd-1fb1-a6bd7cda99a8(OUTBOUND) already exists in database: com.sap.sql.DuplicateKeyException: [NWMss][SQLServer JDBC Driver][SQLServer]Violation of PRIMARY KEY constraint 'PK__XI_AF_MSG__491A1D0B'. Cannot insert duplicate key in object 'dbo.XI_AF_MSG'..
    Could not archive file 'E:\file\in\ZMPSMSGSTATUSMST-20090527-150522-628.xml' after processing
    but i am able to see this file in Archive foleder. once file is archivied sucessfully the same file is delted from source directory?
    I given processing parametes queue name is TEST.
    Thanks
    srinivas
    Edited by: srinivasreddy p on May 28, 2009 8:43 AM
    Edited by: srinivasreddy p on May 28, 2009 8:52 AM

  • Sender file adapter Adapter with out Key field

    Hi All
                 i do have have a requirment ,Sender file adapter , for FCC but file is  with out Key field
    HEADER>
    <DATA1>
    <DATA2>
    <DATA3>
    <HEADER>              file structure
    <ITEM>
    <ITEM1>
    <ITEM2>
    <ITEM3>
    <ITEM
    and the file si
    '10001,20081902,US
    10,soda,1
    30,soda,4
    40,soda,5
    10002,20081902,US
    10,steel,1
    30,steel,4
    40,steel,5
    , and i need to identify the Header and Item using there lenght only , please anyone as idea abt this help me

    Why to post the same question TWICE... in 30 min ? you don't like the answers ?
    File content Conversion Issuse for a Sender File Adapter

  • Very basic design question of File Adapter

    Hi Guys,
    What is the utility of assigning System Name and System Interface names (XMB.SenderInterfaceNamespace, XMB.SenderInterfaceName, XMB.SenderBusinessName) while configuring the Inbound File Adapter?
    What I am struggling to understand, that any particular inbound file adapter is already associated with one particular Sender Agreement and the message header picks up Sender System Name and Sender Interface name etc from this  Sender Agreement (from CPA Cache), but then why the above settings are required for File Adapter ?
    Thanks

    I think you have read the documentation for J2SE adapter.
    The online help for the J2EE adapter is here:
    http://help.sap.com/saphelp_nw04/helpdata/en/e3/94007075cae04f930cc4c034e411e1/frameset.htm

  • File Adapter is not working and create client copy in NW 7.0?

    hi,
    this is sreeram.i installed and configured PI 7.0 SR2 but file was not picking up from the input folder.i can able to select file adapter when i am creating communication channel.i gone throw RWB component monitoring->Adaptor monitoring there i seen all adaptors are in faded color not in green.can any one help to resolve the proble?
    one more question is i created 3 clients from 000 client using tcode scc4.when i am entering with SAP* and password is: pass it's not entering into that client.i also tried username: SAP* password as : password pls tell me SAP* password in NW 7.o?

    Hi,
    Take a look at the forum links looks like same problem
    HTTP Response: 500  internal server error
    HTTP adapter - 500 Internal server error
    Message mapping-Urgent
    Can you go through the below urls:
    calling soap error
    SOAP  - XI - SOAP Error
    Error while Testing SOAP Adapter In XI
    Please reward points if it helps
    Thanks
    Vikranth

  • Is it possible to read the file using File Adapter which is in client machi

    Is it possible to read the file using file Adapter which is in client machine(on the same network).Then what is thee need of FTP Adapter?

    You can achieve that by exposing your client machine as a drive, then you can go using file adapter.
    FTP adapter will help you to communicate with different machine which is in different network.
    It is considered good etiquette to reward answerers with points (as "helpful" - 5 pts - or "correct" - 10pts).
    Thanks,
    Vijay

  • Jar files required to develop adapter module in 7.1

    Hi,
    can any one tell me whether below jar files are enough to develop the adapter modules in 7.1,
    u2022 aii_af_cci.jar
    u2022 aii_af_mp.jar
    u2022 aii_af_ms_api.jar
    u2022 aii_af_ms_spi.jar
    u2022 aii_af_trace.jar
    u2022 aii_af_svc.jar
    u2022 aii_af_cpa.jar
    if not please let me know set of jar files need to develop adapter module in 7.1.
    Thank You,
    Madhav

    Hi ,
    Below Jar files Required to develop Adapter Module in PI7.1
    com.sap.aii.af.cpa.svc.api
    com.sap.aii.af.lib.mod
    com.sap.aii.af.ms.ifc_api
    com.sap.aii.af.svc_api
    sap.comtcloggingjavaimpl
    Regards,
    Raj

  • Dynamic configuration required in sender file - Adapter Module

    Hi Everybody,
    I am developing an Adapter Module in the file adapter (sender) using Adapter Specific Message Attributes.
    I am using Dynamic configuration inside the Module Process method in the adapter module.
    We are getting an error saying Dynamic Configuration cannot be resolved.
    Can anybody tell me the package to be used.
    Thanks,
    Zabiulla

    You can access the dynamic configuration in adapter module like this:
    Message msg = (Message) inputModuleData.getPrincipalData();
    String fileName = msg.getMessageProperty("http://sap.com/xi/XI/System/File", "FileName");
    You do not need any addition library besides the adapter module API.
    Hope that helps
    Stefan

  • Required Changes in FCC Paramenters for Sender File Adapter.

    Hi
    I am Doing File-File Scenario.I am using FCC in the Sender File Adapter. I have defined the structure as below.
    My Source Structure
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:MT_Source xmlns:ns0="http://city.net/filecopy">
       <Message>
          <Id>123</Id>
          <Head>
             <Id>123</Id>
             <Filename>test.xml</Filename>
          </Head>
          <Body>Helloworld</Body>
       </Message>
    </ns0:MT_Source_FILE>
    So for the above structure, I have defined the FCC Parameters as
    Document Name: MT_Source (Message Type)
    Document Namespace:http://city.net/filecopy(Namespace)
    Recordset Name: Message (root node)
    Recordset Structure: Message,1,Head,1
    Recordset Sequence: Ascending
    Recordsets per message:1
    Keyfield Type: string
    In the Table Rows I have defined
    Message.fieldFixedLengths: 3,10
    Message.fieldNames: Id, Body
    Message.fieldSeparator: ,
    Message.endSeparator: 'nl'
    Head.fieldFixedLengths: 3,8
    Head.fieldSeparator: ,
    Head.endSeparator: 'nl'
    Head.fieldNames: Id, Filename.
    My Input Text file
    123,Helloworld
    123,text.xml
    I am Getting Output as
    <?xml version="1.0" encoding="utf-8" ?>
    - <ns:MT_Source xmlns:ns="http://city.net/filecopy">
    - <Message>
    - <Message>
      <Id>123</Id>
      <Body>HelloWorld</Body>
      </Message>
    - <Head>
      <Id>123</Id>
      <Filename>test.xml</Filename>
      </Head>
      </Message>
      </ns:MT_Source>
    I should get Body field after Head Structure as in the Source Structure, So Please what changes do I need to do in the Parameters Specified above to get the desired Output.
    So How should I define the FCC Paramenters For Sender File Adapter ?
    Any Help Would be Appreciated.
    Regards,
    Varun

    Hi Everyone,
    I could Succeed to some extent.
    I have defined the parameters as follows
    Recordset Structure: Message,*,Head,1
    Key Field Name: KZ
    Key Field Type: integer
    In the table, I defined the Parameters as
    Message.fieldFixedLengths:1,3
    Message.fieldNames:KZ,Id
    Message.keyFieldValue:1
    Message.keyFieldInStructure:ignore
    Message.fieldSeparator:,
    Message.endSeparator:'nl'
    Head.fieldFixedLengths:1,3,8
    Head.fieldNames:KZ,Id,filename
    Head.keyFieldValue:2
    Head.keyFieldInStructure:ignore
    Head.fieldSeparator:,
    Head.endSeparator:'nl'
    Message.fieldFixedLengths:1,11
    Message.fieldNames:KZ,Body
    Message.keyFieldValue:3
    Message.keyFieldInStructure:ignore
    Message.fieldSeparator:,
    Message.endSeparator:'nl'
    My source text file
    1,123
    2,123,test.xml
    3,Hello World
    my output is
    <?xml version="1.0" encoding="utf-8" ?>
    - <ns:MT_Source xmlns:ns="http://city.net/FileCopy">
    - <Message>
    - <Message>
      <Id>123</Id>
      </Message>
    - <Head>
      <Id>123</Id>
      <Filename>test.xml</Filename>
      </Head>
      </Message>
      </ns:MT_Source>
    I got the output almost correct except I am not getting the value in the Body
    Any help would be appreciated.
    Please correct me If I am wrong.
    Regards,
    Varun
    Edited by: Varun on Sep 2, 2008 12:06 PM
    Edited by: Varun on Sep 2, 2008 12:15 PM

  • Changing File Adapter target directory - container bounce required?

    I edited USPSshipment.wsdl in the FulfillmentESB project to reflect my desired target directory (/home/oracle/usps_ship instead of C:\temp) and then re-registered the project with ESB.
    The registration completed normally, and I verified that the edited USPSshipment.wsdl file exists in the deploy and content directories in the ESB home. Also, checking the WSDL file from the ESB console showed the new value.
    However, until I bounced the OC4J_soa container, order submissions continued to use the C:\Temp target. After I bounced the container, the next order submission went to the desired /home/oracle/usps_ship.
    What is the expected cacheing behavior here? Is there a programmatic way to clear the cache after an ESB deploy. It is too restrictive if I have to bounce the whole container serving ESB and BPEL (perhaps many processes and ESB adapters) just to make a change in one particular project.
    Thanks.

    Using the SOA Demo, FulfillementESB project ~
    Example: Immediate reflection of change w/o further action
    If I change the Shipment router filter criteria (Fulfillment_Shipment.esbsvc) to cut at say $750 instead of $500, then re-register FulfillmentESB with OrderBookingIS, JDeveloper reports:
    Registration of Services Successful
    Fulfillment Shipment Updates
    The next submitted order follows the new criteria (e.g. a $600 order goes out USPS).
    Example: Change not reflected in runtime, until OC4J container restarted
    If I change the target physical directory of the USPS Shipment file adapter (USPSShipment.wsdl), then re-register FulfillmentESB with OrderBookingIS, JDeveloper reports:
    Registration of Services Successful
    However, the next submitted orders continue to be written to the previous target physical directory. Checking the value of the re-deployed USPSShipment.wsdl at the ESB host filesystem and through the ESB console shows the updated value, but the old copy is being actually used to process the message.
    Restarting the OC4J container, causes the updated USPSShipment.wsdl to be referenced for messages submitted thereafter.
    -Todd
    Message was edited by:
    tbeets

Maybe you are looking for

  • Access to file server from outside the domain

    We have users from another domain who connect over VPN to our SAP. These users must drop a file on a certain server in our domain to create labels. The problem is that they are not users on the domain, so they don't have access rights. I tried with G

  • FCE and Exporting to QT Compressor grayed out

    i have finished my first video. it is all rendered. solid blue line throughout. i go to export, but the "Compressor" is grayed out. in the lydna.com video i was watching, the instructor choose a ratio of 4:3. i thought that is what i choose, but i ca

  • Change Data passed from BEx to BO

    Hi Gurus, In our scenario, we have BO reports built on top of BEx queries. In BI, the convention for Hierarchy Node technical name is -> Hierarchy name + Hierarchy Node Name  e.g, if Hierarchy Name is ABC and node name is XYZ, then  Hierarchy Node na

  • Portal error - new implementation

    Hi Forum Guru's, We have just completed a new installation of PC, RM 3.0 and Netweaver portal. When we select the PC tab from within Portal, we get the following error , Portal Runtime error, an exception occurred while processing your request. Has a

  • Windows 7 will not install after formatting partition

    i am currently trying to install windows 7 on my mac mini, I am running on OS X version 10.7.3 and have a Window 7 OEM system builder pack.  When I get to the point in boot camp where I select the partition i get the standard notification can not be