on 05-22-2015 12:27 PM
Hello Experts,
Our requirement is to fetch the PDF document from SAP ERP into C4C as PDF attachment in Embed Component. We have referred this document on SCN to create the Web Service in ERP to convert the print spool into PDF on ERP and get the data into XSTRING format.
On C4C we have consumed the ERP Web Service into Custom BO and we are getting successful ping test as well as get the response with the XSTRING format. Now I want to know how will I create the PDF from this XSTRING. Below is my BO definition.
businessobject mycustomBO (
element data1 : LANGUAGEINDEPENDENT_MEDIUM_Text;
element data2 : LANGUAGEINDEPENDENT_MEDIUM_Text;
element data3 : LANGUAGEINDEPENDENT_MEDIUM_Text;
element CFlag : Indicator;
[DependentObject(AttachmentFolder)] node Attachment;
}
Kindly help me understand what need to done to achieve this requirement.
Thanks in Advance.
Regards,
Chandan
Hello Experts,
I am still stuck to understand how this can be achieved.
Any suggestions?
Regards,
Chandan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Chandan,
At the top you mention a blog in which it is described how to fetch the spool.
This includes writing a function module (which is not possible in SDK.)
Question: Can this function module return the PDF as string or Base64?
This would it make easier to build up the PDF in the AttachmentDocument.
Bye,
Horst
Hello Horst,
I have built the FM similar to that mentioned in the blog in our SAP ECC system. This is now returning us XSTRING format. (I am getting this XSTRING format Output from SPOOL generated in ECC.)
I am now trying to understand how this XSTRING can be converted into the PDF in the attachment using Cloud SDK.
Thanks,
Chandan
Hi Chandan
After consuming you are getting data in XSTRING format if possible first convert returning data into String then parse string to read your required fields elements and pass those value to our BO elements Once you are able to create BO instances as per PDF document then you can create a Form template on BO.
following the below link
http://scn.sap.com/thread/3627237
Thanks
Sunil
Hello Sunil,
Now I am getting not only XSTRING but also Base64 string format from ECC. I have changed my code to get the PDF from this base64 now. It is as below.
var ATTACHMENT_TYPE_DOCUMENT : DocumentTypeCode;
var documentName : LANGUAGEINDEPENDENT_Name;
var documentAlternativeName : LANGUAGEINDEPENDENT_Name;
var DocDesc : Description;
var DocBInary : BinaryObject.content;
ATTACHMENT_TYPE_DOCUMENT.content = "10001";
documentName = "ECCorder.pdf";
documentAlternativeName = "";
var scenario = "SalesOrderPDFScenario";
var requeecc : SalesOrder_WS.ZknkSalesOrder.Request;
var respons : SalesOrder_WS.ZknkSalesOrder.Response;
var SorderTable : SalesOrder_WS.ZknkSalesOrder.Request.SalesOrders.item;
requeecc.SalesOrders.item.Add(SorderTable);
requeecc.CustomerNumber = "";
requeecc.ISpool = "19855";
respons = SalesOrder_WS.ZknkSalesOrder(requeecc,"",scenario);
DocBInary = Binary.ParseFromString(respons.OB64string);
this.Pdfcontent.content = DocBInary;
this.Pdfcontent.mimeCode = "application/pdf";
//this.Pdfcontent.fileName = documentName;
//DocBInary.content = respons.OB64string;
this.Attachment.CreateFile(ATTACHMENT_TYPE_DOCUMENT, documentName, documentAlternativeName, DocDesc, this.Pdfcontent);
Yet I am not able to see any PDF getting generated under attachments. Kindly suggest if I can somehow rectify this to get the PDF from Base64.
Regards,
Chandan
Do you have a binary object right?
put directly an xstring in the binaryobject.content and then create the attachment.
For me it worked
foreach (var act in qryact_Result.Where(n => n.op_id == this.op_id)){
if (!act.AttachmentFolder.IsSet()){
AttFld = act.AttachmentFolder.Create();
}else{
AttFld = act.AttachmentFolder;
}
foreach (var attachment in this.AttachmentsList){
docName = attachment.name;
doctype.content = "10001";
binar = attachment.binaryObject;
AttFld.CreateFile(doctype, docName, docAltName, docDesc, binar);
}
break;
}
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.