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: 

REUSE_ALV_GRID_DISPLAY user command - double click

Former Member
0 Kudos

Hi everyone,

I try to build program using FM REUSE_ALV_GRID_DISPLAY which will display list of sflight and after double click on any row the popup shows up with selected data by carrid from selected row.

The problem is in the begining when i try use double click.

I wrote something like this:


DATA: lt_tab TYPE TABLE OF sflight,

       lt_fieldcat TYPE slis_t_fieldcat_alv,

       ls_fieldcat TYPE slis_fieldcat_alv,

       ls_tab  TYPE sflight.

START-OF-SELECTION.

   SELECT * FROM sflight INTO TABLE lt_tab.

PERFORM fieldcat.

   CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

     EXPORTING

       i_callback_program      = sy-cprog

       i_callback_user_command = 'UCOMM'

       it_fieldcat             = lt_fieldcat

     TABLES

       t_outtab                = lt_tab.

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

*&      Form  ucomm

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

*       text

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

FORM UCOMM  USING u_ucomm     TYPE sy-ucomm.

    CASE u_ucomm.

     WHEN '&IC1'.

   MESSAGE 'tet' TYPE 'I'.

    ENDCASE.

ENDFORM.

FORM fieldcat.

   ls_fieldcat-fieldname   = 'CARRID'.

   ls_fieldcat-seltext_m   = 'Kod lotniska'.

   ls_fieldcat-col_pos     = 0.

   APPEND ls_fieldcat TO lt_fieldcat.

   ls_fieldcat-fieldname   = 'PLANETYPE'.

   ls_fieldcat-seltext_m   = 'Typ samolotu'.

   ls_fieldcat-col_pos     = 1.

   APPEND ls_fieldcat TO lt_fieldcat.

   ls_fieldcat-fieldname   = 'FLDATE'.

   ls_fieldcat-seltext_m   = 'Data Odlotu'.

   ls_fieldcat-col_pos     = 2.

   ls_fieldcat-edit        = 'X'.

   APPEND ls_fieldcat TO lt_fieldcat.

   CLEAR  ls_fieldcat.

   ls_fieldcat-fieldname   = 'PRICE'.

   ls_fieldcat-seltext_m   = 'CENA'.

   ls_fieldcat-col_pos     = 3.

   APPEND ls_fieldcat TO lt_fieldcat.

   ENDFORM.

The table is displaying normally but when I double click any rows error is displayed in module user_command.

Any suggestions?

thanks in advice

1 ACCEPTED SOLUTION

raymond_giuseppi
Active Contributor
0 Kudos

Read the documentation of parameter i_callback_user_command, you did not respect its signature (parameters list)

Regards,

Raymond

24 REPLIES 24

raymond_giuseppi
Active Contributor
0 Kudos

Read the documentation of parameter i_callback_user_command, you did not respect its signature (parameters list)

Regards,

Raymond

former_member206650
Active Participant
0 Kudos

hi Krzysztof Sliwa,

in the statement

FORM UCOMM  USING u_ucomm  TYPE sy-ucomm. can u add a parameter more

slis_selfield.


use the code in picture in which slis_selfield is mentioned...



   CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

     EXPORTING

       i_callback_program      = sy-cprog

       i_callback_user_command = 'UCOMM'   'check this parameter it is spelled wrong'....





hope it helps.....


Former Member
0 Kudos

Hi Raymond Giuseppi and vishnu venugopal,

You are right, I don't know why, but after adding      


     us_selfield            TYPE slis_selfield. to FORM UCOMM

It started to work.

Thanks very much.

0 Kudos

I don't know why

Just read FM & parameter documentation

(The signature enables you to identify the line/field of the cursor when user interracted with ALV, so you could read data in the form, you can also set some value for following action, e.g. leave the ALV or redisplay some data updated)

0 Kudos

I have another issue.

I created new popup using FM 'REUSE_ALV_POPUP_TO_SELECT'


ORM f_display_data_sflight .

   CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'

     EXPORTING

       i_callback_program      = sy-repid

       i_callback_user_command = 'USER_COMMAND_ALV'

       i_zebra                 = 'X'

       i_tabname               = 1

       i_structure_name        = 'sflight'

       it_fieldcat             = lt_fieldcat_pop[]

     TABLES

       t_outtab                = lt_sflight

     EXCEPTIONS

       program_error           = 1

       OTHERS                  = 2.

ENDFORM.                    " F_DISPLAY_DATA_SFLIGHT

and I need to make columns price and connid editable. I rode that I need set edit option in thous columns in it_fieldcat.

I did as below:

FORM   bulid_pop_fieldcatalog.

   lt_fieldcat_pop-edit        = 'X'.

   lt_fieldcat_pop-fieldname   = 'PRICE'.

   lt_fieldcat_pop-seltext_m   = 'CENA'.

   lt_fieldcat_pop-col_pos     = 1.

   APPEND lt_fieldcat_pop TO lt_fieldcat_pop.

  lt_fieldcat_pop-edit        = ' '.

  lt_fieldcat_pop-fieldname   = 'CONNID'.

  lt_fieldcat_pop-seltext_m   = 'CENA'.

  APPEND lt_fieldcat_pop TO lt_fieldcat_pop.

but it is not working.

Any idea why?

ENDFORM.                    "bulid_pop_fieldcatalog

0 Kudos

hi,

check     i_tabname  .you have given as 1.

0 Kudos

What should be there? because it doesn't matter what I write there. 

0 Kudos

Either pass structure name (in UPPERCASE, and let ALV creates the catalog) or build yourself the field catalog. (Even if called FM will try to merge the field catalog)

You could create a default field catalog with REUSE_ALV_FIELDCATALOG_MERGE, then in a loop modify the EDIT field for your two field names.

