FLAT FILE TO FLAT FILE

FLAT FILE TO FLAT FILE SENARIO

Scenario

Suppose, you want to transfer a FLAT file (some user-defined format eg: Comma Delimiter format) from one system (Sender) to another system (Receiver) and also converting from one FLAT format to another FLAT format then you will use XI as an integration tool between the two systems.

Interface Diagram

Step by Step Solution

Step 1: Login into XI
  • Login into the SAP XI server using the logon pad.
  • Type "sxmb_ifr" transaction code to launch the Integration Builder.
  • Page will popup showing the first screen of the integration Builder which looks similar to this.

Step 2: System Landscape Directory

  • Click on the "System Landscape Directory" link.
  • This will open up the first screen of the SLD (System Landscape Directory). Here we are going to define our Product, Software Component, Technical System and Business System.

Step 3: System Landscape Directory - Define a Product

  • First step is to define a Product. For that, click on "Software Catalog" link.
  • Click on "New Product" Button to create a Product.
  • Now define the Product as per the inputs and click on "Create" button.
  • Can you see this message on your page when u clicked "Create" button. [Keep an eye on such kind of messages on top of the page]
  • If yes then Great. Congratulations! You have created a Product successfully.

Step 4: System Landscape Directory - Define a Software Component

Next step is to create a Software Component. To make the life easier XI automatically takes u to the Software Component page and by default it will select the Product that you have created.

  • Now define the Software Component as per the inputs and click on "Create" button.
  • Fine! You are done with Product and Software Component. If you see this screen then lets go back to main SLD screen as we have created the product and software component successfully. To go back to the main SLD screen click on "Home" Link on the top of the page.

Step 5: System Landscape Directory - Define Technical System

Now we need to define two Technical Systems (One for Sender and another for Receiver).

  • Click on "Technical Landscape" from the SLD main page.
  • When the page opens up select the "Third-Party" from the Technical System Type drop-down and press on the "New Technical System" button.
  • A page will pop-up asking for details of creating a Technical System.
  • Click on "Next>" button and then Fill all the values and then click on "Next>" again.

    Your next screen will ask you where is your product? Just search in the box or select it from the list and when it is listed just double click it or select it and say "Add".

Points to be noted before pressing Finish:
- Check that your Product is listed in the "Selected Products box"
- In the Components is your Software Component is selected. It should be selected as per the figure shown below.

Checklist done! Okay enough reading click on "Finish" now.
Are you with me? - Just nod

Can you see this:


AND

If Yes Great! We are on the same track then. Let's move ahead.

  • Now, I think you are intelligent enough to create one more Technical System. Just go back to the SLD Main Screen - This is can be done by clicking on "Home" link on the top.
  • When you reach to the SLD main screen click on Technical System again to create the Receiver Technical System. Follow the steps as per used earlier in order to create the Sender Technical system.
  • Don't forget to select correct Product and Software Component from the list displayed.
  • This is what I can see what about u?

    AND

Okay we have done with the Technical Systems and now we are going to create Business Systems. Go back to the SLD Home Page - Don't ask me how now it's shown in the top

Step 6: System Landscape Directory - Define Business System

  • Click on the "Business Landscape" on the SLD Main Page.
  • This will open up the Business Landscape page. Just click on "New Business System" button.
  • Enter the Business system name and Press "Next>"
  • Select
    and Press "Next>"
  • Now select the Technical System for which you are creating the Business System.
  • Fill the fields with these values and press "Next>"
  • Don't forget to check the product. Anyhow by default it is selected. Just check that it is like this.
  • Select the Integration Server from the Drop down and Click on "Finish".
  • Now Lets see what u have learned till now. Create one more Business System with different Logical System name (Leg004). All other steps are same.
  • Can you see the two business system
  • Okay now move to SLD Home page again and check that the Technical Systems are correctly added to the Products or not.
  • If you are at SLD Home Page then click at "Software Catalog" and then search you Product.
  • Click on the version and this will show the Software Component.
  • To check the Technical system, click on "Installed Systems" this should show something like this.
  • Can you see this? Yes Thank God! Okay fine we have done with the SLD (Products, Software Component, Technical System and Business System)
  • Just close the SLD window and now come back to our main XI screen.

