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: 

interactive report

Former Member
0 Kudos

Could you all give me a complete example of interactive alv

7 REPLIES 7

Former Member
0 Kudos

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

Regards,

Ravi

note - Please mark all the helpful answers

0 Kudos

Hi ravi,

I am looking for the interactive report example not for alv yaar.......

thanks 7 regards....

bye.....

0 Kudos

START-OF-SELECTION.

WRITE 'Basic List'.

AT LINE-SELECTION.

WRITE 'Secondary List'.

TOP-OF-PAGE DURING LINE-SELECTION.

CASE sy-lsind.

WHEN 1.

WRITE 'First Secondary List'.

WHEN 2.

WRITE 'Second Secondary List'.

WHEN OTHERS.

WRITE: 'Secondary List, Level:', sy-lsind.

ENDCASE.

ULINE.

Click the list u will get 20 secondary list

0 Kudos

You should probably look at the post you have typed, more closely.

<b>Could you all give me a complete example of interactive <i>alv</i> </b><u></u>

http://www.sap-basis-abap.com/abap/check-boxes-in-an-interactive-report.htm

http://sap-img.com/abap/difference-between-drilldown-report-and-interactive-report.htm

Regards,

Ravi

Note - Please mark the helpful ansewrs

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

Check this link.You can find Dialog/Interactive program.

http://www.sap-img.com/abap.htm

0 Kudos

sorry ravi....

it was by mistake......

ya thanks for the link....

bye and take care....

Former Member
0 Kudos

&----


*& Report ZALVREPORT1

*&

&----


*&

*&

&----


REPORT zalvreport1.

class zclass_floc definition deferred. "for event handling.

TABLES : iflo,klah,kssk.

TYPES: BEGIN OF zalv6,

tplnr LIKE iflo-tplnr,

pltxt LIKE iflo-pltxt,

invnr LIKE iflo-invnr,

objnr LIKE iflo-objnr,

erdat LIKE iflo-erdat,

fltyp LIKE iflo-fltyp,

iwerk LIKE iflo-iwerk,

class LIKE klah-class,

clint LIKE kssk-clint,

END OF zalv6.

*tables : z98442empl.

*TYPES: BEGIN OF ztable,

  • empid LIKE z98442empl-empid,

  • location LIKE z98442empl-location,

  • pu like z98442empl-pu,

  • END OF ztable.

*

*DATA : itab TYPE STANDARD TABLE OF ztable.

*DATA : wa_itab TYPE ztable.

DATA : BEGIN OF itab1 OCCURS 0 ,

tplnr LIKE kssk-objek,

clint LIKE kssk-clint,

END OF itab1.

DATA : BEGIN OF itab3 OCCURS 0 ,

class LIKE klah-class,

clint LIKE kssk-clint,

END OF itab3.

DATA : itab TYPE STANDARD TABLE OF zalv6.

DATA : wa_itab TYPE zalv6.

DATA : wa_itab1 LIKE LINE OF itab1.

DATA : wa_itab3 LIKE LINE OF itab3.

DATA : ok_code LIKE sy-ucomm,

g_alvgrid TYPE REF TO cl_gui_alv_grid,

g_custom_control TYPE scrfname VALUE 'F_LOC',

g_container TYPE REF TO cl_gui_custom_container,

g_fieldcat TYPE lvc_t_fcat,

e_row TYPE lvc_s_row,

e_column TYPE lvc_s_col,

e_row_number TYPE lvc_s_roid.

--


CLASS DEFINITION--

CLASS zclass_floc DEFINITION .

PUBLIC SECTION .

CLASS-METHODS : handle_double_click

FOR EVENT double_click OF cl_gui_alv_grid

IMPORTING e_row e_column ,

handle_print_top_of_list

FOR EVENT print_top_of_list OF cl_gui_alv_grid .

ENDCLASS . "zclass_floc DEFINITION

*DATA : g_event_handler TYPE REF TO zclass_floc.

--


CLASS IMPLEMENTATION--

CLASS zclass_floc IMPLEMENTATION .

METHOD handle_double_click .

PERFORM handle_double_click USING e_row e_column e_row_number .

ENDMETHOD . "handle_double_click

METHOD handle_print_top_of_list .

PERFORM top_of_page .

ENDMETHOD . "handle_print_top_of_list

ENDCLASS . "zclass_floc IMPLEMENTATION

--


SELECTION-SCREEN DESIGN--

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-t01.

PARAMETERS: p_fltyp LIKE iflo-fltyp ,

p_tplnr LIKE iflo-tplnr OBLIGATORY ,

