You are on page 1of 12

Scheduling File Adapter – Part I

SDN Community Contribution


(This is not an official SAP document.)

Disclaimer & Liability Notice

This document may discuss sample coding or other information that does not include SAP official interfaces
and therefore is not supported by SAP. Changes made based on this information are not supported and can
be overwritten during an upgrade.

SAP will not be held liable for any damages caused by using or misusing the information, code or methods
suggested in this document, and anyone using these methods does so at his/her own risk.

SAP offers no guarantees and assumes no responsibility or liability of any type with respect to the content of
this technical article or code sample, including any liability resulting from incompatibility between the content
within this document and the materials and services offered by SAP. You agree that you will not hold, or seek
to hold, SAP responsible or liable with respect to the content of this document.

© 2005 SAP AG The SAP Developer Network: http://sdn.sap.com 1


Scheduling File Adapter – Part I

Table of Contents
Applies To.........................................................................................................................................3

Summary ..........................................................................................................................................3

Scheduler Scenario ..........................................................................................................................4

Repository Configuration Steps........................................................................................................4

1. Creating Data and Message Types ..........................................................................................4

2. Creating an Intermediate Message ..........................................................................................5

3. Create Message Interfaces.......................................................................................................5

3.1 Create Outbound and Inbound Interfaces...........................................................................5

3.2. Create an Abstract Interface for BPM Processing .............................................................6

4. Define Message Mappings .......................................................................................................7

4.1. Mapping between Outbound and the Abstract Messages .................................................7

4.2. Java Program used in Mapping .........................................................................................8

4.3. Define a Mapping between Abstract and Inbound Messages. ........................................10

5. Define an Integration Scenario with simple Receive and Send Steps ...................................11

Points of Consideration ..................................................................................................................11

Author Bio.......................................................................................................................................12

© 2005 SAP AG The SAP Developer Network: http://sdn.sap.com 2


Scheduling File Adapter – Part I

Applies To
The scenario depicted in this document Schedules a File Adapter at specified intervals of time, might be a day
or some hours. The same functionality can also be extended for scheduling IDoc, Plain HTTP Adapter and etc
with some additional configurations.

Please also refer to Weblog: https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/2838 for a critique of


this content!

Summary
The scenario doesn’t involve any ABAP proxy call or a batch file running at the backend. This is modeled
using the basic File Adapter and BPM Concepts. This document speaks of configuration steps of Repository
and soon, the sequel would bring those of Directory.

To summarize, the complete scenario includes the following objects, in Repository:

Object Type Object Name

Data Type Details (Taken for example purpose)

Scheduler

Message Type Details

Scheduler

Message Interface Details_IN (Outbound)

Details_OUT (Inbound)

BPM_Message (Abstract)

Message Mapping Sender_To_BPM

BPM_To_Receiver

Interface Mapping Sender_To_BPM

BPM_To_Receiver

Integration Scenario Scheduler

© 2005 SAP AG The SAP Developer Network: http://sdn.sap.com 3


Scheduling File Adapter – Part I

By: Sreenivas Bandi

Date: 4th August 2005

Scheduler Scenario
Scenario Files should be transmitted at 12 PM everyday.

Deviation The files will be transmitted anytime between the mentioned Time (say 12 PM) and the Poll
Interval specified in the Adapter configuration, depending on the Adapter activation time.

Example Say the Poll Interval is 30 min, the file will be transmitted between 12 PM and 12.30 PM.

Explanation

The Poll Interval value is considered as the tolerance with in which the file will be transmitted to
Receiver System. Maintaining this allows the developer to activate the File Adapter irrespective of time. For
example as stated below, take a scenario where in file has to be sent at 12 PM. Suppose I have configured
and activated my sender File Adapter with Poll Interval as 30 min at 9.34 AM. As the Poll Interval is 30 min,
there will be a subsequent polling at 12.04 PM, when the ‘getTimer’ function returns ‘true’ and the file will be
transmitted to the Receiver.

Repository Configuration Steps


1. Creating Data and Message Types