Step 7: Integration Repository

  • Click to open the "Integration Repository" if you are using the XI for the first time this will take some loading time.
  • You will be shown an Integration Builder: Design Screen.
  • First step is to import the Software Component which you have created in the "System Landscape Directory"
  • Select you Software Component from the list shown and click on import button. Done importing - click on "Exit"

  • Now you can see the Software Component on the Left hand side with no objects in it.
    Double click your Software Component, a page will open up in the right hand side. Can you see it?
  • Now everything will be in Disable mode to make it in Enable mode click in Edit or Change Icon.
  • Just enter the Namespace.
  • If you are not able to see the Namespace it will in the minimize mode. Just click on "Namespace" and then click on Cap
    button. This will maximize the Namespace box.
  • Press save icon.
  • Can you see this on the left hand side?

  • Now we are going to create Two Data Types.
  • Right Click on Data types and click on "New".
    Enter the details as per shown and press "Create" Button.

    Now start inserting the Fields that you are going to have in the input FLAT file.

    Create the Sender Data Type (dt_sender) which is some things like this

    Now we need to create the Receiver Data Type (dt_receiver) as per shown below:

    Receiver Data type Fields:

    Now we need to create two Messages Types one for Sender and other for Receiver. In order to create anything new just right click on the object on the left side and select "New".
  • Select the Data Type (dt_sender) for the Message Type (mt_sender) by clicking the help button and then save it.
  • Similar way, create the Receiver message type (mt_receiver) and then press save.

  • It's the time to create Interface now. Say "New" on the Message Interface on the left hand side
  • Please make sure that you selected Outbound and Asynchronous and then select the Message Type (mt_sender) using the help button . Your screen should be like this before u save it.
  • Now we need to create Receiver Interface. Say "New" and then fill the details as per shown.

This time the Category is Inbound and Mode is same Asynchronous and then select the Receiver Message Type - atlast save it.
!https://weblogs.sdn.sap.com/weblogs/images/251692121/FlatFile_39.gif!Where we are?
- We have Created two Data Types (dt_sender and dt_receiver)
- Then we have created two Message Types (mt_sender and mt_receiver)
- Last we have made 2 Interface (mi_sender and mi_receiver)
My Screen says this. What about urs?

  • Same output! Let's move ahead.
  • Now its time to map the fields of Sender Message type and Receiver Message Type. This can be done by creating a Message Mapping Program. A "Graphical Mapping" which maps the field of Sender to Receiver.
  • Here are the inputs for the Message Mapping Screen. Press "Create"
  • You can drag and drop the Message Types in the corresponding boxes shown as Black. Drag mt_sender Message Type and drop it in the Black Box as shown
  • Same way drag and drop the mt_receiver Message type on the Target Box.
  • Now drag the elements say NAME from mt_sender and drop it on the right hand side NAME field. As you do you can see that Red Color fields turns into Green which means we are doing it right. Complete the mapping by dragging and dropping onto the right hand side fields and see that all the target fields are in Green color.
  • In order to see the Mapping lines what you have done Graphically select the Option as displayed below. Right Click on the field and then select "Dependencies" and select "Show All"
  • Nice functionality Right! This is what called as Graphical Mapping. Save
  • Okay we have done with the Mapping program between the messages but we need to create mapping between the Interfaces even.
    So, Select the Interface Mapping and say "New". Fill the details and Press "Create".
  • Now this is tricky. Here you can drag and drop the Interfaces on the white text boxes or you can use the help button to select the interface.
  • Once this is done click on Read Interface button below . This will add the interface in the below box and then u can select the message mapping program for these interface.
  • Okay now we are about to close this Integration Repository. Just select the Message Mapping Program using the help button. What was the mapping program? - (mt_.....).
  • Don't worry as I told XI has made life of us easier it will show only one message mapping program just select it.
  • Good! This is what I Can see now? Okay then save the work.
  • Now its testing time before saying yes we have done everything correct in the Designing Part. Click on the "Test" tab in the same Interface Mapping Screen.
  • Enter the values and press "Execute" button on the same screen
  • Does it works? If Yes wow! This is what I can see? and
    The message box says:

Messages:16:10:32 Start of test
Executed successfully
16:10:37 End of test

  • Here is the list from my XI Tool. Now its time to activate. This is something like results time after you write the exam but here best thing is you can see the errors but in real exam result we can feel the beatings?
  • To activate click on the "Change List" tab
  • Change the name of the Activate List and then press the "Activate" button in the bottom.
  • Hurray ! My first design is Successful.

