Online Tutorials & Training Materials | STechies.com
Register Login

Multiple occurrence of file to single occurrence of RFC

|| || 0

Multiple occurrence of file to single occurrence of RFC
Stechies

Business Description:

In our Landscape we were supposed to interact SAP Release 4.7 system (production system) from SAP XI using RFC.

The roles of R/3 are configured as Application Server mediating the data transfer using SAP XI which acts as Integration Server from Source to Target System.

The scenario is SAP XI reads multiple records from the source system and sends the same to RFC. Finally, the RFC updates the records in Application System.  

Technical Challenge: 

In our current scenario, the RFC accepts one record at a given time and updates in data Base as the occurrences of RFC in export parameters is 1:1. Hence here the RFC doesn’t support collecting multiple documents.

From customer’s point they are not willing to go for any new developments from ABAP side. 

Feasibility Study & identification of solutions (Some of them…) 

After completing the technical feasibility of the scenario we have concluded with following options in draft phase. 

  1. Either we can develop a wrapper function on top of RFC and change the occurrence to 0...unbounded, then handle the application logic in RFC on application server. But problem arises in Interface Determination as we cannot get pull the Inbound Interface from IR as the original RFC is 1:1 and the modified one has 0...unbounded occurrences.

Draw Back: New development has to be taken care on R/3 System, which might be time consuming and requires an ABAP developer. 

  1. Either Post One record at a time.

Draw Back: multiple records will come in the form of CSV file, this is ruled off. 

  1. Either develops ABAP-Server proxy and handles the calls by developing the application logic in server proxy and finally calls the RFC using the loop so that multiple records can be collected and posted.

Draw Back: Same as point one but more flexible solution than that. Again requires development on application server and again there are dependencies of RFC wherein total code needs to be re-written. 

  1. Try using Multi Mapping Concepts offered by SAP XI.

Draw Backs:  though this approach is well suited but it has its own restrictions, The target requires to be 0...unbounded to use multi mapping. Even if we change the occurrence of RFC to 0.. Unbounded in Interface & Message mapping, after observations we found it will post only one record. 

  1. Finally use BPM concepts & to handle the issue.

There was one Pattern, which solves one of our problems. So we made use of that pattern.

For show casing the technical solution we created simple RFC module in Backend.

Time to put down in XI/PI server. 

PART-0 PREPARATION 

Create a Z

  

FUNCTION ZSCARR_INS_ASY.*"----------------------------------------------------------------------*"*"Local Interface:*"  IMPORTING*"     VALUE(CARRID) TYPE  ZSCARR-CARRID OPTIONAL*"     VALUE(CARRNAME) TYPE  ZSCARR-CARRNAME OPTIONAL*"     VALUE(URL) TYPE  ZSCARR-URL OPTIONAL*"----------------------------------------------------------------------
DATA : ITAB TYPE ZSCARR.
ITAB-CARRID = CARRID.ITAB-CARRNAME = CARRNAME.ITAB-URL = URL.INSERT INTO ZSCARR VALUES ITAB.
ENDFUNCTION. 

PART-1 SYSTEM LAND SCAPE DIRECTORY

  • Create the product

  • Create the Software component for the above created Product

  • Define technical Systems

  •  Define Business systems & assign the related integration Server for the business systems. 

PART-2 INTEGRATION REPOSITORY 

  • Import the Software component into Integration repository

  • Create the name space

  • Enable the option “import of RFC/IDOC permitted “

  • Import the ZRFC from R/3 backend.

Data Type:

  Create the Source Data type

 

No Target Message Type is required as we are importing the RFC from backend into IR. 

Message interface:

The Message interfaces needed to be created.

 1. File Coming from File System

Abstract interface picked up from Imported Objects->RFC->ZSCARR_INS_ASY 

Container Elements

Create the Container Elements as shown the “type” displayed here displays only the Abstract message interfaces

 

Change the occurrences of target interfaces to 0—unbounded as shown 

Message Mapping:

The message mapping need to be defined between the Source Message Type & target message type

Message mapping for the corresponding Interface mapping 

Save the objects & activate all the design time objects.

Click the change list and expand the SWCE right click on standard change list and click on activate by selecting the objects. 

PART-3 INTEGRATION DIRECTORY

We are now going to create A2A scenario manually.

Create a scenario & name it then save it.

Once the Scenario is created & saved, it is displayed in Left panel

Then the following steps need to be performed

  • Create Business Systems

  • Create Communication Channel & fill the parameters

  • Create the receiver Determination

  • Create the Interface Determination

  • Create the Receiver Agreement

  • Create the Sender Agreement.

Creating Business Systems: Import the Business systems from SLD. Select the appropriate the systems & click on import, make sure the option “create communication channel automatically is unchecked”. Because we would like to create them manually 

Integration Process: import the BPM from IR into ID

This step is to be done in order to import the BPM from IR to ID

 







 

From BPM to R/3 System

BPM To R/3 System:  

Configure the Inbound interface (outbound) for BPM and Inbound For RFC.

PART4 -  TESTING 

Keep the XML file into the folder on FTP server, as mentioned in the properties of sender communication channel

The XI uses Pull mechanism to pick up the file as per pool interval, And depending on the mode (delete in this case) the file is deleted from the sender folder

 

Finally log on to the R/3 system (backend) and check the data base table for entries. 



 

Execute the Transaction code SXMB_MONI, to check the incoming messages.

  

 

Sender Agreement

Configure the Sender Agreement. This makes the binding between the sender system & sender message interface & communication channel

 

Interface Determination

Select the Appropriate inbound message interface & the interface mapping created in IR for this message.

It contains 2 steps.

  • One from File system to BPM

  • Other from BPM to R/3 system

File To BPM

 

Receiver Determination

Select the Appropriate receiver for this message.

It contains 2 steps.

  • One from File system to BPM

  • Other from BPM to R/3 system

File to BPM 

 

Sender Communication Channel

Since the sender is file system, choose the Adapter type as File.

And configure the Adapter dependent & independent properties

 

Receiver Communication Channel

 Configure RFC Receiver adapter with server specific properties.

 

Business Systems 

Interface Mapping

Since the structure conversion need to be done. Define the Interface mapping which we will be needed in Directory.

Pick up the source Message interface & target message interface as shown



Change the Occurrences in target Message interfaces to 0.unbounded as this is mandatory.

 

Graphical Definition 

Integration process:

The Integration process needed to be created for this scenario  

 

Create an abstract interface as shown; this is the entry point for starting the BPM

Since BPM can understand only Abstract interfaces we need to design one.

 

 

No Target Data Type is required as we are importing the RFC from backend into IR.

Message Type:

Source Message type, create message type & assign the data type created earlier

 

 

Create function module

Path -> SE37 create the function module in function group. Check the remote enabled option. The import parameters should be sent by pass by value.

Create a Z to send the input parameters

Write the source code to update the data base table created in earlier step.

 

 

 


Related Articles