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: 

User command in ALV grid

Former Member
0 Kudos

Hi

I am displaying the output of a report in the ALV grid.

I have used REUSE_ALV_LIST_DISPLAY in my code as follows.

FORM DISPLAY_ALV_LIST.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = SYREPID

IS_LAYOUT = FIELDLAYOUT

I_CALLBACK_USER_COMMAND = 'USER-COMMAND'

IT_FIELDCAT = FIELDCATALOG[]

I_SAVE = 'X'

IT_EVENTS = EVENTSTAB[]

TABLES

T_OUTTAB = ITAB_1

EXCEPTIONS

PROGRAM_ERROR = 1

OTHERS = 2.

ENDFORM. " DISPLAY_ALV_LIST

When I try to call a transaction at the user command with sy-ucomm = &IC1 sys gives a message 'Not valid'.

FORM USER-COMMAND USING UCOMM LIKE SY-UCOMM

SELFIELD TYPE SLIS_SELFIELD.

READ TABLE ITAB_1 INDEX SELFIELD-TABINDEX.

CHECK SY-SUBRC = 0.

CASE UCOMM.

WHEN '&IC1'.

CASE SELFIELD-SEL_TAB_FIELD.

WHEN 'ITAB_1-VBELN'.

SET PARAMETER ID 'VF' FIELD ITAB_1-VBELN.

CALL TRANSACTION 'VF03' AND SKIP FIRST SCREEN.

WHEN 'ITAB_1-MATNR'.

SET PARAMETER ID 'MAT' FIELD ITAB_1-MATNR.

CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.

ENDCASE.

ENDCASE.

ENDFORM. "USER_COMMAND

Kindly let me know what am I missing in the above code. As this FORM USER-COMMAND is at all called during the user-command.

Regds

Priya

1 ACCEPTED SOLUTION

Former Member
0 Kudos

the Code what u are given is WRONG , check this one.

put like this , it will solve ur probs.

  check r_ucomm = '&IC1'.             "User Double Clicked on Some field
  check not rs_selfield-value is initial.

  case rs_selfield-fieldname.

    when 'AUFNR'.
      if rad4 ne 'X'.
        read table  itab_order index rs_selfield-tabindex.
      else.
        read table  itab_order2 index rs_selfield-tabindex.
        itab_order-aufnr = itab_order2-aufnr.
      endif.

      if sy-subrc eq 0.
        set parameter id 'ANR' field  itab_order-aufnr.
        set parameter id 'VGN' field '10'.
        call transaction 'CO14' and skip first screen.
      endif.                            " IF SY-SUBRC EQ 0
  endcase.

Regards

Prabhu

Message was edited by: Prabhu Peram

4 REPLIES 4

Former Member
0 Kudos

the Code what u are given is WRONG , check this one.

put like this , it will solve ur probs.

  check r_ucomm = '&IC1'.             "User Double Clicked on Some field
  check not rs_selfield-value is initial.

  case rs_selfield-fieldname.

    when 'AUFNR'.
      if rad4 ne 'X'.
        read table  itab_order index rs_selfield-tabindex.
      else.
        read table  itab_order2 index rs_selfield-tabindex.
        itab_order-aufnr = itab_order2-aufnr.
      endif.

      if sy-subrc eq 0.
        set parameter id 'ANR' field  itab_order-aufnr.
        set parameter id 'VGN' field '10'.
        call transaction 'CO14' and skip first screen.
      endif.                            " IF SY-SUBRC EQ 0
  endcase.

Regards

Prabhu

Message was edited by: Prabhu Peram

Former Member
0 Kudos

Hi,

Please pass the below constant to user command in REUSE_ALV_LIST_DISPLAY

constant: gc_user_command type slis_formname value 'USER_COMMAND'.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

I_CALLBACK_USER_COMMAND = GC_USER_COMMAND.

i think the above is working with out any errors.

Rewards if helpfull.

Regards,

Subbarao

Former Member
0 Kudos

Hi

The issue is the form itself is not called after the cick on the output. I have activated the Hotspot on the fiest field and I get only the details in a pop up whereas my requirement is to call the transaction.

Kindly suggest to acheive the same.

regds

priya.

0 Kudos

Hi priya,

1. Probably, Single-Click (HOTSPOT)

won't callback our form routine.

2. Atleast a double-click

or a PF-code from toolbar,

is required,

so that our form routine is called back.

regards,

amit m.