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

Problem double click ALV GRID

Former Member
0 Likes
2,158

Hi folks,

I'm trying to get an ALV GRID to make something if I double click one line, this is my code:

FORM create_alv.

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
             i_callback_program = sy-repid
             I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
             is_layout          = gs_layout
             it_fieldcat        = gt_itab_catalog[]
             i_default          = 'X'
             i_save             = 'A'
             it_events          = events[]
        TABLES
             t_outtab           = itab_all
        EXCEPTIONS
             program_error      = 1
             OTHERS             = 2.

  IF sy-subrc <> 0.

  ENDIF.

ENDFORM.  

FORM USER_COMMAND USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.

  break-point.
  CASE r_ucomm.
    WHEN '&IC1'.
      READ TABLE itab_ekko INTO wa_ekko INDEX rs_selfield-tabindex.

*      PERFORM build_fieldcatlog_ekpo.
*      PERFORM event_call_ekpo.
*      PERFORM populate_event_ekpo.
*      PERFORM data_retrieval_ekpo.
*      PERFORM build_listheader_ekpo USING it_listheader.
*      PERFORM display_alv_ekpo.

  ENDCASE.
ENDFORM. "user_command

Why when I'm double clicking the form USER_COMMAND isn't being executed. The break-point I set in there doesn't get executed.

Can anyone tell me if i'm missing something.

Thanks for your help in advance.

Regards,

Gilberto Li

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,215

Hi,

Try this.

Make use of events to handle the double click. Define and implement the double click event in ur coding.

Sharin.

7 REPLIES 7
Read only

Former Member
0 Likes
1,216

Hi,

Try this.

Make use of events to handle the double click. Define and implement the double click event in ur coding.

Sharin.

Read only

Former Member
0 Likes
1,215

ideally it should work, since i can't find any issue with the below code.

can you post your code completely,

Read only

0 Likes
1,215

Hi again,

Ok here's the code:

FORM init_catalog.

* SOCIEDAD
    gt_itab_catalog-fieldname = 'BUKRS'.
    gt_itab_catalog-tabname = 'ITAB_ALL'.
    gt_itab_catalog-seltext_l  = 'Sociedad'.
    gt_itab_catalog-just = 'L'.
    gt_itab_catalog-col_pos = 1.
    gt_itab_catalog-outputlen = 10.
    APPEND gt_itab_catalog.
    CLEAR gt_itab_catalog.

* CONTRATO
    gt_itab_catalog-fieldname = 'EBELN'.
    gt_itab_catalog-tabname = 'ITAB_ALL'.
    gt_itab_catalog-seltext_l  = 'Contrato Marco'.
    gt_itab_catalog-just = 'L'.
    gt_itab_catalog-col_pos = 2.
    gt_itab_catalog-outputlen = 15.
    gt_itab_catalog-hotspot = 'X'.
    APPEND gt_itab_catalog.
    CLEAR gt_itab_catalog.

* CLASE DE DOC
    gt_itab_catalog-fieldname = 'BSART'.
    gt_itab_catalog-tabname = 'ITAB_ALL'.
    gt_itab_catalog-seltext_l  = 'Clase de Contrato'.
    gt_itab_catalog-just = 'L'.
    gt_itab_catalog-col_pos = 3.
    gt_itab_catalog-outputlen = 15.
    APPEND gt_itab_catalog.
    CLEAR gt_itab_catalog.

* RIGE DESDE
    gt_itab_catalog-fieldname = 'KDATB'.
    gt_itab_catalog-tabname = 'ITAB_ALL'.
    gt_itab_catalog-seltext_l  = 'Rige desde'.
    gt_itab_catalog-just = 'L'.
    gt_itab_catalog-col_pos = 4.
    gt_itab_catalog-outputlen = 10.
    APPEND gt_itab_catalog.
    CLEAR gt_itab_catalog.

* VENCE
    gt_itab_catalog-fieldname = 'KDATE'.
    gt_itab_catalog-tabname = 'ITAB_ALL'.
    gt_itab_catalog-seltext_l  = 'Vence el'.
    gt_itab_catalog-just = 'L'.
    gt_itab_catalog-col_pos = 5.
    gt_itab_catalog-outputlen = 10.
    APPEND gt_itab_catalog.
    CLEAR gt_itab_catalog.

* FECHA DE CREACION
    gt_itab_catalog-fieldname = 'AEDAT'.
    gt_itab_catalog-tabname = 'ITAB_ALL'.
    gt_itab_catalog-seltext_l  = 'Creado el'.
    gt_itab_catalog-just = 'L'.
    gt_itab_catalog-col_pos = 6.
    gt_itab_catalog-outputlen = 10.
    APPEND gt_itab_catalog.
    CLEAR gt_itab_catalog.

