cancel
Showing results for 
Search instead for 
Did you mean: 

DynamicConfiguration - Send Email

Former Member
0 Kudos

Hi guys,

There is a interface that send .xml by email . I use de adatper type "mail".

I created message mapping and this mapping there is a rfc that search the emails adress in ECC. In this same mapping I created UDF that get Dynamic email by java code.

Follow code.
---

Public String getTo(Container  container ) throws StremTransformationException{

GlobalContainer gc = container.getGlobalContainer();
AbstractTrace trace = container.getTrace();

DynamicConfiguration dc = (DynamicConfiguration) container
   .getTransformationParameters()
   .get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

String ret = (String)   dc.get(DynamicConfigurationKey.create("http://sap.com/xi/XI/System/Mail", "THeaderBCC"));

trace.addInfo("BCC  = " + ret);

if ((ret==null) || (ret!=null && ret.equals(""))) {
return "";
}else
return  ret;


The interface it´s working and sending emails.

BUT

If the all email are very large (many caracters), the udf not return the emails!

Anyone have any ideas whats happening? or how can I do to fix that problem?

Thanks a lot.

Felipe Martin

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member184720
Active Contributor
0 Kudos

Hi Felipe,

It's not clear. Mail sender or Mail receiver?

If you are trying to read the mail sender, then you don't have an option to read the BCC value

For possible attributes :

Refer to adapter specific attributes @ Configuring the Sender Mail Adapter (SAP Library - SAP NetWeaver Exchange Infrastructure)

If you have mail receiver adapter and would like set the BCC ID Dynamically then check the below UDF,

DynamicConfiguration configuration = (DynamicConfiguration) container.getTransformationParameters().getStreamTransformationConstants.DYNAMIC_CONFIGURATION);

DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/Mail", "THeaderBCC");

configuration.put(key, "<<Here the email ID>>");

return "";

Former Member
0 Kudos

Hi Hareesh

The adapter email is Receiver.

My Udf is working, but when have many caracteres (large emails) is the problem.

transaction SXMB_MONI returned this erro:

<SAP:AdditionalText>com.sap.engine.interfaces.messaging.api.exception.MessagingException: java.lang.StringIndexOutOfBoundsException: String index out of range: 0</SAP:AdditionalText>

the payload not return the emails

  <From>nfec_fiscal@gudy.com</From>
  <To />
  <Content_Type>application/xml; name=".xml"</Content_Type>
  <Content_Description>NFe.xml</Content_Description>
  <Content_Disposition>NFe.xml</Content_Disposition>

This your code is a complement of mine or is a new code?

I belieave that my problem will be in some class!

Regards

Felipe Martin

former_member184720
Active Contributor
0 Kudos

Hi Felipe - If i understand your UDF, you are trying to read the value of the dynamic field "THeaderBCC"

String ret = (String)   dc.get(DynamicConfigurationKey.create("http://sap.com/xi/XI/System/Mail", "THeaderBCC"));

But I don't think there is such dynamic attribute in the sender mail adapter. so i don't think your error is because of this UDF.

What is your sender adapter? can you explain the requirement and the scenario?

However if your requirement is to set a dynamic email ID in BCC, then you have to use the UDF which i provided and supply the email ID to it.

Former Member
0 Kudos

Hello,

>>com.sap.engine.interfaces.messaging.api.exception.MessagingException: java.lang.StringIndexOutOfBoundsException: String index out of range: 0

Where exactly u are getting this message in RFC lookup in case of large mails?

May be disable ur UDF and check if ur mapping is getting executed or not for same set of message? In addition to that, what's the input to ur RFC lookup, since u are not getting email address via RFC lookup, so IMO problem lies there.

Thanks

Amit Srivastava

Former Member
0 Kudos


Hello Amit Srivastava

I tested the rfc lookup and return all email!

The problem is in the UDF, I removed the udf and created a constant with all email and work.

The same UDF works when I test some emails, for example.

( felipe@felipe.com, felipe@felipe.com,felipe@felipe.com,felipe@felipe.com,felipe@felipe.com,felipe@felipe.com,felipe@fel...,   )

if I put much more emails, the UDF return null.

My scenario is:

I need send invoice (xml atached) by email or webservice or ftp.

My reciever determination there is a mapping, in this mapping I created the rfc lookup for search what provider I need to send.

The rfc search the provider if the provider is email, the rfc search all email.

In interface determinatin, there is a mapping , and this mapping has a UDF for getTo(search dynamic email).

Regards

Felipe