cancel
Showing results for 
Search instead for 
Did you mean: 

Context issue - Idoc to FTP fixed length

Former Member
0 Kudos

Experts,

I need your advise on the below issue.

Source Structure Target Structure

E1EDT20

E1ADRM1

E1EDL20 Record 0.. unbounded

--- E1EDL24 Field1 0...1

--- E1EDL24 Field2

--- E1EDL24 Field3

--- E1EDL37 Fieldn

---E1EDL49

--- E1EDL37

---E1EDL49

--- E1EDL37

---E1EDL49

Issue: I need to create a new record for each occurence of segment E1EDL49, iam getting proper output for multiple equal occurences of E1EDL20,E1EDL24,E1EDL49, however in cases like one occurence of E1EDL20 and multiple E1EDL24,E1EDL49 iam facing issues with contexts

Since i have mapped target header to E1EDL49 segment, iam seeing 3 records, however other fields that reference E1EDT20,E1ADRM1 segments in this case are not having the right context. target header node context has 3 entry for instance: but some source element context has only one entry.

What is want to do is if context has entry then map it to target, if there is no value then atleast copyvalue from the first occurence.

Copyvalue function doesn't work in this case bcause when there are values in segments its not populating them. i hope you guys are able to understand this requirement.

Waiting for your reply,

Thanks,

Pavan

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Pavan,

I think doing mapping of the fields as explained below can solve your problem.

For mapping of target fields referencing fields of segment E1EDL20(parent of E1EDL49) you use standard node funtion USEONEASMANY with field of E1EDL20 in first input and the segment E1EDL49 in second and third inputs.

For mapping of the target fields referencing fields of segment E1ADRM1(which is parent of E1EDL20 itself) you can use function USEONEASMANY two times to repeat the value of the field of E1ADRM1 for number of times E1EDL49 is occuring as we have moved up to second hierarchy level from E1EDL49.

To do this, In the first USEONEASMANY pass the field of E1ADRM1 in the first input and segment E1EDL20 in second and third input by doing this we have successfully repeated the field value of segment E1ADRM1 for number of times E1EDL20 is occuring inside it, now to repeat it for number of times E1EDL49 is occuring inside it pass the output of the first USEONEASMANY to first input of second USEONEASMANY with its second and third arguments containing segment node E1EDL49. With this now we have repeated the values of segment E1ADRM1(Grandparent of E1EDL49) number of times E1EDL49 is occuring inside it.

Similiar logic can be implemented for fields of segment E1EDT20 by using three USEONEASMANY functions with first function repeating values according to E1ADRM1 and then following same logic explained above.

Hope this helps !!

Regards,

Amit

Answers (2)

Answers (2)

Former Member
0 Kudos

Thanks a lot for your input Saurabh and Amit. your logic definetely gave me some idea to resolve the issue. i had to use a combination of context handling, useoneasmany and headermapping to resolve the issue.

Thanks and Regards,

Pavan

Former Member
0 Kudos

Hi Pavan,

As per my understanding of your source str. it seems that segment E1EDL20 is the parent segment of E1EDL49 and E1ADRM1 is at the same level of E1EDL20. Now you are telling that you have to create new record for each occurence of segment E1EDL49 i.e if E1EDL49 segment is coming 4 time then you have to create 4 record.

Now If my above understanding is correct then

1. E1EDL20 and E1ADRM1 will occur once and E1EDL49 will come multiple time in this case you will map your taget segment to EIEDL49 by changing the context of E1EDL49 TO ONE LEVEL UP. and other field which you are taking from E1EDL20 and E1EADRM1 can be mapped with standard function using one as many ONE AS MANY ( this fun has three arg 1st will be the field to be mapped and 2nd and third will be E1EDL49(WITH CONTEXT ONE LEVEL UP). In this manner you can populate field properly .

in case if E1EDL20 will also come multiple time along with E1EDL49 then I think you have to go for UDF to populate field from E1EDL20

Regards,

Saurabh