on 02-11-2011 11:21 AM
Hi,
I have created attachment using ABAP proxy. But during runtime I want to get Content ID of the attachment in Java mapping. Please advice on this
Thanks,
Dinesh
Hi Dinesh Babu,
Try this Java Mapping [Link1|http://help.sap.com/javadocs/pi/SP3/xpi/com/sap/aii/mapping/api/Attachment.html ]
package com.JavaMapping;
import java.util.Collection;
import com.sap.aii.mapping.api.*;
import java.util.Iterator;
public class ContentID_Attachments extends AbstractTransformation {
@Override
public void transform(TransformationInput transformationInput, TransformationOutput transformationOutput) throws StreamTransformationException {
try {
// Get Content ID's
InputAttachments inputAttachments = transformationInput.getInputAttachments();
if (inputAttachments.areAttachmentsAvailable()) {
Collection<String> collectionIDs = inputAttachments.getAllContentIds(true);
for (Iterator<String> it = collectionIDs.iterator(); it.hasNext();) {
String ContentID = it.next();
}
}
//Read input payload and write the same to output payload.
/*InputStream inputstream = transformationInput.getInputPayload().getInputStream();
OutputStream outputstream = transformationOutput.getOutputPayload().getOutputStream();
byte[] b = new byte[inputstream.available()];
inputstream.read(b);
String inputFileContent = new String(b);
outputstream.write(inputFileContent.getBytes());
*/
} catch (Exception e) {
e.printStackTrace();
}
}
}
Regards,
Raghu_Vamsee
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Dineshbabu,
Attachment can be accessed in mapping only if ABAP atack passes the Attachment to Java stack during JCO call for Mappin services during Run time. Make sure you have checked the Box Attachment in Operation mapping in PI 7.1.
Thanks,
Sunil Singh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.