cancel
Showing results for 
Search instead for 
Did you mean: 

Need help on IDOC segment creation

Former Member
0 Kudos

Hi friends,

we have a requirement to create only 1 segment, even if the condition is true more than once.

even if createif receives 2 true cases, it should only create 1 segment.

if there is true once , as input to createif, then create 1 segment,

even if there are more than 1 true cases.

pls suggest.

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi,

Please use a loop condition as only once the segment to execute.

For Ex: like a do.. While Loop. using this we can say execute loop only once, even condition is false also.

May this answer will help.

Former Member
0 Kudos

Hi Santosh,

If you have to create a target segment once always even if a condition is false then map it with constant instead of applying any logic.

Regards,

Ankit

Former Member
0 Kudos

Source field -> Your condition you are applying -> create if -> remove context -> sort (descending) -> collapse context -> Target field.

MichalKrawczyk
Active Contributor
0 Kudos

hi,

you can write a simple UDF (queue context)

1. loop by all items

2. check condition = true in a loop and assign a variable to X if so

3. after the loop check if variable  = X and if so return one value

Regards,

Michal Krawczyk

former_member184681
Active Contributor
0 Kudos

Hi Santosh,

Simplest solution, assuming that you are using a custom-developed target structure: set the node minOccurs = 0 or 1, and maxOccurs = 1. If this is not possible (for instance, you are using an IDoc definition imported from some ECC system), then use the following logic in your mapping:

Adjustments to make:

  • use your own source field instead of E1EDP01 and own target node instead of Item.
  • Add an ifWithoutElse function between source field and "count" function, to test the required condition.
  • You might also have to set the context of the source field to the root, to have it working fine.

Hope this helps,
Greg

EDIT: This is somehow equivalent to the solution given by Michal.