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: 

values of the checkboxes in dynamic table

Madhurivs23
Participant
0 Kudos

Hi All,

I have a dynamic internal table which I am using to display in ALV grid. There is a field for checkbox in that internal table.

At which event I can know that these many checkboxes from rows have been checked. When I checked in debug mode at the user command event for that alv, the dynamic table-checkbox field is not getting updated with the 'X' value.

please help.

thanks in advance.

Rgds,

MadhuriG

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Madhuri,

Display a Pushbutton on to the list where u display the dynamic table data

Upon selection of chkboxes & clicking the pushbutton , At user command event u can

capture as to what rows are selected.. proceed this way....

Create report with 'no standard page heading'

data: w_lines type i.

at user-command.

case sy-ucomm.

when 'FCODE'.

describe table itab lines w_lines. // get no of rows displayed.. & read each row

do w_lines times.

read line sy-index

field value itab-chkbox. // itab-chkbox is the checkbox field of dynamic table..

if itab-chkbox = 'X'.

  • functionality

endif.

enddo.

endcase.

Hope it helps....

Regards,

Mdi.Deeba

4 REPLIES 4

Former Member
0 Kudos

Hi Try to use one of these events.

At selection-screen output.

Initialization.

At selection-screen on field

At selection-screen on end of field

At selection-screen on Radiobutton Group R1. (If you have any radio buttons)

At selection-screen on block b1. (If you have any blocks)

Start-of-selection.

Get node. (if the data is retreived from a logical database)

Get node late. (if the data is retreived from a logical database)

Top-of-page. (if the write statement is in the end-of-selection event or we can say that before the first write statement)

end-of-selection.

and fuction modules are

LISTHEADER - Is used to print the header information in the ALV List. Name, Date, Time, ALV Name and other details are called as Header information.

EVENT - Basically this is the FM to handle Event's. When the user needs to do some event operation like when double clicking the a particular field we need to perform some operation.

These events are captured by this FM.

LAYOUT - This FM is used to define the layout of the List. There are many options available in this FM to define the Layout style.

FIELDCAT - These are used to populate the List header. We can change them according to our req.

These are some of the FM. I hope it is useful.

venkat_o
Active Contributor
0 Kudos

Hi Madhuri, Try this way.

 REPORT  ztest_notepad.
DATA: BEGIN OF it_nfal OCCURS 0,
        check TYPE c,
        einri TYPE nfal-einri,
        falnr TYPE nfal-falnr,
        falar TYPE nfal-falar,
      END OF it_nfal.
TYPE-POOLS:slis.
DATA:it_fieldcat TYPE slis_t_fieldcat_alv,
     wa_fieldcat LIKE LINE OF it_fieldcat.
DEFINE fieldcat.
  wa_fieldcat-fieldname = &1.
  wa_fieldcat-tabname   = &2.
  wa_fieldcat-seltext_m = &3.
  wa_fieldcat-checkbox  = &4.
  wa_fieldcat-input     = &5.
  wa_fieldcat-hotspot   = &6.
  append wa_fieldcat to it_fieldcat.
  clear  wa_fieldcat.
END-OF-DEFINITION.

START-OF-SELECTION.
  SELECT * FROM nfal INTO CORRESPONDING FIELDS OF TABLE it_nfal UP TO 100 ROWS.
  fieldcat: 'CHECK' 'IT_NFAL' 'CHECK'  'X' 'X' 'X',
            'EINRI' 'IT_NFAL' 'EINRI'  ''  ''  '',
            'FALNR' 'IT_NFAL' 'FALNR'  ''  ''  '',
            'FALAR' 'IT_NFAL' 'FALAR'  ''  ''  ''.

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      i_callback_program      = sy-repid
      i_callback_user_command = 'USER_COMMAND'
      it_fieldcat             = it_fieldcat
    TABLES
      t_outtab                = it_nfal.
*&---------------------------------------------------------------------*
*&      Form  USER_COMMAND
*&---------------------------------------------------------------------*
FORM user_command USING r_ucomm LIKE sy-ucomm rs_selfield TYPE slis_selfield.
  IF r_ucomm = '&IC1'.
    it_nfal-check = 'X'.
    MODIFY it_nfal INDEX rs_selfield-tabindex TRANSPORTING check..
    rs_selfield-refresh = 'X'. "This variable refreshes the data displayed in ALV
  ENDIF.
ENDFORM.                    "USER_COMMAND
Thanks Venkat.O

Former Member
0 Kudos

Hi Madhuri,

Display a Pushbutton on to the list where u display the dynamic table data

Upon selection of chkboxes & clicking the pushbutton , At user command event u can

capture as to what rows are selected.. proceed this way....

Create report with 'no standard page heading'

data: w_lines type i.

at user-command.

case sy-ucomm.

when 'FCODE'.

describe table itab lines w_lines. // get no of rows displayed.. & read each row

do w_lines times.

read line sy-index

field value itab-chkbox. // itab-chkbox is the checkbox field of dynamic table..

if itab-chkbox = 'X'.

  • functionality

endif.

enddo.

endcase.

Hope it helps....

Regards,

Mdi.Deeba

Madhurivs23
Participant
0 Kudos

solved by making the checkbox field as hotspot. plus for the dynamic internal table, the read statement doesn't work. so need to put loop.

Rgds,

MadhuriG