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

Need help in Interactive Report

Former Member
0 Likes
1,508

hi,

i am using a ALV report now i want to make it interactive. as i click on the current page i need to go MIR4 transaction. how can i do it?

please please help on this issue.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,476

to make an alv interactive i did the following steps

try it by yourself then only u can learn dont copy and paste the code

step1: declare an iternal table and work area of the type

data: it_events type standard table of slis_t_alv_events,

wa_events like line of it_data.

step2: use the function module

reuse_alv_get_events

and pass the internal table to the fm so that u will get all the events in an internal table . This internal table will have 2 fields like name and form. In the name field u will have all the names of events like

top_of_page,end_of_page,user_command etc

so what ever event u want to use modify the internal table according it.For example if u want to use user_command.

read the internal table it_events into wa_events with key name eq 'USER_COMMAND'.

after reading the internal table

move 'f_user_command' to wa_events-form.

then modify the internal table according to it

modify it_events from wa_events transporting form.

after this the internal table will have name = USER_COMMAND and

form = 'f_user_command'.

call this form anywhere in the program

form f_user_command using r_ucomm like sy-ucomm

rs_selfield like slis_selfield.

case r_ucomm.

write u r code as appropiate

WHEN '&IC1'.

SET parameter ID 'AUN' FIELD rs_selfield-value.( aun is the parameter id for the field for which u r clicking depending on that select the parameter id)

CALL TRANSACTION 'VA02' AND SKIP FIRST SCREEN.

ENDIF.

13 REPLIES 13
Read only

Former Member
0 Likes
1,476

Hi Poonam,

Check this link for sample code:

http://www.sap-img.com/abap/an-interactive-alv-report.htm

Hope this helps you.

Regards,

Chandra Sekhar

Read only

Former Member
0 Likes
1,476

This message was moderated.

Read only

Former Member
Read only

Former Member
0 Likes
1,476

Hi ,

There is a very easy way to do it.

If you are clicking on the page, for example you are clicking on a particular column, after that you just

CALL TRANSACTION 'XXX' ( Whatever transaction you want)

SKIP INITIAL SCREEN.

That would do the trick.

Regards,

Khan.

Read only

0 Likes
1,476

where should i write this user command. i mean before alv display or where?

Read only

0 Likes
1,476

hi this is written in the use command..

FORM USER_COMMAND USING F_UCOMM LIKE SY-UCOMM I_SELFIELD TYPE SLIS_SELFIELD.

CASE F_UCOMM.

WHEN 'DATA.

CALL TRANSACTION 'MIR4' AND SKIP FIRST SCREEN.

ENDCASE.

ENDFORM.

Read only

0 Likes
1,476

thanks,

but what is DATA here?

Read only

0 Likes
1,476

Check the sample code.

In this example when i click on the sales order number, i am navigation to The transaction VA03.

REPORT  ztest_alv.

TYPE-POOLS:slis.
DATA:it_fieldcat  TYPE  slis_t_fieldcat_alv,
     wa_field LIKE LINE OF it_fieldcat.
DATA: BEGIN OF it_likp OCCURS 0,
       vbeln TYPE likp-vbeln,
      END OF it_likp.

wa_field-fieldname = 'VBELN'.
wa_field-tabname = 'IT_LIKP'.
wa_field-hotspot = 'X'.
APPEND wa_field TO it_fieldcat.

SELECT vbeln FROM likp
UP TO 10 ROWS
INTO TABLE it_likp.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
  EXPORTING
    i_callback_program      = sy-repid
    i_callback_user_command = 'USER_COMMAND'
    it_fieldcat             = it_fieldcat
  TABLES
    t_outtab                = it_likp
  EXCEPTIONS
    program_error           = 1.

*&---------------------------------------------------------------------*
*&      Form  user_Command
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->UCOMM      text
*      -->SELFIELD   text
*----------------------------------------------------------------------*
FORM user_command USING ucomm TYPE sy-ucomm
                    selfield TYPE slis_selfield.
  CASE ucomm.

    WHEN '&IC1'.
     IF selfield-fieldname = 'VBELN'.
      SET PARAMETER ID 'VL'  FIELD selfield-value.
      CALL TRANSACTION 'VL02N' AND SKIP FIRST SCREEN.
    ENDIF.
  ENDCASE.

ENDFORM. "user_Command

Read only

0 Likes
1,476

Hi,

Its function code value for sy-ucomm which is passed to that FM.

Read only

Former Member
0 Likes
1,476

hi check this program..

use CALL TRANSACTION 'MIR4' AND SKIP FIRST SCREEN.

in the usercommand ...

http://www.sap-basis-abap.com/abap/to-call-transaction-in-alv.htm

Read only

Former Member
0 Likes
1,477

to make an alv interactive i did the following steps

try it by yourself then only u can learn dont copy and paste the code

step1: declare an iternal table and work area of the type

data: it_events type standard table of slis_t_alv_events,

wa_events like line of it_data.

step2: use the function module

reuse_alv_get_events

and pass the internal table to the fm so that u will get all the events in an internal table . This internal table will have 2 fields like name and form. In the name field u will have all the names of events like

top_of_page,end_of_page,user_command etc

so what ever event u want to use modify the internal table according it.For example if u want to use user_command.

read the internal table it_events into wa_events with key name eq 'USER_COMMAND'.

after reading the internal table

move 'f_user_command' to wa_events-form.

then modify the internal table according to it

modify it_events from wa_events transporting form.

after this the internal table will have name = USER_COMMAND and

form = 'f_user_command'.

call this form anywhere in the program

form f_user_command using r_ucomm like sy-ucomm

rs_selfield like slis_selfield.

case r_ucomm.

write u r code as appropiate

WHEN '&IC1'.

SET parameter ID 'AUN' FIELD rs_selfield-value.( aun is the parameter id for the field for which u r clicking depending on that select the parameter id)

CALL TRANSACTION 'VA02' AND SKIP FIRST SCREEN.

ENDIF.

Read only

ankurgodre
SAP Mentor
SAP Mentor
0 Likes
1,476

Hi Poonam,

I've got a few very simple steps for making ALV interactive , so that it calls up a transaction code on user interaction (double click on a field):

After the FM: 'REUSE_ALV_GRID_DISPLAY' do the follwing in ur code:

FORM user_command USING f_ucomm LIKE sy-ucomm i_selfield TYPE slis_selfield.

CHECK f_ucomm = '&IC1 '.

CHECK i_selfield-tabindex > 0.

READ TABLE itab INDEX i_selfield-tabindex.

CHECK sy-subrc = 0.

CHECK NOT itab-kunnr IS INITIAL.

SET PARAMETER ID 'KUN' FIELD itab-kunnr.

SET PARAMETER ID 'BUK' FIELD itab-bukrs.

CALL TRANSACTION 'FD03' AND SKIP FIRST SCREEN.

ENDFORM. "USER_COMMAND

I've used this example from my a code written by myself which works perfectly fine...U can replace ITAB-KUNNR & ITAB_BI-UKRS by your internal table & fields for which u want interactive action to take place....Also plz replace the Tcode: FD03 by your Tcode which u want to call..

Hope it resolves ur problem..

Regards

Ankur Godre