Skip to Content

issue with file name

Hi All,

I have a reqirement, where i am doing a passthru scenario from File(sFTP) to Mail, the info i am getting in the file is load data.

so the filename and information in the file may changes everytime,

The requirement here is, what ever the file name i am getting from File that same name i have to send it to the Mail attachment name..

i have checked the ASMA tab, but no luck, any sugessions??

Regards,

Janardhan

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

6 Answers

  • avatar image
    Former Member
    Oct 27, 2016 at 01:55 PM
    Add comment
    10|10000 characters needed characters exceeded

  • Oct 28, 2016 at 10:32 AM

    Hi Praveen,

    Thanks for your Blog, But my case here is a Pass thru scenario, I am not using any mapping in the repository.

    -> And yes i am using option "Keep attachments" for to get the files in the mail attachments. But these attachments were coming with name "untitled" every time, but I have to name them as per my sender file name dynamically. Please suggest.

    Thanks,

    Janrdhan

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 28, 2016 at 10:53 AM

    Hi Janardhan,

    You have to use either java mapping or custom adapter module for this because you need to set Content-Disposition either in java mapping or adapter module.

    Regards,

    Praveen.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 28, 2016 at 12:05 PM

    Hi Janardhan,

    Use below java mapping.

    import org.apache.commons.io.IOUtils;
    import com.sap.aii.mapping.api.AbstractTransformation;
    import com.sap.aii.mapping.api.DynamicConfiguration;
    import com.sap.aii.mapping.api.DynamicConfigurationKey;
    import com.sap.aii.mapping.api.StreamTransformationException;
    import com.sap.aii.mapping.api.TransformationInput;
    import com.sap.aii.mapping.api.TransformationOutput;
    public class SetContentDispositionJavaMap extends AbstractTransformation {
    @Override
    public void transform(TransformationInput transformationInput, TransformationOutput transformationOutput)
    			throws StreamTransformationException {
    	try {
    		DynamicConfiguration dynConfig = transformationInput.getDynamicConfiguration();
    		dynConfig.put(DynamicConfigurationKey.create("http://sap.com/xi/XI/System/Mail", "XHeaderName1"),
    				"attachment; filename="
    						+ dynConfig.get(DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File", "FileName")));
    		IOUtils.copy(transformationInput.getInputPayload().getInputStream(), transformationOutput.getOutputPayload()
    				.getOutputStream());
    		} catch (Exception e) {
    		throw new StreamTransformationException(e.getMessage());
    		}
    	}
    }	

    I am using IOUtils class in the java mapping so you need to import this as imported archive in common software component then create dependency for the software component which this java mapping contains, this step i shown in below blog.

    Archive File to Multiple Folders When Pickup from Multiple Folders

    Receiver Mail Module Configuration:

    Email which i received:

    Regards,

    Praveen.

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 28, 2016 at 12:28 PM

    Thanks for your prompt response Praveen, I will try these approaches and get back :-)

    Regards,

    Janardhan

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 07, 2016 at 01:48 PM

    HI Janardhan,

    I am facing same issue in my scenario. Could you please confirm is above method is resolved your issue.

    because with the above approach I am receiving below error.

    please suggest.

    Error:

    Message processing failed. Cause: com.sap.engine.services.jndi.persistent.exceptions720.NameNotFoundException: Path to object does not exist. First missing component is [Custom_AF_Modules], the whole lookup name is [localejbs/Custom_AF_Modules/DynamicAttributeChangeBean].\

    Regards,

    Raj.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      hi Praveen,

      Thanx for your reply.

      can you confirm who will deploy this module and where I can find this( path/link)

      Regards,

      Raj