Skip to Content
0

Graphical mapping - conditional node creation and sub-element mapping

May 10, 2017 at 04:50 AM

82

avatar image

Hi,

I have a graphical mapping issue. I have a source document:

Documents 0..1

--Document 0.. N

--Header 0..1

--Line 0..N

-- LineTypeCode 0..1

-- GLAccountNum 0..1

I am mapping this to idoc ACC_DOCUMENT.ACC_DOCUMENT02.

For segment E1BPACGL09 in the idoc, I only want to map the Lines where LineTypeCode = 'GLITEM'.

My issue is when I map GLAccountNum (source) to a field in E1BPACGL09 (target), I need to do a RFC lookup as part of the mapping. The RFC lookup and mapping works fine when all Lines are 'GLITEM' but as soon as one of the line items should be suppressed, my mapping no longer works. Below is the GLAccountNum mapping I currently have:

Ideally, I would like to perform the RFC lookup only for the GLITEM Lines but not sure if this is possible with the way PI handles queues. Regardless, I need the mapping to work whether all Lines are relevant or some need to be suppressed.

I'm hoping someone who's much better at graphical mapping can help or even suggest a simpler solution.

Thank you!

snipimage.jpg (8.7 kB)
snipimage2.jpg (37.2 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Evgeniy Kolmakov May 10, 2017 at 06:42 AM
0

Hi Joy!

As I could see you use useOneAsMany functions in your mapping. It seems to me that you can assign your source values (it looks like document or message level constants) to variables and use it instead of useOneAsMany. This will simplify the mapping.

As for RFC lookup, I'm not quite sure but I would try to move lookup to "then" condition of your IfWithoutElse function: if true then lookup.

Regards, Evgeniy.

Share
10 |10000 characters needed characters left characters exceeded
Mark Dihiansan May 10, 2017 at 09:11 AM
0

Hi,

Since you are creating E1BPACGL09 based on linetypecode, it will be created multiple times right? Then the rfc will be called as many times as E1BPACGL09 exists. My solution would be to:

1. create a mapping variable just below the target root message and use the rfc lookup there

2. eliminate the filter for cost center in the rfc lookup, you'd be retrieving all cost centers in the source xml

3. perform an rfc lookup and then store in a hashmap

4. call the hashmap once the filter for cost center gets executed (COSTCENTER field in Idoc)

If for some reason you need the cost centers without GLITEM, then you just need to create another getter udf.

Regards,

Mark

Share
10 |10000 characters needed characters left characters exceeded