* PROVEEDOR
    gt_itab_catalog-fieldname = 'LIFNR'.
    gt_itab_catalog-tabname = 'ITAB_ALL'.
    gt_itab_catalog-seltext_l  = 'Proveedor'.
    gt_itab_catalog-just = 'L'.
    gt_itab_catalog-col_pos = 7.
    gt_itab_catalog-outputlen = 10.
    APPEND gt_itab_catalog.
    CLEAR gt_itab_catalog.

* NOMBRE DE PROVEEDOR
    gt_itab_catalog-fieldname = 'NAME1'.
    gt_itab_catalog-tabname = 'ITAB_ALL'.
    gt_itab_catalog-seltext_l  = 'Nombre Proveedor'.
    gt_itab_catalog-just = 'L'.
    gt_itab_catalog-col_pos = 8.
    gt_itab_catalog-outputlen = 20.
    APPEND gt_itab_catalog.
    CLEAR gt_itab_catalog.

* CED JURIDICA
    gt_itab_catalog-fieldname = 'STCD1'.
    gt_itab_catalog-tabname = 'ITAB_ALL'.
    gt_itab_catalog-seltext_l  = 'Cédula Jurídica'.
    gt_itab_catalog-just = 'L'.
    gt_itab_catalog-col_pos = 9.
    gt_itab_catalog-outputlen = 10.
    APPEND gt_itab_catalog.
    CLEAR gt_itab_catalog.


* MATERIAL
    gt_itab_catalog-fieldname = 'MATNR'.
    gt_itab_catalog-tabname = 'ITAB_ALL'.
    gt_itab_catalog-seltext_l  = 'Material'.
    gt_itab_catalog-just = 'L'.
    gt_itab_catalog-col_pos = 10.
    gt_itab_catalog-outputlen = 18.
    APPEND gt_itab_catalog.
    CLEAR gt_itab_catalog.

* NOMBRE DE MATERIAL
    gt_itab_catalog-fieldname = 'MAKTX'.
    gt_itab_catalog-tabname = 'ITAB_ALL'.
    gt_itab_catalog-seltext_l  = 'Desc. Material'.
    gt_itab_catalog-just = 'L'.
    gt_itab_catalog-col_pos = 11.
    gt_itab_catalog-outputlen = 20.
    APPEND gt_itab_catalog.
    CLEAR gt_itab_catalog.

* MONTO
    gt_itab_catalog-fieldname = 'NETPR'.
    gt_itab_catalog-tabname = 'ITAB_ALL'.
    gt_itab_catalog-seltext_l  = 'Monto'.
    gt_itab_catalog-just = 'L'.
    gt_itab_catalog-col_pos = 12.
    gt_itab_catalog-outputlen = 16.
    APPEND gt_itab_catalog.
    CLEAR gt_itab_catalog.

* MONEDA
    gt_itab_catalog-fieldname = 'WAERS'.
    gt_itab_catalog-tabname = 'ITAB_ALL'.
    gt_itab_catalog-seltext_l  = 'Moneda'.
    gt_itab_catalog-just = 'L'.
    gt_itab_catalog-col_pos = 13.
    gt_itab_catalog-outputlen = 10.
    APPEND gt_itab_catalog.
    CLEAR gt_itab_catalog.

ENDFORM.                    "init_catalog


FORM init_layout.

  gs_layout-zebra = 'X'.
  gs_layout-f2code = '&amp;ETA'.
  gs_layout-detail_popup = 'X'.
  gs_layout-no_totalline = 'X'.

ENDFORM.  "init_layout

FORM listado.

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
             i_callback_program = g_repid
             I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
             it_fieldcat        = gt_itab_catalog[]
        TABLES
             t_outtab           = itab_all
        EXCEPTIONS
             program_error      = 1
             OTHERS             = 2.

  IF sy-subrc <> 0.

  ENDIF.

ENDFORM.  

FORM USER_COMMAND USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.

  break-point.
  CASE r_ucomm.
    WHEN '&IC1'.
      READ TABLE itab_ekko INTO wa_ekko INDEX rs_selfield-tabindex.

*      PERFORM build_fieldcatlog_ekpo.
*      PERFORM event_call_ekpo.
*      PERFORM populate_event_ekpo.
*      PERFORM data_retrieval_ekpo.
*      PERFORM build_listheader_ekpo USING it_listheader.
*      PERFORM display_alv_ekpo.

  ENDCASE.
ENDFORM. "user_command


  PERFORM init_catalog.
  PERFORM init_layout.
  PERFORM listado.

I just post the ALV GRID creation code.

Hope you guys can guide me through this.

Thanks again.

Regards,

Gilberto Li

Read only

Former Member
0 Likes
1,215

