cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to get the sender side interface name using custom adapter module

avinash_ayanala
Participant
0 Kudos

Hello SAP Guru's,

I want to know is it possible to retrieve the sender side interface name using the custom adapter module if it is possible please tell me how and through which api.

Any help is very much appreciable thank you very much.

Regards,

Avinash

Accepted Solutions (1)

Accepted Solutions (1)

avinash_ayanala
Participant
0 Kudos

Hi Team,

Thanks for your support i have solved the problem by using the module context as the condition i have used the custom module on both the communication channels  and appended the generated file using a condition.

String Sender = (String) moduleContext.getContextData("sender");

if(Sender!=null)

{

            Action act = msg.getAction();

            String interface_Name = act.getName();

                  FileWriter fw = new FileWriter("/tmp/pitest/AuditFiles/AuditFile"+MSGID+".txt");

                  fw.write("outbound_interface_name:-->"+interface_Name+"\n");

                  fw.close();   

                 

        }

        else{

        Action act = msg.getAction();

        String interface_Name = act.getName();

              FileWriter fw = new FileWriter("/tmp/pitest/AuditFiles/AuditFile"+MSGID+".txt",true);

              fw.write("inbound_Interface Name:-->"+interface_Name+"\n"+"Message ID:-->"+MSGID+"\n"+"Message Direction:-->"+MSGDIR+"\n"+"Message Key:-->"+MSG_KEY+"\n"+"Business system sender:-->"+BS_sender+"\n"+"Business system receiver:-->"+BS_Receiver+"\n"+"SendTime:-->"+SendtTime+"\n"+"Receive time:-->"+RecivedTime);

              fw.close();             

        }

Regards,

Avinash.

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi

Write a module in the sender adapter and use this piece of code

Message mes = null;

mes = (Message) inputModuleData.getPrincipalData();

String iname = mes.getAction().getName();

avinash_ayanala
Participant
0 Kudos

Hi,

I am able to access the sender side interface using that code but i want the both the interface names in the same output file of receiver side custom adapter module.

Regards,

Avinash

iaki_vila
Active Contributor
0 Kudos

Hi Avinash,

Depending of the adapter, you can access to PI variables, like sender interface, with ASMA and variable substitution

For example, for file adapter Defining Variable Substitution for Target Directory/File Name - SAP Library

Regards.

avinash_ayanala
Participant
0 Kudos

Hai Inaki,

Thank's for you suggestion but i want the both the interface names to be accessed from receiver side and store it in an output file of custom module is it possible to do it please give me a solution.

Is there any possibility of accessing the interface name using dynamic configuration bean on sender side channel and access that in receiver side channel please give me some solution.

Regards,

Avinash

Former Member
0 Kudos

Hi Avinash

You can write an UDF in message mapping to read the both sender and receiver interface.

Following is the code

InputHeader inputHeader = container.getInputHeader();


String SI = inputHeader.getInterface() ;

String RI =  inputHeader.getReceiverInterface() ;

former_member181985
Active Contributor
0 Kudos

Hi,

check this: http://help.sap.com/javadocs/pi/SP3/xpi/com/sap/engine/interfaces/messaging/api/Message.html

method: getFromService()


You can also get this info during mapping using standard function

Regards,

Praveen Gujjeti

avinash_ayanala
Participant
0 Kudos

Hi Praveen,

the method getFromService() it gives the business system name and i am able to get the receiver side interface name using getAction and getname but i am not able to access the sender side service interface name.

Regards,

Avinash.

engswee
Active Contributor
0 Kudos

Hi Avinash

Are you using the adapter module on the receiver channel side? If yes, then at this stage of the pipeline, the interface name has been transformed by the Operation Mapping, therefore using getAction().getName(), you will only get the receiver interface.

If you need to access the sender interface, you can try out Inaki's suggestion to store the sender interface name into Dynamic Configuration first (either at sender comm channel or message mapping). Then you can access Dynamic Configuration to retrieve it at the receiver side module.

Rgds

Eng Swee

avinash_ayanala
Participant
0 Kudos

Hai Eng Swee,

I am trying to get the sender  and receiver interface names on single output file and your suggestion is really great but i have no clue how to access the dynamic configuration values of sender side channel on receiver side custom module can you please suggest me some solution.

Regards,

Avinash.