cancel
Showing results for 
Search instead for 
Did you mean: 

Graphical mapping - conditional node creation and sub-element mapping

masjo
Explorer
0 Kudos

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!

Accepted Solutions (0)

Answers (2)

Answers (2)

markangelo_dihiansan
Active Contributor
0 Kudos

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

former_member190293
Active Contributor
0 Kudos

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.