cancel
Showing results for 
Search instead for 
Did you mean: 

creation of multiple records in reciever file as per occurance of 1 segment

venkatasap
Participant
0 Kudos

Hi SapAll.

i have a got a requirement in an IDOC To File Interface

the Requirement is under sending IDOC there will be multiple segments whose fields will me mapped to reciever file,so here i got a business requirement as

IDOC -

Segment 1-occur for 1 time

segment 2- occurs for 1 time

segment 3-occurs for 3 times so here PI Need to create a file with 3 records as segment 3 repeats for 3 times, here segment 1 and segment 2 field values repeats for all the 3 records int the file and segment 3 fields values will have to be mapped respectively for each record of all the 3 records from each segment 3.

i dont know on how i can acheive this.

can any of sap group provide me the solution.

regards.

Varma

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Create trarget structure as Segment 1 - 0-1 occurance , Seg 2- 0-1 Occurance and Seg 3- Occurance 0- Unbounded.

and do the mapping of IDOC seg with corr seg.

So if Seg 3 is occuring n times then target end seg 3 wil occur n no times.

Occurance of node decide how many times that seg will repeate based on the source inputs.

U can try that

chirag

venkatasap
Participant
0 Kudos

Hi Chirag.

Thanks for the quick response but the reciever file is a flat file structure with PIPE'|' delimited ,so i dont think the file will look in a good manner if i do as u said.

my requirement is to create file with 3 records with segment 1 and 2 field values repeating for all the 3 records and segement 3 fields values occurs respectively for each record in the file.

ex :

segmet 1 : a,808,999

segment 2 : b,909,101.

segment 3 : xxx1,yyy1,zzz1

segment 3 : xxx2,yyy2,zzz2

segment 3 : xxx3,yyy3,zzz3

then file should look like a,808,999,b,909,101,xxx1,yyy1,zzz1

a,808,999,b,909,101, xxx2,yyy2,zzz2

a,808,999,b,909,101, xxx3,yyy3,zzz3.

will be waiitng for your response.

regards.

Varma

Former Member
0 Kudos

Hi Varma,

As sarvesh mentioning you can use copyvalue for copying the value in all the segments. If it didnot work then you can use UseoneAsmany function as mentioned in solution2:

/people/claus.wallacher/blog/2006/04/17/replication-of-nodes-using-the-graphical-mapping-tool

Regards,

---Satish

Answers (1)

Answers (1)

Former Member
0 Kudos

> segment 3-occurs for 3 times so here PI Need to create a file with 3 records as segment 3 repeats for 3 times, here segment 1 and segment 2 field values repeats for all the 3 records int the file and segment 3 fields values will have to be mapped respectively for each record of all the 3 records from each segment 3.

Create your target structure as mentioned and do the mapping as shown below.

<Records> 0..unbounded
     <segment1_Fields> </segment1_Fields>
     <segment2_Fields> </segment2_Fields>
     <segment3_Fields> </segment3_Fields>
</Records>

Now do the mapping like this..

segment3 -


>RemoveContext---> Records (parent node mapping)

segment1----->CopyValue(0) ---> segment_field1

segment2----->CopyValue(0) ---> segment_field2

segment3----->SplitByValue ---> segment_field3

Note: You can also use "UseOneAsMany" instead of "CopyValue" function to repeat the segment1 & segment2 values in each record.

venkatasap
Participant
0 Kudos

Hi.

Thanks for the best answers and suggestions,it looks like it is working.

as per the requirement PI is creating mutliple files based on one particular segment repeating for multiple times using use one as many and copy value standard functions in graphical mapping.

but i didnt create multiple segmetns in reciever file structure ,i had only created one segment with all fields refer to mutlipel segments on sending IDOC side.

regards.

Varma