cancel
Showing results for 
Search instead for 
Did you mean: 

content conversion for 2 files in one sender adapter

former_member187447
Participant
0 Kudos

Hi Folks,

I am trying to achieve FCC for 2 files using same sender comm channel by a combination of TransformBean and PayloadSwapBean. I have used the following blog for the config setup for attachment.

But coming to the module configuration I am having issues. Should I have to TransformBean Moudle Keys for each Key and the corresponding Module configuration? or should I do the FCC for one file using the standard FCC and the other using Module config?


Regards

Kalyan.



Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Kalyan,

If the file names are unique , I would suggest to go for a 2 step approach.

Scenario 1 - Reads both files separately, does FCC and places in a NFS location.

Scenario 2 - Reads XML files(fileB as attachment) and then do a java mapping to combine.

former_member187447
Participant
0 Kudos

Harish,

Yes, I agree, looks like that's the only the only option left. But I would rather do it in BPM which is a simple 2 step process. Thanks for the suggestion anyway.

Regards

Kalyan

Answers (1)

Answers (1)

engswee
Active Contributor
0 Kudos

Kalyan

You can do it per your screenshot but the converted XML content will still be in separate payload - main payload and attachment.

If you want to combine them, you still need a Java mapping to merge the main payload with attachment.

Rgds

Eng Swee

former_member187447
Participant
0 Kudos

Hi Eng,

Thanks for the response. So according what you said I will have the Plain2XML1 transformation first for the actual payload (or the payload configured in the channel directory and filename schema) and then followed by PayloadSwapBean and then followed by Plain2XML2 transformation for the attachment file in the same sender channel.

Also I am a bit confused on what module config should I have for the PayLoadSwapBean? I mean what values should I have for the Swap.key and Swap.value parameters? Also please let me know any other parameter which is required for swapBean.

Regards

Kalyan.

engswee
Active Contributor
0 Kudos

Can you provide screenshot on how you are going to get the two files in one sender channel?

former_member187447
Participant
0 Kudos

Hi Eng,

Here is the screenshot

engswee
Active Contributor
0 Kudos

Try the following parameter values:

swap.keyName = Payload-Name

swap.keyValue = FILE_B.CSV

Adding PayloadSwapBean in the Module Processor -  Adding Modules to the Module Processor - SAP Libr...

former_member187447
Participant
0 Kudos

Hi Eng,

For the swap to work I used the following and it works

swap.keyName = Payload-Name

swap.keyValue = AttachmentFile

But the issue I am having here is that, after the 3 module configs to complete the 1) FCC for FILE_A 2) to Swap the payload and 3) FCC for the FILE_B the final output generated from the File channel is only the attachment part i.e the FILE_B structure. FILE_A is complete replaced by FILE_B. What seems to be happening here is that the FILE_A structure is being swaped with FILE_B.  I am starting wonder if this is the right approach to achieve both payload as well as attachment as output from sender channel. Here is the log activity

MP: processing local module localejbs/AF_Modules/MessageTransformBean

Transform: using Transform.Class: com.sap.aii.messaging.adapter.Conversion

Transform: transforming the payload ...

Transform: successfully transformed

MP: processing local module localejbs/AF_Modules/PayloadSwapBean

Swap: swapping by Payload-Name ? AttachmentFile

Swap: successfully swapped

MP: processing local module localejbs/AF_Modules/MessageTransformBean

Transform: using Transform.Class: com.sap.aii.messaging.adapter.Conversion

Transform: transforming the payload ...

Transform: successfully transformed

MP: processing local module localejbs/CallSapAdapter

Application attempting to send an XI message asynchronously using connection File_http://sap.com/xi/XI/System

.....

...

Regards

Kalyan.

engswee
Active Contributor
0 Kudos

Hi Kalyan

Yes, that behavior is correct - PayloadSwapBean replaces main document with attachment.

That is why I mentioned in my earlier reply


If you want to combine them, you still need a Java mapping to merge the main payload with attachment.

What is your intended final output for the target, and what adapter are you using for receiver channel?

Rgds

Eng Swee

former_member187447
Participant
0 Kudos

Hi Eng,

Yes I think I have the wrong approach. In the blog I mentioned earlier the blogger used both inputs as XMLs and he is able to  extract both structures from the file channel without any Java Mapping. The java mapping in combination with Read attachments option in the OM is used later to merge both the structures  The problem in my case is that I am trying to use both non XML structures as inputs. My requirement is same as the blogs requirement and eventually perform some additional action on the combined structure which would be easy task.

I suppose you also meant to use Java mapping after extracting the 2 structures from the file channel just like the blog. If not could you please elaborate what is your approach.

Regards

Kalyan.

engswee
Active Contributor
0 Kudos

Kalyan


I suppose you also meant to use Java mapping after extracting the 2 structures from the file channel just like the blog. If not could you please elaborate what is your approach

Yes, you need Java mapping to merge contents of main payload and attachments. The modules you have configured just helps you transform both text files into XML but they are still separate, not merged.

Rgds

Eng Swee

former_member187447
Participant
0 Kudos

Eng,

Yes now we are on the same page. Just to add, of course I know that the modules are to generate the XMLs only. But in this case for 2 non XML inputs to Channel it is not possible to achieve both the XML structures using standard modules. unlike when both or one of the inputs are XMLs.

Thanks for the useful discussion.

Regards

Kalyan

engswee
Active Contributor
0 Kudos

2 non XML inputs to Channel it is not possible to achieve both the XML structures using standard modules. unlike when both or one of the inputs are XMLs

I really don't understand what you are saying here. What are you trying "to achieve"? What is your intended final output - XML, CSV, etc?

former_member187447
Participant
0 Kudos

Hi Eng,

Please check the blog  that I have posted about what I am saying. Anyway for reference here it is again In the blog 2 XMLs have been used as input to the channel but in my case I am using 2 non XMLs i.e 2 .CSV files.

Regards

Kalyan.

engswee
Active Contributor
0 Kudos

Kalyan

I have gone through the blog previously already. What I am asking is what is your specific requirement?

Can you provide sample content of both text inputs and sample of intended final output?

Rgds

Eng Swee

former_member187447
Participant
0 Kudos

Hi Eng,

The requirement is I have 2 .CSVs FILE A and FILE B and I would need FILE C as output.

FILE_A

ABC,123

RDN,456

RKC,678

FILE B

123,555

678,666

345,777

The output should be

FILE C

555,ABC,123

,RDN,456

666,RKC,678

I am not sure exactly why you need the requirement, but just FYI, I have already achieved this using a simple BPM and also the using the above blog that I mentioned, But instead of trying to directly give FILE A.CSV and FILE B.CSV I am converting them first to 2 .xmls FILE A.xml and FILE B.xml and then providing them as inputs to the file sender channel which takes the FILE A.xml as main payload and FILE B.xml as application attachment and subsequently merging them using Java mapping and then eventually getting the desired output FILE_C using another simple graphical mapping.  To be clear the purpose of this discussion was to see if there is anyway to use 2 .CSVs as input to one file sender channel and subsequently use it in the java mapping for merging unlike in the blog where 2 .xmls are used as input to the sender channel.

Hope this clears what I was trying to achieve through this blog. If you still think there is some other alternative please let me know.

Regards

Kalyan.