cancel
Showing results for 
Search instead for 
Did you mean: 

[abap2xlsx] Create report using template

former_member210008
Active Participant
0 Kudos

Hi all. I need to create a report using an existing template stored in smw0. Currently I'm using another way (zwww_openform) to do it but it using OLE and cant be done in background. I am trying to adopt abap2xlsx without huge report modification.

I attached sample template(upd: xlsx file can't be attached so I added screenshots). On first worksheet you can see template with [TEXT] elements which will be replaced with report values. The second worksheet contains sample result.

If I will use bind_table method it will overwrite total line in template. I did found any method to insert a line between two so I wrote my own.

Next problem - formulas. If I'll insert a row formulas will be broken.

Example: cell A1 = 3, A2 = 5, A3 = sum(A1:A2).

If I'll insert row between rows 1 and 2 I will have A1 = 3, A2 = empty cell, A3 = 5, A4 = sum(A1:A2).

Partially it can be fixed by small modify of zcl_excel_common=>shift_formula but in can't be done via inheritance.

Any hints/solutions?

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

I started to use this abap2xlsx recently and see that i need inserting rows functionallity too. Could you, plaese, share your solution?

former_member210008
Active Participant
0 Kudos

I didn't complete it as I want, but main idea is:

make copy of worksheet->sheet_content, then read table from end to start until required row will be found or I find that there is no such row.

Append lines and move table back to worksheet->sheet_content.

You cant just insert rows because it's a sorted table so you cant modify key fields.