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

New ALV report development

Former Member
0 Likes
1,005

Hi gurus,

iam new to abap.

i have a requirement to develop a report program. the layout is:

palnt :_________

date:__________

1.initial report(button)

2.category wise(button)

3.per plant(button).

the above are the fields in my report.

when i enter the plant and date, and press any of the buttons, the report should be displayed within the same screen below the selection data itself..

the report is alv type, So overall my report goes with only one screen. So please guide me how to start with the navigation between the buttons and the screen.

please give a detailed explanation and not the ex codes.

points will be rewarded.

chaitu

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
960

U need to create a Module pool and define 2 subscreen areas.

in one subscreen area u have the selection-screen and in the other subscreen area u will display the ALV report.

so get goin with the module pool

pk

U need to create a Module pool and define 2 subscreen areas.

in one subscreen area u have the selection-screen and in the other subscreen area u will display the ALV report.

so get goin with the module pool

pk

6 REPLIES 6
Read only

Former Member
0 Likes
961

U need to create a Module pool and define 2 subscreen areas.

in one subscreen area u have the selection-screen and in the other subscreen area u will display the ALV report.

so get goin with the module pool

pk

Read only

Former Member
0 Likes
960

Hi.

Refer this code.

REPORT ZALV_INTMENUTOOL.

*Author : Swarna.S.

*AS : Simple ALV with user defined menu in toolbar

  • Published at SAPTechnical.COM

*Class declarations

CLASS lcl_event_receiver DEFINITION DEFERRED.*type pool declarations

TYPE-POOLS : icon.*Internal table and work area declarations for dd02l

DATA: it_dd02l TYPE TABLE OF dd02l,

wa_dd02l TYPE dd02l.*Data declaration for alv.

DATA :it_layout TYPE lvc_s_layo,

it_toolbar TYPE stb_button,

c_alv TYPE REF TO cl_gui_alv_grid,

custom_container TYPE REF TO cl_gui_custom_container,

event_receiver TYPE REF TO lcl_event_receiver.*Select options multiple values no ranges

SELECT-OPTIONS : s_table FOR wa_dd02l-tabname NO INTERVALS.*Initialization event

INITIALIZATION.*Start of selection event

START-OF-SELECTION.*sUBROUTINE FOR ALV DISPLAY

PERFORM alvdisplay.*Class definition

CLASS lcl_event_receiver DEFINITION. PUBLIC SECTION.

CLASS-METHODS:*handling toolbar for interactive

handle_toolbar

FOR EVENT toolbar OF cl_gui_alv_grid

IMPORTING e_object e_interactive,*handling menu button

handle_menu_button

FOR EVENT menu_button OF cl_gui_alv_grid

IMPORTING e_object e_ucomm,*On click of the menu button

handle_user_command

FOR EVENT user_command OF cl_gui_alv_grid

IMPORTING e_ucomm. PRIVATE SECTION.ENDCLASS. "lcl_event_receiver DEFINITION*Class implementation

CLASS lcl_event_receiver IMPLEMENTATION. METHOD handle_toolbar.* handle toolbar CLEAR it_toolbar. MOVE 'DETAIL' TO it_toolbar-function.

MOVE icon_detail TO it_toolbar-icon.

MOVE 2 TO it_toolbar-butn_type.

APPEND it_toolbar TO e_object->mt_toolbar. ENDMETHOD. "handle_toolbar METHOD handle_menu_button.* handle own menubuttons

IF e_ucomm = 'DETAIL'.

CALL METHOD e_object->add_function

EXPORTING

fcode = 'DISPLAY'

text = 'DISPLAY'.

ENDIF.

ENDMETHOD. "handle_menu_button METHOD handle_user_command.

*On click

CASE e_ucomm.

WHEN 'DISPLAY'.

MESSAGE 'Menu Clicked' TYPE 'I'.

ENDCASE.

ENDMETHOD. "handle_user_command

ENDCLASS. "lcl_event_receiver IMPLEMENTATION&----


*& Module PBO OUTPUT

&----


  • text

----


MODULE pbo OUTPUT.

IF custom_container IS INITIAL.

  • select data from table dd02l

PERFORM fetch_dd02l.* create a custom container control for our ALV Control

CREATE OBJECT custom_container

EXPORTING

container_name = 'CCONT'.* create an instance of alv control

CREATE OBJECT c_alv

EXPORTING i_parent = custom_container.* Set a titlebar for the grid control it_layout-grid_title = 'TABLE DETAILS'.*ALV display

CALL METHOD c_alv->set_table_for_first_display

EXPORTING

i_structure_name = 'dd02l'

is_layout = it_layout

CHANGING

it_outtab = it_dd02l.*Handlers for the events

CREATE OBJECT event_receiver.

SET HANDLER event_receiver->handle_user_command

event_receiver->handle_menu_button

event_receiver->handle_toolbar FOR ALL INSTANCES.*Calling the interactive toolbar method of ALV

CALL METHOD c_alv->set_toolbar_interactive.

ENDIF.ENDMODULE. " PBO OUTPUT

&----


*& Module PAI INPUT

&----


  • text

----


MODULE pai INPUT.ENDMODULE. " PAI INPUT&----


*& form fetch_dd02l

