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: 

Unable to get the standrad tool bar in the ALV grid..

Former Member
0 Kudos
84

Hi All,

i have devveloed a report, but i am unable to get the standard tool bar with optins like sort sum etc...in my ALV. please check the below code and let me know why its not happening.. More over i am addding two custom buttons in the toolbar. you can check the below code.

----


FORM FM_DISP_REPORT .

*-Sub Routine to fill color data

perform FM_FILL_COLOR.

*-Sub Routine to build feild catalog

perform FM_FILL_CATALOG.

*-Sub Routine To Write Report

perform FM_BUILD_REPORT.

ENDFORM. " FM_DISP_REPORT

&----


*& Form FM_FILL_CATALOG

&----


  • text

----


FORM FM_FILL_CATALOG .

IT_LAYOUT-COLWIDTH_OPTIMIZE = C_X.

IT_LAYOUT-INFO_FIELDNAME = 'COLOR_LINE'.

WA_FCAT-COL_POS = 0.

WA_FCAT-FIELDNAME = 'KLVAR'.

WA_FCAT-TABNAME = 'IT_KKPA'.

WA_FCAT-SELTEXT_L = 'Costing Variant'(H01).

WA_FCAT-OUTPUTLEN = 4.

APPEND WA_FCAT TO IT_FCAT.

CLEAR WA_FCAT.

WA_FCAT-COL_POS = 1.

WA_FCAT-FIELDNAME = 'MATNR'.

WA_FCAT-TABNAME = 'IT_KEPA'.

WA_FCAT-SELTEXT_L = 'Material Number'(H02).

WA_FCAT-OUTPUTLEN = 18.

APPEND WA_FCAT TO IT_FCAT.

CLEAR WA_FCAT.

WA_FCAT-COL_POS = 2.

WA_FCAT-FIELDNAME = 'WERKS'.

WA_FCAT-TABNAME = 'IT_KKPA'.

WA_FCAT-SELTEXT_L = 'Plant'(H03).

WA_FCAT-OUTPUTLEN = 4.

APPEND WA_FCAT TO IT_FCAT.

CLEAR WA_FCAT.

WA_FCAT-COL_POS = 3.

WA_FCAT-FIELDNAME = 'TVERS'.

WA_FCAT-TABNAME = 'IT_KKPA'.

WA_FCAT-SELTEXT_L = 'Costing Version'(H04).

WA_FCAT-OUTPUTLEN = 2.

APPEND WA_FCAT TO IT_FCAT.

CLEAR WA_FCAT.

WA_FCAT-COL_POS = 4.

WA_FCAT-FIELDNAME = 'STLAN'.

WA_FCAT-TABNAME = 'IT_KKPA'.

WA_FCAT-SELTEXT_L = 'BOM Usage'(H08).

WA_FCAT-OUTPUTLEN = 1.

APPEND WA_FCAT TO IT_FCAT.

CLEAR WA_FCAT.

WA_FCAT-COL_POS = 5.

WA_FCAT-FIELDNAME = 'KADAT'.

WA_FCAT-TABNAME = 'IT_KKPA'.

WA_FCAT-SELTEXT_L = 'Costing From Date'(H05).

WA_FCAT-OUTPUTLEN = 10.

APPEND WA_FCAT TO IT_FCAT.

CLEAR WA_FCAT.

WA_FCAT-COL_POS = 6.

WA_FCAT-FIELDNAME = 'BIDAT'.

WA_FCAT-TABNAME = 'IT_KKPA'.

WA_FCAT-SELTEXT_L = 'Costing To Date'(H06).

WA_FCAT-OUTPUTLEN = 10.

APPEND WA_FCAT TO IT_FCAT.

CLEAR WA_FCAT.

WA_FCAT-COL_POS = 7.

WA_FCAT-FIELDNAME = 'BWDAT'.

WA_FCAT-TABNAME = 'IT_KKPA'.

WA_FCAT-SELTEXT_L = 'Costing Date'(H09).

WA_FCAT-OUTPUTLEN = 10.

APPEND WA_FCAT TO IT_FCAT.

CLEAR WA_FCAT.

WA_FCAT-COL_POS = 8.

WA_FCAT-FIELDNAME = 'MESSAGE'.

WA_FCAT-TABNAME = 'IT_KKPA'.

WA_FCAT-SELTEXT_L = 'Message Text'(H07).

WA_FCAT-OUTPUTLEN = 200.

APPEND WA_FCAT TO IT_FCAT.

CLEAR WA_FCAT.

ENDFORM. " FM_FILL_CATALOG

&----


*& Form FM_BUILD-REPORT

&----


  • text

----


FORM FM_BUILD_REPORT .

SORT IT_KKPA_DATA BY FLAG MATNR WERKS.

*- CALL ABAP LIST VIEWER (ALV)

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = SY-REPID

I_CALLBACK_PF_STATUS_SET = 'FM_GUI_STAT'

I_CALLBACK_USER_COMMAND = 'FM_STAT'

IS_LAYOUT = IT_LAYOUT

IT_FIELDCAT = IT_FCAT

TABLES

T_OUTTAB = IT_KKPA_DATA.

ENDFORM. " FM_BUILD_REPORT

&----


*& Form FM_GUI_STAT

&----


  • text

----


FORM FM_GUI_STAT USING RT_EXTAB TYPE SLIS_T_EXTAB.

SET PF-STATUS 'STATUS_ALV1'.

ENDFORM. "FM_GUI_STAT

&----


*& Form FM_STAT

&----


  • text

----


FORM FM_STAT USING R_UCOMM LIKE SY-UCOMM RS_SELFIELD TYPE SLIS_SELFIELD.

CASE R_UCOMM.

WHEN '&EXF'.

V_EXE_FLAG = C_X.

EXPORT V_EXE_FLAG TO MEMORY ID 'V_EXE_FLAG'.

SUBMIT ZCOCOI004_COSTEST_BDC AND RETURN.

PERFORM FM_SUB_FOREGROUND.

WHEN '&EXB'.

V_EXE_FLAG = C_Y.

EXPORT V_EXE_FLAG TO MEMORY ID 'V_EXE_FLAG'.

SUBMIT ZCOCOI004_COSTEST_BDC AND RETURN.

ENDCASE.

ENDFORM. "FM_STAT

-


please check and let me know the propable reason for not geting standard tool bar with optins like sort sum etc...

Many Thanks,

Raghu.

2 REPLIES 2

Former Member
0 Kudos
52

Hi,

looking at the code below there seems to be no probs, one can only make the issue out after seeing the customised pf-status. in anycase i will explain how it works

copy standard pf-status to zpf-status.

modify it by adding or removing as per requirement.

then call that pf-status in the alv fm and also set pf-status in a form(this u have already done).

so its only about copying the standard and modifying it.

tc

saji

Former Member
0 Kudos
52

Hi Raghu,

try

SET PF-STATUS 'STATUS_ALV1' EXCLUDING rt_extab.

Also make sure that to use a self-defined user interface (for example, in order to provide additional list functions or use existing functions), it is recommend that you copy standard status STANDARD from function group SALV and modify it accordingly. ALV standard function codes always start with '&'.