Skip to Content
0

UDF to get only the values from the input message type/xml based on filed fixed length

Apr 17, 2017 at 03:16 AM

99

avatar image

We have requirement to post the output as string concatenating the input parameters(240) from the messagetype/node..we are using HTTP receiver adapter .

Please help us to define the UDF

Example;

MT_Account/Customerdetails

match="AccountNumber"> <xsl:value-of select="substring(concat(., ' '), 1, 9)"

match="DOB"> <xsl:value-of select="substring(concat(translate(., '/', ''), ' '), 1, 8)

match="LastName"> <xsl:value-of select="substring(concat(., ' '), 1, 16)

Expected output = 3254678 02041986STALIN

Thanks,

RaviTeja M

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Manoj K Apr 17, 2017 at 10:50 AM
0

Ravi,

Would you mind sharing a sample input file and expected output for the same ?

Br,

Manoj

Share
10 |10000 characters needed characters left characters exceeded
Evgeniy Kolmakov Apr 17, 2017 at 11:52 AM
0

Hi RaviTeja!

If you need to implement mentioned functionality using UDF in graphical mapping you can use approach like this:

https://archive.sap.com/discussions/thread/3955709

Regards, Evgeniy.

Show 3 Share
10 |10000 characters needed characters left characters exceeded

Thanks Evgeniy,

if the value populating in the parameter is only 4 or empty characters and maxi length is 15 then remaining length of the parameter value should be fill with spaces.

example:

LastName max length=15

LastName='MAXWELL '

Regards,

RaviTeja M

0

Need to check each every parameter length in the input xml strcture(more than 240) and if the parameter value is empty or less than the max length..then need to fill with spaces. The output should be concatenate as a st

Input xml

MT_Customer

<Details>

<AccountNumber>234123</AccountNumber>

<DOB>120219</DOB>

<LastName>Maxwell</LastName>

</Details>

</MT_Customer>

UDF

if param=AccountNumber

{

for(int i=AccountNumber.length();i<10;i++)

{

param=AccountNumber+" ";

}

return param and concatenate to param;

}

if param=DOB

{

for(int i=DOB.length();i<8;i++)

{

param=DOB+" ";

}

return param and concatenate to param;

}

if param=LastName

{

for(int i=LastName.length();i<15;i++)

{

param=LastName+" ";

}

return param and concatenate to param;

}

Expected Output:

'167423 0224198 MAXWELL '

0

Hi RaviTeja!

I gave you an example of similar logic implementation using java code. Further you can modify and extend it according to your requirements.

For example, if you need to check field lengths, you could use Map object containing collection of field names as keys and its lengths as values. While iterating the NodeList you check current element name against its length in Map and adjust it accordingly.

Regards, Evgeniy.

0
Ravi M Apr 21, 2017 at 05:01 AM
0

Thanks Evgenly - we did by using the standard graphical mapping and xsl code....scenario is working fine....

- http://www.w3.org/1999/XSL/Transform" version="1.0"> - Unnormalized: " " Normalized: " "

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hi RaviTeja!

Glad to hear. Wouldn't you mind to close the thread by setting correct answer?

Regards, Evgeniy.

0