Skip to Content
1
Oct 28 at 06:25 AM

Opening word document from a template with fields that can be populated and retrieved

66 Views

Hi,

We have a requirement where the user should be able to open a word document from an SAP transaction with a pre defined template. Some fields should be pre-populated from the ABAP program and the others the user will enter. Now I have an issue with defining these fields in the template and retrieving the data back to the ABAP program.

Below are the steps that I followed.

  • Uploaded a template word document with placeholders (eg: soldto_num) in the BDN using tcode OAER.
  • I have used I_OI_DOCUMENT_PROXY for office integration and CL_BDS_DOCUMENT_SET for retrieving the template. (SAP demo programs SAPRDEMO_DOI_BDS and SAPRDEMO_FORM_INTERFACE used as reference)
  • Now using the word processor interface I am able replace the text 'soldto_num' with the value in lv_soldto.
  • The word document is successfully displayed in place with the template and runtime values from the program.

The problem is when I try to retrieve data from the document to the program. Need help in understanding how we define fields in the template and read it in our programs. I have tried using the form interface (I_OI_FORM) and link server (I_OI_LINK_SERVER) but in either case I am not able to define the fields and transfer data.

Any pointers on this will be really helpful.

Thanks in Advance.

Rincy