Skip to Content

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

TO enable the menu button in ALV Grid Display

Hi Mates,

I have a peculiar problem while doing ALV Grid display for screens.

In the main Screen i have Three coloumns.The 1st coloum will interacted

next screen 101 and 2nd coloum will interacted to screen 102.

Now the problem is in the menu of ALV Grid display,the Total button was enabled for screen

101 and same button is disabled in screen 102.

But the code semms to be fine .

Below i have pasted the code and please have a look and help to come out of this cris.

My Code :

FORM CREATE_ALV_GRID USING R_SCREEN.

DATA: LS_LAYOUT TYPE LVC_S_LAYO,

ITAB_FUNCTIONS TYPE UI_FUNCTIONS. "MHTK903257(+)(add)

CASE R_SCREEN.

*--> SCREEN 9000

WHEN C_SCREEN_9000.

*-- Build the field catalog for the ALV grid.

PERFORM BUILD_FIELD_CATALOG TABLES ITAB_FIELDCAT_9000

USING:

*ref_table|fieldname|coltext|hotspot|inttype|outputlen|lzero|just|color

'ITAB_OVERVIEW' 'WADAT' 'Due date'(004) 'X' 'D' ' ' ' ' ' ' 'C100',

*'ITAB_OVERVIEW' 'HU_UNLOAD' 'Unloaded HU'(005) 'X' 'I' '15' ' ' ' ' 'C500', "MHTK903257(-)

'ITAB_OVERVIEW' 'TOT_TO' 'Total TO'(006) 'X' 'I' ' ' ' ' ' ' 'C30',

  • GMTK901103: REMOVE HOTSPOT ON ESTIMATED TO:

'ITAB_OVERVIEW' 'EST_TO' 'Estim TO'(030) ' ' 'I' ' ' ' ' ' ' 'C500'.

LOOP AT ITAB_INB_LOC WHERE OUTPUT = 'X'.

PERFORM BUILD_FIELD_CATALOG TABLES ITAB_FIELDCAT_9000

USING:

  • ref_table|fieldname|coltext|hotspot|inttype|outputlen|lzero|just|color

'ITAB_OVERVIEW' ITAB_INB_LOC-FIELDNAME

ITAB_INB_LOC-Z_INBND_LOC 'X' '' ' ' ' ' 'R' 'C500'. "MHTK903418

ENDLOOP.

LOOP AT ITAB_STORAGE_TYPE WHERE OUTPUT = 'X'.

PERFORM BUILD_FIELD_CATALOG TABLES ITAB_FIELDCAT_9000

USING:

*ref_table|fieldname|coltext|hotspot|inttype|outputlen|lzero|just|color

'ITAB_OVERVIEW' ITAB_STORAGE_TYPE-FIELDNAME

ITAB_STORAGE_TYPE-LGTYP 'X' 'I' ' ' ' ' 'R' 'C500'.

ENDLOOP.

*-- Create the ALV grid object.

CREATE OBJECT PT_ALV_1000

EXPORTING

I_PARENT = PT_DOCK_1000.

PERFORM EXCLUDE_FUNCTIONS TABLES ITAB_FUNCTIONS "MHTK903257(+)(add)

USING R_SCREEN.

*-- Get the title of the ALV grid.

PERFORM GET_ALV_GRID_TITLE USING C_SCREEN_1000

CHANGING LS_LAYOUT-GRID_TITLE.

*-- Display the ALV grid.

CALL METHOD PT_ALV_1000->SET_TABLE_FOR_FIRST_DISPLAY

EXPORTING

IS_LAYOUT = LS_LAYOUT

IT_TOOLBAR_EXCLUDING = ITAB_FUNCTIONS

CHANGING

IT_OUTTAB = ITAB_OVERVIEW

IT_FIELDCATALOG = ITAB_FIELDCAT_9000.

*--> SCREEN 9100

WHEN C_SCREEN_1100.

*-- Build the field catalog for the ALV grid.