Hi Folks,

For some reason, i'm getting a dump now:

PARAMETER_MISSING in this standard program: SAPLSLVC_FULLSCREEN

014540 *& *

014550 *& Form USER

014560 *& *

014570 form user_command using r_ucomm type sy-ucomm

014580 r_refresh

014590 r_exit

> rs_stable type lvc_s_stbl.

014610 data: ls_selfield type slis_selfield.

014620 *

014630 check not gt_grid-i_callback_user_command is initial.

014640 check not i_callback_program is initial.

014650

014660 perform selfield_get using ls_selfield.

014670 if r_ucomm is initial.

014680 r_ucomm = '&IC1'.

014690 endif.

014700

014710 perform (gt_grid-i_callback_user_command)

014720 in program (i_callback_program)

014730 using r_ucomm

014740 ls_selfield.

014750 rs_stable-row = ls_selfield-row_stable.

014760 rs_stable-col = ls_selfield-col_stable.

014770

014780 r_refresh = ls_selfield-refresh.

014790 r_exit = ls_selfield-exit.

Am I missing something within my code?

Edit: Forget the dump, I changed the g_repid for sy-repid and that was generating the dump.

Still can't get USER_COMMAND to work

Thanks again.

Regards,

Gilberto Li

Edited by: Gilberto Li on Aug 22, 2008 4:26 PM

Read only

Former Member
0 Likes
1,215

Hi again,

I got it working.

I found that my variable g_repid wasn't initialized correctly. Dumb mistake.

Anyway, thanks.

Read only

0 Likes
1,215

hi everyone,

im fresh abap .Can plese help me.

Im trying to execute the two alv grid display for two different internal tables but when i execute the alv report it displays two alv grid when i press continue displays another alv grid.but i want single alv grid. i have no ides about this.Please take care .below is my code

LOOP AT gt_unbw_mb INTO DATA(s_mb).

TRY .
DATA(s_unbw) = t_unbw[ material = s_mb-matnr
plant = s_mb-werks ].

gs_con_unbw-werks = s_unbw-plant.
IF s_unbw-effectiveprice IS NOT INITIAL.
gs_con_unbw-dmbtr = s_mb-menge * s_unbw-effectiveprice.
COLLECT gs_con_unbw INTO gt_con_unbw.


"""start by kp on 03.09.2021
ELSE.
READ TABLE git_mat INTO DATA(gs_mat) WITH KEY material = s_unbw-material.
* baseunitofmeasure = gs_mseg-meins.

IF sy-subrc = 0.
gs_con_unbw-dmbtr = s_mb-menge * gs_mat-materialprice.
COLLECT gs_con_unbw INTO gt_con_unbw.

ELSE.
ls_alv_popup-material = s_unbw-material.

READ TABLE lit_mat_des INTO DATA(ls_mat_des) WITH KEY matnr = ls_alv_popup-material.

IF sy-subrc = 0.
ls_alv_popup-materialdescription = ls_mat_des-maktx.
ENDIF.

IF ls_alv_popup-material IS NOT INITIAL.
APPEND ls_alv_popup TO lit_alv_popup.
ENDIF.
CLEAR ls_alv_popup.
ENDIF.
ENDIF.
CATCH cx_sy_itab_line_not_found.
CLEAR s_unbw.
ENDTRY.
ENDLOOP.
ENDIF.

IF lit_alv_popup[] IS NOT INITIAL.

REFRESH gt_fcat1.

gs_fcat1-fieldname = 'MATERIAL'.
gs_fcat1-seltext_l = 'Material'.
gs_fcat1-tabname = 'lit_alv_popup'.
APPEND gs_fcat1 TO gt_fcat1.
CLEAR:gs_fcat1.

gs_fcat1-fieldname = 'MATERIALDESCRIPTION'.
gs_fcat1-seltext_l = 'Material Description'.
gs_fcat1-tabname = 'lit_alv_popup'.
APPEND gs_fcat1 TO gt_fcat1.
CLEAR:gs_fcat1.

CLEAR : gd_repid.
gd_repid = sy-repid.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = gd_repid
i_grid_title = 'Maintain the price for the below materials in ZCAT01_PRICE'
it_fieldcat = gt_fcat1
i_screen_start_column = 50
i_screen_start_line = 20
i_screen_end_column = 150
i_screen_end_line = 67
TABLES
t_outtab = lit_alv_popup.

IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
ENDIF.

Read only

0 Likes
1,215

Thanks for coming to SAP Community for answers. Please post your question as a new question here:

Since you're new in asking questions here, check out our tutorial about asking and answering questions (if you haven't already), as it provides tips for preparing questions more effectively, that draw responses from our members.

Please note, that your post here won't be answered.