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

steps to create interactive alv report

Former Member
0 Likes
6,477

plz tell me the steps needed to create interactive alv report. explaining the importance of events. please tell me with suitable example

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
4,453

Hi

<b>Interactive Reporting</b>

-User can actively control the data retrieval and display of data

-To create a detailed list from a very basic list

-To make a report interactive with another transaction.

-The detailed data is written on a secondary list.

-The secondary list may either completely overlay the first screen or one can display it in a new screen

-The secondary lists can be themselves interactive.

-The first list may also call a transaction.

There are different <b>events</b> associated with interactive programming

<b>At Line-Selection-Event</b> is triggered by either the user double clicking a particular line or using F2 to select it

<b>At User-Command-Event</b> triggered by user pressing a function key

<b>At PFn</b>

Where n is between 0 to 99-Event triggered on press of a function key.

The position of the cursor in the list is irrelevant.

<b>Top-of-Page during Line Selection</b>-Event called during list processing when a detailed list is called

<b>have a look at demo programs</b>

DEMO_LIST_INTERACTIVE_1

DEMO_LIST_INTERACTIVE_2

DEMO_LIST_INTERACTIVE_3

DEMO_LIST_INTERACTIVE_4

DEMO_LIST_HIDE

<b>reward points for useful ans</b>

Regards

Vivek

3 REPLIES 3
Read only

Former Member
0 Likes
4,453

Check the below Link :

See example code :

REPORT ZTEST MESSAGE-ID ZZ NO STANDARD PAGE HEADING.

TABLES:VBAK.

DATA: BEGIN OF IT_VBAK OCCURS 0,

VBELN LIKE VBAK-VBELN,

ERDAT LIKE VBAK-ERDAT,

END OF IT_VBAK.

DATA: BEGIN OF IT_VBAP OCCURS 0,

VBELN LIKE VBAP-VBELN,

POSNR LIKE VBAP-POSNR,

MATNR LIKE VBAP-MATNR,

END OF IT_VBAP.

DATA: FIELDNAME(20),

VALUE(10).

SELECT-OPTIONS:S_VBELN FOR VBAK-VBELN.

START-OF-SELECTION.

SELECT VBELN

ERDAT

FROM VBAK

INTO TABLE IT_VBAK

WHERE VBELN IN S_VBELN.

IF SY-SUBRC = 0.

SORT IT_VBAK BY VBELN.

ENDIF.

IF NOT IT_VBAK[] IS INITIAL.

SELECT VBELN

POSNR

FROM VBAP

INTO TABLE IT_VBAP

FOR ALL ENTRIES IN IT_VBAK

WHERE VBELN = IT_VBAK-VBELN.

ENDIF.

TOP-OF-PAGE.

WRITE: 'SALES ORDER',

'CREATION DATE'.

END-OF-SELECTION.

PERFORM WRITE_LIST.

AT LINE-SELECTION.

SET PF-STATUS 'STAT'. " This is important

GET CURSOR FIELD FIELDNAME VALUE VALUE.

IF FIELDNAME = 'IT_VBAK-VBELN' .

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

INPUT = VALUE

IMPORTING

OUTPUT = VALUE(10).

  • SET PARAMETER ID 'AUN' FIELD VALUE.

  • CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.

LOOP AT IT_VBAP WHERE VBELN = VALUE.

WRITE:/ IT_VBAP-VBELN,

IT_VBAP-POSNR.

ENDLOOP.

ENDIF.

AT USER-COMMAND.

CASE SY-UCOMM.

WHEN 'BACK1' OR 'CANC1' OR 'EXIT1'.

sy-lsind = 0.

PERFORM WRITE_LIST.

WHEN 'REFR'.

SY-LSIND = 0.

PERFORM WRITE_LIST.

ENDCASE.

&----


*& Form WRITE_LIST

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM WRITE_LIST .

IF NOT IT_VBAK[] IS INITIAL.

LOOP AT IT_VBAK.

WRITE:/ IT_VBAK-VBELN,

IT_VBAK-ERDAT.

ENDLOOP.

ELSE.

MESSAGE I000 WITH 'NO DATA FOUND'.

ENDIF.

ENDFORM. " WRITE_LIST

Thanks

Seshu

Read only

Former Member
0 Likes
4,454

Hi

<b>Interactive Reporting</b>

-User can actively control the data retrieval and display of data

-To create a detailed list from a very basic list

-To make a report interactive with another transaction.

-The detailed data is written on a secondary list.

-The secondary list may either completely overlay the first screen or one can display it in a new screen

-The secondary lists can be themselves interactive.

-The first list may also call a transaction.

There are different <b>events</b> associated with interactive programming

<b>At Line-Selection-Event</b> is triggered by either the user double clicking a particular line or using F2 to select it

<b>At User-Command-Event</b> triggered by user pressing a function key

<b>At PFn</b>

Where n is between 0 to 99-Event triggered on press of a function key.

The position of the cursor in the list is irrelevant.

<b>Top-of-Page during Line Selection</b>-Event called during list processing when a detailed list is called

<b>have a look at demo programs</b>

DEMO_LIST_INTERACTIVE_1