PERFORM BUILD_FIELD_CATALOG TABLES ITAB_FIELDCAT_1100

USING:

*ref_table|fieldname|coltext|hotspot|inttype|outputlen|lzero|just|color

'ITAB_DETIAL' 'WAUHR' 'Due time'(007) ' ' 'T' ' ' 'X' ' ' 'C100',

'ITAB_DETAIL' 'TOT_TO' 'Total TO'(006) 'X' 'I' ' ' ' ' ' ' 'C30',

'ITAB_DETAIL' 'EST_TO' 'Estim TO'(030) ' ' 'I' ' ' ' ' ' ' 'C500'.

CLEAR ITAB_INB_LOC.

LOOP AT ITAB_INB_LOC WHERE SELECTED = 'X'.

CHECK SY-SUBRC EQ 0.

PERFORM BUILD_FIELD_CATALOG TABLES ITAB_FIELDCAT_1100

USING:

  • ref_table|fieldname|coltext|hotspot|inttype|outputlen|lzero|just|color

'ITAB_DETAIL' ITAB_INB_LOC-FIELDNAME

ITAB_INB_LOC-Z_INBND_LOC '' '' ' ' ' ' 'R' 'C500'.

ENDLOOP.

CLEAR: ITAB_STORAGE_TYPE.

LOOP AT ITAB_STORAGE_TYPE WHERE SELECTED = 'X'.

CHECK SY-SUBRC EQ 0.

PERFORM BUILD_FIELD_CATALOG TABLES ITAB_FIELDCAT_1100

USING:

*ref_table|fieldname|coltext|hotspot|inttype|outputlen|lzero|just|color

'ITAB_DETAIL' ITAB_STORAGE_TYPE-FIELDNAME

ITAB_STORAGE_TYPE-LGTYP 'X' 'I' ' ' ' ' 'R' 'C500'.

ENDLOOP.

*-- Create the ALV grid object.

CREATE OBJECT PT_ALV_1100

EXPORTING

I_PARENT = PT_DOCK_1100.

PERFORM EXCLUDE_FUNCTIONS TABLES ITAB_FUNCTIONS "MHTK903257(+)(add)

USING R_SCREEN.

*-- Get the title of the ALV grid.

PERFORM GET_ALV_GRID_TITLE USING C_SCREEN_1100

CHANGING LS_LAYOUT-GRID_TITLE.

*-- Display the ALV grid.

CALL METHOD PT_ALV_1100->SET_TABLE_FOR_FIRST_DISPLAY

EXPORTING

IS_LAYOUT = LS_LAYOUT

IT_TOOLBAR_EXCLUDING = ITAB_FUNCTIONS

CHANGING

IT_OUTTAB = ITAB_DETAIL

IT_FIELDCATALOG = ITAB_FIELDCAT_1100.

  • screen 1300 TO detail.

*--> SCREEN 9300

WHEN C_SCREEN_1300.

*-- Build the field catalog for the ALV grid.

PERFORM BUILD_FIELD_CATALOG TABLES ITAB_FIELDCAT_1300

USING:

*ref_table|fieldname|coltext|hotspot|inttype|outputlen|lzero|just|color

'ITAB_TO2' 'TANUM' 'TO'(020) ' ' 'C' ' ' ' ' ' ' 'C100',

'ITAB_TO2' 'NLPLA' 'Location'(021) ' ' 'C' ' ' ' ' ' ' 'C500',

'ITAB_TO2' 'LETY1' 'SUT'(013) ' ' 'C' ' ' ' ' ' ' 'C500',

'ITAB_TO2' 'MATNR' 'Material'(016) ' ' 'C' ' ' ' ' ' ' 'C500',

'ITAB_TO2' 'NSOLM' 'Quantity'(017) ' ' 'I' ' ' ' ' ' ' 'C500',

'ITAB_TO2' 'NLTYP' 'Storage type'(014) ' ' '' ' ' ' ' ' ' 'C500'. "MHTK903257(-)

