Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

adding the fields

Hello Sir,

In the below codings i want total column as sum of the values that are present in pa000 according to actioncode..

i.e., for (01-actioncode(massn) in t529t table , the total number of values present in pa0000 tables according to massn is 30)&----


*& Report ZACTIONGRIDPRACTICE

*&

&----


*&

*&

&----


REPORT ZACTIONGRIDPRACTICE.

*data declarations.....

TYPE-POOLS SLIS.

TABLES : T529T ,PA0000.

data : it_layout TYPE SLIS_LAYOUT_ALV.

DATA : BEGIN OF WA_TABLE,

MASSN TYPE T529T-MASSN,

MNTXT TYPE T529T-MNTXT,

userg type userg,

TOTAL TYPE I ,

begda type begda,

endda type endda,

END OF WA_TABLE,

IT_TABLE LIKE TABLE OF WA_TABLE.

data : begin of wa_1,

massn type PA0000-massn,

end of wa_1,

it_1 like table of wa_1.

DATA : MASSN TYPE N.*parmeters and select-options...selection-screen BEGIN OF BLOCK B WITH FRAME TITLE TEXT-003.select-options : s_date for sy-datum.SELECTION-SCREEN END OF BLOCK B.data : temp type c.

DATA : TOTAL TYPE C.

DATA : IT_FCAT TYPE SLIS_T_FIELDCAT_ALV,

WA_FCAT LIKE LINE OF IT_FCAT.DATA : IT_EVENTS TYPE SLIS_T_EVENT,

WA_EVENTS LIKE LINE OF IT_EVENTS.

DATA : WA_PA000 LIKE PA0000,

LT_PA0000 TYPE TABLE OF PA0000,

LT_PA0000_T typE TABLE OF PA0000 with header line.

DATA : LV_LINES TYPE I.wa_events-form = 'HEADER'.

WA_EVENTS-NAME = 'TOP_OF_PAGE'.

APPEND WA_EVENTS TO IT_EVENTS.

PERFORM HEADER.*DESCRIBE TABLE it_1 lines MASSN.

SELECT MASSN MNTXT INTO TABLE IT_table FROM T529T where SPRSL EQ 'E' .

SELECT massn FROM PA0000 INTO TABLE LT_PA0000 WHERE BEGDA GT S_DATE AND ENDDA LT S_DATE. LOOP AT IT_TABLE INTO WA_TABLE. READ TABLE lt_pa0000 INTO LT_PA0000_T WITH KEY MASSN = wa_TABLE-MASSN BINARY SEARCH.

DESCRIBE TABLE LT_PA0000_t LINES LV_LINES.

MOVE LV_LINES to wa_TABLE-TOTAL.

MODIFY IT_TABLE FROM WA_TABLE. REFRESH : LT_PA0000_t.

CLEAR : LV_LINES.

ENDLOOP. PERFORM FCAT USING '1' 'MASSN' 'ACTIONCODE'.

PERFORM FCAT USING '2' 'MNTXT' 'ACTION TYPE'.

PERFORM fcat USING '3' 'TOTAL' 'TOTAL'.CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = SY-CPROG

  • I_CALLBACK_USER_COMMAND = ' '

I_GRID_TITLE = 'REPORT'

IS_LAYOUT = IT_LAYOUT

IT_FIELDCAT = IT_FCAT

I_SAVE = 'X'

IT_EVENTS = IT_EVENTS

TABLES

T_OUTTAB = IT_TABLE.&----


*& Form FCAT

&----


FORM FCAT USING FP_COL_POS

FP_FIELDNAME

FP_SELTEXT_M.

WA_FCAT-COL_POS = FP_COL_POS.

WA_FCAT-FIELDNAME = FP_FIELDNAME.

wa_fcat-seltext_m = fp_seltext_m.

APPEND WA_FCAT TO IT_FCAT.

ENDFORM.

&----


*& Form HEADER

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM HEADER .

DATA : IT_HEADER TYPE SLIS_T_LISTHEADER,

WA_HEADER LIKE LINE OF it_header.

WA_HEADER-TYP = 'H'.

WA_HEADER-INFO = 'ACTION TYPE REPORT'.

APPEND WA_HEADER TO IT_HEADER.

wa_header-typ = 'S'.

wa_header-key = Text-022. CONCATENATE s_date-low+6(2) '.'

s_date-low+4(2) '.'

s_date-low(4)

temp

'. TO .'

s_date-high+6(2) '.'

s_date-high+4(2) '.'

s_date-high(4)

INTO wa_header-info SEPARATED BY space.

APPEND wa_header TO it_header.

CLEAR wa_header.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

IT_LIST_COMMENTARY = IT_HEADER

I_LOGO = 'HRRU_51050061'.

  • I_END_OF_LIST_GRID =

  • I_ALV_FORM = .ENDFORM. " HEADER

Tags:
Former Member
Not what you were looking for? View more on this topic or Ask a question