cancel
Showing results for 
Search instead for 
Did you mean: 

Comined ABAP <> Webdynpro Adobe Form

Former Member
0 Kudos

Hi,

we're actually investigation the possibility to print out sales representative data

from ECC to Adobe Forms. This works realy fine. The Idea is to send the pdf's to

the sales representative which will fill out the forms offline and upload the pdf's via

Webdynpro to the ECC-System back again.

The question is now, that we do not get the pdf data back in the webdynpro. I was

using a howto from sdn to get the upload of the pdf done and the pdf is shown to

the user for review and then click on the send button. so far so good - the data will

be send, but i don't know how to handle the data then.

Has anyone of you an idea??

Thanks for every hint,

Mike

PS: ECC 6.0

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Mike,

Well, there's some WD Java to develop: when your data are mapped in the context of your application, you have to send them to an SAP system. For this, use the RFC model, explained in the https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/webcontent/uuid/28113de9-0601-0010-71a3-c8780... [original link is broken] [original link is broken].

Regards,

Francois

Answers (1)

Answers (1)

Former Member
0 Kudos

answered by my own.

Former Member
0 Kudos

Hi Mike,

Please detail the solution, you have found, so that it will be helpfull for all...

Kindly post it.

Thanks and Regards,]

Anto.

Former Member
0 Kudos

Hi @ll,

sorry, i forgot to mention the solution.

The problem exactly was that I didn't know exactly the structure of the adobe

document and had to update the data in the ECC-System, but I found the

following sdn thread and and could have a look at the adobe structure

and did some xml-processing to get the data.

The process goes on as follows:

1. a new contact is being created in transaction VC01N

2. a adobe interactive form is being send to the sales representative

3. the sales p. filles out the form and uploads it to a webdynpro app

4. the wd-app updates the contact in VC01n

here is the code (maybe not the smatest code, but it works g😞


public void onActionFormSubmit(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
  {
    //@@begin onActionFormSubmit(ServerEvent)
    
    String xmlData = null;
	try{
		byte[] filebytearray = wdContext.currentContextElement().getPDFObject();
		ByteArrayOutputStream out = new ByteArrayOutputStream();
		IOUtil.write(new ByteArrayInputStream(filebytearray), out);
		IWDPDFObject pdfObject = WDPDFObjectFactory.getPDFObject();
		pdfObject.setPDF(out);
		InputStream in = pdfObject.getData();
		if (in == null) {
			xmlData = "<empty>";
			}
 		else{
			java.io.DataInputStream din = new java.io.DataInputStream(in);
			StringBuffer sb = new StringBuffer();
			String line = null;
			while((line=din.readLine()) != null){
				sb.append(line+"n");
			}
			xmlData = sb.toString();
			//for debugging only (to see the xml structure before): wdContext.currentVBKAVBElement().setINCLUDETEXT(xmlData);
 		}
  	}
  	catch( Exception ex ){}
  	try{
  		
  		
		DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
		DocumentBuilder documentBuilder = factory.newDocumentBuilder();
		Document doc = documentBuilder.parse(new InputSource(new StringReader(xmlData)));
		
		NodeList tmpNodeList = doc.getElementsByTagName("VBELN");
		Node tmpTextNode = tmpNodeList.item(0);
		Text tmpText = (Text) tmpTextNode.getFirstChild();
		wdContext.currentVBKAVBElement().setVBELN(tmpText.getNodeValue());

		
		NodeList tmpNodeList2 = doc.getElementsByTagName("KTABG");
		Node tmpTextNode2 = tmpNodeList2.item(0);
		Text tmpText2 = (Text) tmpTextNode2.getFirstChild();
		wdContext.currentVBKAVBElement().setKTABG(tmpText2.getNodeValue());

		tmpNodeList = doc.getElementsByTagName("KTAEN");
		tmpTextNode = tmpNodeList.item(0);
		tmpText = (Text) tmpTextNode.getFirstChild();
		wdContext.currentVBKAVBElement().setKTAEN(tmpText.getNodeValue());

		tmpNodeList = doc.getElementsByTagName("KTABT");
		tmpTextNode = tmpNodeList.item(0);
		tmpText = (Text) tmpTextNode.getFirstChild();
		wdContext.currentVBKAVBElement().setKTABT(tmpText.getNodeValue());

		tmpNodeList = doc.getElementsByTagName("KTAET");
		tmpTextNode = tmpNodeList.item(0);
		tmpText = (Text) tmpTextNode.getFirstChild();
		wdContext.currentVBKAVBElement().setKTAET(tmpText.getNodeValue());

		tmpNodeList = doc.getElementsByTagName("KTEXT");
		tmpTextNode = tmpNodeList.item(0);
		tmpText = (Text) tmpTextNode.getFirstChild();
		wdContext.currentVBKAVBElement().setKTEXT(tmpText.getNodeValue());
		
		tmpNodeList = doc.getElementsByTagName("KUNNR");
		tmpTextNode = tmpNodeList.item(0);
		tmpText = (Text) tmpTextNode.getFirstChild();
		wdContext.currentVBKAVBElement().setKUNNR(tmpText.getNodeValue());
} catch( Exception ex2){}
}

Mike

Message was edited by: Mike

Mike Fröhlich