cancel
Showing results for 
Search instead for 
Did you mean: 

File to Proxy with an attachment

Former Member
0 Kudos

Hi,

  I had a requirement , File to Proxy. File should go as an attachment to ECC.

I had gone through the following Doc


. In my case Sender is File , i can't take the reference of this doc.


I had tried of attaching the file to SFTP (Additional Files). But its throwing an error with Payload swap bean.


So can any body throw some light how can we attach a file to FTP/SFTP .


Also can ignore the main payload.


Or can we have any other approach to meet the above requirement.






Regards,

Samir

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Praveen/ Experts,

I do have similar kind of requirement but little different , In my case we don't have any main payload data, only .txt file will be placed in source directory I need to process the file to ECC inbound program.

could you please let me know what to maintain in SFTP channel Additional files  and do I need to create ESR part like service interface and all in receiver side.

In Swap bean module what I have to maintain.

Appreciate your quick reply. This is very urgent requirement for me.

Thanks,

Gayathri.

Former Member
0 Kudos

Hi Gayathri,

Do you have to send the file as an attachment to Proxy?

If yes, then you can achieve this requirement by following the below steps.

  1. Read the file using File/SFTP adapter. Content conversion, reading of additional files is not required.
  2. In the operation mapping you need to have a Java mapping.
  3. In Java mapping read the file and set it as an attachment to the output payload. You need to extend the AbstractTransformation class and not the StreamTransformation interface. Also you need to hardcode the output payload(TransformationOutput).

Refer the link http://scn.sap.com/thread/1918880 to get a sample code. However, you'll have to refine the code as per your requirement.

Regards

Charan

Former Member
0 Kudos

Hi Charan,

In my case we don't have any mapping involved in this. I have created one Receiver data type with one field,message type, and inbound service interface in ESR. Coming to sender side I have created one channel with FTP as adapter with payload swap bean.

I just want to pick the file from source directory(it is .txt ) file. and I have to pass the same file as it is to ECC through SOAP proxy.

Here is my channel config:

Please do let me know will it fulfill my requirement or not.

Note: For now i am testing myself with FTP. Actual requirement is with SFTP.

Appreciate your quick help!

Thanks,

Gayathri.

Former Member
0 Kudos

Hi Gayathri,

You'll have to read the test.txt as main payload and then convert that into an output attachment in j    java mapping. Also, you'll have to hardcode the receiver proxy structure in the java mapping and set it to TransformationOutput.

Regards

Charan

Former Member
0 Kudos

Hi Charan,

I can able to receive the file from SFTP in main document payload. I just want to send the .txt file to ECC through proxy.

Could you please suggest me how PI can hold the data and pass it to ECC through inbound proxy.

What is the ESR parr is required in this.

Thanks,

Gayathri.

Former Member
0 Kudos

Hi Charan,

Now i am an impression that we have to convert that .txt file to XML and then we have to pass it to inbound proxy. Correct me if i am wrong.

If that is the case can you please help me is there any standard module for SFTP sender channel to convert the data into xml file.

Thanks,

Gayathri.

Former Member
0 Kudos

Hi Gayathri,

I guess you need to be clear with the requirement.

  • If your requirement is just to send the file as an attachment to the inbound proxy then you can follow the java mapping approach.
  • If it is to trigger the data from the file to the ABAP proxy, then you need to convert the data in the file into XML using FCC and then pass it to the proxy. You can use the same MT, DT in the outbound and inbound SI without any OM and MM.

Regards

Charan

Former Member
0 Kudos

Hi Charan,

I will explain you my scenario in detail.

My Sender channel will be SFTP. I have to pick one .txt file which contains some unusual data.I am not sure about the structure of that .txt file. I have to pass the same txt file to ECC.

Unfortunately there is no direct mounting from PI to ECC in our landscape so I am not supposed to place the file in AL11 directory.

Now my query is how do I pass the txt file to ECC. I just created one DT,MT,SI for inbound in ESR.

