ALV Grid Print Parameters (Select-Option Headerpage)
Dear developers,
I'm searching for the right method to call, parameter to
set or whatever I may need to do in order to get my
programm using the function REUSE_ALV_GRID_DISPLAY to
set the option for the printout of the leading page
with the select-options list. I want to force the output and I thought I coulde use the IS_PRINT - parameter for
that (structure SLIS_PRINT_ALV, field no_print_selinfos),
but that doesn't seeem to work. What am I doing wrong ?
regards
Andreas
If all else fails, you can write your select-options manually in the header. Something like this.
report zrich_0001
no standard page heading.
* Global ALV Data Declarations
type-pools slis.
data: begin of i_alv occurs 0,
matnr type mara-matnr,
end of i_alv.
* Miscellanous Data Declarations
data: fieldcat type slis_t_fieldcat_alv,
events type slis_t_event,
list_top_of_page type slis_t_listheader,
top_of_page type slis_formname value 'TOP_OF_PAGE'.
select-options: s_matnr for i_alv-matnr.
start-of-selection.
perform initialization.
perform get_data.
perform call_alv.
end-of-selection.
* Form Initialization
form initialization.
clear i_alv. refresh i_alv.
perform eventtab_build using events[].
endform.
* Form Get_Data
form get_data.
select matnr into table i_alv
from mara where matnr in s_matnr.
endform.
* CALL_ALV
form call_alv.
data: variant type disvariant.
data: repid type sy-repid.
repid = sy-repid.
variant-report = sy-repid.
variant-username = sy-uname.
perform build_field_catalog.
perform comment_build using list_top_of_page[].
* Call ABAP List Viewer (ALV)
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
it_fieldcat = fieldcat
i_callback_program = repid
is_variant = variant
it_events = events[]
i_save = 'U'
tables
t_outtab = i_alv.
endform.
* EVENTTAB_BUILD
form eventtab_build using events type slis_t_event.
* Registration of events to happen during list display
data: tmp_event type slis_alv_event.
call function 'REUSE_ALV_EVENTS_GET'
exporting
i_list_type = 0
importing
et_events = events.
read table events with key name = slis_ev_top_of_page
into tmp_event.
if sy-subrc = 0.
move top_of_page to tmp_event-form.
append tmp_event to events.
endif.
endform.
* BUILD_FIELD_CATALOG
form build_field_catalog.
clear: fieldcat. refresh: fieldcat.
data: tmp_fc type slis_fieldcat_alv.
tmp_fc-reptext_ddic = 'Material'.
tmp_fc-fieldname = 'MATNR'.
tmp_fc-tabname = 'I_ALV'.
tmp_fc-outputlen = 18.
append tmp_fc to fieldcat.
endform.
* COMMENT_BUILD
form comment_build using list_top_of_page type
slis_t_listheader.
data: tmp_line type slis_listheader.
clear tmp_line.
tmp_line-typ = 'H'.
tmp_line-info = 'Select-Options'.
append tmp_line to list_top_of_page.
read table s_matnr index 1.
clear tmp_line.
tmp_line-typ = 'S'.
tmp_line-key = 'From Material'.
tmp_line-info = s_matnr-low.
append tmp_line to list_top_of_page.
clear tmp_line.
tmp_line-typ = 'S'.
tmp_line-key = 'To Material'.
tmp_line-info = s_matnr-high.
append tmp_line to list_top_of_page.
endform.
* TOP_OF_PAGE
form top_of_page.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
i_logo = 'ENJOYSAP_LOGO'
it_list_commentary = list_top_of_page.
endform.
Regards,
Rich Heilman
Similar Messages
-
Text above an ALV-Grid print-out
It is possible to set a Text above an ALV-Grid print-out?
hii
yes you can print header in ALV & it will come in print out.use following code
DATA: i_listheader TYPE slis_t_listheader WITH HEADER LINE,
w_date like sy-datum.
move:
'H' TO i_listheader-typ,
TO i_listheader-info.
* text-021 TO i_listheader-info.
APPEND i_listheader.
WRITE sy-datum TO w_date.
move:
'S' TO i_listheader-typ,
'Execution date' TO i_listheader-key,
w_date TO i_listheader-info.
APPEND i_listheader.
MOVE:
'S' TO i_listheader-typ,
'Execution user' TO i_listheader-key,
sy-uname TO i_listheader-info.
APPEND i_listheader.
Move:
'Discription' to i_listheader-key,
'Tolling Production Variance' to i_listheader-info.
APPEND i_listheader.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = i_listheader[].
<REMOVED BY MODERATOR>
thx
twinkal
Edited by: twinkal patel on Jun 12, 2008 2:51 PM
Edited by: Alvaro Tejada Galindo on Jun 12, 2008 1:33 PM -
Issue with ALV grid print preview/spool
Hello everyone,
I am working on a report and I am having some issues with ALV grid. Currently in our DEV and QA environments the user can run the report, view the ALV grid, and print the grid without any issues.
However this isn't the case in the Prod environment. The user is able to run the report and view the grid without any issues. But when they click print preview or click print, the spool is incorrect. It shows the proper values from the grid, but the first field is reduced in length. Rather than showing a numeric field of length 10 it shows 99999999# or 99999999...
The programs are identical through every environment, including user parameters, formats, and spool settings. I have been told printing grids may have some issues, does anyone have any advice or dealt with this issue before?
I appreciate the help.
Thanks,
CI was waiting to hear from the functional team on the matter and no one has mentioned any more issues. I am assuming the problem is solved. I just noticed the thread was still un-answered and wanted to give an update.
Thank you for you help Vijay.
Regards
C -
ALV grid disable right click options
Hi experts,
Iam working on <b>normal</b> ALV grid.
In the output of the ALV, if we click right click,
we can see 'Cut', 'Copy text', 'Insert with Overwirte' options.
How can i disable(or remove) these 3 options?
Pls give me suggestions
Reward guaranteed,
thanks
kakiHello Kaki
You have to handle event <b>CONTEXT_MENU_REQUEST</b> (of class CL_GUI_ALV_GRID). The following sample report shows how to do that:
*& Report ZUS_SDN_ALV_CONTEXT_MENU_1
*& Flow logic of screen 100 (no screen elements; ok_code = GD_OKCODE)
*& PROCESS BEFORE OUTPUT.
*& MODULE STATUS_0100.
*& PROCESS AFTER INPUT.
*& MODULE USER_COMMAND_0100.
REPORT zus_sdn_alv_context_menu_1.
DATA:
gd_okcode TYPE ui_func,
go_docking TYPE REF TO cl_gui_docking_container,
go_splitter TYPE REF TO cl_gui_splitter_container,
go_cell_top TYPE REF TO cl_gui_container,
go_cell_bottom TYPE REF TO cl_gui_container,
go_grid1 TYPE REF TO cl_gui_alv_grid,
go_grid2 TYPE REF TO cl_gui_alv_grid,
gs_layout TYPE lvc_s_layo.
DATA:
gt_knb1 TYPE STANDARD TABLE OF knb1,
gt_knvv TYPE STANDARD TABLE OF knvv.
* 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,
handle_context_menu_request FOR EVENT context_menu_request
OF cl_gui_alv_grid
IMPORTING
e_object
sender,
handle_user_command FOR EVENT user_command OF cl_gui_alv_grid
IMPORTING
e_ucomm
sender.
ENDCLASS. "lcl_eventhandler DEFINITION
* CLASS lcl_eventhandler IMPLEMENTATION
CLASS lcl_eventhandler IMPLEMENTATION.
METHOD handle_double_click.
* define local data
DATA:
ls_knb1 TYPE knb1.
CHECK ( sender = go_grid1 ).
READ TABLE gt_knb1 INTO ls_knb1 INDEX e_row-index.
CHECK ( ls_knb1-kunnr IS NOT INITIAL ).
CALL METHOD go_grid1->set_current_cell_via_id
EXPORTING
* IS_ROW_ID =
* IS_COLUMN_ID =
is_row_no = es_row_no.
* Triggers PAI of the dynpro with the specified ok-code
CALL METHOD cl_gui_cfw=>set_new_ok_code( 'DETAIL' ).
ENDMETHOD. "handle_double_click
METHOD handle_context_menu_request.
* define local data
DATA: lt_fcodes TYPE ui_funcattr,
ls_fcode TYPE uiattentry,
ls_func TYPE ui_func,
lt_func TYPE ui_functions.
" Inactivate all standard functions
CALL METHOD e_object->get_functions
IMPORTING
fcodes = lt_fcodes.
LOOP AT lt_fcodes INTO ls_fcode.
ls_func = ls_fcode-fcode.
APPEND ls_func TO lt_func.
ENDLOOP.
e_object->disable_functions( lt_func ).
" Add new functions
e_object->add_separator( ).
CALL METHOD e_object->add_function
EXPORTING
fcode = 'XD03'
text = 'Call Transaction'.
CALL METHOD e_object->add_function
EXPORTING
fcode = 'DETAILS'
text = 'Display Details'.
ENDMETHOD. "handle_context_menu_request
METHOD handle_user_command.
* define local data
DATA:
ls_knb1 TYPE knb1,
ls_row TYPE lvc_s_row,
ls_col TYPE lvc_s_col.
" NOTE: in case of CL_GUI_ALV_GRID the functions of a context menu
" are handled in method USER_COMMAND.
CHECK ( e_ucomm = 'XD03' OR
e_ucomm = 'DETAILS' ).
CALL METHOD sender->get_current_cell
IMPORTING
es_row_id = ls_row
es_col_id = ls_col.
CASE e_ucomm.
WHEN 'XD03'.
READ TABLE gt_knb1 INTO ls_knb1 INDEX ls_row-index.
SET PARAMETER ID 'BUK' FIELD ls_knb1-bukrs.
SET PARAMETER ID 'KUN' FIELD ls_knb1-kunnr.
CALL TRANSACTION 'XD03' AND SKIP FIRST SCREEN.
WHEN 'DETAILS'.
" NOTE: only for the sake of simplicity the event handler method
" is called
CALL METHOD lcl_eventhandler=>handle_double_click
EXPORTING
e_row = ls_row
sender = go_grid1.
WHEN OTHERS.
ENDCASE.
ENDMETHOD. "handle_user_command
ENDCLASS. "lcl_eventhandler IMPLEMENTATION
START-OF-SELECTION.
SELECT * FROM knb1 INTO TABLE gt_knb1
WHERE bukrs = '1000'.
* 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 splitter container
CREATE OBJECT go_splitter
EXPORTING
parent = go_docking
rows = 2
columns = 1
* NO_AUTODEF_PROGID_DYNNR =
* NAME =
EXCEPTIONS
cntl_error = 1
cntl_system_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.
* Get cell container
CALL METHOD go_splitter->get_container
EXPORTING
row = 1
column = 1
RECEIVING
container = go_cell_top.
CALL METHOD go_splitter->get_container
EXPORTING
row = 2
column = 1
RECEIVING
container = go_cell_bottom.
* Create ALV grids
CREATE OBJECT go_grid1
EXPORTING
i_parent = go_cell_top
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,
lcl_eventhandler=>handle_context_menu_request FOR go_grid1,
lcl_eventhandler=>handle_user_command FOR go_grid1.
CREATE OBJECT go_grid2
EXPORTING
i_parent = go_cell_bottom
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.
* Display data
gs_layout-grid_title = 'Customers'.
CALL METHOD go_grid1->set_table_for_first_display
EXPORTING
i_structure_name = 'KNB1'
is_layout = gs_layout
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.
gs_layout-grid_title = 'Customers Details (Sales Areas)'.
CALL METHOD go_grid2->set_table_for_first_display
EXPORTING
i_structure_name = 'KNVV'
is_layout = gs_layout
CHANGING
it_outtab = gt_knvv " empty !!!
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.
* NOTE: dynpro does not contain any elements
CALL SCREEN '0100'.
* Flow logic of dynpro (does not contain any dynpro elements):
*PROCESS BEFORE OUTPUT.
* MODULE STATUS_0100.
*PROCESS AFTER INPUT.
* MODULE USER_COMMAND_0100.
END-OF-SELECTION.
*& Module STATUS_0100 OUTPUT
* text
MODULE status_0100 OUTPUT.
SET PF-STATUS 'STATUS_0100'. " contains push button "DETAIL"
* SET TITLEBAR 'xxx'.
* Refresh display of detail ALV list
CALL METHOD go_grid2->refresh_table_display
* EXPORTING
* IS_STABLE =
* I_SOFT_REFRESH =
EXCEPTIONS
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.
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.
* User has pushed button "Display Details"
WHEN 'DETAIL'.
PERFORM entry_show_details.
WHEN OTHERS.
ENDCASE.
CLEAR: gd_okcode.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form ENTRY_SHOW_DETAILS
* text
* --> p1 text
* <-- p2 text
FORM entry_show_details .
* define local data
DATA:
ld_row TYPE i,
ls_knb1 TYPE knb1.
CALL METHOD go_grid1->get_current_cell
IMPORTING
e_row = ld_row.
READ TABLE gt_knb1 INTO ls_knb1 INDEX ld_row.
CHECK ( syst-subrc = 0 ).
SELECT * FROM knvv INTO TABLE gt_knvv
WHERE kunnr = ls_knb1-kunnr.
ENDFORM. " ENTRY_SHOW_DETAILS
Regards
Uwe -
Mix of Parameters & Select Options in a Selection screen in WD4A
Hi All.
I just created my first selection screen in WD4A couple of days back.
Now, we have to mix up some parameters and select-options just like in normal ABAP.
But I could only find a way to insert a "Range" into the WD4A screens via "Create_Range_table".
Supposing I have 2 select-options, then 2 parameters - i.e. no Pattern or range or intervals options (simple = option); then again 2 select-options.
Can't we make a simple Parameter option in WD4A selection screen? I know we can make no_extension and no_intervals as true so that it does look like a parameter. But still user can enter a pattern search in it like a select-option.
Hope my query is clear.
Another question is : As far as I understood, we ALWAYS need a IT_RESULT table in the method ADD_SELECTION_FIELD. Then why is it not mandatory in the method?
Thanks in adv.Hi Aishi,
In an early version of SelectOptions, the parameter it_result was mandatory. Some time later, a developer contacted me and showed me an example where it was benefitial to first create the field and to pass in the range table at a later point in his algorithm. This can be done by calling set_range_table_of_sel_field( ). Hence, the parameter has become optional. Of course, a range table needs to be specified before the page gets rendered.
Best regards,
Thomas -
Problem in ALV Grid control in selecting multiple rows.
Dear All,
I am using ALV grid, in that first column is sel field user will select record and he press the customized button for one record it is working fine, but user unable to select multiple records without using CTRL key, and i used HOTSPOT on LIFNR field in this case when ever i ampressing LIFNR field it is takunf Fcode as &IC1 instead of LIFNR, i tried to solve this but i coudn;t succeded, please help me out in this .
Regards,
Madhu srujan.P
Edited by: Chinnu on Apr 9, 2010 5:26 PM
Edited by: Chinnu on Apr 9, 2010 5:30 PMI assume the first column contains the standard selection field of the ALV grid.
To enable the proper method of seletion, you need to pass the appropriate SEL_MODE in the your layout structure:
SEL_MODE is either SPACE, A, B, C or D.
Google for ALV grid PDF and you'll find some documentation on ALV grids in general. -
What will happen if we execute a report without giving any value in parameter in selection screen ?
What will happen if we execute a report without giving any value in select-options in selection screen ?Hi Swapna,
Here you go..Use this code and find the differennce
*-- 2) Difference between Parameters and Select options with
*-- No-Intervals and No-extension
Explanation: -
1) If u dont enter any value in parameter, the system consider it as a initial value and dont retrive any records. If u dont enter any value in select-options, the system selects all values from the database.
2) The other difference is You can check a value againist a Entries against a check table with Parameter option by as " VALUE CHECK ". However it is recommended to use this only when the parameter is obligatory becuase it checks for blank entries also. This option( VALUE CHECK ) cannot be used in SELECT-OPTIONS.
( Eg:- p_matnr like mara-matnr OBLIGATORY VALUE CHECK. )
TABLES: MARA.
DATA: p_count TYPE i,
s_count TYPE i.
PARAMETERS: p_mtart like mara-mtart.
SELECT-OPTIONS: s_mtart FOR mara-mtart NO INTERVALS NO-EXTENSION.
SELECT count(*) FROM
MARA into p_count
WHERE matnr = p_mtart.
SELECT count(*) FROM
MARA into s_count
WHERE matnr IN s_mtart.
WRITE:/ p_count,
s_count.
In this output, p_count = 0.
and s_count will be total no. of records in database.
Reward points if this code is helpful.
Thanks.
Hari krishna -
ALV Grid multiple row selection, disabling some
Does anyone know if it is possible to have an ALV grid with multiple row selection allowed but for some rows the row selection is disabled?
Kind regards,
John.Hi John,
You can add a check box and select multiple rows. I am using the same technique. I have used OO.
a) Use Even handler "Double Click"
b)Using "SELECT_ALL_ENTRIES CHANGING PT_OUTTAB TYPE STANDARD TABLE" and I am sorting based Check box selection.
Need more help please let me know. I will send you the code.
Lanka
Message was edited by: Lanka Murthy -
Selection screen Parameters - Select -options values populated from ITAB
PARAMETERS : PLANT
SELECT-OPTIONS : MATERIAL
My Selection Screen contents of should change as the PLANT changes ..
and i want to populate the contents of SELECT-OPTIONS from an ITAB how can i do that .
wen plant changes its corresponding materials should reflect inthe Select -options. this is my need .
please solve..
thanks, .
Aslam.Srry Raj u misundersttod me ...
I was not saying ur solution is not gud ...my question was different .....may be this is not the right forum to ask what i want to know ....
just bear with me moderators plz ...
i just wanted to understand the interview process...since I have not appreared for any interview ( I started my carreer with a company and I am still with it ..wuld luv to continue [:d])
I believe , if you would have asked me the same question probably i would not have given u the best possible solution...as u r also admitting for ur particular scenario ur solution is better than max's .....
as an inteviewer will u expect the best solution from me .....( which might not come to my mind ( nd I am sure will not ..I luv abap debugger ) or u just wanna check if I know how to use difference selection screen events .
If u wanted to hear only the better solution ...( I am rejected ............now I will have to continue sticking to my current job [:d], not bcoz i prefer but bcoz I cant switch )
if u want to test if i know how to use selection screen events then ( I am selected ...but now I would like to stick to my current job ...bcoz I want to )
Now I realize I cannot do ABAP without Debugger. -
ALV GRID-how to select all the check boxes using push button
Hai All,
I displayed ALV grid & every record contains one check box as first column.
If user clicks on one push button all the check boxes needs to selected.
Could any one tell me how to do this?
Regards,
BhaskarHi Bhaskar,
Try this code :
*" Table declarations...................................................
TABLES :
spfli. " Flight Schedule
*" Data declarations...................................................
Work variables *
DATA :
w_checkbox TYPE c, " Check Box
w_checkbox1 TYPE c, " Check Box
w_lineno LIKE sy-lilli, " Current Line No
w_lines TYPE i. " No. Of Records in Int.Table
Internal table to hold Flight Schedule data *
DATA :
t_spfli LIKE
STANDARD TABLE
OF spfli.
Structure to hold Function Codes *
DATA :
fs_fcode LIKE LINE OF t_fcode.
TOP-OF-PAGE EVENT *
TOP-OF-PAGE.
PERFORM top_of_page.
START-OF-SELECTION EVENT *
START-OF-SELECTION.
PERFORM fetch_spfli_data.
SET PF-STATUS 'YMENU1'.
DESCRIBE TABLE t_spfli LINES w_lines.
fs_fcode = 'EXIT'.
APPEND fs_fcode TO t_fcode.
fs_fcode = 'SELECT'.
APPEND fs_fcode TO t_fcode.
fs_fcode = 'DESELECT'.
APPEND fs_fcode TO t_fcode.
fs_fcode = 'RETRIEVE'.
APPEND fs_fcode TO t_fcode.
AT USER-COMMAND EVENT *
AT USER-COMMAND.
PERFORM user_command.
FORM top_of_page .
WRITE :/50 'Flight Schedule Information'(008).
ULINE.
FORMAT COLOR 1.
WRITE :/10 'Carrier ID'(001),
25 'Connection ID'(002) ,
43 'Airport From'(003),
59 'Airport To'(004),
74 'Departure Time'(007),
93 'Arrival Time'(011),
106 space.
ENDFORM. " FORM TOP_OF_PAGE
FORM fetch_spfli_data .
SELECT carrid " Carrier ID
connid " Connection ID
airpfrom " Airport From
airpto " Airport To
deptime " Departure Time
arrtime " Arrival Time
FROM spfli
INTO CORRESPONDING FIELDS OF
TABLE t_spfli.
IF sy-subrc EQ 0.
PERFORM display_spfli_data.
ENDIF. " IF SY-SUBRC EQ 0
ENDFORM. " FORM FETCH_SPFLI_DATA
FORM display_spfli_data .
SORT t_spfli BY carrid ASCENDING.
LOOP AT t_spfli INTO spfli.
FORMAT COLOR 2.
WRITE :/2 w_checkbox AS CHECKBOX,
spfli-carrid UNDER text-001,
spfli-connid UNDER text-002,
spfli-airpfrom UNDER text-003,
spfli-airpto UNDER text-004,
spfli-deptime UNDER text-007,
spfli-arrtime UNDER text-011.
ENDLOOP. " LOOP AT T_SPFLI...
ENDFORM. " FORM DISPLAY_SPFLI_DATA
FORM user_command .
CASE sy-ucomm.
WHEN 'SELECT'.
w_checkbox1 = 'X'.
DO w_lines TIMES.
w_lineno = sy-index + 3.
READ LINE w_lineno FIELD VALUE w_checkbox.
IF w_checkbox = '*'.
CONTINUE.
ELSE.
MODIFY LINE w_lineno FIELD VALUE w_checkbox FROM w_checkbox1.
ENDIF. " IF W_CHECKBOX = '*'
ENDDO. " DO W_LINES TIMES.
WHEN 'DESELECT'.
w_checkbox1 = ' '.
DO w_lines TIMES.
w_lineno = sy-index + 3.
READ LINE w_lineno.
IF w_checkbox = '*'.
CONTINUE.
ELSE.
MODIFY LINE w_lineno FIELD VALUE w_checkbox FROM w_checkbox1.
ENDIF. " IF W_CHECKBOX = '*'
ENDDO. " DO W_LINES TIMES.
WHEN 'RETRIEVE'.
w_checkbox = ' '.
DO w_lines TIMES.
w_lineno = sy-index + 3.
READ LINE w_lineno FIELD VALUE w_checkbox INTO w_checkbox.
IF w_checkbox = 'X'.
PERFORM fetch_sflight_data.
PERFORM display_sflight_data.
ENDIF. " IF W_CHECKBOX = 'X'
ENDDO. " DO W_LINES TIMES.
ENDCASE. " CASE SY-UCOMM
ENDFORM. " FORM USER_COMMAND
This report gives you the SPFLI Data and places a check box in front of each record. When u click on select all button it will select all the records. And if you click on deselect all it will deselect all the records. When you are trying this maintain the pf-status 'YMENU1' and give the function codes as in the code.
Regards,
Swapna. -
ALV Grid Single Row Selection Only
Hi,
I have a requirement to select a single row in an ALV grid using class
I tried with layout-sel_mode = 'B' its not working, and don't want to use
call method g_grid->get_selected_rows
importing
et_row_no = lt_row_no.
and check for number of rows and giving error message " select only one row".
Is there any other way to tackle this issue
Thanks
aRsHi,
DATA:
* Internal table for indexes of selected rows
gi_index_rows TYPE lvc_t_row,
* Information about 1 row
g_selected_row LIKE lvc_s_row.
CALL METHOD go_grid->get_selected_rows
IMPORTING
et_index_rows = gi_index_rows.
DESCRIBE TABLE gi_index_rows LINES l_lines.
Here the L_Lines will contain the number of rows selected
Regards
Sudheer -
How to capture multiple rows of ALV grid when user selected?
Actually,It is easy to get one single line.However, my user wants select several lines of ALV grid by condition . i need to process the selected lines ,so i need to put these lines into an internal table. But now, i have no idea to capture the lines.
What method for an ALV Grid will return the lines the user has selected?
Appreciate for your help!
Edited by: Heyman52 on Aug 25, 2010 4:28 AM
Edited by: Heyman52 on Aug 25, 2010 4:30 AMHi,
Once user selects multiple rows and press another button for further execution, you can modify your internal table with marked rows using selection column.
You need to add user command code in your ALV grid call. Please refer below code.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_PF_STATUS_SET = 'F_GUI_STATUS'
I_CALLBACK_USER_COMMAND = 'F_USERCOMMAND'
I_GRID_TITLE = TEXT-026
IS_LAYOUT = WA_LAYOUT
IT_FIELDCAT = I_FIELDCAT
TABLES
T_OUTTAB = I_OUTTAB
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
IF SY-SUBRC NE 0.
MESSAGE S475 DISPLAY LIKE 'E'.
LEAVE LIST-PROCESSING.
ENDIF.
*- User command for details display.
PERFORM F_USERCOMMAND USING I_UCOMM
I_SELFIELD.
FORM F_USERCOMMAND USING FP_R_UCOMM LIKE SY-UCOMM
FP_SELFIELD TYPE SLIS_SELFIELD.
IF L_V_REF_GRID IS INITIAL.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
E_GRID = L_V_REF_GRID.
ENDIF.
IF NOT L_V_REF_GRID IS INITIAL.
CALL METHOD L_V_REF_GRID->CHECK_CHANGED_DATA.
ENDIF.
ENDFORM.
You can then read your final internal table as below and take the selected records in another internal table.
LOOP AT I_OUTTAB ASSIGNING <FS_OUTTAB> WHERE SEL EQ 'X'.
APPEND <FS_OUTTAB> TO I_CHECK.
ENDLOOP.
Edited by: Archana Pawar on Aug 25, 2010 11:16 AM -
ALV GRID and a SELCTION-OPTION as cell
Hi,
is there any class or other things that can I use to add a value range field into a cell?
Regards
Fanninger ThomasHi,
This is just ,how we can use select-options in Alv.
https://forums.sdn.sap.com/click.jspa?searchID=13886942&messageID=4848758
Regards,
Shiva kumar
Edited by: Kodityala on Jul 10, 2008 10:58 AM -
How to write text name of parameters / select options in ABAP list??
Hi gurus, i must read the text name of parameterd / select options in ABAP program and write it in a list of the same program for log.......how can i do it??
Thanks in advance!
Best regards!
Ferdinando
Message was edited by:
Ferdinando SellittoHello Ferdinandino
Useful function modules are:
RS_PRINT_SELECTIONS
RS_LIST_SELECTION_TABLE (Generates list according to values in selection table(RSPARAMS))
RS_REFRESH_FROM_SELECTOPTIONS (Current contents of selection screen)
Function module RS_REFRESH_FROM_SELECTOPTIONS can provide the input for function module RS_LIST_SELECTION_TABLE.
Regards
Uwe -
Hi guys,
When I execute my report I can see all fields ok, but when I decide to print it the columns and fields are been displaced. I tried to fix with the fielcatalog but it isn't possible. Can anybody help me?
Thanks a lot
Best regards.
AnaHi Menegazzo Marco ,
I call the alv :
***fieldcatalog***
LS_FCAT-COL_POS = '1'.
LS_FCAT-FIELDNAME = 'BUKRS' .
LS_FCAT-TABNAME = 'BKPF'.
LS_FCAT-INTTYPE = 'C' .
LS_FCAT-OUTPUTLEN = '4' .
LS_FCAT-COLTEXT = 'Sociedad ' .
LS_FCAT-SELTEXT = 'Sociedad ' .
LS_FCAT-JUST = 'X'.
LS_FCAT-COL_OPT = ' '.
APPEND LS_FCAT TO PGT_FIELDCAT .
CLEAR LS_FCAT.
LS_FCAT-COL_POS = '2'.
LS_FCAT-FIELDNAME = 'BELNR' .
LS_FCAT-TABNAME = 'BKPF'.
LS_FCAT-INTTYPE = 'C' .
LS_FCAT-OUTPUTLEN = '10' .
LS_FCAT-DD_OUTLEN = '10'.
LS_FCAT-COLTEXT = 'Nº doc. Contable' .
LS_FCAT-SELTEXT = 'Nº doc. Contable' .
LS_FCAT-JUST = 'X'.
LS_FCAT-COL_OPT = ''.
APPEND LS_FCAT TO PGT_FIELDCAT .
CLEAR LS_FCAT.
LS_FCAT-COL_POS = '3'.
LS_FCAT-FIELDNAME = 'GJAHR' .
LS_FCAT-TABNAME = 'BKPF'.
LS_FCAT-INTTYPE = 'N' .
LS_FCAT-OUTPUTLEN = '4' .
LS_FCAT-COLTEXT = 'Ejercicio' .
LS_FCAT-SELTEXT = 'Ejercicio' .
LS_FCAT-JUST = 'X'.
LS_FCAT-COL_OPT = ' '.
APPEND LS_FCAT TO PGT_FIELDCAT .
CLEAR LS_FCAT.
**end fieldcatalog**
*layout**
PGS_LAYOUT-CWIDTH_OPT = 'X'.
PGS_LAYOUT-COL_OPT = 'X'.
*end layout**
*print*
GS_PRINT-NO_COLWOPT = 'X'.
*end print*
CALL METHOD GR_ALVGRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
I_STRUCTURE_NAME = 'S_ALV'
IS_LAYOUT = GS_LAYOUT
IS_PRINT = GS_PRINT
CHANGING
IT_OUTTAB = LT_ALV[]
IT_FIELDCATALOG = GT_FIELDCAT
EXCEPTIONS
INVALID_PARAMETER_COMBINATION = 1
PROGRAM_ERROR = 2
TOO_MANY_LINES = 3
OTHERS = 4.
IF SY-SUBRC <> 0.
*--Exception handling
ENDIF.
Thanks a lot.
Maybe you are looking for
-
Hi, Is there anyway to import presets from Media Encoder CS3 to CS5?
-
Trying to send "Message" on iPad 2 and keep getting message that "x" is "not registered with iMessage." Never happened on previous iPad. What does it mean and how do I solve?
-
Shortcut Key v. Toolbar Button - Set in point/set out point
I know that the shortcut keys to insert an in-point and out-point are Alt+[ and Alt+] - but is there actually a button to add these points in Adobe After Effects CS6? I'm terrible at remembering shortcut keys and can't believe that it doesn't app
-
InDesign crashes when packaging
I have InDesign CS5 and have never had any problem packaging large files. I do this to basically archive everything. Suddenly, random files I try to package are hanging and then InDesign quits responding and I have to force quit. So far I've deleted
-
Hi, what's the best way to replace IMAC 27'' glass when broken (latest Imac generation from end 2012) ? Thanks,