*'ITAB_TO2' 'POSNR' 'Line'(015) ' ' 'C' ' ' ' ' ' ' 'C500'. "MHTK903257(-)

*-- Create the ALV grid object.

CREATE OBJECT PT_ALV_1300

EXPORTING

I_PARENT = PT_DOCK_1300.

*-- Exclude the non-applicable functions from the ALV grid.

PERFORM EXCLUDE_FUNCTIONS TABLES ITAB_FUNCTIONS

USING R_SCREEN.

*-- Get the title of the ALV grid.

PERFORM GET_ALV_GRID_TITLE USING C_SCREEN_1300

CHANGING LS_LAYOUT-GRID_TITLE.

SORT ITAB_TO2 BY TANUM VBELN POSNR.

*-- Display the ALV grid.

CALL METHOD PT_ALV_1300->SET_TABLE_FOR_FIRST_DISPLAY

EXPORTING

IS_LAYOUT = LS_LAYOUT

IT_TOOLBAR_EXCLUDING = ITAB_FUNCTIONS

CHANGING

IT_OUTTAB = ITAB_TO2

IT_FIELDCATALOG = ITAB_FIELDCAT_1300.

  • screen 9400 Pre Processing detail.

*--> SCREEN 9400

WHEN C_SCREEN_9400. "MHTK903418(BEgin Of change)

*-- Build the field catalog for the ALV grid.

PERFORM BUILD_FIELD_CATALOG TABLES ITAB_FIELDCAT_1400

USING:

*ref_table|fieldname|coltext|hotspot|inttype|outputlen|lzero|just|color

'ITAB_PRE_PROC2' 'Z_PRE_PROC' 'Pre Processing Number'(030) ' ' 'C' ' ' ' ' ' ' 'C100',

'ITAB_PRE_PROC2' 'Z_PRE_PROC_LN' 'Pre Processing Number'(035) ' ' 'C' ' ' ' ' ' ' 'C100',

'ITAB_PRE_PROC2' 'MATNR' 'Material'(035) ' ' 'C' ' ' ' ' ' ' 'C500',

'ITAB_PRE_PROC2' 'Z_PSH_QTY' 'Quantity'(035) ' ' 'C' ' ' ' ' ' ' 'C500'.

*'ITAB_TO2' 'MATNR' 'Material'(016) ' ' 'C' ' ' ' ' ' ' 'C500',

*'ITAB_TO2' 'NSOLM' 'Quantity'(017) ' ' 'I' ' ' ' ' ' ' 'C500',

*'ITAB_TO2' 'NLTYP' 'Storage type'(014) ' ' '' ' ' ' ' ' ' 'C500'. "MHTK903257(-)

**'ITAB_TO2' 'POSNR' 'Line'(015) ' ' 'C' ' ' ' ' ' ' 'C500'. "MHTK903257(-)

*-- Create the ALV grid object.

CREATE OBJECT PT_ALV_1400

EXPORTING

I_PARENT = PT_DOCK_1400.

*-- Exclude the non-applicable functions from the ALV grid.

PERFORM EXCLUDE_FUNCTIONS TABLES ITAB_FUNCTIONS

USING R_SCREEN.

*-- Get the title of the ALV grid.

PERFORM GET_ALV_GRID_TITLE USING C_SCREEN_1400

CHANGING LS_LAYOUT-GRID_TITLE.

SORT ITAB_PRE_PROC2 BY Z_PRE_PROC.

*-- Display the ALV grid.

CALL METHOD PT_ALV_1400->SET_TABLE_FOR_FIRST_DISPLAY

EXPORTING

IS_LAYOUT = LS_LAYOUT

IT_TOOLBAR_EXCLUDING = ITAB_FUNCTIONS

CHANGING

IT_OUTTAB = ITAB_PRE_PROC2

IT_FIELDCATALOG = ITAB_FIELDCAT_1400. "MHTK903418(End of change)

ENDCASE.

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