Please suggest me how to proceed on thins. Hope this is clear to you.

Thanks,

Gayathri.

Former Member
0 Kudos

Hi Gayathri,

I guess you need to discuss with ABAP development team on how they want the file. As you are not sure about the contents of the file and the structure, it is better to go send it as an attachment to an inbound proxy or simply drop it in some FTP/SFTP server accessible to both PI and ECC systems.

Hope this is clear.

Regards

Charan

Former Member
0 Kudos

Hi Charan,

They want us to send the .txt file as an attachment to inbound proxy. Unfortunately there is no option to place the file in AL11.

Please help me with the solution approach.

Thanks,

Gayathri.

markangelo_dihiansan
Active Contributor
0 Kudos

Hi Shaik,

In the File Adapter (NFS), there is an option to include additional files. So to have the attachment, you would need two files (one for the main payload, the other for the attachment). I'm not sure if you have this option in SFTP, but it is not there in the FTP adapter.

If you can zip the files, you can just extract them and create an attachment in operation mapping.

Regards,

Mark

Former Member
0 Kudos

Thanks Mark.

Yes in  File(NFS)/SFTP we have option of adding files. But they will process as main payloads but not as an attachment.

If you can zip the files, you can just extract them and create an attachment in operation mapping.


   Is there any document for the above approach.



Regards,

Samir

markangelo_dihiansan
Active Contributor
0 Kudos

Hi Shaik,

PayloadSwapBean should work in your case. What is the extension of the first payload and the second? Can you share your config?

Since your scenario is a proxy, you need to have a defined structure for the target message type. Swapping the payloads will result in a proxy error.

Regards,

Mark

Former Member
0 Kudos

Hi Mark,

   

I had done the configuration for attaching the files as shown

I

Payload Swap Bean

  And i am getting the following error.

If i am doing some where wrong.Kindly guide me

Reards,

Samir

Former Member
0 Kudos

Also ,in the Receiver side i am using SOAP Channel.

Regards,

Samir

markangelo_dihiansan
Active Contributor
0 Kudos

Hi Shaik,

In this document, https://help.sap.com/saphelp_nwpi711/helpdata/en/44/692ab8a4b633eae10000000a1553f6/content.htm

the part and name e.g ".xml"="1.txt" is your text file name test1.txt?

Regards,

Mark

former_member182412
Active Contributor
0 Kudos

Hi Shaik,

Use below configuration.You must not have ModuleProcessorExitBean it is for receiver channels so remove the entry.

Regards,

Praveen.

Former Member
0 Kudos

Yes correct Mark.

Regards,

Samir

Former Member
0 Kudos

Thanks Praveen,

successfully swapped the Payload.

But i am getting the following error

\

May be the error is of because  I had not generated a proxy in the ECC.

Let me try and will get back.

former_member182412
Active Contributor
0 Kudos

Yes Shaik,

Yes, You are not yet generated the proxy because of that you are getting that error.

Regards,

Praveen.

Former Member
0 Kudos

Hi Praveen,

  It may take some time to create Proxy, because some  dependency is there..

Mean time , i have one query

used Payload swap bean successfully, but still  its showing both the files as payload only but not attachment.

Regards,

Samir

markangelo_dihiansan
Active Contributor
0 Kudos

Hi Shaik,


used Payload swap bean successfully, but still  its showing both the files as payload only but not attachment.

Where are you viewing this? If you remember the PI-SOAP format, the main payload is attachment-0 and the other attachments are attachment-1..n.

Regards,

Mark

former_member182412
Active Contributor
0 Kudos

Hi Shaik,

Where do you see can you attach the screen shot?

Regards,

Praveen.

Former Member
0 Kudos

Hi Praveen,

 

In the above screen shot, you can see .Its showing as payload for both the files.

Regards,

Samir

former_member182412
Active Contributor
0 Kudos

Hi Shaik,

Those are content id's for both payloads, if you want to see the difference you can check under manifest section sap:Name element.Example below is MainDocument is main payload.

Regards,

Praveen.