Application Development and Automation 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: 
Read only

Multiple ALV with checkboxes

Former Member
0 Likes
408

Hi Everyone,

I need to output 3 tables onto separate ALV's on the screen with matching checkboxes and pick out the checked items for processing.

I've already been able to create 3 ALV's with checkboxes using REUSE_ALV_BLOCK_LIST_INIT and REUSE_ALV_BLOCK_LIST_APPEND. My problem is updating the 3 different tables where the rows are checked. The function GET_GLOBALS_FROM_SLVC_FULLSCR doesn't seem to update multiple tables in my user_command.

Any suggestions on how to read the checked rows or might be any other ideas or sample for my requirement.

Thanks,

Eric

2 REPLIES 2
Read only

Former Member
0 Likes
384

create one more field in your final internal table.

Here the demo program i have just created to show hao to use alv with

editble checkboxes and pick checked boxes in user_command.

code snippet:

REPORT  ZNEW36.

TYPE-POOLS:SLIS.

DATA BEGIN OF I_MAKT OCCURS 0.

        INCLUDE STRUCTURE MAKT.

DATA CHECK TYPE CHAR1.

DATA END OF I_MAKT.

DATA IT_FCAT TYPE SLIS_T_FIELDCAT_ALV.

DATA WA_FCAT LIKE LINE OF IT_FCAT.

START-OF-SELECTION.

  SELECT * FROM MAKT INTO TABLE I_MAKT UP TO 100 ROWS.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

   EXPORTING

     I_PROGRAM_NAME               = SY-REPID

     I_STRUCTURE_NAME             = 'MAKT'

     I_INCLNAME                   = SY-REPID

    CHANGING

      CT_FIELDCAT                  = IT_FCAT

   EXCEPTIONS

     INCONSISTENT_INTERFACE       = 1

     PROGRAM_ERROR                = 2

     OTHERS                       = 3

            .

  WA_FCAT-FIELDNAME = 'CHECK'.

  WA_FCAT-COL_POS = 1.

  WA_FCAT-CHECKBOX = 'X'."use this in field catalogue to display checkboxes.

  WA_FCAT-SELTEXT_M = 'Check'.

  WA_FCAT-DDICTXT = 'M'.

  WA_FCAT-EDIT = 'X'."this one is to make these checkboxes editable.

  APPEND WA_FCAT TO IT_FCAT.

  CLEAR WA_FCAT.

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

   EXPORTING

     I_CALLBACK_PROGRAM                = SY-REPID

     I_CALLBACK_USER_COMMAND           = 'USER_COMMAND'

    IT_FIELDCAT                       = IT_FCAT

    TABLES

      T_OUTTAB                          = I_MAKT[]

   EXCEPTIONS

     PROGRAM_ERROR                     = 1

     OTHERS                            = 2

            .

  IF SY-SUBRC <> 0.

* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

  ENDIF.

"while ALV is displaed select some checkboxes and doubles click on any cell to fire user command.

*&---------------------------------------------------------------------*

*&      Form  user_command

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

*      -->R_UCOMM      text

*      -->RS_SELFIELD  text

*----------------------------------------------------------------------*

FORM USER_COMMAND  USING R_UCOMM LIKE SY-UCOMM

                           RS_SELFIELD TYPE SLIS_SELFIELD.

  BREAK-POINT.

"have a loop at internal table i_makt.

"in debugger check internal table i_makt -->> u will see 'X' in field check of table i_makt .

ENDFORM.                    "user_command

revert back if still needs any help!

Read only

0 Likes
384

Thanks for the reply, but i've already been able to do the update to a single table. I need to update the checkoxes on multiple tables. Thanks.