NB: But, I'm not sure of succes, description of FM is "List in dialog box to choose one or more entries (or display only)"

Regards,

Raymond

0 Kudos

also thank you for your answer Raymond.

I created REUSE_ALV_FIELDCATALOG_MERGE, but i don't know how should I implement it because i get error 'CALL_FUNCTION_CONFLICT_TYPE'


FORM catalog_merge.

   FIELD-SYMBOLS <ls_fieldcat_pop> TYPE slis_t_fieldcat_alv.

   CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

     EXPORTING

       i_program_name     = sy-repid

       i_internal_tabname = 'lt_fieldcat_pop'

       i_inclname         = sy-repid

       i_bypassing_buffer = 'X'

     CHANGING

       ct_fieldcat        = lt_fieldcat_pop.

ENDFORM.                    "catalog_merge

0 Kudos
  • Don't use sy-repid but move it to a variable and use this variable.
  • Are you actually generating the field catalog on the field catalog, should not i_internal_tabname be LT_SFLIGHT (also in uppercase)
  • Did you respect signature (is  lt_fieldcat_pop of type  lt_fieldcat_pop and not a TABLE OF  lt_fieldcat_pop ?

Regards,

Raymond

0 Kudos

Hi..

That addition is required ..... slis_selfield ,,,,signature .........!

Because of the function module Reuse_alv_grid_Display in that documentation it will say like

that for ex :  i_callback_user_command parameter = 'UCOMM'.

We mention that then immediately  that function module is constructing one Subroutine definition with that name which we mention there in our FM......like UCOMM

Internally with the key word Perform....statement it automatically generated

and with the signatures sy-ucomm and slis_selfield

SLIS_SELFIELD  

it captures the selected field value and name of that field .......

Thats the use of slis_selfield




Thanks

vamsilakshman.p

former_member206650
Active Participant
0 Kudos

hi,

please checkout the link

0 Kudos

vishnu venugopal wrote:

hi,

please checkout the link using 'REUSE_ALV_POPUP_TO_SELECT'....

this link is about displaying empty pop-up and it doesn't fit to my issue.

former_member206650
Active Participant
0 Kudos

hi,

inside form  f_display_data_sflight did you write the alv display function module.also check the parameter   t_tabname it should be the internal table you have defined do mention i_checkbox_fieldname.also check  the structure sflight it should not contains more than the field that u need...







hope it works.....

0 Kudos

Hi Vishnu,

I did as you wrote, but now I cannot display my pop list because i get an error GETWA_NOT_ASSIGNED

I made types like this:


BEGIN OF ty_sflight,

     carrid   TYPE sflight-carrid,

     price     TYPE sflight-price,

     fldate    TYPE sflight-fldate,

     planetype TYPE sflight-planetype,

     connid    TYPE sflight-connid,

     currency  TYPE sflight-currency,

   END OF ty_sflight.


and defined local table and structure of this table;


      lt_ty_sflight    TYPE TABLE OF ty_sflight,

       ls_ty_sflight    TYPE          ty_sflight,

Finaly this is my FM REUSE_ALV_POPUP_TO_SELECT


FORM f_display_data_sflight .

   CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'

     EXPORTING

       i_callback_program      = sy-repid

       i_callback_user_command = 'USER_COMMAND_ALV'

       i_zebra                 = 'X'

       i_tabname               = 'LT_TY_SFLIGHT'

       i_checkbox_fieldname    = 'CHECKBOX'

       i_structure_name        = 'LS_TY_SFLIGHT'

       it_fieldcat             = LT_FIELDCAT_POP[]

     TABLES

       t_outtab                = LT_TY_SFLIGHT

     EXCEPTIONS

       program_error           = 1

       OTHERS                  = 2.

ENDFORM.

former_member206650
Active Participant
0 Kudos

hi,

CHECKBOX is not defined in local types .in your scenario there is only 2 field PRICE and connid..so make fieldcatalog with those two....

0 Kudos

It works. I added definition checkbox   TYPE c into type of ty_sflight, and deleted not nessesery fields, but the fields PRICE and CONNID are still not editable though i inserted

 lt_fieldcat_pop-edit        = 'X'

in form FORM    bulid_pop_fieldcatalog.

0 Kudos

Or maybe I could make popup and display reuse alv grid in this new popup. But which popup should i use?

former_member206650
Active Participant
0 Kudos

hi,

ya....that is the logic...use the same pop fm which you used....

0 Kudos

There is two oprions:

Making reuse alv grid with exporting parameters ( i_screen_start_column,  i_screen_start_line,  i_screen_end_column,   i_screen_end_line )

or using

CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'


and setting in fieldcatalog

fieldcatalog-edit        = 'X'.

and

fieldcatalog-input         = 'X'.

former_member206650
Active Participant
0 Kudos

while creating field catalog code must be

DATA: FLDCAT TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE.

parameters are

FLDCAT-FIELDNAME =

FLDCAT-COL_POS = .

FLDCAT-SELTEXT_M =.

then it should be APPENDED and CLEARED.

....


hope it helps.....

0 Kudos

vishnu venugopal wrote:

while creating field catalog code must be

DATA: FLDCAT TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE.

header line is no recommend to use any more

now you should use

DATA: lt_fieldcat  TYPE               slis_t_fieldcat_alv,

           ls_fieldcat  LIKE LINE OF  lt_fieldcat.

and append structure to table.

Thanks for your help.

best regards

former_member206650
Active Participant
0 Kudos

hi Mr Krzysztof,

you are right.work area must be defined separately..i hope the issue is solved...

Former Member
0 Kudos

Yes it's solved thank you for your help. I used completely other resolution for this case using just displaying new window starting at X Y.