DEMO_LIST_INTERACTIVE_2

DEMO_LIST_INTERACTIVE_3

DEMO_LIST_INTERACTIVE_4

DEMO_LIST_HIDE

<b>reward points for useful ans</b>

Regards

Vivek

Read only

Former Member
0 Likes
4,453

Hello Yogesh,

I did not see as you mentioned Interactive ALV , sorry for wrong reply.

Please use proper parameter to function module ,here you need to use user command,this user command will call form routine(Dynamic) ,here you can do whatever ,below example one interactive ,if user clicks on material it will goto MM02 transaction.

See the simple example one in ALV :

REPORT Z_GET_REFRESH no standard page heading.

type-pools : slis.

tables : makt,

mara.

data : i_fieldcat type slis_t_fieldcat_alv.

data : begin of i_makt occurs 0,

matnr like makt-matnr,

maktx like makt-maktx,

end of i_makt.

data : v_repid like sy-repid,

g_user_command type slis_formname value 'USER_COMMAND',

g_status_set type slis_formname value 'SET_PF_STATUS'.

DATA:LC_GLAY TYPE LVC_S_GLAY.

select-options s_matnr for mara-matnr .

start-of-selection.

select matnr maktx from makt into table i_makt

where matnr in s_matnr.

end-of-selection.

  • Fill the fieldcatlog

perform fill_field.

  • Call the FM

perform call_fm.

&----


*& Form fill_field

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM fill_field.

data wa_fieldcat type slis_fieldcat_alv.

clear : wa_fieldcat.

wa_fieldcat-tabname = 'I_MAKT'.

wa_fieldcat-fieldname = 'MATNR'.

wa_fieldcat-outputlen = '18'.

wa_fieldcat-seltext_l = 'Material #'.

wa_fieldcat-col_pos = '1'.

append wa_fieldcat to i_fieldcat.

clear : wa_fieldcat.

wa_fieldcat-tabname = 'I_MAKT'.

wa_fieldcat-fieldname = 'MAKTX'.

wa_fieldcat-outputlen = '40'.

wa_fieldcat-seltext_l = 'Material Desc'.

wa_fieldcat-col_pos = '2'.

append wa_fieldcat to i_fieldcat.

ENDFORM. " fill_field

&----


*& Form call_fm

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM call_fm.

v_repid = sy-repid.

LC_GLAY-EDT_CLL_CB = 'X'.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE = ' '

I_CALLBACK_PROGRAM = v_repid

I_CALLBACK_PF_STATUS_SET = g_status_set

I_CALLBACK_USER_COMMAND = g_user_command

  • I_CALLBACK_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_END_OF_LIST = ' '

  • I_STRUCTURE_NAME =

  • I_BACKGROUND_ID = ' '

  • I_GRID_TITLE =

I_GRID_SETTINGS = LC_GLAY

  • IS_LAYOUT =

IT_FIELDCAT = i_fieldcat

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • IT_SORT =

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_DEFAULT = 'X'

  • I_SAVE = ' '

  • IS_VARIANT =

  • IT_EVENTS =

  • IT_EVENT_EXIT =

  • IS_PRINT =

  • IS_REPREP_ID =

  • I_SCREEN_START_COLUMN = 0

  • I_SCREEN_START_LINE = 0

  • I_SCREEN_END_COLUMN = 0

  • I_SCREEN_END_LINE = 0

  • IT_ALV_GRAPHICS =

  • IT_ADD_FIELDCAT =

  • IT_HYPERLINK =

  • I_HTML_HEIGHT_TOP =

  • I_HTML_HEIGHT_END =

  • IT_EXCEPT_QINFO =

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

TABLES

T_OUTTAB = i_makt

EXCEPTIONS

PROGRAM_ERROR = 1

OTHERS = 2

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDFORM. " call_fm

----


  • FORM USER_COMMAND *

----


FORM user_command USING r_ucomm LIKE sy-ucomm

rs_selfield TYPE slis_selfield. "#EC CALLED

data i_RSPARAMS like RSPARAMS occurs 0.

CASE R_UCOMM.

WHEN '&IC1'.

read table i_makt index rs_selfield-tabindex.

SET PARAMETER ID 'MAT' FIELD i_makt-matnr.

if not i_makt-matnr is initial.

call transaction 'MM02' and skip first screen.

endif.

when 'REFRESH'.

CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'

EXPORTING

CURR_REPORT = v_repid

  • IMPORTING

  • SP =

TABLES

SELECTION_TABLE = i_RSPARAMS

EXCEPTIONS

NOT_FOUND = 1

NO_REPORT = 2

OTHERS = 3

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

submit z_get_refresh with selection-table i_RSPARAMS.

rs_selfield-refresh = 'X'.

*

ENDCASE.

MOVE 'REFRESH' TO r_ucomm.

ENDFORM.

----


  • FORM set_pf_status *

----


FORM SET_PF_STATUS USING rt_extab TYPE slis_t_extab.

SET PF-STATUS 'ZSTANDARD' EXCLUDING rt_extab.

SET TITLEBAR sy-tcode.

ENDFORM.

Thanks

Seshu