Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

ALV - selecting row

Hi guys

I have a problem with adding row select option to my ALV.

Here's my code:

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

   I_STRUCTURE_NAME  = 'ZDEF_INTRASTAT'

CHANGING

    CT_FIELDCAT  = lt_fcat[]

EXCEPTIONS

   INCONSISTENT_INTERFACE = 1

   PROGRAM_ERROR  = 2

   OTHERS   = 3.

  DATA: g_variant TYPE disvariant,

        g_layo TYPE slis_layout_alv.

        g_layo-info_fieldname = 'COLOR'.

        g_variant-report  = sy-repid.

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

   EXPORTING

    i_callback_program = sy-repid

    i_callback_user_command  = 'USER_COMMAND'

    i_callback_pf_status_set   = 'SUB_PF_STATUS'

    is_layout    = g_layo

    it_fieldcat   = lt_fcat

    i_save   = 'A'

    is_variant   = g_variant

    TABLES

      t_outtab   = gt_dane

EXCEPTIONS

   PROGRAM_ERROR = 1

   OTHERS   = 2.

FORM sub_pf_status USING rt_extab TYPE slis_t_extab..

  SET PF-STATUS 'ZSTANDARD'.

ENDFORM.

FORM user_command USING r_ucomm     LIKE sy-ucomm

                        rs_selfield TYPE slis_selfield.

     IF r_ucomm EQ 'CTR'.

       call TRANSACTION 'SM30'. "calling transaction sm30 with by button called CTR

     ENDIF.

ENDFORM.

and my table look like this:

If I add: "g_layo-box_fieldname = 'SELECT'." it looks like I would like it to be (select squares, marked red):

But if I press any button I some big error (I copied text to dump.txt file).

Can anyone help me with this error?

Best regards,

Bartlomiej

dump.txt.zip (1515 B)
Tags:
Former Member replied

Hi

You should post how GT_DANE is defined in your program,


for example of your defination is like this:


DATA GT_DANE LIKE STANDARD TABLE OF ZDEF_INTRASTAT.

or equivalent definitions:


DATA GT_DANE LIKE ZDEF_INTRASTAT OCCURS 0.


You can try to replace it with this definition:

DATA: BEGIN OF GT_DANE 0CCURS 0.

                 INCLUDE STRUCTURE ZDEF_INTRASTAT.

DATA:      SELECT TYPE FLAG,

           END     OF GT_DANE 0CCURS 0.


In this way now the internal table GT_DANE has a field caled SELECT to be used for marker in ALV GRID

Max

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question