cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple Idocs to Multiple files

varun_k
Contributor
0 Kudos

Hi,

I have a Idoc to File Scenario, where I get multiple Idocs and I need to generate multiple files with different file names

Assume I am using file XML port at SAP to collect the Idocs.

Target files are generated based on two field values (Delivery Type and Shipping Point)from Idoc.

Eg:

I have three Idocs at a time.

Idoc1 has Delivery Type = EL & Shipping Point = 2550 --> Target file name is test1.bpr

Idoc2 has Delivery Type = LF & Shipping Point = 2551 --> Target file name is test2.bps

Idoc3 has Delivery Type = NL & Shipping Point = 2552 --> Target file name is test3.bpr and test3.bps

1) Does Mult-mapping support in the case... ?

2) Do I need to change the Idoc Occurrence 0 to unbounded ?

3) What will be the Occurrences in the interface Mapping

4) Can i generate Multiple fileswith different names at one time as specified above using Dynamic Configuration?

5) What will be the Target Structure Occurrence ?

Thanks,

Varun

Accepted Solutions (0)

Answers (6)

Answers (6)

Former Member
0 Kudos

Hi Varun,

I am also having the same requirment. I need to create a multiple files based on the input requetno. I have created multiple files using multimapping. But Dynamically i need to pass the file name as request no. I have seen you have acheived this using variable substution. could you please share the info. it will be greartful for me to proceed.

Regards,

Ramalakshmi.G

varun_k
Contributor
0 Kudos

Its working fine now.. I am able to generate multiple files with different file names

but in case

for eg:

when 1 Idoc has Delivery Type = NL & Shipping Point = 2552 --> Target file name is 2552_test3.bpr and 2552_test3.bps

so in this case two files need to be generated from single Idoc

2552_test3.bpr

2552_test3.bps

same file with different extension

How to achieve this ?

Thanks

Former Member
0 Kudos

Hi Varu,

Just use copy commad in your receiver adapter with the second extension. Call this after message processing. It should work as expected.

Regards,

---Satish

varun_k
Contributor
0 Kudos

Hi Satish,

In my case I am using Multi mapping and Variable substitution for file name.

I need to generate the second extension file only in case when delivery type is NL, need to concatenate two source fields and generate two (.bpr and .bps) files.. In other cases 1 file will be generated.

so in this case does OS command work ?

I am using NFS

In OS Command, Directory path will be the same Target directory path specified under file access parameters

Current file name scheme used is %var1% (variable substitution)

Target file name: concatenate VBELN and VSTEL from source idoc

eg: VBELN = 123

VSTEL = 8888

If LFART (del type) = EL

then Target file = 123_8888.bpr

If LFART (del type) = LF

then Target file = 123_8888.bps

If LFART (del type) = NL

then Target file = 123_8888.bps and

Target file = 123_8888.bpr

If yes, Can you please suggest how do I specify that in the com channel.

Thanks,

Varun

Edited by: Varun Reddy on May 10, 2011 2:33 PM

Former Member
0 Kudos

Hi,

You can control the creation of your second file in the message mapping itself. Use occurrence 0..unbounded and in the message node, put in the condition that if delivery type is NL, the node should be created.

Regards

varun_k
Contributor
0 Kudos

Hi,

Though I am using Multi - Mapping only 1 file is being created. I tested with two Idocs, where 2 files should be created.

In Moni, under Payload, I can see 2 sets of Main Document and SubMainDocument been created.

How to generate 2 files/multiple files ?

If Dynamic Configuration is not supported in case of Multi Mapping, If I want to use Variable Substitution, then What will be the Target path to be defined in the comm channel since Multi mapping is there. I am trying to define for Action field. Does Variable Substitution support Attributes in the aml payload ?

My target structure

<?xml version="1.0" encoding="utf-8" ?> 
- <ns1:Root xmlns:ns1="urn:ap:xi:dwn:Logi:100">
- <Shipment Company="XX" Warehouse="01" ErpOrder="0830001212">
  <Action>0830001212_2551.bpr</Action> 
  <Customer Customer="DEMO" Company="DEMO" /> 
  </Shipment>
  </ns1:Root>

-


<?xml version="1.0" encoding="UTF-8" ?>

<root>

<Shipment>

<Action>0830001212_2551.bpr</Action>

</Shipment>

</root>

-


Shipment Occurrence is 0 to unbounded and above root I have Messages and message1 node (since Multi mapping)..

so How do I specify Path for variable substitution in this case, i tried all possibilities, but i am getting error as

Message processing failed. Cause: com.sap.aii.af.ra.ms.api.RecoverableException: Error during variable substitution: com.sap.aii.adapter.file.varsubst.VariableDataSourceException: The following variable was not found in the message payload: var2: com.sap.aii.adapter.file.configuration.DynamicConfigurationException: Error during variable substitution: com.sap.aii.adapter.file.varsubst.VariableDataSourceException: The following variable was not found in the message payload: var2

I am working on PI 7.0 SP 21

Thanks

Edited by: Varun Reddy on May 9, 2011 4:38 PM

Former Member
0 Kudos

1) Does Mult-mapping support in the case... ?

-- Yes you can use multimapping as Idoc in this case is sender

2) Do I need to change the Idoc Occurrence 0 to unbounded ?

-- No need to change Idoc occurrence to unbounded. Just use multimapping on target side as you are already collecting the Idocs using XML file port.

3) What will be the Occurrences in the interface Mapping

-- Occurrence in your interface mapping will be similar to your message mapping. So, if your message mapping is source -> 1..1 and target > 1unbounded, your interface mapping occurrence will be similar.

4) Can i generate Multiple fileswith different names at one time as specified above using Dynamic Configuration?

No dynamic configuration will not work in this case as the XI message header is only one, so it can only hold one filename, not multiple. If you need to go for dynamic filename, use variable substitution. Ofcource, in this case, the filename has to be part of your payload for the variable substitution to work.

5) What will be the Target Structure Occurrence ?

target structure occurrence should be unbounded to generate multiple files

Regards

former_member208856
Active Contributor
0 Kudos

No need to change IDoc occurance.

Use multimapping for mapping the IDoc to file.

Use dynamic configuration for file name.

baskar_gopalakrishnan2
Active Contributor
0 Kudos

>>1) Does Mult-mapping support in the case... ?

Yes you need to do Mutl mapping only

>>2) Do I need to change the Idoc Occurrence 0 to unbounded ?

If you have same idoc type and comes as mulitple idocs then yes you have to change the occurence o to unbounded

>> 3) What will be the Occurrences in the interface Mapping

Yes o to unbounded for both source and target

>>5) What will be the Target Structure Occurrence ?

o to many

See these links...

You might have to take information some portion of the above links for source and target

Hope that helps.

Former Member
0 Kudos

Hi Gopal

I have a scenario IDOC to File

requirement is :

in Idoc one line item repeats multiple times then thous many xml files has to be generate in receiver location.

Ex: line item 5 times repeated 5 xml files in one location.

the above one is my structure

if ZRDSPICK to repeats 5 times 5 xml files

but i am getting 5 messages in one file but required 5 different files

In mapping i kept occurrence 0-UB

signature occurrence 0-UB

ICO occurrence 0-UB still same prob

can please help