p_objnr LIKE iflo-objnr .

SELECTION-SCREEN END OF BLOCK b1.

*SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-t01.

*PARAMETERS: p_empid LIKE z98442empl-empid obligatory.

  • SELECTION-SCREEN END OF BLOCK b1.

*

--


IMPLEMENTATION OF AT-SELECTION-SCREEN EVENT--

AT SELECTION-SCREEN .

--


IMPLEMENTATION OF START-OF-SELECTION EVENT--

START-OF-SELECTION.

data : TPLNR type IFLO-TPLNR,

SPRAS type IFLO-SPRAS.

CALL FUNCTION 'ENQUEUE_EZIFLO'

EXPORTING

MODE_IFLO = 'X'

MANDT = SY-MANDT

TPLNR = TPLNR

SPRAS = SPRAS

  • X_TPLNR = ' '

  • X_SPRAS = ' '

  • _SCOPE = '2'

  • _WAIT = ' '

  • _COLLECT = ' '

EXCEPTIONS

FOREIGN_LOCK = 1

SYSTEM_FAILURE = 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.

break-point.

PERFORM fetchdata.

.

CALL FUNCTION 'DEQUEUE_EZIFLO'

EXPORTING

MODE_IFLO = 'X'

MANDT = SY-MANDT

TPLNR = TPLNR

SPRAS = SPRAS

  • X_TPLNR = ' '

  • X_SPRAS = ' '

  • _SCOPE = '3'

  • _SYNCHRON = ' '

  • _COLLECT = ' '

.

END-OF-SELECTION.

PERFORM display_alv.

--


CALLING SCREEN IN WHICH THE OUTPUT IS DISPLAYED--

CALL SCREEN 100.

&----


*& Form FETCHDATA

&----


  • text

----


FORM fetchdata.

BREAK-POINT.

SELECT tplnr

pltxt

invnr

objnr

erdat

fltyp

iwerk FROM iflo

INTO CORRESPONDING FIELDS OF TABLE itab

WHERE tplnr EQ p_tplnr.

*select empid

*location

*pu from z98442empl

*INTO CORRESPONDING FIELDS OF TABLE itab where empid EQ p_empid.

SELECT objek

clint FROM kssk

APPENDING TABLE itab1

WHERE objek EQ p_tplnr.

SELECT class

clint FROM klah

INTO TABLE itab3

FOR ALL ENTRIES IN itab1

WHERE clint = itab1-clint.

LOOP AT itab INTO wa_itab.

READ TABLE itab1 INTO wa_itab1 WITH KEY tplnr = wa_itab-tplnr.

READ TABLE itab3 INTO wa_itab3 WITH KEY clint = wa_itab1-clint.

wa_itab-class = wa_itab3-class.

wa_itab-clint = wa_itab3-clint.

MODIFY itab FROM wa_itab.

ENDLOOP.

IF sy-subrc NE 0.

MESSAGE 'no values found for the specified key. Press any key to exit' TYPE 'E' .

LEAVE PROGRAM.

ENDIF.

ENDFORM. "fetchdata

&----


*& Module display_alv OUTPUT

&----


  • text

----


MODULE display_alv OUTPUT.

ENDMODULE. "display_alv OUTPUT

&----


*& Form display_alv

&----


  • text

----


FORM display_alv.

SET PF-STATUS 'FLOC'.

SET TITLEBAR '100'.

IF g_alvgrid IS INITIAL.

--


CREATING CUSTOM CONTAINER INSTANCE--

CREATE OBJECT g_container

EXPORTING

container_name = g_custom_control.

--


CREATING ALV GRID INSTANCE--

CREATE OBJECT g_alvgrid

EXPORTING

i_parent = g_container.

--


PREPARING FIELD CATALOG--

PERFORM prepare_field_catalog CHANGING g_fieldcat .

--


CREATING EVENT HANDLER INSTANCE--

  • CREATE OBJECT g_event_handler.

--


ADDING ADDITIONAL FEATURES--

CALL METHOD g_alvgrid->set_table_for_first_display

EXPORTING

i_structure_name = 'ZALV6'

  • i_structure_name = 'Ztable'

CHANGING

it_outtab = itab

it_fieldcatalog = g_fieldcat.

  • ELSE.

CALL METHOD g_alvgrid->refresh_table_display

EXCEPTIONS

finished = 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.

--


SET EVENT HANDLERS--

SET HANDLER zclass_floc=>handle_double_click FOR g_alvgrid.

SET HANDLER zclass_floc=>handle_print_top_of_list FOR g_alvgrid.

ENDIF.

