Search
Search

# Total in a Column using Methods for Excel ....

I have created an report that create an Excel using Methods .The problem that i have is that i can't do SUM in a certain column that is the same all the time but in different sheets.

Look my code and give an idea please ....

```  LOOP AT ITAB.

AT FIRST.
PERFORM AUTOFIT.
PERFORM FIRST_SHEET.
PERFORM COL_NAMES.
INDEX = 2.
ENDAT.

AT NEW S2.
PERFORM AUTOFIT.
PERFORM NEXT_SHEET.
PERFORM COL_NAMES.
INDEX = 1 .

ENDAT.

INDEX = INDEX + 1.

CALL METHOD OF SHEET 'Cells' = CELLS EXPORTING #1 = INDEX #2 = 1.
SET PROPERTY OF CELLS 'Value' = ITAB-S2.
FREE OBJECT CELLS.

CALL METHOD OF SHEET 'Cells' = CELLS EXPORTING #1 = INDEX #2 = 2.
SET PROPERTY OF CELLS 'Value' = ITAB-S1.
FREE OBJECT CELLS.

CALL METHOD OF SHEET 'Cells' = CELLS EXPORTING #1 = INDEX #2 = 3.
SET PROPERTY OF CELLS 'Value' = ITAB-S3.
SET PROPERTY OF CELLS 'NumberFormat' = 0.
FREE OBJECT CELLS.

CALL METHOD OF SHEET 'Cells' = CELLS EXPORTING #1 = INDEX #2 = 4.
SET PROPERTY OF CELLS 'Value' = ITAB-S4.
FREE OBJECT CELLS.

CALL METHOD OF SHEET 'Cells' = CELLS EXPORTING #1 = INDEX #2 = 5.
SET PROPERTY OF CELLS 'Value' = ITAB-S5.
FREE OBJECT CELLS.

CALL METHOD OF SHEET 'Cells' = CELLS EXPORTING #1 = INDEX #2 = 6.
SET PROPERTY OF CELLS 'Value' = ITAB-S1_TEXT.
FREE OBJECT CELLS.

CALL METHOD OF SHEET 'Cells' = CELLS EXPORTING #1 = INDEX #2 = 7.
SET PROPERTY OF CELLS 'Value' = ITAB-BTR1.
FREE OBJECT CELLS.

CALL METHOD OF SHEET 'Cells' = CELLS EXPORTING #1 = INDEX #2 = 8.
SET PROPERTY OF CELLS 'Value' = ITAB-BTR2.
FREE OBJECT CELLS.

AT END OF S2.
<b>PERFORM SYNOLO</b>.
ENDAT.

AT LAST.
PERFORM AUTOFIT.
PERFORM SYNOLO.
ENDAT.

ENDLOOP.

ENDFORM.                    "FILL_SHEET

......
......

*&---------------------------------------------------------------------*
*&      Form  SYNOLO
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM SYNOLO .

INDEX = INDEX + 1.

CALL METHOD OF SHEET 'Cells' = H_CELL
EXPORTING
#1 = INDEX
#2 = 7.

SET PROPERTY OF H_CELL 'FormulaR1C1' = '=SUM(R[-7]C:R[-1]C)'.
FREE H_CELL.
INDEX = 1.

*  SET PROPERTY OF H_CELL 'VALUE' = 'SYNOLO'.

ENDFORM.                    " SYNOLO
```

The problem is that in Excel i have "Cirrcular Refference" ...

Points will be rewarded ....

##### Former MemberNovember 07, 2007 at 14:33 PM0 Likes
View more on this topic or