STEP 8: INTEGRATION DIRECTORY

  • Close the Integration Builder:Design and move onto the Configuration part. Open the XI Startup screen. Click on "Integration Directory"
  • I am here now into the Integration Directory now right click on the left side box and select "New". It's okay that Scenario is selected.
  • Just fill the values and press "Create". Then you need to save it in order to see the Configuration Scenario on the left hand side.
  • Fine! Spit on your hand for some more work.
  • Next step is to import the Business System? Right click the Business system and select "Assign Business System" this will opens up a wizard.
  • First screen is Introduction (Sorry no theory as I promised) just say "Continue" button and then it will ask for Party - Sorry no Party say "Continue" button. Select the Business system and press "Finish" button.
  • Please make sure that the "Create Communication Channels Automatically" option is unselected.
  • Next step Right Click on the Communicate Channel and say "New".
  • Give a name to the communication Channel.
  • Now configure your Sender Communicate channel. First Click on the Help button to select the Adapters - Select "File"
  • Then select "Sender" and give the
    Source Directory:
    FileName:
    Processing Mode: Delete [Delete the file once it has been picked up by Adapter]
    All other are default

  • Let's not discuss what each of the Fields do. I just mentioned what need to be changed.
    Folder path should be XI Server system path not your system folder path. As I have installed it on my machine that is the reason I have given my C:\ path but If you are having XI server not on your machine then create the folder in the XI Server and give the Local path.
    Its logically make sense that from where XI will pick up the file, give that path and check that can Adapter access that path from XI server. I mean a share drive. Did u understand?
  • If yes smile and save the Sender Communication channel.
  • Now in the same manner create the Receiver Communication Channel. I know you are clever you know how to do this?
  • My Screen is like this. Only Filename and Target Directory are different.
  • Left hand side Communication channel are like this
  • Done! Next is "Receiver Determination"
  • Did I told u that XI makes our job easier then here it is the proof. Just use the help button to select the Service means your Business system and in the Interface box it will present you the correct interface just select. Before closing, match the following input as below.
  • You know what you are doing here? We are trying to say to XI that this is the
    Sender Business system, Sender Interface, Sender Namespace (This is the key)
    And to this sender information we need to map the Receiver Business system. In order to do that select the Help option from the "Service" option in "Configured Receivers"
  • After selecting the Receiver Business System. Click on "Save"
  • Now we will create Interface Determination. Just select as it is shown
  • Fill as it has shown below.
  • This interface Determination will ask for Inbound Interface and also for Interface Mapping. Just use help button to select it. Always save when it is done.
  • Next Sender Agreement
  • Nothing special we do here. We just attach the Communication channel to the Sender Key (Sender Business system, Sender Interface, Sender Namespace)
  • Simple as it shows. "Save"
  • Now same way create Receiver Agreement. Thinking How? Now I need to raise my Eyebrow.
  • Simple again. Just select the Receiver Communication Channel.

    Are we in the same Boat?
  • You know what? We have done the scenario. Its time for result

  • Activate the scenarios same steps as we have done in the Design part. You need to move to "Change List" tab in order to see the activate option.
  • Yupp we are there! Smile on my face
  • Are we done? Where is the output? What's next? So, XI is going to run the file? What I need to do Next? Finished?
    These were the question when I did my first scenario using XI by reading the Blogs. They just end up saying "Provide the input file and then you will get the output file". You know one my student gave XSD content as the input when he did the first scenario. Don't worry I am not going to leave half path. lets go to the target and shout from there that we have done it!
  • Now XI will be a Scheduler job which tries to search for the file in the "Sender Folder" what is this? This is the folder (C:\XI_FILES\SENDER) that we have configured in the Sender Communication Channel and also we gave the file name to pick up. As the file is not there so there will not be any output in the Receiver Folder (C:\XI_FILES\RECEIVER)
  • So how can I provide the file to XI? You need to create a file xi_flatfile_input.dat in the folder C:\XI_FILES\SENDER and copy this data and save it.
  • Now wait for the XI to pick the file. Once XI picks the file then it will delete the file.
  • Hurray I got the output file!
  • How to debug if anything went wrong? Login into the XI server and type the TCode "SXMB_MONI" this will take u to the message monitoring screen. Just select the first option then press "Execute". One more screen opens up Just Press "Execute" again.
  • Now open the message which has your business service name. If it is in red color box then error or else if you are seeing what I am seeing then You have successfully created a "FLAT FILE 2 FLAT FILE Scenario" from Scratch.
  • Some of you get the success message in the "SXMB_MONI" transaction but no clue why the file has not been generated in the Reciever Folder. There is one more place where you can check the errors. Yes you are right! "Runtime WorkBench".
  • Click on "Component Monitoring" >> "Display button" >> "Adapter Engine startxi" >> "Adapter Monitoring button"
  • Click on the "File" Adapter if it is Green then we are safe or try to read the errors that is been displayed.



SAP PI Training

SAP Developer Network SAP Weblogs: SAP Process Integration (PI)