cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping question

Former Member
0 Kudos

Hi,

is it possible to decide in order to my incoming value if a IDOC segment should be created or not? Because I'm getting scared of trying that

Or is this just possible using Java functions?

Thanks for any help?

Matt

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

you can use the node function <b>exists</b> with a <b>ifwithoutelse</b> condition.

regards

Shravan

Former Member
0 Kudos

Firstly - Thanks for your quick response...

I use Message Mapping (not XLST), and yes I like to decide from incoming value if or if not to create segment.

for example I get to rows in source message (once with jes once with no):

sourcevalue = jes--> if yes --> segement

sourcevalue = no --> if yes --> NO segement

like this... at the moment I try it that way:

field --> RemoveContext --> SplitByValue(value change) --> segement

This works if I need to create just one IDOC - if I get more datasets he always create all of this (special) segements in the first IDOC...

I don't understand that :-(((((((

THANKS

Matt

Former Member
0 Kudos

Hi Matthias,

using equals and ifwithoutelse you can decied wheather to create a target segment or not.

1. use equals function and pass your source value as one of the inputs to equals function a constant 'jes' as the second input.

2. Pass the output of equals function as a input to ifwithoutelse function.The second input for your ifwithoutelse will be your source value itself.

Your target segment will be created only if the sourcevalue is 'jes'.

Refer this link for more information...

http://help.sap.com/saphelp_nw04/helpdata/en/5d/db0e83e8e74202a5bff527055ab7e5/content.htm

Regards

Anand

moorthy
Active Contributor
0 Kudos

HI Matthias,

"This works if I need to create just one IDOC - if I get more datasets he always create all of this (special) segements in the first IDOC... "

Can u elaborate on this ??

If you are mapping with source as Flat XML and Target as deeply nested Idoc structure , then it is very diffcult with Message Mapping. So it is better to go either XSLT or Java Mapping.

Regards,

Moorthy

Former Member
0 Kudos

Hello Moorthy,

thanks for your response! I try to elaborate it:

I have an source like this:

row(1)

- key

- field1

- field..n

row(2)

- key

- field1

- field...n

and so on...

for every change of field KEY I create an IDOC. So If I have just one key (1 key could be in more than one row)

my target looks like this:

IDOC(1)

- Headersegmet

- Segement1

- Segement2(should be the special segment)

- Segement..n

In case of more than 1 key my target looks like this:

IDOC(1)

- Headersegmet

- Segement1

- Segement2(should be the special segment)of IDOC 1

- Segement2(should be the special segment)of IDOC 2

- Segement2(should be the special segment)of IDOC 3

- Segement..n

IDOC(2)

- Headersegmet

- Segement1

- Segement..n

IDOC(3)

- Headersegmet

- Segement1

- Segement..n

all the other segements are correctly in each IDOC - just my special one (with correct data inside) is allways in the first one - scared!!

By the way - where can I find a good tutorial or blog how to use java as mapping programm?

THX

Matt

qMoorthy: I could also provide you some screen shots...

and my XLST (generated by XI) looks like this:

/ACC_DOCUMENT02/IDOC/E1BPACKEC9=SplitByValue(removeContexts(ifWithoutElse(FixValues(/p2:MT_SQL_QUERY_response/StmName_response/row/BEP_ZEILE_KZ=), /p2:MT_SQL_QUERY_response/StmName_response/row/HGB__BK_KEYi=)))=SplitByValue(removeContexts(ifWithoutElse(FixValues(/p2:MT_SQL_QUERY_response/StmName_response/row/BEP_ZEILE_KZ=), /p2:MT_SQL_QUERY_response/StmName_response/row/HGB__BK_KEYi=)))

Message was edited by: Matthias Boettger

Message was edited by: Matthias Boettger

Former Member
0 Kudos

Hi Matthias

Help on your second part, i.e blogs on java mapping,

/people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-i

/people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-ii

/people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-iii

/people/ravikumar.allampallam/blog/2005/06/24/convert-any-flat-file-to-any-idoc-java-mapping

cheers

Sameer

Former Member
0 Kudos

Thx - for the linkx :-)!!

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

I am struggling with this same issue.Using exists and ifwithoutelse will only solve this issue, if the target has a min occurs of "0".

In my case the min occurs is "1", so ifwithoutelse wouldnot create the target node if the condition is not satisfied and my mapping is not activated without correcting this.

So I am forced to use ifwithelse, in which case what value should I pass in the else?

A Space? if I pass a space, it is rewriting the old values with a space in the next iteration.

Hope I made it clear.Please help me with this issue.

Thanks

JD

moorthy
Active Contributor
0 Kudos

Hi John,

If your target segment is mandatory (i.e min occurs is 1 ), then there is no scope for exits condition at all . Because Target segment should populate everytime.

Then what's the purpose of check for existence ?

Regards,

Moorthy

Former Member
0 Kudos

Correct me if I get your question wrong..

Did u mean to use incoming value to decide whether the IDOC segment needs to be created..?

If so, offcourse it can be done , for example in the XSLT mapping we can just check the incoming value using a <xsl:if test=<<Test Condition>>> before creating the IDOC segment.