ENDFORM. "display_alv

&----


*& Form PREPARE_FIELD_CATALOG

&----


  • text

----


FORM prepare_field_catalog CHANGING g_fieldcat TYPE lvc_t_fcat.

DATA : ls_fcat TYPE lvc_s_fcat .

ls_fcat-fieldname = 'TPLNR'.

ls_fcat-ref_table = 'ZALV6'.

ls_fcat-coltext = 'functional location '.

APPEND ls_fcat TO g_fieldcat.

ls_fcat-fieldname = 'PLTXT'.

ls_fcat-ref_table = 'ZALV6'.

ls_fcat-coltext = 'functional location description'.

APPEND ls_fcat TO g_fieldcat.

ls_fcat-fieldname = 'INVNR'.

ls_fcat-ref_table = 'ZALV6'.

ls_fcat-coltext = 'inventory number '.

APPEND ls_fcat TO g_fieldcat.

ls_fcat-fieldname = 'OBJNR'.

ls_fcat-ref_table = 'ZALV6'.

ls_fcat-coltext = 'object number'.

APPEND ls_fcat TO g_fieldcat.

ls_fcat-fieldname = 'ERDAT'.

ls_fcat-ref_table = 'ZALV6'.

ls_fcat-coltext = 'Creation Date '.

APPEND ls_fcat TO g_fieldcat.

ls_fcat-fieldname = 'FLTYP'.

ls_fcat-ref_table = 'ZALV6'.

ls_fcat-coltext = 'Functional Location Category '.

APPEND ls_fcat TO g_fieldcat.

ls_fcat-fieldname = 'IWERK'.

ls_fcat-ref_table = 'ZALV6'.

ls_fcat-coltext = 'Maintenance planning plant '.

APPEND ls_fcat TO g_fieldcat.

ls_fcat-fieldname = 'CLASS'.

ls_fcat-ref_table = 'ZALV6'.

ls_fcat-coltext = 'Class name '.

APPEND ls_fcat TO g_fieldcat.

ls_fcat-fieldname = 'CLINT'.

ls_fcat-ref_table = 'ZALV6'.

ls_fcat-coltext = 'Internal class number '.

APPEND ls_fcat TO g_fieldcat.

  • ls_fcat-fieldname = 'empid'.

  • ls_fcat-ref_table = 'Ztable'.

  • ls_fcat-coltext = 'Maintenance planning plant '.

  • APPEND ls_fcat TO g_fieldcat.

*

  • ls_fcat-fieldname = 'location'.

  • ls_fcat-ref_table = 'Ztable'.

  • ls_fcat-coltext = 'Class name '.

  • APPEND ls_fcat TO g_fieldcat.

*

  • ls_fcat-fieldname = 'pu'.

  • ls_fcat-ref_table = 'Ztable'.

  • ls_fcat-coltext = 'Internal class number '.

  • APPEND ls_fcat TO g_fieldcat.

*

*

*

ENDFORM. "prepare_field_catalog

&----


*& Module DISPLAY_ALV INPUT

&----


  • text

----


MODULE display_alv INPUT.

CASE ok_code.

WHEN 'EXIT'.

LEAVE PROGRAM.

WHEN OTHERS.

CALL SCREEN 100.

ENDCASE.

CLEAR ok_code.

ENDMODULE. "display_alv INPUT

&----


*& Form EXIT

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM exit .

CALL SCREEN 100.

ENDFORM. "EXIT

&----


*& Form handle_double_click

&----


  • text

----


FORM handle_double_click USING e_row TYPE lvc_s_row

e_column TYPE lvc_s_col

e_row_number TYPE lvc_s_roid.

DATA : itab5 TYPE zalv6.

  • DATA : itab5 TYPE ztable.

*

READ TABLE itab INTO itab5 INDEX e_row-index.

IF sy-subrc = 0 AND e_column-fieldname EQ 'TPLNR' .

  • READ TABLE itab INTO itab5 INDEX e_row-index.

  • IF sy-subrc = 0 AND e_column-fieldname EQ 'empid' .

SET PARAMETER ID 'FLD' FIELD itab5-tplnr.

  • SET PARAMETER ID 'FLD' FIELD itab5-empid.

CALL TRANSACTION 'ZALVSCRIPT_98341' AND SKIP FIRST SCREEN .

ENDIF.

ENDFORM. "handle_double_click

&----


*& Form top_of_page

&----


  • text

----


FORM top_of_page .

WRITE : / ' FUNCTIONAL LOCATION DETAILS :'.

ENDFORM. "top_of_page

pls reward points if useful

palak