cancel
Showing results for 
Search instead for 
Did you mean: 

Retrieving Message ID of previous message

shweta_walaskar2
Contributor
0 Kudos

Hi,

I have created 2 Message Mappings and 2 Interface mappings in my scenario.

Hence three messages(one branched message and two child messages) are getting generated.

I need to retrieve msg ID of first child msg in MM of second message:I have used this:

String headerField;

java.util.Map map;

map = container.getTransformationParameters();

String key = "RefToMessageId";

(I have read that ReftomsgID gives msg ID of previous msg)

headerField = (String) map.get(key);

But it gives 0000000000000000000000000000 as msgID.

Can anyone pls help.

Thanks,

Regards,

Shweta

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Shweta !

"RefToMessageId" is the ID of a referenced message that belongs semantically to this message. For example, a response message uses this field to note which request message it belongs to.

I don't think it is for your scenario.

Maybe you need to create an extra field in the branched message with a code (random or based on the message id) and then in each of the child mapping programs, concatenate a "1" at the end or something like this to this value, to know that this is message from message mapping #1 and the same, but with "2" in the mapping program #2...

e.g.

branched message, field "NewIDField", you create a value 012345ABC.

then when it is received by mapping program #1, it concatenates "01" at the end, resulting in "012345ABC-01" and in mapping program #2, it results as "012345ABC-02", then you will easy relate the 3 messages and know exactly which is message source, which is #1 and which is #2.

Regards,

Matias.

ps :please award points if helpful

shweta_walaskar2
Contributor
0 Kudos

Hi Matias,

Thanks a lot for the reply.

However ,I am able to realize this in another way:

I have created a BAPI in XI system:

FUNCTION Z_ZBXI_GET_PRE_MSG_ID.

*"----


""Local Interface:

*" IMPORTING

*" VALUE(I_CURRMSGID) TYPE SXMSMGUID

*" EXPORTING

*" VALUE(E_PREMSGID) TYPE SXMSMGUID

*"----


DATA: lv_currmsgid LIKE SXMSPMAST-MSGGUID,

lv_parentmsgid LIKE SXMSPMAST-PARENTMSG,

lv_premsgid LIKE SXMSPMAST-MSGGUID.

lv_currmsgid = i_currmsgid.

select single PARENTMSG from SXMSPMAST into lv_parentmsgid where MSGGUID = lv_currmsgid.

select single MSGGUID from SXMSPMAST into lv_premsgid where PARENTMSG = lv_parentmsgid and MSGGUID ne lv_currmsgid.

e_premsgid = lv_premsgid.

ENDFUNCTION.

and I am calling this in my MM using RFC lookup.

Thanks again for your help.

Best Regards,

Shweta