Create/Import a Data Type say Details, representing the structure of the File to be transferred and build the
message type.

© 2005 SAP AG The SAP Developer Network: http://sdn.sap.com 4


Scheduling File Adapter – Part I

2. Creating an Intermediate Message

Enhance the above structure by adding an extra field say ‘Timer’ which will contain value ‘true’ or ‘false’
basing on the time during runtime.

Basing on the value of ‘Timer’, the File will be routed to the Receiver System.

3. Create Message Interfaces

3.1 Create Outbound and Inbound Interfaces

The same message type is used create the Outbound and Inbound interfaces, say Details_IN and
Details_OUT respectively.

© 2005 SAP AG The SAP Developer Network: http://sdn.sap.com 5


Scheduling File Adapter – Part I

3.2. Create an Abstract Interface for BPM Processing

© 2005 SAP AG The SAP Developer Network: http://sdn.sap.com 6


Scheduling File Adapter – Part I

4. Define Message Mappings

4.1. Mapping between Outbound and the Abstract Messages

© 2005 SAP AG The SAP Developer Network: http://sdn.sap.com 7


Scheduling File Adapter – Part I

All the fields of Target Message (Scheduler in this case) except ‘Timer’ are mapped to the respective ones of
the Source Message (Details). The field ‘Timer’ is mapped to a User defined function say, ‘getTimer’ (as
shown in the next fig.). The function returns either ‘true’ or ‘false’ basing on the Time conditions maintained.
The program specified below, contains logic for 12 PM schedule. This can be modified as per the
requirement.

4.2. Java Program used in Mapping

© 2005 SAP AG The SAP Developer Network: http://sdn.sap.com 8


Scheduling File Adapter – Part I

In the above program, the condition should be in such a way, that ‘hours’ should be equal to the time at
which File has to be scheduled and ‘minutes’ less than the Poll Interval specified in the Adapter
Configuration.

Possibilities:

Case 1: File Adapter activated at 9.00 AM with Poll Interval as 30 min

With the above settings, there will be subsequent polling (6th poll) at 12.00 PM, and since the
specified condition becomes true, ‘true’ will be associated to the field ‘Timer’.

Case 2: File Adapter activated at 9.30 AM with Poll Interval as 30 min

With the above settings, there will be subsequent polling (5th poll) at 12.00 PM, and since the
specified condition becomes true, ‘true’ will be associated to the field ‘Timer’.

Case 3: File Adapter activated at 9.04 AM with Poll Interval as 30 min (any time other than 9 & 9.30 AM)

© 2005 SAP AG The SAP Developer Network: http://sdn.sap.com 9


Scheduling File Adapter – Part I

With the above settings, there will be subsequent polling (6th poll) at 12.04 PM, and since the
specified condition becomes true, ‘true’ will be associated to the field ‘Timer’.

4.3. Define a Mapping between Abstract and Inbound Messages.

Map all the respective fields of Source to the Target message and do not map the ‘Timer’ filed to any one of
the Target Fields.

© 2005 SAP AG The SAP Developer Network: http://sdn.sap.com 10


Scheduling File Adapter – Part I

5. Define an Integration Scenario with simple Receive and Send Steps

Define a Container Object, say BPM_Message.

Simulate a BPM Process say Scheduler, as shown in the Fig.

Points of Consideration
1. The file gets transmitted only when the value of field ‘Timer’ is ‘true’.

© 2005 SAP AG The SAP Developer Network: http://sdn.sap.com 11


Scheduling File Adapter – Part I

2. Specifically the ‘hours’, is dependent on the date format (12/24 Clock) of the system.

3. It is assumed, all the other required objects, Message Interfaces and Interface Mappings will be
configured accordingly.

Author Bio
Sreenivas Bandi has 2 years of IT experience. His skill set mainly includes EAI, J2EE and e-
Matrix besides SAP Netweaver. He has been working on SAP XI for the past 6 months and
currently associated with SAP Labs India.

© 2005 SAP AG The SAP Developer Network: http://sdn.sap.com 12

You might also like