cancel
Showing results for 
Search instead for 
Did you mean: 

SAP PI Design

Former Member
0 Kudos

HI All

I have a requirement please suggest me a design

ECC sends a  input message to PI with filename and directory through proxy

Sender channel has to pick the image file from the directory and send back the binary data back to proxy

I believe we need to go for BPM .Please let me know if there is any alternative for the same.

Regards

sandeep

Accepted Solutions (0)

Answers (2)

Answers (2)

markangelo_dihiansan
Active Contributor
0 Kudos

Hi,

The scenario can be done by ECC(proxy async) -> PI -> ECC(proxy async).

In your message mapping, you can use file input stream to read the file in an AL11 directory. This is assuming the ECC file system is mounted in your XI file system. Otherwise, you need to use an FTP api in Java to access the ECC directory (also assuming you are allowed to do an ftp call).

Regards,

Mark

Former Member
0 Kudos

HI Mark

The scenario is ecc sends only the file directory and filename ftp sender channel has to pick the image file based on this filename and directory and convert the image file to binary data and send back to ECC

Regards
Sandeep

markangelo_dihiansan
Active Contributor
0 Kudos

Hi Sandeep,

The suggestion still stands. In message mapping, the filename and directory will be used by the Java FTP API to access the file in ECC, encode it in base64 and then send to abap proxy.

As far as I know, it is not possible to dynamically determine the source filename and directory in a file sender cc.

Regards,

Mark

Former Member
0 Kudos

Hi  Mark

So in this case we need parser in java code to get the filename and directory from Proxy XML and then FTP API to get the file

correct right?

Regards

Sandeep

markangelo_dihiansan
Active Contributor
0 Kudos

Hi Sandeep,

No You need the parser to fetch the file in the ECC directory.

Regards,

Mark

Former Member
0 Kudos

Hi Mark

Actually the file is image file and its located in different ftp server location.

I will just get the filename and directory details from ECC.

Proxy sends it in XML format.  so I need to parse it right to get the details.

Regards

Sandeep

markangelo_dihiansan
Active Contributor
0 Kudos

Hi Sandeep,

Sorry about that. Yes, when the filename and directory is sent by ECC the Java API for FTP will get the file in a different location.

Regards,

Mark

Former Member
0 Kudos

Hi Mark

So the data from ECC will not be direct input to java mapping right.

We need to parse it to get details right?

Regards

Sandeep

markangelo_dihiansan
Active Contributor
0 Kudos

Hi Sandeep,

If the filename and directory comes from the ECC message, you need to extract it (a simple substring in Java Mapping will do).

Regards,

Mark

engswee
Active Contributor
0 Kudos

Dear Sandeep

While it is technically possible to read a file through Java mapping/UDF, please note that this goes against J2EE EJB restrictions.

This is also documented in SAP's JavaDocs for PI


Java mapping programs are not permitted to be stateful. You are therefore not permitted to perform actions such as writing data to a database table during a Java mapping. The Integration Server cannot track such side effects. Therefore, if an attempt is made to resend a message that has not been received by the receiver, the data may inadvertently be written to the database twice in a Java mapping.

Note for Java mapping programs (user-defined functions and Imported Archives), the programming restrictions imposed on J2EE application providers and especially the restrictions imposed on J2EE EJB providers are valid. This means for example, you should not

  • load and use JDBC drivers (use instead the Lookup API),
  • use class loaders,
  • use the package java.io (writing to or reading from file system),
  • create and manage threads,
  • change system properties (using java.lang.System.setProperties()),
  • listen on, accept connections on, or multicast from a network socket.

For more on these restrictions, see chapter 25.1.2 of the EJB 2.1 specification.

Rgds

Eng Swee

markangelo_dihiansan
Active Contributor
0 Kudos

Hi Eng Swee,

Thank you! I didn't know that. So are you suggesting to use stateful session bean via adapter module?

Regards,

Mark

engswee
Active Contributor
0 Kudos

Hi Mark

Unfortunately, I don't have a readily available solution to suggest. The tricky part is that file pickup is normally done at a sender communication channel based on polling. However, the requirement here needs it to be on the receiving end.

One idea I could think of is to develop a custom adapter (not module) that would be used at the receiver communication channel. This adapter would receive the synchronous request message (from the sender proxy channel), retrieve the file (via Java IO API), and construct the response message back.

Will be quite an effort though!

Rgds

Eng Swee

Former Member
0 Kudos

Hi Eng Swee

Is there any design you can suggest through BPM by externally controlling(starting) channel in mapping.

Regards

Sandeep

former_member184720
Active Contributor
0 Kudos

Hi Sandeep - See if you can make use of sync/async bridge.

Refer to the page 17 and scenario 6 VARIANT 2: SYNC/ASYN BRIDGE BY MEANS OF MODULE PROCESSOR in the below document.

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/80f96dbf-adca-3010-ffb5-daf2d1f0e...

in the file receiver /sender channel, use execute OS commands option to fetch the file from your FTP server.

i.e. you have to write a custom program(java,perl etc) which will take the file name from the proxy message and fetch that file from FTP and place it on another location.

From that location, your sender channel can pick and send it to proxy..

ravi_reddy1
Participant
0 Kudos

Hi Sandeep,

Go through this link 

it will help to u

Thanks & Regards

E.Ravi chandra reddy