Simple alv report displaying double click on that goto application
HI Experts,
i will working for that simple alv display the report . when ever user double click on that go to next scren . i will work for ECC 6.0 and function module is REUSE_ALV_LIST_DISPLAY i will write the logic is
at user-command
SET PARAMETER ID 'LIF' VALUE FVAL.
CALL TRANSACTION 'LF03' AND SKIP FIRST SCREEN.
so any body plz help me.
advance thanking u.
Hi
try this code...
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = W_PROG
I_CALLBACK_USER_COMMAND = 'PICK'
I_STRUCTURE_NAME = 'EKKO'
TABLES
T_OUTTAB = T_EKKO
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.
*& Form pick
* -->UCOMM text
* -->SELFIELD text
FORM PICK USING COMMAND LIKE SY-UCOMM
SELFIELD TYPE SLIS_SELFIELD.
READ TABLE T_EKKO INTO FS_EKKO INDEX SELFIELD-TABINDEX.
CASE COMMAND.
WHEN '&IC1'.
SET PARAMETER ID 'LIF' VALUE FS_EKKO-EBELN. "here write your field name
CALL TRANSACTION 'LF03' AND SKIP FIRST SCREEN.
Similar Messages
-
In ALV reports how double click event works?
in ALV reports how double click event works? Explain in detail.....
hi,
last lines is used for clicking
*& Report Z_SWAS_FUNCTIONAL
report z_swas_functional.
tables: qmel,viqmel,iloa,afko.
-- global data declerations--
data: ok_code like sy-ucomm,
gt_itab type table of zfunctional,
t_output type table of zfunctional,
g_container type scrfname value 'CUSTOM_CONTROL',
grid1 type ref to cl_gui_alv_grid,
g_custom_container type ref to cl_gui_custom_container,
e_row type lvc_s_row,
e_column type lvc_s_col,
es_row_no type lvc_s_roid.
*CLASS DECLARATION
class z_functional definition.
public section.
class-methods : handle_double_click
for event double_click of cl_gui_alv_grid
importing e_row e_column.
endclass.
*CLASS IMPLEMENTATION
class z_functional implementation.
method handle_double_click.
perform handle_double_click using e_row e_column es_row_no.
endmethod.
endclass.
*CODE FOR SELECTION SCREEN
selection-screen begin of block 84433 with frame title text-t01.
parameters : n_number like viqmel-qmnum,
n_type like qmel-qmart,
f_loca like iloa-tplnr,
name like qmel-qmnam.
selection-screen end of block 84433.
screen validation event *
at selection-screen on n_number.
select single *
from viqmel
where qmnum eq n_number.
if sy-subrc ne 0.
MESSAGE 'NOTIFICATION NUMBER DOESNOT EXIST' TYPE 'E'.
endif.
select qmart from qmel into qmel where qmart eq N_TYPE.
endselect.
if sy-subrc ne 0.
MESSAGE 'NOTIFICATION TYPE DOES NOT EXIST' TYPE 'E'.
endif.
*START OF SELECTION EVENT
start-of-selection.
perform fetchdata.
end-of-selection.
*Call screen event
call screen 100.
*PERFORM DISPLAY.
*& Form FETCHDATA
text
--> p1 text
<-- p2 text
form fetchdata .
*SELECT VIQMEL~QMNUM VIQMEL~QMTXT VIQMEL~QMDAT VIQMEL~LTRMN VIQMEL~PRIOK
VIQMELBEZDT VIQMELAUFNR VIQMELTPLNR AFKOGLTRP into corresponding fields of table GT_ITAB
FROM VIQMEL INNER JOIN AFKO ON VIQMELAUFNR = AFKOAUFNR
WHERE VIQMELQMNUM IN N_NUMBER and VIQMELQMART IN N_TYPE AND VIQMEL~QMNAM IN NAME.
call function 'ZSWAS_TEST'
exporting
qmnum = n_number
qmart = n_type
tplnr = f_loca
qmnam = name
tables
output = gt_itab
if sy-subrc ne 0.
message e000(z84433_msg_class).
endif.
endform. " FETCHDATA
*& Module STATUS_0100 OUTPUT
text
module status_0100 output.
set pf-status 'MAIN'.
SET TITLEBAR 'xxx'.
*creating custom container and grid instance
if g_custom_container is initial.
create object g_custom_container
exporting container_name = g_container.
create object grid1
exporting i_parent = g_custom_container.
call method grid1->set_table_for_first_display
exporting
i_structure_name = 'ZFUNCTIONAL'
changing
it_outtab = gt_itab.
*set handler events
set handler z_functional=>handle_double_click for grid1.
endif.
endmodule. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
text
module user_command_0100 input.
case ok_code.
when 'EXIT'.
perform exit_program.
endcase.
clear ok_code.
endmodule. " USER_COMMAND_0100 INPUT
*& Form EXIT_PROGRAM
text
--> p1 text
<-- p2 text
form exit_program .
leave program.
endform. " EXIT_PROGRAM
*& Form handle_double_click
text
-->P_E_ROW text
-->P_E_COLUMN text
-->P_ES_ROW_NO text
form handle_double_click using e_row type lvc_s_row
e_column type lvc_s_col
es_row_no type lvc_s_roid.
data: t_output type zfunctional.
read table gt_itab into t_output index e_row-index .
if sy-subrc = 0 and e_column-fieldname eq 'QMNUM'.
set parameter id 'K01' field t_output-qmnum.
call transaction 'ZSMART' and skip first screen .
endif.
endform. " handle_double_click
regards,
swaroop. -
How to read complete line displayed thru ALV report on double click? urgent
Hi guys,
An ALV report is displayed using 'REUSE_ALV_LIST_DISPLAY' and i have a requirement such that i have to read the line item on which double click is done.
I have to fetch the line item, field by field and not by characters. I have attached the function code and all using PF status.
Please tell me an approach as how to fetch the line item on which double click is done.
Points will be rewarded.
Regards
RahulHi ..
i did report with belnr , bukrs , Gjahr . which will call the transcation code FB03 displaing thedocument ...
please cut and paste the report it will work ..
REPORT zdemo_alvgrid .
TABLES: bkpf . " ekko.
type-pools: slis. "ALV Declarations
*Data Declaration
TYPES: BEGIN OF t_ekko,
BUKRS like bkpf-BUKRS,
BELNR like bkpf-BELNR,
GJAHR like bkpf-GJAHR,
BLART like bkpf-BLART,
BLDAT like bkpf-BLDAT,
BUDAT like bkpf-BUDAT,
MONAT like bkpf-MONAT,
XBLNR like bkpf-XBLNR ,
* ebeln TYPE ekpo-ebeln,
* ebelp TYPE ekpo-ebelp,
* statu TYPE ekpo-statu,
* aedat TYPE ekpo-aedat,
* matnr TYPE ekpo-matnr,
* menge TYPE ekpo-menge,
* meins TYPE ekpo-meins,
* netpr TYPE ekpo-netpr,
* peinh TYPE ekpo-peinh,
END OF t_ekko.
DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
wa_ekko TYPE t_ekko.
*ALV data declarations
data: fieldcatalog type slis_t_fieldcat_alv with header line,
gd_tab_group type slis_t_sp_group_alv,
gd_layout type slis_layout_alv,
gd_repid like sy-repid,
gt_events type slis_t_event,
gd_prntparams type slis_print_alv.
*Start-of-selection.
START-OF-SELECTION.
perform data_retrieval.
perform build_fieldcatalog.
perform build_layout.
perform build_events.
perform build_print_params.
perform display_alv_report.
*& Form BUILD_FIELDCATALOG
* Build Fieldcatalog for ALV Report
form build_fieldcatalog.
* There are a number of ways to create a fieldcat.
* For the purpose of this example i will build the fieldcatalog manualy
* by populating the internal table fields individually and then
* appending the rows. This method can be the most time consuming but can
* also allow you more control of the final product.
* Beware though, you need to ensure that all fields required are
* populated. When using some of functionality available via ALV, such as
* total. You may need to provide more information than if you were
* simply displaying the result
* I.e. Field type may be required in-order for
* the 'TOTAL' function to work.
fieldcatalog-fieldname = 'BUKRS'.
fieldcatalog-seltext_m = 'Purchase Order'.
fieldcatalog-col_pos = 0.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
fieldcatalog-key = 'X'.
* fieldcatalog-do_sum = 'X'.
* fieldcatalog-no_zero = 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'BELNR'.
fieldcatalog-seltext_m = 'PO Item'.
fieldcatalog-col_pos = 1.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
fieldcatalog-key = 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'GJAHR'.
fieldcatalog-seltext_m = 'Status'.
fieldcatalog-col_pos = 2.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
fieldcatalog-key = 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'BLART'.
fieldcatalog-seltext_m = 'Item change date'.
fieldcatalog-col_pos = 3.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'BLDAT'.
fieldcatalog-seltext_m = 'Material Number'.
fieldcatalog-col_pos = 4.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'BUDAT'.
fieldcatalog-seltext_m = 'PO quantity'.
fieldcatalog-col_pos = 5.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MONAT'.
fieldcatalog-seltext_m = 'Order Unit'.
fieldcatalog-col_pos = 6.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'XBLNR'.
fieldcatalog-seltext_m = 'Net Price'.
fieldcatalog-col_pos = 7.
fieldcatalog-outputlen = 15.
* fieldcatalog-do_sum = 'X'.
* fieldcatalog-datatype = 'CURR'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
** fieldcatalog-fieldname = 'PEINH'.
** fieldcatalog-seltext_m = 'Price Unit'.
** fieldcatalog-col_pos = 8.
** append fieldcatalog to fieldcatalog.
* clear fieldcatalog.
endform. " BUILD_FIELDCATALOG
*& Form BUILD_LAYOUT
* Build layout for ALV grid report
form build_layout.
gd_layout-no_input = 'X'.
gd_layout-colwidth_optimize = 'X'.
gd_layout-totals_text = 'Totals'(201).
* gd_layout-totals_only = 'X'.
* gd_layout-f2code = 'DISP'. "Sets fcode for when double
* "click(press f2)
* gd_layout-zebra = 'X'.
* gd_layout-group_change_edit = 'X'.
* gd_layout-header_text = 'helllllo'.
endform. " BUILD_LAYOUT
*& Form DISPLAY_ALV_REPORT
* Display report using ALV grid
form display_alv_report.
gd_repid = sy-repid.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = gd_repid
i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM
i_callback_user_command = 'USER_COMMAND'
* i_grid_title = outtext
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
* it_special_groups = gd_tabgroup
it_events = gt_events
is_print = gd_prntparams
i_save = 'X'
* is_variant = z_template
tables
t_outtab = it_ekko
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. " DISPLAY_ALV_REPORT
*& Form DATA_RETRIEVAL
* Retrieve data form EKPO table and populate itab it_ekko
form data_retrieval.
select BUKRS
BELNR
GJAHR
BLART
BLDAT
BUDAT
MONAT
XBLNR up to 10 rows
from bkpf
into table it_ekko.
*select ebeln ebelp statu aedat matnr menge meins netpr peinh
* up to 10 rows
* from ekpo
* into table it_ekko.
endform. " DATA_RETRIEVAL
* Form TOP-OF-PAGE *
* ALV Report Header *
Form top-of-page.
*ALV Header declarations
data: t_header type slis_t_listheader,
wa_header type slis_listheader,
t_line like wa_header-info,
ld_lines type i,
ld_linesc(10) type c.
* Title
wa_header-typ = 'H'.
wa_header-info = 'EKKO Table Report'.
append wa_header to t_header.
clear wa_header.
* Date
wa_header-typ = 'S'.
wa_header-key = 'Date: '.
CONCATENATE sy-datum+6(2) '.'
sy-datum+4(2) '.'
sy-datum(4) INTO wa_header-info. "todays date
append wa_header to t_header.
clear: wa_header.
* Total No. of Records Selected
describe table it_ekko lines ld_lines.
ld_linesc = ld_lines.
concatenate 'Total No. of Records Selected: ' ld_linesc
into t_line separated by space.
wa_header-typ = 'A'.
wa_header-info = t_line.
append wa_header to t_header.
clear: wa_header, t_line.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = t_header.
* i_logo = 'Z_LOGO'.
endform.
* FORM USER_COMMAND *
* --> R_UCOMM *
* --> RS_SELFIELD *
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
* Check function code
CASE r_ucomm.
WHEN '&IC1'.
* Check field clicked on within ALVgrid report
IF rs_selfield-fieldname = 'BELNR'.
* Read data table, using index of row user clicked on
READ TABLE it_ekko INTO wa_ekko INDEX rs_selfield-tabindex.
* Set parameter ID for transaction screen field
SET PARAMETER ID 'BES' FIELD wa_ekko-bELNR .
SET PARAMETER ID 'MES' FIELD wa_ekko-bUKRS .
SET PARAMETER ID 'DES' FIELD wa_ekko-GJAHR .
* Sxecute transaction ME23N, and skip initial data entry screen
* CALL TRANSACTION 'FB03' AND SKIP first screen.
SUBMIT RFBUEB00
* WITH ALCUR ...
* WITH ARCHOBJ ...
* WITH ARCH_SEL ...
* WITH ARUSETYP ...
* WITH AUTBEXNO ...
* WITH AUTH_BUK ...
* WITH AUTH_LDR ...
* WITH BR_AWKEY ...
* WITH BR_AWSYS ...
* WITH BR_AWTYP ...
WITH BR_BELNR = wa_ekko-bELNR
* WITH BR_BLART ...
* WITH BR_BLDAT ...
* WITH BR_BUDAT ...
WITH BR_BUKRS = wa_ekko-bUKRS
* WITH BR_CPUDT ...
WITH BR_GJAHR = wa_ekko-GJAHR
* WITH BR_RLDNR ...
* WITH BR_SEQ ...
* WITH BR_USNAM ...
* WITH BR_XBLNR ...
* WITH EXCDT ...
* WITH P_STATS ...
* WITH STATISTK ...
* WITH STATUSD ...
* WITH STATUSL ...
* WITH STATUSM ...
* WITH STATUSS ...
* WITH STATUSV ...
* WITH TCODE ...
* WITH UNAME ...
* WITH XEMUCNV ...
* WITH XUSEAR ...
* WITH XUSEAS ...
* WITH XUSEDB
AND RETURN .
ENDIF.
ENDCASE.
ENDFORM.
*& Form BUILD_EVENTS
* Build events table
form build_events.
data: ls_event type slis_alv_event.
call function 'REUSE_ALV_EVENTS_GET'
exporting
i_list_type = 0
importing
et_events = gt_events[].
read table gt_events with key name = slis_ev_end_of_page
into ls_event.
if sy-subrc = 0.
move 'END_OF_PAGE' to ls_event-form.
append ls_event to gt_events.
endif.
read table gt_events with key name = slis_ev_end_of_list
into ls_event.
if sy-subrc = 0.
move 'END_OF_LIST' to ls_event-form.
append ls_event to gt_events.
endif.
endform. " BUILD_EVENTS
*& Form BUILD_PRINT_PARAMS
* Setup print parameters
form build_print_params.
gd_prntparams-reserve_lines = '3'. "Lines reserved for footer
gd_prntparams-no_coverpage = 'X'.
endform. " BUILD_PRINT_PARAMS
*& Form END_OF_PAGE
form END_OF_PAGE.
data: listwidth type i,
ld_pagepos(10) type c,
ld_page(10) type c.
write: sy-uline(50).
skip.
write:/40 'Page:', sy-pagno .
endform.
*& Form END_OF_LIST
form END_OF_LIST.
data: listwidth type i,
ld_pagepos(10) type c,
ld_page(10) type c.
skip.
write:/40 'Page:', sy-pagno .
endform.
reward points if it is usefull ...
Girish -
Example of creating ALV double click event that can be used in ANY Program
Once you get the hang of OO you can really create useful generalized code that can be used in a huge number of situtations.
Double click on ALV is often wanted
Right here goes to implement a generalized double click action that returns the row, column and column name back to the caller.
In your CLASS in the DEFINITION part code as follows.
CLASS zcl_dog DEFINITION.
PUBLIC SECTION.
METHODS:
constructor
IMPORTING z_object type ref to zcl_dog,
i_parent type ref to cl_gui_custom_container,
PRIVATE SECTION.
on_dubbelklik FOR EVENT double_click OF cl_gui_alv_grid
IMPORTING e_row
e_column
es_row_no,
dubbleklik
IMPORTING
e_row type LVC_S_ROW
e_column TYPE LVC_S_COL
es_row_no type lvc_s_ROID
program type sy-repid.
code here any extra any methods you need.
In the CONSTRUCTOR method of the implementation
CLASS zcl_dog IMPLEMENTATION.
METHOD constructor.
CREATE OBJECT grid_container1
EXPORTING
container_name = 'CCONTAINER1'.
CREATE OBJECT grid1
EXPORTING
i_parent = grid_container1.
SET HANDLER z_object->on_user_command for grid1.
SET HANDLER z_object->on_toolbar for grid1.
SET HANDLER Z_OBJECT->handle_data_changed_finished FOR grid1.
SET HANDLER Z_OBJECT->on_dubbelklik FOR grid1.
endmethod.
METHOD on_dubbelklik.
CALL METHOD me->dubbleklik
exporting
e_row = e_row
e_column = e_column
es_row_no = es_row_no
program = sy-repid.
break-point 1.
method dubbleklik.
perform dubbleklik IN PROGRAM (program)
using
e_row
e_column
es_row_no.
ENDMETHOD.
endclass.
This will now perform a routine called dubbleklik in your application program whenever you double click a cell in the grid.
In the application program just code the following
DATA: z_object type ref to zcl_dog, "Instantiate our class
grid_container1 type ref to cl_gui_custom_container,
CREATE OBJECT z_object EXPORTING z_object = z_object.
call ANY method in the class which eventually displays the grid
CALL METHOD z_object->build_dynamic_structures
CHANGING it_fldcat = it_fldcat.
form dubbleklik using
e_row type LVC_S_ROW
e_column type LVC_S_col
es_row_no type lvc_s_roid.
break-point 1.
endform.
When you double click a cell you'should be at the break point in your routine in the application program.
You've got the cell that was clicked so by reading your table you can examine the data and take the appropriate action.
Cheers
JimboI suggest you purchase a case and have a dedicated support engineer work with you directly:
http://www.sdn.sap.com/irj/boc/gettingstarted
Or
http://store.businessobjects.com/store/bobjects/Content/pbPage.CSC_map_countyselector/pgm.67024400?resid=jFmmLgoBAlcAAALO-iYAAAAP&rests=1278687224728
If this is a bug you'll get a refund, if not post your enhancement request in the Idea Place. Or the Rep will suggest a better way to create your report. -
HOw to make an Object oriented alv respond to double click
Hi all,
HOw to make an Object oriented alv respond to double click.SAmple code will be helpful.
Thanks in advance,
Alex.Hi,
1. Create a Control (for Custom and Split Containers only)
2. Instantiate a Container Object (in case of Custom and Split Containers, specify the control which is created by us in Screen painter) CREATE OBJECT
3. Instantiate an Object of the kind of report that has to be displayed (List, Grid or Tree). CREATE OBJECT . Here we need to specify the Parent Container as the so that it sits in that container.
4. Call appropriate methods to display the report on the screen. CALL METHOD ->
DATA : g_dock TYPE REF TO cl_gui_docking_container,
g_split TYPE REF TO cl_gui_easy_splitter_container,
g_cont1 TYPE REF TO cl_gui_container,
g_cont2 TYPE REF TO cl_gui_container,
g_grid1 TYPE REF TO cl_gui_alv_grid,
g_grid2 TYPE REF TO cl_gui_alv_grid.
i_mara is an internal table of structure MARA
SELECT * FROM mara INTO TABLE i_mara.
i_kna1 is an internal table of structure KNA1
SELECT * FROM kna1 INTO TABLE i_kna1.
To create an Object of type Docking Container
CREATE OBJECT g_dock
EXPORTING
side = cl_gui_docking_container=>dock_at_top
extension = 200 .
To Create an Object of Type Split Container. Here we can see that the Docking *Container Created above has been used as a parent .
CREATE OBJECT g_split
EXPORTING
parent = g_dock
orientation = 1 .
Easy Split container splits one Control into 2 manageable controls, each of them is used * to handle one GUI Container each
g_cont1 = g_split->top_left_container.
g_cont2 = g_split->bottom_right_container.
To Create an Object of type Grid . Here we can see that the Left Split Container * Created above has been used as a parent .
CREATE OBJECT g_grid1
EXPORTING
i_parent = g_cont1 .
To Create an Object of type Grid . Here we can see that the Right Split Container * Created above has been used as a parent .
CREATE OBJECT g_grid2
EXPORTING
i_parent = g_cont2 .
The method of Grid Control Object is used to display the Data.
CALL METHOD g_grid1->set_table_for_first_display
EXPORTING
i_structure_name = 'MARA'
CHANGING
it_outtab = i_mara[] .
The method of Grid Control Object is used to display the Data.
CALL METHOD g_grid2->set_table_for_first_display
EXPORTING
i_structure_name = 'KNA1'
CHANGING
it_outtab = i_kna1[] .
Regards
Hari -
ALV: Issue with double click event after sorting the ALV
Hello Experts,
I have an internal table that populates an ALV grid. When the user doubleclicks a row, my method HANDLE_DOUBLE_CLICK returns the e_row-index value from the ALV Grid. I use this index value to read the internal table, then retrieve additional data.
My problem is the user may sort the ALV grid before double clicking on a line. If this happens my internal table is not sorted to match the ALV grid, so reading the internal table with the e_row-index value returns the wrong information.
When the double click event occurs, is it possible to capture the value in column 1 instead of a value for e_row-index?
There is one more paramter in HANDLE_DOUBLE_CLICK for row id. It is coming blank in debugging . what is the purpose of this parameter and how i can make use of it ?
Regards
VivekHi,
I am Posting The Code Which Uses Double Click Event.
And This Code will provide the total information to you.
REPORT ZALVGRID_PG.
TABLES: SSCRFIELDS.
DATA: V_BELNR TYPE RBKP-BELNR.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS: IRNO FOR V_BELNR.
PARAMETERS: P_GJAHR TYPE RBKP-GJAHR.
SELECTION-SCREEN END OF BLOCK B1.
DATA: WA TYPE ZALVGRID_DISPLAY,
ITAB TYPE STANDARD TABLE OF ZALVGRID_DISPLAY.
DATA: IDENTITY TYPE REF TO CL_GUI_CUSTOM_CONTAINER.
DATA: GRID TYPE REF TO CL_GUI_ALV_GRID.
DATA: L_IDENTITY TYPE REF TO CL_GUI_CUSTOM_CONTAINER.
DATA: L_TREE TYPE REF TO CL_GUI_ALV_TREE_SIMPLE.
TYPE-POOLS: SLIS,SDYDO.
DATA: L_LOGO TYPE SDYDO_VALUE,
L_LIST TYPE SLIS_T_LISTHEADER.
END-OF-SELECTION.
CLASS CL_LC DEFINITION.
PUBLIC SECTION.
METHODS: DC FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID IMPORTING E_ROW E_COLUMN.
ENDCLASS.
CLASS CL_LC IMPLEMENTATION.
METHOD DC.
DATA: WA1 TYPE ZALVGRID_DISPLAY.
READ TABLE ITAB INTO WA1 INDEX E_ROW-INDEX.
BREAK-POINT.
SET PARAMETER ID 'BLN' FIELD WA1-BELNR.
CALL TRANSACTION 'FB02'.
ENDMETHOD. "DC
ENDCLASS.
DATA: OBJ_CL TYPE REF TO CL_LC.
START-OF-SELECTION.
PERFORM SELECT_DATA.
IF SY-SUBRC = 0.
CALL SCREEN 100.
ELSE.
MESSAGE E000(0) WITH 'DATA NOT FOUND'.
ENDIF.
INCLUDE ZALVGRID_PG_STATUS_0100O01.
INCLUDE ZALVGRID_PG_LOGOSUBF01.
INCLUDE ZALVGRID_PG_SELECT_DATAF01.
INCLUDE ZALVGRID_PG_USER_COMMAND_01I01.
***INCLUDE ZALVGRID_PG_STATUS_0100O01 .
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'AB'.
* SET TITLEBAR 'xxx'.
IF IDENTITY IS INITIAL.
CREATE OBJECT IDENTITY
EXPORTING
CONTAINER_NAME = 'ALVCONTROL'.
CREATE OBJECT GRID
EXPORTING
I_PARENT = IDENTITY.
CALL METHOD GRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
I_STRUCTURE_NAME = 'ZALVGRID_DISPLAY'
CHANGING
IT_OUTTAB = ITAB.
CREATE OBJECT OBJ_CL.
SET HANDLER OBJ_CL->DC FOR GRID.
ENDIF.
IF L_IDENTITY IS INITIAL.
CREATE OBJECT L_IDENTITY
EXPORTING
CONTAINER_NAME = 'LOGO'.
CREATE OBJECT L_TREE
EXPORTING
I_PARENT = L_IDENTITY.
PERFORM LOGOSUB USING L_LOGO.
CALL METHOD L_TREE->CREATE_REPORT_HEADER
EXPORTING
IT_LIST_COMMENTARY = L_LIST
I_LOGO = L_LOGO.
ENDIF .
ENDMODULE. " STATUS_0100 OUTPUT
***INCLUDE ZALVGRID_PG_LOGOSUBF01 .
FORM LOGOSUB USING P_L_LOGO.
P_L_LOGO = 'ERPLOGO'.
ENDFORM. " LOGOSUB
***INCLUDE ZALVGRID_PG_SELECT_DATAF01 .
FORM SELECT_DATA .
SELECT RBKP~BELNR
RBKP~BLDAT
RSEG~BUZEI
RSEG~MATNR
INTO TABLE ITAB
FROM RBKP INNER JOIN RSEG
ON RBKP~BELNR = RSEG~BELNR
WHERE RBKP~BELNR IN IRNO
AND RBKP~GJAHR = P_GJAHR.
ENDFORM. " SELECT_DATA
***INCLUDE ZALVGRID_PG_USER_COMMAND_01I01 .
MODULE USER_COMMAND_0100 INPUT.
CASE SY-UCOMM.
WHEN 'EXIT'.
LEAVE PROGRAM.
WHEN 'CANCEL'.
EXIT.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
Warm Regards,
PavanKumar.G
Edited by: pavankumar.g on Jan 19, 2012 5:30 AM -
Example of a Simple ALV Report using Function Modules (not OO)
Hi,
I am new to ABAP. Where can I get a proper Example of a Simple ALV Report using Function Modules? I searched the forum but did not find a proper solution. Kindly help.
Smruthi.
Edited by: Smruthi Acharya on Jan 29, 2009 7:13 PMHi,
Use this demo code:-
REPORT z_alv01 MESSAGE-ID zmsg.
* TABLES
TABLES : ekpo.
* TYPE POOLS
TYPE-POOLS : slis.
* TYPE DECLARATION
TYPES : BEGIN OF t_ekpo,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
matnr TYPE ekpo-matnr,
werks TYPE ekpo-werks,
menge TYPE ekpo-menge,
END OF t_ekpo.
* PARAMETERS
PARAMETERS : s_var TYPE disvariant-variant.
* DATA DECLARATION
*VARIABLES
DATA : check(1),
rep_id TYPE sy-repid.
*INTERNAL TABLE TYPE OF ZEKPO
DATA : it_ekpo TYPE STANDARD TABLE OF t_ekpo WITH HEADER LINE.
*FIELD CATALOG
DATA : it_field TYPE slis_t_fieldcat_alv,
wa_field TYPE slis_fieldcat_alv.
*SORTING
DATA : it_sort TYPE slis_t_sortinfo_alv,
wa_sort TYPE slis_sortinfo_alv.
*FOR TOP OF THE PAGE
DATA : it_top TYPE slis_t_listheader,
wa_top TYPE slis_listheader.
*FOR END OF THE PAGE
DATA : it_end TYPE slis_t_listheader,
wa_end TYPE slis_listheader.
*TO CAPTURE EVENTS AND HANDLE
DATA : it_event TYPE slis_t_event,
wa_event TYPE slis_alv_event.
*FOR GRID TITLE
DATA : wa_title TYPE lvc_title.
*FOR LAYOUT
DATA : wa_layout TYPE slis_layout_alv.
*FOR EXCLUDING STANDARD BUTTON FROM ALV TOOLBAR
DATA : it_exclude TYPE slis_t_extab,
wa_exclude TYPE slis_extab.
*FOR VARIANT
DATA : wa_variant TYPE disvariant.
* INITIALIZATION
INITIALIZATION.
check = 'X'.
rep_id = sy-repid.
wa_variant-report = sy-repid.
*GET DEFUALT ON THE SELECTION SCREEN FOR DEFAULT DISPLAY
CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
EXPORTING
i_save = 'A'
CHANGING
cs_variant = wa_variant
EXCEPTIONS
wrong_input = 1
not_found = 2
program_error = 3
OTHERS = 4.
IF sy-subrc = 0. " IF DEFAULT VARIANT FOUND
s_var = wa_variant-variant. " PASS THE DEFAULT VARIANT TO THE SELECTION SCREEN FIELD
ENDIF.
* AT-SELECTION SCREEN ON VALUE REQUEST
* TO GET THE F4 HELP FOR VARIANT
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_var.
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
EXPORTING
is_variant = wa_variant
* I_TABNAME_HEADER =
* I_TABNAME_ITEM =
* IT_DEFAULT_FIELDCAT =
i_save = 'A'
* I_DISPLAY_VIA_GRID = ' '
IMPORTING
* E_EXIT =
es_variant = wa_variant
EXCEPTIONS
not_found = 1
program_error = 2
OTHERS = 3.
IF sy-subrc = 0.
s_var = wa_variant-variant. " PASS THE SELECTED VARIANT TO THE SELECTION SCREEN FIELD
ENDIF.
* AT-SELECTION SCREEN
* TO CHECK THE EXISTENCE FOR VARIANT
AT SELECTION-SCREEN.
wa_variant-variant = s_var.
CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
EXPORTING
i_save = 'A'
CHANGING
cs_variant = wa_variant
EXCEPTIONS
wrong_input = 1
not_found = 2
program_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE w001.
ENDIF.
* START OF SELECTION
START-OF-SELECTION.
SELECT ebeln
ebelp
matnr
werks
menge
FROM ekpo
INTO TABLE it_ekpo.
* FIELD CATALOG
wa_field-fieldname = 'EBELN'.
wa_field-tabname = 'IT_TAB'.
wa_field-outputlen = 10.
wa_field-seltext_l = 'PO #'.
APPEND wa_field TO it_field.
CLEAR wa_field.
wa_field-fieldname = 'EBELP'.
wa_field-tabname = 'IT_TAB'.
wa_field-outputlen = 10.
wa_field-seltext_l = 'Line Item'.
APPEND wa_field TO it_field.
CLEAR wa_field.
wa_field-fieldname = 'MATNR'.
wa_field-tabname = 'IT_TAB'.
wa_field-outputlen = 15.
wa_field-seltext_l = 'Material'.
* wa_field-input = check.
* wa_field-edit = check.
APPEND wa_field TO it_field.
CLEAR wa_field.
wa_field-fieldname = 'WERKS'.
wa_field-tabname = 'IT_TAB'.
wa_field-outputlen = 6.
wa_field-seltext_l = 'Plant'.
* wa_field-input = check.
* wa_field-edit = check.
APPEND wa_field TO it_field.
CLEAR wa_field.
wa_field-fieldname = 'MENGE'.
wa_field-tabname = 'IT_TAB'.
wa_field-outputlen = 10.
wa_field-seltext_l = 'Qty.'.
* wa_field-input = check.
* wa_field-edit = check.
wa_field-do_sum = check.
APPEND wa_field TO it_field.
CLEAR wa_field.
* SORT W.R.T. PURCHASE ORDER NUMBER
wa_sort-spos = 1.
wa_sort-fieldname = 'EBELN'.
wa_sort-tabname = 'IT_EKPO'.
wa_sort-up = check.
wa_sort-subtot = check.
APPEND wa_sort TO it_sort.
CLEAR wa_sort.
* FOR GRID TITLE
wa_title = 'Hello'.
* FOR LAYOUT
wa_layout-zebra = check.
* FOR EXCLUDING STANDARD BUTTONS FROM ALV TOOLBAR
wa_exclude-fcode = '&OUP'.
APPEND wa_exclude TO it_exclude.
CLEAR wa_exclude.
wa_exclude-fcode = '&ODN'.
APPEND wa_exclude TO it_exclude.
CLEAR wa_exclude.
wa_exclude-fcode = '&OAD'.
APPEND wa_exclude TO it_exclude.
CLEAR wa_exclude.
* wa_exclude-fcode = '&AVE'.
* APPEND wa_exclude TO it_exclude.
* CLEAR wa_exclude.
wa_exclude-fcode = '&INFO'.
APPEND wa_exclude TO it_exclude.
CLEAR wa_exclude.
* POPULATE ALL EVENTS INTO INTERNAL TABLE
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = it_event
EXCEPTIONS
list_type_wrong = 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.
READ TABLE it_event INTO wa_event WITH KEY name = 'END_OF_LIST'.
wa_event-form = 'END'.
MODIFY it_event FROM wa_event INDEX sy-tabix.
CLEAR wa_event.
* DISPLAY RECORDS IN ALV GRID
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = ' '
* I_BUFFER_ACTIVE = ' '
i_callback_program = rep_id
* i_callback_pf_status_set = 'PF'
i_callback_user_command = 'COMMAND'
i_callback_top_of_page = 'TOP'
* I_CALLBACK_HTML_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_END_OF_LIST = ' '
* I_STRUCTURE_NAME =
* I_BACKGROUND_ID = ' '
i_grid_title = wa_title
* I_GRID_SETTINGS =
is_layout = wa_layout
it_fieldcat = it_field
it_excluding = it_exclude
* IT_SPECIAL_GROUPS =
it_sort = it_sort
* IT_FILTER =
* IS_SEL_HIDE =
* I_DEFAULT = 'X'
i_save = 'A'
is_variant = wa_variant
it_events = it_event
* 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
* I_HTML_HEIGHT_TOP = 0
* I_HTML_HEIGHT_END = 0
* IT_ALV_GRAPHICS =
* IT_HYPERLINK =
* IT_ADD_FIELDCAT =
* IT_EXCEPT_QINFO =
* IR_SALV_FULLSCREEN_ADAPTER =
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = it_ekpo
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
ENDIF.
*& Form top
* TO WRITE THE HEADER
FORM top.
REFRESH it_top.
wa_top-typ = 'S'.
wa_top-key = text-001.
wa_top-info = rep_id.
APPEND wa_top TO it_top.
CLEAR wa_top.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = it_top
* I_LOGO =
* I_END_OF_LIST_GRID =
* I_ALV_FORM =
ENDFORM. "top
*& Form end
* TO WRITE THE FOOTER
FORM end.
REFRESH it_end.
wa_end-typ = 'S'.
wa_end-key = text-001.
wa_end-info = rep_id.
APPEND wa_end TO it_end.
CLEAR wa_end.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = it_end
* I_LOGO =
* I_END_OF_LIST_GRID =
* I_ALV_FORM =
ENDFORM. "end
*& Form pf
* FOR PF-STATUS WITH USER DEFINED BUTTONS
* -->RT_EXTAB text
FORM pf USING rt_extab TYPE slis_t_extab.
SET PF-STATUS 'ZTG_PF_ALV'.
ENDFORM. "pf
*& Form command
* TO HANDLE USER ACTIONS AGAINST PF-STATUS
* -->UCOMM text
* -->SELFIELD text
FORM command USING ucomm LIKE sy-ucomm selfield TYPE slis_selfield.
DATA : ok_code TYPE sy-ucomm.
ok_code = ucomm.
CASE ok_code.
WHEN 'T_DOWN'.
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = 'HELLO'
txt1 = 'USER COMMAND'
txt2 = 'TOTAL DOWN'.
WHEN 'DOWN'.
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = 'HELLO'
txt1 = 'USER COMMAND'
txt2 = 'DOWN'.
WHEN 'UP'.
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = 'HELLO'
txt1 = 'USER COMMAND'
txt2 = 'UP'.
WHEN 'T_UP'.
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = 'HELLO'
txt1 = 'USER COMMAND'
txt2 = 'TOTAL UP'.
ENDCASE.
ENDFORM. "command
Hope this helps you.
Thanks & Regards,
Tarun Gambhir -
A simple ALV report using classes & methods ...
i want a simple ALV report using classes & methods ...
my requirement : i have to use classes & methods instead of calling a function module to display in grid or list format.
plz send me with explanation ASAP...it's very urgent..
Thanks in advance .Hi
Please refer
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a415907
U can use methods for vreating ALVs.
There is a method named set_table_for_first_display in OOP Concepts.
Use this Object Oriented Approach for ALV Creation
Calling the method set_table_for_first_display
CALL METHOD cust_alv->set_table_for_first_display
EXPORTING
is_layout = gst_layout
CHANGING
it_outtab = gt_list
it_fieldcatalog = gt_fcat
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Object Creation and all
Creation of Object for Container
CREATE OBJECT cust_container
EXPORTING
container_name = 'ALV_CONTAINER'
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
others = 6
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Creation of Object for ALV Grid
CREATE OBJECT cust_alv
EXPORTING
i_parent = cust_container
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
others = 5
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Layout settings
gst_layout-zebra ='X'.
gst_layout-cwidth_opt = 'X'.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
I_BUFFER_ACTIVE =
I_STRUCTURE_NAME = 'ZCS_INACTV_CUST'
I_CLIENT_NEVER_DISPLAY = 'X'
I_BYPASSING_BUFFER =
CHANGING
ct_fieldcat = gt_fcat
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 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.
Calling the method set_table_for_first_display
CALL METHOD cust_alv->set_table_for_first_display
EXPORTING
is_layout = gst_layout
CHANGING
it_outtab = gt_list
it_fieldcatalog = gt_fcat
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
For object oriented concepts refer this link https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/b6cae890-0201-0010-ef8b-f970a9c41d47
Reaward if helpful -
Different between coding of simple ALV report and interactive ALV report
Hi
Please some one tell me the difference (extra coding) for interactive ALV report.
I know how to design simple ALV report but i dont know what extra I hace to code for interactive ALV report.
Thanks in advance.View at se38, ALV grid demos, search BCALGRID
-
Creating a simple ALV report based on join condition
Dear All
SAP Version: ECC6 EHP7
I wan to create simple ALV report based on join condition. can anyone provide me the complete steps to create this report.
Regards,Hi Syed,
Please check the link,
ALV report - Joining 2 tables
Regards,
Prakash. -
ALV Grid Control Double click error
Hi
In my Editable ALV Grid Control I input the data ,then click save, the program display error msg if any errors , then i double click in any field ,after that I exit from the program , here i dont want this after double click also the control should be on the same field.Pleace help me out this issue.
THXBut what you will do with the error data. you tell me that.
Don't update some error values to DB.
if you don't want error then check this sample code.
report ztest_alv_edit.
data: it_flight type standard table of sflight.
data: it_fcat type lvc_t_fcat,
wa_fcat type lvc_s_fcat.
data: grid type ref to cl_gui_alv_grid,
cont type ref to cl_gui_custom_container.
class lcl_event_receiver definition deferred.
data: g_handler type ref to lcl_event_receiver.
* CLASS lcl_event_receiver DEFINITION
class lcl_event_receiver definition.
public section.
methods:
handle_data_changed
for event data_changed of cl_gui_alv_grid
importing er_data_changed.
endclass. "lcl_event_receiver DEFINITION
* CLASS lcl_event_receiver IMPLEMENTATION
class lcl_event_receiver implementation.
method handle_data_changed.
"this is important
"this will stop poping the message
clear er_data_changed->mt_protocol.
endmethod. "handle_data_changed
endclass. "lcl_event_receiver IMPLEMENTATION
start-of-selection.
select * from sflight
into table it_flight
up to 20 rows.
end-of-selection.
call screen 100.
*& Module STATUS_0100 OUTPUT
* text
module status_0100 output.
set pf-status 'STATUS'.
if cont is initial.
call function 'LVC_FIELDCATALOG_MERGE'
exporting
i_structure_name = 'SFLIGHT'
changing
ct_fieldcat = it_fcat
exceptions
inconsistent_interface = 1
program_error = 2.
create object cont
exporting
container_name = 'CONT'
exceptions
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
others = 6
if sy-subrc ne 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
wa_fcat-edit = 'X'.
wa_fcat-checktable = '!'.
modify it_fcat from wa_fcat transporting edit checktable
where fieldname = 'FLDATE'
create object grid
exporting
i_parent = cont
exceptions
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
others = 5
if sy-subrc ne 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
call method grid->set_table_for_first_display(
changing
it_outtab = it_flight
it_fieldcatalog = it_fcat
exceptions
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
if sy-subrc ne 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
"Important for editable grid
call method grid->register_edit_event
exporting
i_event_id = cl_gui_alv_grid=>mc_evt_enter.
create object g_handler.
"setting the handler
set handler g_handler->handle_data_changed for grid.
endif.
endmodule. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
* text
module user_command_0100 input.
"important method to trigger the DATA_CHANGED event
call method grid->check_changed_data.
case sy-ucomm.
when 'BACK'.
leave to screen 0.
endcase.
endmodule. " USER_COMMAND_0100 INPUT -
How can i show details in ALV GRID with double click in a row?
Hello, ich try to show the details of a row with double click in the line,
but it doesn't work!?
I have a eventhandler for doubleclick and the program run this code, but what i have to do, to show the details!?
I try it with some methods like cl_gui_cfw=>set_new_ok_code, ...
i think about the methods cl_gui_alv_grid->show_detail, but this method is private,
i can create a class with inheritance of the cl_gui_alv_grid class and try this method!?
Have anybody any ideas!?Hello Lars
The following sample reports shows an ALV list with company codes. Double-clicking on any company code will open a second ALV list displaying all customers.
*& Report ZUS_SDN_ALVGRID_EVENTS_1
REPORT zus_sdn_alvgrid_events_1.
DATA:
gd_okcode TYPE ui_func,
gt_fcat TYPE lvc_t_fcat,
go_docking TYPE REF TO cl_gui_docking_container,
go_docking2 TYPE REF TO cl_gui_docking_container,
go_grid1 TYPE REF TO cl_gui_alv_grid,
go_grid2 TYPE REF TO cl_gui_alv_grid.
DATA:
gt_t001 TYPE STANDARD TABLE OF t001,
gt_knb1 TYPE STANDARD TABLE OF knb1.
* CLASS lcl_eventhandler DEFINITION
CLASS lcl_eventhandler DEFINITION.
PUBLIC SECTION.
CLASS-METHODS:
handle_double_click FOR EVENT double_click OF cl_gui_alv_grid
IMPORTING
e_row
e_column
es_row_no
sender.
ENDCLASS. "lcl_eventhandler DEFINITION
* CLASS lcl_eventhandler IMPLEMENTATION
CLASS lcl_eventhandler IMPLEMENTATION.
METHOD handle_double_click.
* define local data
DATA:
ls_t001 TYPE t001,
ls_col_id TYPE lvc_s_col.
CHECK ( sender = go_grid1 ).
READ TABLE gt_t001 INTO ls_t001 INDEX e_row-index.
CHECK ( ls_t001-bukrs IS NOT INITIAL ).
SELECT * FROM knb1 INTO TABLE gt_knb1
WHERE bukrs = ls_t001-bukrs.
IF ( syst-subrc NE 0 ).
MESSAGE 'No customers found' TYPE 'S'.
ELSE.
* Trigger PAI of dynpro '0100' and set new ok-code
CALL METHOD cl_gui_cfw=>set_new_ok_code( 'CALL_SCREEN_0200' ).
ENDIF.
ENDMETHOD. "handle_hotspot_click
ENDCLASS. "lcl_eventhandler IMPLEMENTATION
START-OF-SELECTION.
SELECT * FROM t001 INTO TABLE gt_t001.
REFRESH: gt_knb1.
* Create docking container
CREATE OBJECT go_docking
EXPORTING
parent = cl_gui_container=>screen0
ratio = 90
EXCEPTIONS
OTHERS = 6.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT go_docking2
EXPORTING
parent = cl_gui_container=>screen0
ratio = 90
EXCEPTIONS
OTHERS = 6.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Create ALV grid
CREATE OBJECT go_grid1
EXPORTING
i_parent = go_docking
EXCEPTIONS
OTHERS = 5.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT go_grid2
EXPORTING
i_parent = go_docking2
EXCEPTIONS
OTHERS = 5.
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 handler
SET HANDLER:
lcl_eventhandler=>handle_double_click FOR go_grid1.
* Display data
CALL METHOD go_grid1->set_table_for_first_display
EXPORTING
i_structure_name = 'T001'
CHANGING
it_outtab = gt_t001
EXCEPTIONS
OTHERS = 4.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL METHOD go_grid2->set_table_for_first_display
EXPORTING
i_structure_name = 'KNB1'
CHANGING
it_outtab = gt_knb1
EXCEPTIONS
OTHERS = 4.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Link the docking container to the target dynpro
CALL METHOD go_docking->link
EXPORTING
repid = syst-repid
dynnr = '0100'
* CONTAINER =
EXCEPTIONS
OTHERS = 4.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL METHOD go_docking2->link
EXPORTING
repid = syst-repid
dynnr = '0200'
* CONTAINER =
EXCEPTIONS
OTHERS = 4.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* ok-code field = GD_OKCODE
CALL SCREEN '0100'.
END-OF-SELECTION.
*& Module STATUS_0100 OUTPUT
* text
MODULE status_0100 OUTPUT.
SET PF-STATUS 'STATUS_0100'.
* SET TITLEBAR 'xxx'.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
* text
MODULE user_command_0100 INPUT.
CASE gd_okcode.
WHEN 'BACK' OR
'END' OR
'CANC'.
SET SCREEN 0. LEAVE SCREEN.
WHEN 'CALL_SCREEN_0200'.
go_grid2->refresh_table_display( ). " necessary
CALL SCREEN '0200'.
WHEN OTHERS.
ENDCASE.
CLEAR: gd_okcode.
ENDMODULE. " USER_COMMAND_0100 INPUT
Regards
Uwe -
ALV Report - displaying column name in two fields.
Dear All,
I am working on ALV report , report is ready but now i have to format it according to client requirment, in which have to show column name in two row like.
supppose there is field by name
"Date of receipt of processed Goods"
can i display it like
"Date of receipt of
processed Goods "
Assured points for suitable answer.
Looking foward to your response.
Best Regards,
Gulrez AlamHi Ellery,
As Philipp said, there is no need for populating the field using PL/SQL. You would just need to go to the Paper Layout in the Reports Editor, click on "Text" in the Drawing toolbar, drag it to the appropriate place in your layout to create the field, and write what you want in that field. Below that, you can create the field(s) which will display the actual totals. I'm assuming that creating the totals field is not a problem.
Navneet. -
ALV Report Displaying QUAN field different in systems
Hi Guys,
I have a field of type QUAN (quantity) on an ALV report that is displaying differently on the Devlopment and QA systems.
If I enter the value '5' in this field in Development and press enter, the value displays as '5.000'. If I enter the value in the QA field, however, the value displayes as '0.005'.
I have looked at domains and everything, but they seem simmilar.
Please advise fi there is something I have overlooked,
Thank you,
ChristiaanHi,
Check in system default parameter settings. It works based on system default parameter settings.
System => User Profile => Own Data
In *Defaults* tab check the *Decimal Notaion* field.
Regards,
Shankar. -
ALV report display online and generate in spool
Dear expert,
I have created an ALV report. I want to run this report online. After executed, the report is displayed. After display this report, I also want to generate the output report in the spool. Is there any way to do this? Thank you.
I have tried to use submit...to SAP Spool. in this way, it will generate the spool, but it will not display the report online. I want it both display online and generate a spool.well forget yout the new-page print on thingie, since you use ALV.
if you had a write list this trick would be cool since you just could do following:
Do 2 times.
if sy-index GT 1.
new page print on.
endif.
loop at itab into wa.
write stuff....
endloop.
if sy-index GT 1.
new page print off.
endif.
enddo.
/edit arrrgh forgot to write further...
with your ALV you could process a write list as well after displaying but you will have layout differences between your display and your spool then and i dont think that this is what you want/need.
you could however after display process your programm a second time, in background task and give it a printer where to print to. Since ALV wont get executed in background task you will get a spool instead.
Edited by: Florian Kemmer on Sep 15, 2010 2:40 PM
Maybe you are looking for
-
Hi everybody, I have an iphone 6 and my ex partner is intercepting and reading my imessage text messages remotely and without any access to my phone. Can someone shed any light on how this is possible and if so provide me with a solution to my probl
-
Adobe Flex 4 Drag and drop example in application
I have been looking at the following example: http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf64595-7fed.html#WS2d b454920e96a9e51e63e3d11c0bf69084-7cee The example works in web based flash project, but if I use the same code in
-
Problem with file transfer via wi-fi!
Hi, folks, Please, could someone help me to get a music file I made using Groovemaker app? After finish the mix, I built a song. Then, I saved it in the "mix browser". In the end of the exporting process, I typed the URL address displayed in the brow
-
I love Arch and I love GNOME. The problem is - the default GNOME desktop that comes with Arch is EXTREMELY BARE! Even after I change the wallpaper and add some new icons. It just feels so empty. Do you guys have any suggestions on how I can fix t
-
Incorrect percentage of storage space
(MBP user) When I click my cloud icon at the top right, it indicates that I have used 26% (5.3 GB) of my allotted storage space on the server. However, there are no files present in my CC folder. Why is it showing I am using that much space when I ha