Skip to Content
avatar image
Former Member

ALV Grid with check box

Hi All,

I have developed a ALV grid report where my first feild is checkbox.My requirement is that when user select some records using check box in output then a BDC should call to update each records.

But i am enable to get checked records when i click a button on application toolbaar.Please sugest me the way to get checked records.

I have used below code:

WA_FIELDCAT-FIELDNAME = 'CHECKBOX'.

WA_FIELDCAT-TABNAME = 'IT_BLOCKED_CUS'.

WA_FIELDCAT-CHECKBOX = 'X'.

wa_FIELDCAT-INPUT = 'X'.

WA_FIELDCAT-EDIT = 'X'.

APPEND WA_FIELDCAT TO IT_FIELDCAT.

CLEAR WA_FIELDCAT.

WA_FIELDCAT-FIELDNAME = 'KUNN2'.

WA_FIELDCAT-TABNAME = 'IT_BLOCKED_CUS'.

WA_FIELDCAT-SELTEXT_L = TEXT-001.

APPEND WA_FIELDCAT TO IT_FIELDCAT.

CLEAR WA_FIELDCAT.

WA_FIELDCAT-FIELDNAME = 'KUNNR'.

WA_FIELDCAT-TABNAME = 'IT_BLOCKED_CUS'.

WA_FIELDCAT-SELTEXT_L = TEXT-002.

APPEND WA_FIELDCAT TO IT_FIELDCAT.

CLEAR WA_FIELDCAT.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = G_REPID

I_CALLBACK_PF_STATUS_SET = 'PF_STATUS'

I_CALLBACK_USER_COMMAND = 'USER_COMMAND'

IS_LAYOUT = WA_LAYOUT

IT_FIELDCAT = IT_FIELDCAT

IT_EVENTS = IT_EVENTS

I_SAVE = 'A'

I_GRID_SETTINGS = S_GLAY

  • IT_SORT = IT_SORT

I_DEFAULT = 'X'

TABLES

T_OUTTAB = IT_BLOCKED_CUS

EXCEPTIONS

PROGRAM_ERROR = 1

OTHERS = 2.

IF SY-SUBRC NE 0.

MESSAGE I018.

LEAVE LIST-PROCESSING.

ENDIF.

FORM PF_STATUS USING LT_EXTAB TYPE SLIS_T_EXTAB.

SET PF-STATUS 'ZSTATUS'.

ENDFORM.

FORM USER_COMMAND USING G_UCOMM TYPE SY-UCOMM

R_SELFIELD TYPE SLIS_SELFIELD.

data: REF_GRID TYPE REF TO CL_GUI_ALV_GRID,

l_valid type c.

CASE G_UCOMM.

WHEN '&BLK_UNBLK'.

IF REF_GRID IS INITIAL.

CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'

IMPORTING

E_GRID = REF_GRID.

ENDIF.

IF NOT REF_GRID IS INITIAL.

CALL METHOD REF_GRID->CHECK_CHANGED_DATA

ENDIF.

loop at IT_blocked_cus into wa_blocked_cus where CHECKBOX = 'X' .

PERFORM CALL_BDC.

endloop.

Please help me.

Regards,

Mohit khandelwal

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Oct 16, 2008 at 02:41 PM
    FORM USER_COMMAND USING G_UCOMM TYPE SY-UCOMM
    R_SELFIELD TYPE SLIS_SELFIELD.
    
    data: REF_GRID TYPE REF TO CL_GUI_ALV_GRID,
    l_valid type c.
    
    break-point.
    CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
    IMPORTING
    E_GRID = REF_GRID.
    
    IF NOT REF_GRID IS INITIAL.
    CALL METHOD REF_GRID->CHECK_CHANGED_DATA
    ENDIF.
    
    
    CASE G_UCOMM.
    
    WHEN '&BLK_UNBLK'.
    
    loop at IT_blocked_cus into wa_blocked_cus where CHECKBOX = 'X' .
    PERFORM CALL_BDC.
    endloop.
    endcase.
    endform.

    keep break-point in the above form and see. what is happening.

    Add comment
    10|10000 characters needed characters exceeded