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: 

checkbox in ALV

Former Member
0 Kudos

hi,

I am using REUSE_ALV_GRID fn mod.

in my ALV i am having checkbox for each & every record & a gui_status.

<b>my reqmt is :

when a button is pressed,

I want to get the details of the particular record whereever check box is ticked.</b>

Kindly Help,

With regards,

S.barani

1 ACCEPTED SOLUTION

Former Member
0 Kudos

try this

Function module to display the ALV report

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = W_REPID

I_CALLBACK_PF_STATUS_SET = 'PF_STATUS'

I_CALLBACK_USER_COMMAND <b> = 'USER_COMMAND'</b>

FORM <b>USER_COMMAND</b> USING P_UCOMM TYPE SY-UCOMM

P_SELFLD TYPE SLIS_SELFIELD.

DATA : L_REP_MODE. "report mode

CASE P_UCOMM.

Data ref1 type ref to cl_gui_alv_grid.

CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'

IMPORTING

E_GRID = ref1.

call method ref1->check_changed_data

WHEN 'SAVE'.

<b>loop at itab where check eq 'X'.

endloop.</b>

ENDCASE.

ENDFORM.

5 REPLIES 5

Former Member
0 Kudos

Hi

Create an Event for that clicking of Check box.

Go thru these threads u'll get an idea,

Regards,

Padmam.

Former Member
0 Kudos

Hello,

DO like this.


" For this u should have a field in the itab like this
* Internal table to store the final data
DATA: BEGIN OF G_T_OUTTAB OCCURS 0,
        CHECK(1),  " Check Here
        LIFNR LIKE LFA1-LIFNR,
        NAME1 LIKE LFA1-NAME1,
        MATNR LIKE MARA-MATNR,
        EBELN LIKE EKKO-EBELN,
        INFNR LIKE EKPO-INFNR,
        KBETR LIKE KONV-KBETR,
        KSCHL LIKE KONV-KSCHL,
        DATBI LIKE A016-DATBI,
        DATAB LIKE A016-DATAB,
        APLFZ LIKE EINE-APLFZ,
        AEDAT LIKE EKKO-AEDAT,
        STATUS(4),
      END OF G_T_OUTTAB.
  DATA REF1 TYPE REF TO CL_GUI_ALV_GRID.
  CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
       IMPORTING
            E_GRID = REF1.
  CALL METHOD REF1->CHECK_CHANGED_DATA.

Vasanth

Former Member
0 Kudos

try this

Function module to display the ALV report

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = W_REPID

I_CALLBACK_PF_STATUS_SET = 'PF_STATUS'

I_CALLBACK_USER_COMMAND <b> = 'USER_COMMAND'</b>

FORM <b>USER_COMMAND</b> USING P_UCOMM TYPE SY-UCOMM

P_SELFLD TYPE SLIS_SELFIELD.

DATA : L_REP_MODE. "report mode

CASE P_UCOMM.

Data ref1 type ref to cl_gui_alv_grid.

CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'

IMPORTING

E_GRID = ref1.

call method ref1->check_changed_data

WHEN 'SAVE'.

<b>loop at itab where check eq 'X'.

endloop.</b>

ENDCASE.

ENDFORM.

Pawan_Kesari
Active Contributor
0 Kudos

Assuming that you are using FM REUSE_ALV_GRID_DISPLAY for grid display

DO following for you requirement

1) Add button in pf status

2) Specify form name in importing parameter I_CALLBACK_USER_COMMAND

3) Write corresponding form in your program as


FORM user_command  USING r_ucomm LIKE sy-ucomm
                         rs_selfield TYPE slis_selfield.
ENDFORM.

4) This form will be called when user will press button on PF status. Inside this form check SY_UCOMM and loop at you internal table where checkbox_field = 'X'

Former Member
0 Kudos

Hi,

Since you've already implemented the checkbox for the AVL GRID, it should be very easy to pick those records.

The variable that u must have declared as TYPE C of width 1 character should be holding value 'X' for all the records for which the check box is checked.

So loop on the internal table that you are using by checking this field value having value 'X'. This should give you control of that line item, now once u have this data, you can manipulate and get the required data further.

<b>Reward points if this helps,</b>

Kiran