ALV Grid Event Problem
Hi,
I have a dialog that contains an ALV grid and three buttons. When the ALV grid is created, it's parent is specified as a custom container.
Container
data : g_custom_container type ref to cl_gui_custom_container.
ALV Grid
data : g_grid type ref to cl_gui_alv_grid.
create object g_custom_container
exporting container_name = p_cont_name.
create object g_grid
exporting i_parent = g_custom_container
I_APPL_EVENTS = 'X'.
I would like the user to be able to just hit enter to accept the values displayed in the ALV. My problem is that when the dialog is created, the ALV has focus so the event isn't getting to the PAI of the dialog. If I click the mouse outside of the ALV to take focus away from the ALV, hitting the enter key does trigger the correct event in the dialog PAI. How can I either set the focus outside of the ALV when the dialog loads, or make the ALV forward the event to the dialog.
Thank you very much for any isight you can lend!
John Richason
Hi John, are you working with an editable ALV grid? If so, the code below will allow an event to be fired when the user hits enter after the data has been changed.
call method alv_grid->register_edit_event
exporting
i_event_id = cl_gui_alv_grid=>mc_evt_enter.
You then need to create an event handler to handle the event being fired when the data is changed.
* create Event Receiver
create object event_receiver.
* handler for ALV grid
set handler event_receiver->handle_data_changed for alv_grid.
REgards,
Rich Heilman
Similar Messages
-
Wrong messagetype while processing in an alv grid event
Hello,
a brief discription of my problem:
I am processing a standard SAP form "PERIODE_PRUEFEN" which calls the function "READ_CUSTOMIZED_MESSAGE". The routine is called inside an event-handler of the ALV Grid event 'user_command'. The messagetype is selected from a customising table 'T100C'. Despite the messagetype 'W' the program is always aborted with an 'E' message.
What I have tried so far:
1. I debugged the SAP standard transaction 'fb08' which runs exactly the same functions with the same values and it works.
2. I changed the messagetype in the debugger - no success
3. I searched the SAP notes, but theres nothing about my problem
I guess the problem is somewhere in the ALV Grid event, because this is the only difference between the SAP standard an my program. Maybe the message is processed wrong while beeing called within an event.
It would be great to get some useful hints to solve this problemHi,
The ABAP runtime environment handles messages according to the type declared in the MESSAGE statement and the context in which the message was sent.
The behaviour of message type 'W' in a dialog is different from a report program.
Run demo program DEMO_MESSAGES, select Main Program, Type 'W' and execute. You will get an error message instead of warning message.
This behaviour is well documeneted in the on-line help for MESSAGE statement.
Regards,
Rao A -
hi,
I have 2 views, input and output these two included in a MAIN views.
when user key in their input values in INPUT view and the search results will be displayed in OUTPUT view using ALV grid.
the problem i'm facing here is, when user changes search criteria once after search results displayed.. it is not displaying with new search results. every time i have to give F5(Refresh) it is certainly not comfortable to deliver it as it is.
i have tried same scenario with simple query in our local server.. where it is working very well.
i really clueless what would be the cause.. is there any with SAP patch issues.
i have tried with refresh method of ALV component.
please help me out of this, i cannot use TABLE control every time to avoid this.
thanks,
gupta.Hi Gupta,
Could you please let us know how you are filling the context node which is mapped to ALV table?
After the search criteria is changed, if you are doing it inside handler of the button or something like that, it should work.
Refer to the tutorial in the following link which shows an example similar to your scenario:
SAP List Viewer in Web Dynpro - Simple Example for Using ALV
please post the code also which you are using to fill the node in case if you still face the issue after referring to the above tutorial.
Hope this helps!
Regards.
Srilatha
Edited by: Srilatha M on Jul 19, 2010 7:57 AM -
Hello Friends;
I have a problem with event handlers. I have defined events for double_click, data_change and hotspot_click. At first run of the program everything runs fine but when I make a change at the screen (like pressing Enter or entering a value at a screen field) the handlers seem to be called a couple of times. For example at a hotspot click I call an accounting document display and when I want to return with back button the program seems to be stuck at document display. Actually it calls event handler over and over again. How can I solve this problem? Can refreshing grid be a solution?
Thx in advance
AliHello Ali
The problem is that after handling the hotspot event the current cell is still on the field with the hotspot. Thus, when you push ENTER the ALV grid checks the current cell which has a hotspot defined which, in turn, raises event HOTSPOT_CLICK.
Therefore, you have to move the current cell to another cell that has no hotspot defined. Have a look at the implementation of the event handler method. The hotspot is on field KUNNR. After calling transaction XD03 I shift the current cell to field BUKRS.
If you comment these lines you will see the same behaviour of the report as you described.
*& Report ZUS_SDN_TWO_ALV_GRIDS
REPORT ZUS_SDN_ALVGRID_EVENTS.
DATA:
gd_okcode TYPE ui_func,
gt_fcat TYPE lvc_t_fcat,
go_docking TYPE REF TO cl_gui_docking_container,
go_grid1 TYPE REF TO cl_gui_alv_grid.
DATA:
gt_knb1 TYPE STANDARD TABLE OF knb1.
PARAMETERS:
p_bukrs TYPE bukrs DEFAULT '1000' OBLIGATORY.
* CLASS lcl_eventhandler DEFINITION
CLASS lcl_eventhandler DEFINITION.
PUBLIC SECTION.
CLASS-METHODS:
handle_hotspot_click FOR EVENT hotspot_click OF cl_gui_alv_grid
IMPORTING
e_row_id
e_column_id
es_row_no
sender.
ENDCLASS. "lcl_eventhandler DEFINITION
* CLASS lcl_eventhandler IMPLEMENTATION
CLASS lcl_eventhandler IMPLEMENTATION.
METHOD handle_hotspot_click.
* define local data
DATA:
ls_knb1 TYPE knb1,
ls_col_id type lvc_s_col.
READ TABLE gt_knb1 INTO ls_knb1 INDEX e_row_id-index.
CHECK ( ls_knb1-kunnr IS NOT INITIAL ).
SET PARAMETER ID 'KUN' FIELD ls_knb1-kunnr.
SET PARAMETER ID 'BUK' FIELD ls_knb1-bukrs.
CALL TRANSACTION 'XD03' AND SKIP FIRST SCREEN.
* Set active cell to field BUKRS otherwise the focus is still on
* field KUNNR which will always raise event HOTSPOT_CLICK
ls_col_id-fieldname = 'BUKRS'.
CALL METHOD go_grid1->set_current_cell_via_id
EXPORTING
IS_ROW_ID = e_row_id
IS_COLUMN_ID = ls_col_id.
ENDMETHOD. "handle_hotspot_click
ENDCLASS. "lcl_eventhandler IMPLEMENTATION
START-OF-SELECTION.
SELECT * FROM knb1 INTO TABLE gt_knb1
WHERE bukrs = p_bukrs.
* 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 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.
* Set event handler
SET HANDLER:
lcl_eventhandler=>handle_hotspot_click FOR go_grid1.
* Build fieldcatalog and set hotspot for field KUNNR
PERFORM build_fieldcatalog_knb1.
* Display data
CALL METHOD go_grid1->set_table_for_first_display
CHANGING
it_outtab = gt_knb1
it_fieldcatalog = gt_fcat
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.
* 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 OTHERS.
ENDCASE.
CLEAR: gd_okcode.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form BUILD_FIELDCATALOG_KNB1
* text
* --> p1 text
* <-- p2 text
FORM build_fieldcatalog_knb1 .
* define local data
DATA:
ls_fcat TYPE lvc_s_fcat.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
* I_BUFFER_ACTIVE =
i_structure_name = 'KNB1'
* I_CLIENT_NEVER_DISPLAY = 'X'
* I_BYPASSING_BUFFER =
* I_INTERNAL_TABNAME =
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.
READ TABLE gt_fcat INTO ls_fcat
WITH KEY fieldname = 'KUNNR'.
IF ( syst-subrc = 0 ).
ls_fcat-hotspot = abap_true.
MODIFY gt_fcat FROM ls_fcat INDEX syst-tabix.
ENDIF.
ENDFORM. " BUILD_FIELDCATALOG_KNB1
Regards
Uwe -
ALV grid refresh problem when I return from list-processing
hi,
I have made alv grid with f4 help features and i'm using row select feature.
When i click on a button in Application toolbar, the program leaves to list processing and then return to alv gridscreen.
Now the problem arises.
(1)Even if i select rows and press F8, the program does not identify the rows selected and does not give me desired output.
(2)Also, when i press F4, the selected value does not appear in the text field.
Both the cases are working fine, if i dont press button and go to list processing.
Please help!!You can use the function module as stated below -
FORM user_command USING r_ucomm TYPE sy-ucomm
rs_selfield TYPE slis_selfield.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
ET_EXCLUDING =
E_FLG_NO_HTML =
E_CALLBACK_PROGRAM =
E_REPID =
e_grid = ref1
ES_LAYOUT_KKBLO =
ES_SEL_HIDE =
CALL METHOD ref1->check_changed_data.
This helps to get the data in the internal table refreshed as well as that on the screen so that both are in sync.
this is generally used on some event, you can also use it otherwise.
<b>
Reward if useful.</b>
Regards,
Pritha -
Hi expert,
I got problem while downloading ALV GRID ouput to any local file. The output contains two records. but while downloading no records will be downloaded. only field headings are downloaded. What is the problem.
Pls help me to do.
Thanks
Murugan ArumugamI would suggest you add an additional button to the ALV grid toolbar. When the user clicks on this button you call in your event handler method for USER_COMMAND the method CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD with the entire itab.
Or
Set the NO_OUT as 'X' in your fieldcatalog for the particular field.
Reward points if useful -
ALV GRID DISPLAY -Problem with Layout
Hi,
I'm using ALV GRID DISPLAY. I ran the program and in the output i created a layout Test1.Later i created a layout Test2. Now when i run the report, when i select layout Test1, the display is not as selected for the layout. but when i manualy select the layout throu change layout-->Test1, the display is working good. Can someone tell me what the problem can be?
Thanks
Challahi,
in the FM have you filled the structure IS_VARIANT.
is_variant-report = sy-repid.
is_variant-variant = <variant name>.
Regards,
Leo -
ALV GRID OUTPUT PROBLEM.
here i m sending code for u r reviews.
i have two tables: pa0002, zfm_handy
i have to display alv grid by using these tables, i m getting output but the fields in the table pa0002(nachn,vorna) r not populated i m getting output for the fields those which r in the table zfm_handy only.
plz modify this code and suggest according to my requirement...
*& Report ZFM_MOBLIST *
REPORT ZFM_MOBLIST.
TABLES: ZFM_HANDY , PA0002.
TYPE-POOLS : SLIS.
DATA: G_REPID LIKE SY-REPID,
GS_PRINT TYPE SLIS_PRINT_ALV,
GT_LIST_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER,
GT_LIST_END_OF_PAGE TYPE SLIS_T_LISTHEADER,
GT_EVENTS TYPE SLIS_T_EVENT,
GT_SORT TYPE SLIS_T_SORTINFO_ALV,
GS_LAYOUT TYPE SLIS_LAYOUT_ALV,
GT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
FIELDCAT_LN LIKE LINE OF GT_FIELDCAT,
COL_POS TYPE I.
*DATA:
t_HANDY LIKE TABLE OF ZFM_HANDY,
t_pa0002 like table of PA0002,
f_handy like line of t_handy.
*DATA : BEGIN OF I_ZFM OCCURS 0.
*INCLUDE STRUCTURE ZFM_HANDY.
*DATA : NACHN LIKE PA0002-NACHN,
VORNA LIKE PA0002-VORNA,
END OF I_ZFM.
DATA : BEGIN OF ty_MOBLIST.
include structure zfm_handy.
data: NACHN like pa0002-nachn,
VORNA like pa0002-vorna,
END OF ty_MOBLIST.
DATA : BEGIN OF ty_zfm_handy.
include structure zfm_handy.
data : END OF ty_zfm_handy.
DATA : BEGIN OF ty_pa0002,
NACHN type pa0002-nachn,
VORNA type pa0002-vorna,
pernr type pa0002-pernr,
END OF ty_pa0002.
data : it_MOBLIST LIKE table of ty_MOBLIST,
wa_MOBLIST LIKE ty_MOBLIST ,
it_zfm_handy LIKE table of ty_zfm_handy,
wa_zfm_handy LIKE ty_zfm_handy ,
it_pa0002 LIKE table of ty_pa0002,
wa_pa0002 LIKE ty_pa0002 .
*DATA : BEGIN OF IT_ZFM_MOBLIST OCCURS 0.
include structure zfm_handy.
data: NACHN like pa0002-nachn,
VORNA like pa0002-vorna,
END OF IT_ZFM_MOBLIST.
DATA : BEGIN OF IT_ZFM_HANDY OCCURS 0.
include structure zfm_handy.
END OF IT_ZFM_HANDY.
*DATA : BEGIN OF IT_ZFM_PA0002 OCCURS 0,
NACHN type pa0002-nachn,
VORNA type pa0002-vorna,
pernr type pa0002-pernr,
END OF IT_ZFM_PA0002.
INITIALIZATION.
G_REPID = SY-REPID.
PERFORM PRINT_BUILD USING GS_PRINT. "Print PARAMETERS
START-OF-SELECTION.
SELECT * from
zfm_handy
into corresponding fields of table it_zfm_handy.
if not it_zfm_handy[] is initial.
select NACHN
VORNA
from pa0002
into table it_pa0002
for all entries in it_zfm_handy
where pernr = it_zfm_handy-pernr.
endif. " not it_zfm_handy
loop at it_zfm_handy into wa_zfm_handy.
read table it_pa0002 into wa_pa0002 with key pernr = ty_zfm_handy-pernr.
if sy-subrc = 0.
clear wa_MOBLIST.
move wa_zfm_handy to wa_MOBLIST.
move wa_pa0002 to wa_MOBLIST.
append wa_MOBLIST to it_MOBLIST .
endif. " sy-subrc
endloop.
*SELECT * from
zfm_handy
into corresponding fields of table it_zfm_handy.
if not it_zfm_handy[] is initial.
select NACHN
VORNA
from pa0002
into table it_pa0002
for all entries in it_zfm_handy
where pernr = it_zfm_handy-pernr.
endif. " not it_zfm_handy
loop at it_zfm_handy.
read table it_pa0002 FROM PA0002 with key pernr = ty_zfm_handy-pernr.
if sy-subrc = 0.
clear wa_MOBLIST.
move wa_zfm_handy to wa_MOBLIST.
move wa_pa0002 to wa_MOBLIST.
append wa_MOBLIST to it_MOBLIST .
APPEND IT_ZFM_MOBLIST.
endif. " sy-subrc
endloop.
SELECT *
FROM zfm_handy
INTO TABLE t_handy.
*SELECT ZFM_HANDY~TELNUM ZFM_HANDY~KARTNR ZFM_HANDY~ZUTART ZFM_HANDY~PERNR
ZFM_HANDYZDATE ZFM_HANDYPINNR ZFM_HANDYPUKNR ZFM_HANDYTARIF1
ZFM_HANDYTARIF2 ZFM_HANDYTARIF3 ZFM_HANDYGTYPE ZFM_HANDYIMEI ZFM_HANDY~TWINCARD
ZFM_HANDYTWINBILL ZFM_HANDYEINBAU ZFM_HANDYBESCHR ZFM_HANDYTEXT1 ZFM_HANDY~TEXT2
ZFM_HANDYTEXT3 PA0002NACHN PA0002~VORNA INTO TABLE I_ZFM FROM ZFM_HANDY INNER JOIN PA0002
ON ZFM_HANDYPERNR = PA0002PERNR.
select atelnum akartnr azutart apernr azdate apinnr apuknr atarif1 atarif2 atarif3 agtype aimei a~twincard
atwinbill aeinbau abeschr atext1 atext2 atext3 bnachn bvorna into table i_zfm from zfm_handy as a inner join pa0002
as b on apernr = bpernr where apernr = bpernr.
*telnum , kartnr , zutart , pernr , zdate , pinnr , puknr ,
tarif1 , tarif2 , tarif3 , gtye , imei , twincard , twinbill , einbau , beschr , text1 , text2 , text3 , nachn , vorna) from
zfm_handy as a inner join pa0002 as b on apernr = bpernr where apernr = bpernr.
PERFORM BUILD.
PERFORM EVENTTAB_BUILD CHANGING GT_EVENTS.
PERFORM COMMENT_BUILD CHANGING GT_LIST_TOP_OF_PAGE.
PERFORM CALL_ALV.
*& Form BUILD
FORM BUILD.
DATA FIELD CATALOG
Explain Field Description to ALV
DATA: FIELDCAT_IN TYPE SLIS_FIELDCAT_ALV.
CLEAR FIELDCAT_IN.
FIELDCAT_LN-FIELDNAME = 'TELNUM'.
FIELDCAT_LN-TABNAME = 'IT_MOBLIST'.
FIELDCAT_LN-NO_OUT = ' '.
FIELDCAT_LN-SELTEXT_L = 'TELNUM'.
APPEND FIELDCAT_LN TO GT_FIELDCAT.
CLEAR FIELDCAT_IN.
FIELDCAT_LN-FIELDNAME = 'KARTNR'.
FIELDCAT_LN-TABNAME = 'IT_MOBLIST'.
FIELDCAT_LN-NO_OUT = ' '.
FIELDCAT_LN-SELTEXT_L = 'KARTNR'.
APPEND FIELDCAT_LN TO GT_FIELDCAT.
CLEAR FIELDCAT_IN.
FIELDCAT_LN-FIELDNAME = 'ZUTART'.
FIELDCAT_LN-TABNAME = 'IT_MOBLIST'.
FIELDCAT_LN-NO_OUT = ' '.
FIELDCAT_LN-SELTEXT_L = 'ZUTART'.
APPEND FIELDCAT_LN TO GT_FIELDCAT.
CLEAR FIELDCAT_IN.
FIELDCAT_LN-FIELDNAME = 'PERNR'.
FIELDCAT_LN-TABNAME = 'IT_MOBLIST'.
FIELDCAT_LN-NO_OUT = ' '.
FIELDCAT_LN-SELTEXT_L = 'PERNR'.
APPEND FIELDCAT_LN TO GT_FIELDCAT.
CLEAR FIELDCAT_IN.
FIELDCAT_LN-FIELDNAME = 'ZDATE'.
FIELDCAT_LN-TABNAME = 'IT_MOBLIST'.
FIELDCAT_LN-NO_OUT = ' '.
FIELDCAT_LN-SELTEXT_L = 'ZDATE'.
APPEND FIELDCAT_LN TO GT_FIELDCAT.
CLEAR FIELDCAT_IN.
FIELDCAT_LN-FIELDNAME = 'PINNR'.
FIELDCAT_LN-TABNAME = 'IT_MOBLIST'.
FIELDCAT_LN-NO_OUT = ' '.
FIELDCAT_LN-SELTEXT_L = 'PINNR'.
APPEND FIELDCAT_LN TO GT_FIELDCAT.
CLEAR FIELDCAT_IN.
FIELDCAT_LN-FIELDNAME = 'PUKNR'.
FIELDCAT_LN-TABNAME = 'IT_MOBLIST'.
FIELDCAT_LN-NO_OUT = ' '.
FIELDCAT_LN-SELTEXT_L = 'PUKNR'.
APPEND FIELDCAT_LN TO GT_FIELDCAT.
CLEAR FIELDCAT_IN.
FIELDCAT_LN-FIELDNAME = 'TARIF1'.
FIELDCAT_LN-TABNAME = 'IT_MOBLIST'.
FIELDCAT_LN-NO_OUT = ' '.
FIELDCAT_LN-SELTEXT_L = 'TARIF1'.
APPEND FIELDCAT_LN TO GT_FIELDCAT.
CLEAR FIELDCAT_IN.
FIELDCAT_LN-FIELDNAME = 'TARIF2'.
FIELDCAT_LN-TABNAME = 'IT_MOBLIST'.
FIELDCAT_LN-NO_OUT = ' '.
FIELDCAT_LN-SELTEXT_L = 'TARIF2'.
APPEND FIELDCAT_LN TO GT_FIELDCAT.
CLEAR FIELDCAT_IN.
FIELDCAT_LN-FIELDNAME = 'TARIF3'.
FIELDCAT_LN-TABNAME = 'IT_MOBLIST'.
FIELDCAT_LN-NO_OUT = ' '.
FIELDCAT_LN-SELTEXT_L = 'TARIF3'.
APPEND FIELDCAT_LN TO GT_FIELDCAT.
CLEAR FIELDCAT_IN.
FIELDCAT_LN-FIELDNAME = 'GTYPE'.
FIELDCAT_LN-TABNAME = 'IT_MOBLIST'.
FIELDCAT_LN-NO_OUT = ' '.
FIELDCAT_LN-SELTEXT_L = 'GTYPE'.
APPEND FIELDCAT_LN TO GT_FIELDCAT.
CLEAR FIELDCAT_IN.
FIELDCAT_LN-FIELDNAME = 'IMEI'.
FIELDCAT_LN-TABNAME = 'IT_MOBLIST'.
FIELDCAT_LN-NO_OUT = ' '.
FIELDCAT_LN-SELTEXT_L = 'IMEI'.
APPEND FIELDCAT_LN TO GT_FIELDCAT.
CLEAR FIELDCAT_IN.
FIELDCAT_LN-FIELDNAME = 'TWINCARD'.
FIELDCAT_LN-TABNAME = 'IT_MOBLIST'.
FIELDCAT_LN-NO_OUT = ' '.
FIELDCAT_LN-SELTEXT_L = 'TWINCARD'.
APPEND FIELDCAT_LN TO GT_FIELDCAT.
CLEAR FIELDCAT_IN.
FIELDCAT_LN-FIELDNAME = 'TWINBILL'.
FIELDCAT_LN-TABNAME = 'IT_MOBLIST'.
FIELDCAT_LN-NO_OUT = ' '.
FIELDCAT_LN-SELTEXT_L = 'TWINBILL'.
APPEND FIELDCAT_LN TO GT_FIELDCAT.
CLEAR FIELDCAT_IN.
FIELDCAT_LN-FIELDNAME = 'EINBAU'.
FIELDCAT_LN-TABNAME = 'IT_MOBLIST'.
FIELDCAT_LN-NO_OUT = ' '.
FIELDCAT_LN-SELTEXT_L = 'EINBAU'.
APPEND FIELDCAT_LN TO GT_FIELDCAT.
CLEAR FIELDCAT_IN.
FIELDCAT_LN-FIELDNAME = 'BESCHAR'.
FIELDCAT_LN-TABNAME = 'IT_MOBLIST'.
FIELDCAT_LN-NO_OUT = ' '.
FIELDCAT_LN-SELTEXT_L = 'BESCHR'.
APPEND FIELDCAT_LN TO GT_FIELDCAT.
CLEAR FIELDCAT_IN.
FIELDCAT_LN-FIELDNAME = 'TEXT1'.
FIELDCAT_LN-TABNAME = 'IT_MOBLIST'.
FIELDCAT_LN-NO_OUT = ' '.
FIELDCAT_LN-SELTEXT_L = 'TEXT1'.
APPEND FIELDCAT_LN TO GT_FIELDCAT.
CLEAR FIELDCAT_IN.
FIELDCAT_LN-FIELDNAME = 'TEXT2'.
FIELDCAT_LN-TABNAME = 'IT_MOBLIST'.
FIELDCAT_LN-NO_OUT = ' '.
FIELDCAT_LN-SELTEXT_L = 'TEXT2'.
APPEND FIELDCAT_LN TO GT_FIELDCAT.
CLEAR FIELDCAT_IN.
FIELDCAT_LN-FIELDNAME = 'TEXT3'.
FIELDCAT_LN-TABNAME = 'IT_MOBLIST'.
FIELDCAT_LN-NO_OUT = ' '.
FIELDCAT_LN-SELTEXT_L = 'TEXT3'.
APPEND FIELDCAT_LN TO GT_FIELDCAT.
CLEAR FIELDCAT_IN.
FIELDCAT_LN-FIELDNAME = 'NACHN'.
FIELDCAT_LN-TABNAME = 'IT_MOBLIST'.
FIELDCAT_LN-NO_OUT = ' '.
FIELDCAT_LN-SELTEXT_L = 'NACHN'.
APPEND FIELDCAT_LN TO GT_FIELDCAT.
CLEAR FIELDCAT_IN.
FIELDCAT_LN-FIELDNAME = 'VORNA'.
FIELDCAT_LN-TABNAME = 'IT_MOBLIST'.
FIELDCAT_LN-NO_OUT = ' '.
FIELDCAT_LN-SELTEXT_L = 'VORNA'.
APPEND FIELDCAT_LN TO GT_FIELDCAT.
DATA SORTING
DATA: GS_SORT TYPE SLIS_SORTINFO_ALV.
CLEAR GS_SORT.
GS_SORT-FIELDNAME = 'TELNUM'.
GS_SORT-SPOS = 1.
GS_SORT-UP = 'X'.
GS_SORT-SUBTOT = 'X'.
APPEND GS_SORT TO GT_SORT.
CLEAR GS_SORT.
GS_SORT-FIELDNAME = 'KARTNR'.
GS_SORT-SPOS = 2.
GS_SORT-UP = 'X'.
*GS_SORT-SUBTOT = 'X'.
APPEND GS_SORT TO GT_SORT.
ENDFORM. "BUILD
*& Form CALL_ALV
FORM CALL_ALV.
ABAP List Viewer
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = G_REPID
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_STRUCTURE_NAME = 'ITAB1'
IS_LAYOUT = GS_LAYOUT
IT_FIELDCAT = GT_FIELDCAT
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT = GT_SORT
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS = GT_EVENTS
IT_EVENT_EXIT =
IS_PRINT = GS_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_HYPERLINK =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = IT_ZFM_HANDY[]
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
ENDFORM. "CALL_ALV
HEADER FORM
FORM EVENTTAB_BUILD CHANGING LT_EVENTS TYPE SLIS_T_EVENT.
CONSTANTS:
GC_FORMNAME_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE',
GC_FORMNAME_END_OF_PAGE TYPE SLIS_FORMNAME VALUE 'END_OF_PAGE'.
DATA: LS_EVENT TYPE SLIS_ALV_EVENT.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = LT_EVENTS.
READ TABLE LT_EVENTS WITH KEY NAME = SLIS_EV_TOP_OF_PAGE
INTO LS_EVENT.
IF SY-SUBRC = 0.
MOVE GC_FORMNAME_TOP_OF_PAGE TO LS_EVENT-FORM.
APPEND LS_EVENT TO LT_EVENTS.
ENDIF.
define END_OF_PAGE event
READ TABLE LT_EVENTS WITH KEY NAME = SLIS_EV_END_OF_PAGE
INTO LS_EVENT.
IF SY-SUBRC = 0.
MOVE GC_FORMNAME_END_OF_PAGE TO LS_EVENT-FORM.
APPEND LS_EVENT TO LT_EVENTS.
ENDIF.
ENDFORM. "EVENTTAB_BUILD
*& Form COMMENT_BUILD
FORM COMMENT_BUILD CHANGING GT_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER.
DATA: GS_LINE TYPE SLIS_LISTHEADER.
data: today_date(10) type c.
concatenate
sy-datum+6(2) '.'
sy-datum+4(2) '.'
sy-datum(4) into today_date.
CLEAR GS_LINE.
GS_LINE-TYP = 'H'.
GS_LINE-INFO = 'MOBLIST DETAILS'.
APPEND GS_LINE TO GT_TOP_OF_PAGE.
CLEAR GS_LINE.
GS_LINE-TYP = 'S'.
GS_LINE-KEY = 'Date:'.
GS_LINE-INFO = today_date.
APPEND GS_LINE TO GT_TOP_OF_PAGE.
GS_LINE-KEY = 'User:'.
GS_LINE-INFO = sy-uname.
APPEND GS_LINE TO GT_TOP_OF_PAGE.
CLEAR GS_LINE.
GS_LINE-TYP = 'A'.
GS_LINE-INFO = 'ACTION'.
APPEND GS_LINE TO GT_TOP_OF_PAGE.
ENDFORM. "COMMENT_BUILD
*& Form TOP_OF_PAGE
FORM TOP_OF_PAGE.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = GT_LIST_TOP_OF_PAGE.
WRITE: SY-DATUM, 'Page No', SY-PAGNO RIGHT-JUSTIFIED.
ENDFORM. "TOP_OF_PAGE
*& Form END_OF_PAGE
FORM END_OF_PAGE.
WRITE: /.
WRITE at (sy-linsz) sy-pagno CENTERED.
ENDFORM. "END_OF_PAGE
### PRINT SETTINGS
FORM PRINT_BUILD USING LS_PRINT TYPE SLIS_PRINT_ALV.
LS_PRINT-PRINT = ' '. "PRINT IMMEDIATE
LS_PRINT-NO_PRINT_SELINFOS = 'X'. "NO SELECTION INFO
LS_PRINT-NO_COVERPAGE = ' '. "NO COVER PAGE
LS_PRINT-NO_NEW_PAGE = ' '. "NO NEW PAGE
LS_PRINT-NO_PRINT_LISTINFOS = 'X'. "NO PRINT LIST INFO
LS_PRINT-RESERVE_LINES = 2. " FOOTERLINE
ENDFORM. "PRINT_BUILDHi narendra,
loop at it_zfm_handy into wa_zfm_handy.
<b>read table it_pa0002 into wa_pa0002 with key pernr = ty_zfm_handy-pernr.</b>
if sy-subrc = 0.
clear wa_MOBLIST.
move wa_zfm_handy to wa_MOBLIST.
move wa_pa0002 to wa_MOBLIST.
append wa_MOBLIST to it_MOBLIST .
endif. " sy-subrc
endloop.
<b>read table it_pa0002 into wa_pa0002 with key pernr = ty_zfm_handy-pernr.</b>
replace the above statement with
<b>read table it_pa0002 into wa_pa0002 with key pernr = it_zfm_handy-pernr.</b> -
Hi Experts,
I am working on ALV Grid , Data is Displayed in Grid well , But Can Any one please tell me how can i capture the event (back,exit and cancel) which is persent on standard toolbar on ALV Gried output .
Rgds,
PremrajHello PremRaj ,
Please find an dummy program to capture the events below:
TYPE-POOLS slis.
DATA: ITAB_EVENTS TYPE slis_t_event,
WA_EVENTS TYPE SLIS_ALV_EVENT.
DATA: IT_END TYPE SLIS_T_LISTHEADER,
WA_END TYPE SLIS_LISTHEADER.
** This function module will get all the events present in alv into internal table itab_events*
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = ITAB_EVENTS
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.
** With this read table statement itab_events is read for the desired event*+
READ TABLE itAB_eventS INTO wa_eventS WITH KEY name = 'END_OF_LIST'.
wa_eventS-form = 'END'.
MODIFY itAB_eventS FROM wa_eventS INDEX sy-tabix.
CLEAR wa_eventS.
*Pass the ITAB_EVENTS created in this Function Module
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
IT_EVENTS = ITAB_EVENTS
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = it_tab
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.
*READ TABLE itAB_eventS INTO wa_eventS WITH KEY name = 'END_OF_LIST'.
wa_eventS-form = 'END'.
MODIFY itAB_eventS FROM wa_eventS INDEX sy-tabix.
CLEAR wa_eventS.
*in these statements ,the second line will automatically try to call subroutine with name end.
FORM END.
WA_END-TYP = 'S'.
WA_END-KEY = TEXT-004.
WA_END-INFO = SY-DATUM.
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.
Hope it helps you.
Thanks Mansi
Code Formatted by: Alvaro Tejada Galindo on Jan 8, 2009 11:02 AM
Edited by: MANSI ASNANI on Jan 9, 2009 7:31 AM -
ALV Grid: event for user return in ALV Grid Control
Hi developers,
i'm wanna do something after a user has pressed the return button in a alv grid control. For that i need probably a event. But i can not find a proper event in the documentation. Could one of you guys help me?
Best regards christianHi Christian
ALV grid is an encapsulated object, so it seems there is no way, you ought to implement the data_changed event. So if you want to make bulk data input and after trigger the event by pressing the return key, you should make the ALV Grid get your changes after pressing the key but not after a cell change of a modified cell.
To set this attribute:
CALL METHOD gr_alvgrid->register_edit_event
EXPORTING i_event_id = cl_gui_alv_grid=>mc_evt_enter .
This way "data_changed" event will be triggered whenever you press the return key while editing.
For some more information you can also refer to the tutorial <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/documents/a1-8-4/an%20easy%20reference%20for%20alv%20grid%20control.pdf">"An Easy Reference for ALV Grid Control"</a>.
Regards
*--Serdar <a href="https://www.sdn.sap.com:443http://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.sdn.businesscard.sdnbusinesscard?u=qbk%2bsag%2bjiw%3d">[ BC ]</a> -
Hi all,
Please let me know how to hanldle event handling , making a cell in editable mode ,double click and hotspot creation,colorign a single cell,calling a transatcion when clicked on hotspot in a alv grid display program (not using OO concepts).
Looikng forward for a positive response.
Reagrds,
Mohinder.Hi,
You can create your own custom status and asign it to your
ALV GRID. Here is a sample code to add custom status and handling events.
http://www.geocities.com/mpioud/Z_DEMO_ALV_REFRESH_BUTTON.html
Reward Points if found helpfull..
Cheers,
Chandra Sekhar. -
Web Dynpro ALV grid navigation problems when entry is selected
Hi,
We have implemented support packs 19 and 20 and following this, we are having the following side effect :
When you click on an entry within an alv grid, it does not navigate to the next screen. It worked fine before the service packs, please advise if you have any suggestions as to how we can get it to work again!? Thanks in advance.
When I click, the debug does not event go to the ON_LEAD_SELECT event.
Edited by: James Wilson on Dec 10, 2009 3:52 PMHi Samir,
I think possibly you have other code which is relying on a lead selection being set in the context that you have provided to the ALV grid?
And it is that code that is falling over?
In this case I think you need to handle in that other code the possibility that the user/ALV grid will unselect all entries in the table.
Or am I misunderstanding your issue? Please do let us know,
Thanks,
Chris -
ALV Grid: event for return
Hi developers,
i'm wanna do something after a user has pressed the return button in a alv grid control. For that i need probably a event. But i can not find a proper event in the documentation. Could one of you guys help me?
Best regards christianYou should post your question in the ABAP forum
-
Hi,
I have created an alv grid in a basic program which runs fine.
But when I try to create a transaction for this program I run into problems. What type of transaction should I create? I have tried dialog and selection screen transaction but for some reason when I run these transaction codes the alv grid does not contain the content I am looking for from internal table. Where as when I run the program directly, there is not any problems at all.
Any help would be great, thanks.Hi,
Since it is a report transaction, Choose option 2
Program and selection screen (report transaction).
Put screen number 1000.
Regards,
Jovito -
I am using ALV Grid Control ABAP Objects concept.
I am facing problem in it , if i click on any record it will display me the output , but when i click on any other report it is still
displaying me the 1st record output.
for eq. i clicked on 000002121 it will display me internal table related to this document but when i click on
000002122 it is showing IT of previous document only.
How to refresh the display in gui with new recordHi
Check your double click method implementation. How you are retrieving the value of the selected item.
sample code for hotspot click
CALL METHOD grid1->get_current_cell
IMPORTING
e_row = w_row
e_value = w_value
e_col = w_col
Maybe you are looking for
-
We have 4 ipod touch learning labs at our school, one of the carts we have upgraded all devices to IOS5, which we had to do one at a time in order tomake the upgrade stick. The cart that now has IOS5 devices no longer shows the devices in ITunes, un
-
Check Deposit : Date Issue
In FF68 Transaction Header screen there are Entry Date Posting Date Value Date On the detail transaction screen inside i.e. chequewise detail entry screen also we got Doc Date Posting Date Value date but by default system takes header values for all
-
Apple products r suppose to b great, since I've had my new big screen MAC my bought products & accounts w $$ in it has been just disappearing or Apps purchased r reverting back to trial apps. How do I get this fixed. I'm not paying for my apps again.
-
I downloaded all the files of Oracle 9i for the Sun Solaris 8 machine Intel Plateform. I can't somehow unzip the files. I can't run cpio utility if it is not unzipped. I tried every thing such as gunzip -d, gzip, zcat, and uncompress. It gives me tha
-
This problem only started occurring this morning. Every time I open a project After Effects, it stops responding. After some time is begins to respond again, but this is short lived. Whenever I now scrub through the timeline or do any slightly strenu