cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping Problem 2

0 Kudos

Dear mapping gurus,

We have a cutover issue related to a message mapping problem. The issue is that the FOOTER segment includes a field called GROUP. This is the same GROUP field in the ITEMS segment which denotes the number of IDOCs to be created (1 to N message split w/o BPM - create multiple message for every unique GROUP in ITEMS segment). It has an occurrence of 0..1 hence, there could be an instance where the FOOTER doesn't have a GROUP field.

Everytime there's no GROUP field in the FOOTER, then the value for TYPE is always set to XX. In this case, if TYPE = XX, the FOOTER must be replicated to all IDOCs that will be created, regardless of its GROUP.

Here's a snapshot of this scenario:

Before Mapping:

After Mapping (desired outcome):

Will really appreciate if you can lend a hand and provide some tips. Thank you very much.

Mike

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Dear Experts,

Is this achievable by graphical mapping? Any help is greatly appreciated. Thank you!

Mike

markangelo_dihiansan
Active Contributor
0 Kudos

Hi Mike,

I was about to reply to the other thread, anyway I've modified the mapping a bit.

For ZDOC:

For Header/MANDT (Header is mapped to a constant)

For ITEM/ITEMS (ITEM is mapped to a constant)

For ID, NAME, GROUP under ITEMS

For Footer, you need to duplicate the other one. One for those not containing XX and one for those that do.

For Footer[0] (no XX)

For Footer[1] (with XX), this is where the UDF is needed

Footer[1]/TYPE is mapped to a constant XX.

UDF is the same as in the previous thread


if(num[0]>0){

     for(int a=0;a<num[0];a++){

          for(int b=0;b<ftr.length;b++){

               result.addValue(ftr[b]);

          }

          if(a+1!=num[0]){

               result.addContextChange();

          }

     }

}

Test tab:

Regards,

Mark

0 Kudos

Mark - hi!

Thanks for always taking the time to answer my queries! I will try this out. Just a noob question. Can you briefly explain the concept of mapping onto 2 target fields? How does it work

markangelo_dihiansan
Active Contributor
0 Kudos

Hi Mike,

As of PI 7.1 they have introduced the concept of one output to multiple inputs. It just says that the mapping for TYPE and FOOTER are the same, it also has no performance improvement over mapping them separately.

Regards,

Mark

0 Kudos

Mark - hi

Thanks for the explanation!

Ok, so I tried your mapping. Worked perfectly fine with my initial test data. But when I modified it and added another FOOTER, it wasn't replicated correctly. See snapshot of the test tab.

The additional FOOTER with TYPE B is also for GROUP 100. So there should be 3 FOOTER segments in the outcome - Type A, Type B and Type XX.

Any advise?

markangelo_dihiansan
Active Contributor
0 Kudos

Hi Mike,

Here is the updated mapping:

Testing:

Regards,

Mark

Answers (2)

Answers (2)

0 Kudos

Mark - you are the best! The mapping is perfect and that duplicate tree worked like a charm. Fantastic!Thanks again!

sendhil_kumar
Active Participant
0 Kudos

Hi Mike,

Can you also show the mapping for that particular field. I guess, the context is not handled properly and hence the first value is carried out through out.

--

Sendhil

0 Kudos

Sendhill - hi,

This is a new field so it's currently not mapped. We don't have a mapping for this yet and that's where I need some help.

Mike

sendhil_kumar
Active Participant
0 Kudos

Hi Mike,

Check the mapping on the footer, it is handling the footers with group field present, you would have to add one more condition for checking the value of Type as XX, then that particular footer also should be included. If possible, provide us the mapping on footer, ppl here can tweak the existing logic and share it with you.

--

Sendhil

0 Kudos

Sendhil - hi,

This is the current UDF for the FOOTER. There's no check for anything (i.e. check presence of GROUP field) as the previous requirement is to just replicate all FOOTER segments to all the IDOCs/messages that will be created after the 1 to N message split.

if(group.length>0){

     for(int i=0;i<group.length;i++){

          for(int j=0;j<footer.length;j++){

               result.addValue(footer[j]);

          }

          if(i+1!=group.length){

               result.addContextChange();

          }

     }

}

Mike

sendhil_kumar
Active Participant
0 Kudos

Mike,

If I understand it correctly, as per your current logic, you replicate the footer to all idocs irespective the value in the group, (i.e. The footer with Value for Group 100 and Group 101 will appear in all the idocs).

If yes, and you want to include the footer with Value of Type "XX" into all the idocs,

then the same udf can be used, Just change the group inputs into Type inputs.

(i.e., Input to udf, instead of Group, use Type field).

--

Sendhil

0 Kudos

Sendhil - hi,

Yes, your understanding of the current logic is correct.

But now, with the introduction of GROUP field into the FOOTER segment, I should only replicate the FOOTER segment to its corresponding GROUP based on the GROUP field. Hence, the current logic cannot be used. You may refer to the attached screenshots I inserted in the first post.

Mike