cancel
Showing results for 
Search instead for 
Did you mean: 

How can we pick Message ID at runtime in message mapping?

Former Member
0 Kudos

Hi Experts,

I am working on a file to file Scenario.

Lets say I have a Field called SEQ_NO at target.

I want to populate it this with Message ID (MONI one) at runtime.

Is it possible? If Yes, How can we do this?

Accepted Solutions (0)

Answers (2)

Answers (2)

prateek
Active Contributor
0 Kudos

Use UDF.

java.util.Map map;

String header;

map = container.getTransformationParameters();

header = (String) map.get(StreamTransformationConstants.MESSAGE_ID);

return header;

Regards,

Prateek

MichalKrawczyk
Active Contributor
0 Kudos

hi,

yes this is possible

have a look at this question

http://mypigenie.com/mapping/4-mapping/49-How-can-access-technical-context-object

you can do in the same way as with INTERFACE_NAMESPACE

for message id

Regards,

Michal Krawczyk

Former Member
0 Kudos

Hi Michel,

I have tried the Code given by you.

I just copied that code inside a UDF. UDF did not have any input parameter and without any Imports as well.

String constant;

java.util.Map map;

map = container.getTransformationParameters();

constant = (String) map.get(StreamTransformationConstants.MESSAGE_ID);

return constant;

Still at the target, I am getting a "null" at SEQ_ID.

MichalKrawczyk
Active Contributor
0 Kudos

hi,

but you're not doing it inside a BPM right?

Regards,

Michal Krawczyk

http://mypigenie.com - XI/PI FAQ

Former Member
0 Kudos

Yes, Ur right, I am not using BPM.

I am doing it inside the Message Mapping only.

I am just Mapping the Target Field called SEQ_NO with the code given by you.

Below is the Output I am getting.

HEADER IN14INELAH INICHNFI01 null 20081215110305

010205000033,VAISHNAVI SALES CORPN,0.00,0.00,350000.00

010205000034,CHAKKA ENTERPRISES,0.00,-641350.47,8649.53

010205000035,SEHGAL TRADING COMPANY,338665.00,-220.00,461115.00

I nstead of "null", I need Message ID on Runtime.

Am I doing it Right, Please reply.

Thanks

MichalKrawczyk
Active Contributor
0 Kudos

hi,

inside your mapping (test tab) there is a tab - parameters

put message id there and check if the code is working in the test mode ok?

Regards,

Michal Krawczyk

http://mypigenie.com - XI/PI FAQ

Former Member
0 Kudos

Do I need to do some setting in ID as well?

Former Member
0 Kudos

Hi,

No It is not working fine.

Inside TEST----


> Parameter Tab< I had input MESSAGE_ID Against MessageId.

After that I run It, Got the error as Below:

17:48:17 Start of test

Runtime exception during processing target field mapping /ns0:MT_BANK_CUST_DET/File_Out/Header/SEQNO. The message is: Exception:[java.lang.StringIndexOutOfBoundsException] in class com.sap.aii.mappingtool.flib3.TextFunctions method substring[, com.sap.aii.mappingtool.tf3.rt.Context@6ec66ec6] com.sap.aii.mappingtool.tf3.MessageMappingException: Runtime exception during processing target field mapping /ns0:MT_BANK_CUST_DET/File_Out/Header/SEQNO. The message is: Exception:[java.lang.StringIndexOutOfBoundsException] in class com.sap.aii.mappingtool.flib3.TextFunctions method substring[, com.sap.aii.mappingtool.tf3.rt.Context@6ec66ec6].

It is possible to get MESSAGE ID which we get in MONI for every message pass throught XI in message mapping itself?

Regards

Pradeep

Former Member
0 Kudos

Now Mapping is running Fine.

After Putting MESSAGE ID in Parameters.

But at the output, Still not getiing any Valur for SEQ_NO

/PARNUM><INTID>INICHNFI01 </INTID><SEQNO></SEQNO><BEGDA>20081215</BEGDA>

MichalKrawczyk
Active Contributor
0 Kudos

hi,

>>It is possible to get MESSAGE ID which we get in MONI for every message pass throught XI in message mapping itself?

yes - it's only not possible if you use a BPM

Regards,

Michal Krawczyk

Former Member
0 Kudos

Hi Michal,

Thanks a lot for the reply.

I am happy that It is possible, as it is my requirement only.

Can u please elaborate the steps to achieve it as, after So many trials I could not get it.

Regards

Pradeep

MichalKrawczyk
Active Contributor
0 Kudos

Hi,

it's as easy as copying the code you have

nothing more, realy

without seeing the system I cannot help any more I believe

as this always works

Regards,

Michal Krawczyk

Former Member
0 Kudos

Thanks a lot Michal.

Althought It is not working in my Scenario (May be because we are using multiple Coustmized things rather than conventional), But your inputs helped me a lot.

I need to search for some other alternative.

Thanks a lot again for the help rendered by you.

Regards

Pradeep