cancel
Showing results for 
Search instead for 
Did you mean: 

Processing Several Records in a CSV File

Former Member
0 Kudos

Hello Experts!

I'm currently using XI to process an incoming CSV file containing Accounts Payable information. The data from the CSV file is used to call a BAPI in the ECC (BAPI_ACC_DOCUMENT_POST). Return messages are written to text file. I'm also using BPM. So far, I've been able to get everything to work - financial documents are successfully created in the ECC I also receive the success message in my return text file.

I am, however, having one small problem... No matter how many records are in the CSV file, XI only processes the very first record. So my question is this: Why isn't XI processing all the records? Do I need a loop in my BPM? Are there occurrence settings that I'm missing? I kinda figured XI would simply process each record in the file.

Also, are there some good examples out there that show me how this is done?

Thanks a lot, I more than appreciate any help!

Accepted Solutions (1)

Accepted Solutions (1)

justin_santhanam
Active Contributor
0 Kudos

Matthew,

First of all you need to split the Account Payable Information in your message mapping. For this you need to create the mapping program with Source and Target as same.

Source with 1..1 occurrence, and target with 1..Unbounded occurrence.

Next thing, do you want to generate output file separately for Each BAPI Response or club all the response together and write it to file.

There might be couple of changes in your BPM, based on your reply will suggest further.

raj.

Former Member
0 Kudos

Raj,

Thank you so much for the quick reply, I really appreciate it I will be sure to reward your answers!

Yes, I'd like to have all the return messages written to one single text file (this would be ideal).

Thanks again!

Matt

justin_santhanam
Active Contributor
0 Kudos

Matthew,

First let me explain the BPM Steps,

Recv--->Transformation1->For-Each Block->Transformation2->Synch Call->Container(To append the response from BAPI)->Transformation3--->Send

Transformation3 and Send must be outside Block.

Transformation1

Here, the source and target must be same. I think you must be know to split the messages, if not see the below example

Source

<MT_Input>

<Records>

<Field1>Value1</Field1>

<Field2>Value1</Field2>

</Records>

<Records>

<Field1>Value2</Field1>

<Field2>Value2</Field2>

</Records>

<Records>

<Field1>Value3</Field1>

<Field3>Value3</Field3>

</Records>

</MT_Input>

Now , I need to split the messages for each Records, so what I can do?

In Message Mapping, choose the source and target as same and in the Messages tab, choose the target occurrence as 0..Unbounded.

Now,if you come to Mapping tab, you can see Messages tag added to your structure, and also you can see <MT_Input> occurrence will be changed to 0..unbounded.

Here is the logic now

Map Records to MT_INPUT

Constant(empty) to Records

Map rest of the fields directly. Now your o/p looks like

<Messages>

<Message1>

<MT_Input>

<Records>

<Field1>Value1</Field1>

<Field2>Value1</Field2>

</Records>

</MT_Input>

<MT_Input>

<Records>

<Field1>Value2</Field1>

<Field2>Value2</Field2>

</Records>

</MT_Input>

<MT_Input>

<Records>

<Field1>Value3</Field1>

<Field3>Value3</Field3>

</Records>

</MT_Input>

</Message1>

</Messages>

raj.

Former Member
0 Kudos

Raj,

Thanks again for the pointers, I really appreciate it!

I was able to get the Message Mapping split functionality working in test mode, outside of the BPM engine. When I test the mapping via the Message Mapping definition, all the records are transferred from the source to the target. Source and target are the exact same, per your instructions.

Upon defining Transformation1 in the BPM engine, I've selected my Interface Mapping (which contains my Message Mapping). I am, however, a little confused on what to specify for the Source Messages and Target Messages value... I have defined a new Container Element, specifying an Abstract Message Inteface that I created. I have also selected Multiline for the Container Element. When I specify the new Container Element as both the Source Messages and Target Messages for the Transformation1 step, I receive the following error:

Expression must not return a multiline value

Maybe I shouldn't have selected the same Container Element as both the Source Messages and Target Messages? Not sure... Any ideas?

Thanks,

Matt

Former Member
0 Kudos

Raj,

I was able to get past the "Expression must not return a multiline value." I needed to specify two separate container elements (one as non-multiline and one as multiline).

I'm now trying to figure out what needs to happen in the Transformation2 step. When you have a moment, would you mind sending over details on what needs to happen in the Transformation2 step? I'm guessing I need to map the Message Interfaces that I'm looping through to the RFC, in preparation for the Synch Call step.

Thanks,

Matt

Edited by: Matthew Ramella on Mar 17, 2008 10:21 PM

justin_santhanam
Active Contributor
0 Kudos

Matt,

I apologize for the late reply! I was held up with other works, just now able to login to SDN.

Ok, let come to the issue. Yes the Transformation2 is used to Map each message to RFC Structure in order to make synch call. If you have any doubts, post ur questions.

raj.

Former Member
0 Kudos

Raj,

Thanks again for the reply, I really appreciate it!

For Transformation2, I'm a little stuck in determining what my Source Messages and Target Messages should be and what my Container Elements should be. I'm also stuck in determining how the results of Transformation2 tie in with the Synchronous Send step.

If you have a moment, would you mind providing some guidance on how Transformation2 should be setup and how it then relates to the Synchronous Send step?

Thanks again! I think I'm getting close!

Matt

justin_santhanam
Active Contributor
0 Kudos

Matt,

While defining For-Each Block you might have chosen Multiline and current line element right?

Now, for transformation2 u need the source as Current line and target as ur structure, Here don't need to change any occurrnences of the source or target messages. Do usual mapping.

Now the target of the tarsformation, must be the request of the Synchronous call.

raj.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello,

maybe you could use recordsetsPerMessage in Sender File Adapter (for example with value 1 or *).

Regards

Patrick