Application Development 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: 

DOI Excel:How do I insert multiple empty lines in the same format as one line

0 Kudos
540

Hi, experts.

As two picture below. I want to insert some empty rows in the same format as row "14", and then I can Insert inner table data to the rows. When I insert the empty rows, other rows like "Rma Discount" and "TOTAL" are down Automatically.

How can I do that using DOI?

pic 1.

pic 2.

1 ACCEPTED SOLUTION

Sandra_Rossi
Active Contributor
434

DOI is limited to simple operations like reading values and formats, writing values and formats, not inserting rows, etc. If you want to do special operations, you need to use direct OLE, either by extracting the OLE "object" used by DOI and executing OLE from ABAP, or by using the Script Collection in DOI which is based on VBScript and the Excel object model, both OLE and VBScript will work with the same methods and properties. In all cases, you know which methods and properties are to be used, by using the Excel macro recorder (and then you'll translate in either ABAP OLE or VBScript).

NB: DOI is slow, limited, can run only in foreground, needs Excel to be installed on user's laptop, prefer using abap2xlsx (community API used for more than 10 years) whenever possible.

4 REPLIES 4

Sandra_Rossi
Active Contributor
435

DOI is limited to simple operations like reading values and formats, writing values and formats, not inserting rows, etc. If you want to do special operations, you need to use direct OLE, either by extracting the OLE "object" used by DOI and executing OLE from ABAP, or by using the Script Collection in DOI which is based on VBScript and the Excel object model, both OLE and VBScript will work with the same methods and properties. In all cases, you know which methods and properties are to be used, by using the Excel macro recorder (and then you'll translate in either ABAP OLE or VBScript).

NB: DOI is slow, limited, can run only in foreground, needs Excel to be installed on user's laptop, prefer using abap2xlsx (community API used for more than 10 years) whenever possible.

0 Kudos
434

Thank you. I will try abap2xlsx

0 Kudos
434

By the way, Can abap2xlsx achieve the above effect?

434

There's no direct feature in abap2xlsx to insert a row by duplicating another row, but you have the Template feature which does it for you:

Best way to generate Microsoft Excel xlsx from template in ABAP | SAP Blogs

It was developed by Anton in a cloned repository, which he later merged into standard abap2xlsx.