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: 

custom push button in alv list display

Bharath84
Participant
0 Kudos

Hi All,

I am having 4 custom push buttons Button1, Button2, Button3 and Button4 in my alv list display. When I display the alv list Button4 should be in disable mode. When I press any of the first 3 buttons then only Button4 should be in Enable mode. How to achieve this functionality. Please help me.

Thanks,

Haritha

5 REPLIES 5

ipravir
Active Contributor
0 Kudos

Hi Haritha,

Where you have added buttons in ALV? in rows or in tool bar?

regards.

Praveer.

0 Kudos

Hi Praveen,

I am having custom push buttons in ALV toolbar.

Thanks,

Haritha

0 Kudos

Hi Haritha,

Inside USER_COMMMAND, you can write the LOOP AT SCREEN for Hiding/Displaying the push button also refresh the ALV. Hope it will work.

Regards

Rajkumar Narasimman

ipravir
Active Contributor
0 Kudos

Hi haritha,

I think, you have used I_CALLBACK_PF_STATUS_SET to set the new buttons.

write the below code inside the Status Routine (Form - EndForm).

SET PF-STATUS 'STATUS-NAME used in Program' EXCLUDING IT_UCOMM.

here IT_UCOMM is standard table of SY-UCOMM.

that you have to update with FUNTION CODE of the Buttons.

So based on your requirement, you can display Button4 by selecting any 1 of 3 buttons.

Only You have to refresh your LIST ALV display to reload the Screen.

Regards.

Praveer.

Former Member
0 Kudos

Hi

I suppose you've developed the routine to active a your own ALV status, this routine should be triggered after pressing a button, so you can decide which button has to be active after pressing another one, try this sample:


DATA: T_OUTPUT TYPE STANDARD TABLE OF T001.

DATA: GT_REPID TYPE SY-REPID.

DATA: ACT_1_OR_2(1) TYPE C.

START-OF-SELECTION.

   SELECT * INTO TABLE T_OUTPUT

     FROM T001.

   GT_REPID = SY-REPID.

   ACT_1_OR_2 = '1'.

   CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

     EXPORTING

       I_CALLBACK_PROGRAM       = GT_REPID

       I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS'

       I_CALLBACK_USER_COMMAND  = 'USER_COMMAND'

       I_STRUCTURE_NAME         = 'T001'

     TABLES

       T_OUTTAB                 = T_OUTPUT.


FORM USER_COMMAND USING R_UCOMM     LIKE SY-UCOMM

                         RS_SELFIELD TYPE SLIS_SELFIELD.

   CASE R_UCOMM.

     WHEN 'BUT1'. ACT_1_OR_2 = '2'.

     WHEN 'BUT2'. ACT_1_OR_2 = '1'.

   ENDCASE.

   RS_SELFIELD-REFRESH = 'X'.

ENDFORM.         


FORM SET_PF_STATUS  USING RT_EXTAB TYPE SLIS_T_EXTAB.

   DATA: T_EXTAB LIKE SY-UCOMM OCCURS 0 WITH HEADER LINE.

   CASE ACT_1_OR_2.

     WHEN '1'. T_EXTAB = 'BUT2'.

     WHEN '2'. T_EXTAB = 'BUT1'.

   ENDCASE.

   APPEND T_EXTAB.

   SET PF-STATUS 'MY_STATUS' EXCLUDING T_EXTAB.

ENDFORM.

Max