Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Mapping logic required-UDF

Hi,

My sender structure is as follows

<zaction>(1:1)

--Trans

<Zcode>(0:999)

--Code

--Id

My target field is

<code>(0:999)

--ID

My requirement is

if code= CE,CB,CH,CJ,CI,CO then don't create target field ID.

else

if code=AF and Trans=01 then ID=axv0001

or

if code=AF and Trans=02 then ID=axv0002

if none of the above conditions matches pass ID received from sender.

I am confused at using context type UDF. As suppress result is completely supressing the target field. it's not looking into the rest of logic. Can you provide me an appropraite UDF for this logic please.

TIA,

Mahesh

Former Member
replied

Hello,

You can use this context type UDF:

Arguments: inTrans
inCode
inID

for(int a=0;a<inCode.length;a++){
	if(inCode[a].equals("CE")|inCode[a].equals("CB")|inCode[a].equals("CH")|inCode[a].equals("CJ")|inCode[a].equals("CI")|inCode[a].equals("CO")){
		result.addSuppress();
	}
	else if(inCode[a].equals("AF")&inTrans[0].equals("01")){
		result.addValue("axv0001");
	}
	else if(inCode[a].equals("AF")&inTrans[0].equals("02")){
		result.addValue("axv0002");
	}
	else{
		result.addValue(inID[a]);
	}
}

Logic is like this:

For code

Trans -> removeContext -> \
Code --> removeContext -> UDF -> code
ID ----> removeContext -> /

For ID

Trans -> removeContext -> \
Code --> removeContext -> UDF -> splitByValue:eachValue -> ID
ID -----> removeContext -> /

Hope this helps,

Mark

Edited by: Mark Dihiansan on Nov 9, 2011 3:47 AM

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question