Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Export data to Word template

Former Member
0 Likes
1,209

Hi,

How exactly do I export data to a Word template? I have a custom program in which data is stored in an internal table. I would like to create an option for the user so that a Word template is opened and the fields are filled with the data from SAP.

For example, transaction FBL5N has this option: File->Export->Word Processing.

I would like to have something like that.

Thanks!

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,003

You can use FM - <b>ALV_WORD_EXECUTE_SIMPLE_LIST</b> for doing this.

You need to pass your internal table to this FM alongwith ur ALV fieldcatalog - and you will be able to export your internal table in the same way FBL1N does.

Cheers.

SKC.

Hi,

How exactly do I export data to a Word template? I have a custom program in which data is stored in an internal table. I would like to create an option for the user so that a Word template is opened and the fields are filled with the data from SAP.

For example, transaction FBL5N has this option: File->Export->Word Processing.

I would like to have something like that.

Thanks!

4 REPLIES 4
Read only

Former Member
0 Likes
1,004

You can use FM - <b>ALV_WORD_EXECUTE_SIMPLE_LIST</b> for doing this.

You need to pass your internal table to this FM alongwith ur ALV fieldcatalog - and you will be able to export your internal table in the same way FBL1N does.

Cheers.

SKC.

Read only

0 Likes
1,003

Thanks.

In the end, I use the FM MS_WORD_OLE_FORMLETTER. I think that FM makes it easier to work with templates.

Another question: in the Word template there are checkboxes. Is there a way to check/uncheck these automatically? Depending on whether a value in the internal table is 'X' or not, for example.

Thanks!

Read only

0 Likes
1,003

There is no readymade FM to do that automatically.. for acessing the Form Controls ( like check Boxes,edit boxes, buttons or drop down boxes).

You will have to do that programatically...if u have a look at the FM MS_WORD_OLE_FORMLETTER.. it will give u some idea of doing this... It basically calls the methods of <b>Word.Document</b>. By this object you will be able to access the form objects too ( provided u understand the methods of the Word.Document - u need to some VBA basics.)

Read only

0 Likes
1,003

Thanks again. I think I'll leave the checkboxes for what they are then. Maybe I could just replace them by a simple 'X' in the document.