&----


  • text

----


*Subroutine to fetch data

FORM fetch_dd02l. SELECT * FROM dd02l INTO CORRESPONDING FIELDS OF TABLE it_dd02l WHERE tabname IN s_table.

ENDFORM. " SELECT_TABLE_dd02l

&----


*& Form ALVDISPLAY

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM alvdisplay .* ALV output

SET SCREEN 600.ENDFORM. " ALVDISPLAY

Reward all helpfull answers.

Regards.

Jay.

Read only

0 Likes
960

Can i acheive my task using Exceutable program(report prog).

if so please suggest me , how to go

Read only

Former Member
0 Likes
960

this is a simple pgm i developed a loooong time ago for subscreen areas.

check it out.

&----


*& Module pool ZPK_SUB_SCREEN *

*& *

&----


*& *

*& *

&----


PROGRAM ZPK_SUB_SCREEN.

CONTROLS: TABC TYPE TABLEVIEW USING SCREEN 1002.

DATA: TCODE(4) TYPE C,

BEGIN OF WA_T001,

BUKRS TYPE BUKRS,

BUTXT TYPE BUTXT,

END OF WA_T001,

IT_T001 LIKE TABLE OF WA_T001,

WA_MARA TYPE MARA,

IT_MARA LIKE TABLE OF WA_MARA.

&----


*& Module STATUS_1000 OUTPUT

&----


  • text

----


module STATUS_1000 output.

SET PF-STATUS 'MY_STATUS'.

  • SET TITLEBAR 'xxx'.

CASE SY-UCOMM.

WHEN 'BACK'.

LEAVE PROGRAM.

ENDCASE.

endmodule. " STATUS_1000 OUTPUT

&----


*& Module USER_COMMAND_1001 INPUT

&----


  • text

----


module USER_COMMAND_1001 input.

CASE SY-UCOMM.

WHEN 'EXE'.

CALL TRANSACTION TCODE.

ENDCASE.

endmodule. " USER_COMMAND_1001 INPUT

&----


*& Module USER_COMMAND_1002 INPUT

&----


  • text

----


module USER_COMMAND_1002 input.

CASE SY-UCOMM.

WHEN 'DISP'.

SELECT BUKRS BUTXT INTO TABLE IT_T001 FROM T001 UP TO 10 ROWS.

ENDCASE.

endmodule. " USER_COMMAND_1002 INPUT

&----


*& Module USER_COMMAND_1003 INPUT

&----


  • text

----


module USER_COMMAND_1003 input.

CASE SY-UCOMM.

WHEN 'ALV'.

SELECT * INTO TABLE IT_MARA FROM MARA UP TO 5 ROWS.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = 'SY-CPROG'

I_STRUCTURE_NAME = 'MARA'

TABLES

t_outtab = IT_MARA.

ENDCASE.

endmodule. " USER_COMMAND_1003 INPUT

MAIN SCREEN FLOW LOGIC

**********************

PROCESS BEFORE OUTPUT.

MODULE STATUS_1000.

CALL SUBSCREEN: SS1 INCLUDING SY-REPID '1001',

SS2 INCLUDING SY-REPID '1002',

SS3 INCLUDING SY-REPID '1003'.

PROCESS AFTER INPUT.

CALL SUBSCREEN: SS1, SS2, SS3.

  • MODULE USER_COMMAND_1000.

SUBSCREEN1 FLOW LOGIC

*********************

PROCESS BEFORE OUTPUT.

  • MODULE STATUS_1001.

*

PROCESS AFTER INPUT.

MODULE USER_COMMAND_1001.

SUBSCREEN2 FLOW LOGIC

*********************

PROCESS BEFORE OUTPUT.

  • MODULE STATUS_1002.

LOOP AT IT_T001 INTO WA_T001 WITH CONTROL TABC

CURSOR TABC-TOP_LINE.

ENDLOOP.

PROCESS AFTER INPUT.

LOOP.

ENDLOOP.

MODULE USER_COMMAND_1002.

SUBSCREEN2 FLOW LOGIC

*********************

PROCESS BEFORE OUTPUT.

  • MODULE STATUS_1003.

*

PROCESS AFTER INPUT.

MODULE USER_COMMAND_1003.

pk

Read only

Former Member
0 Likes
960

hi,

for navigation between the buttons and the screen u need to create a PF_status bar...... and pass it to REUSE_ALV_GRID_DISPLAY FM while calling alv and also a user command to it

this fields in the FM call

i_callback_pf_status_set = 'SET_PF_STATUS'

i_callback_user_command = 'USER_COMMAND'

FORM set_pf_status USING rt_extab TYPE slis_t_extab.

SET PF-STATUS 'TOOLBAR_1' .

ENDFORM. "set_pf_status

FORM user_command USING r_ucomm TYPE sy-ucomm

rs_selfield TYPE slis_selfield.

CASE sy-ucomm.

WHEN 'BACK'.

LEAVE TO SCREEN 1000.

WHEN 'CHECK'.

ENDCASE.

ENDFORM. "user_command

this will allow to navigate from ALv screen to the screen where u enter values...... the BACK button on the ALV screen.....

reward points if useful.......

Read only

Former Member
0 Likes
960

s