Separator line in alv grid custome toolbar
I had created a toolbar in alv grid through CLASS cl_alv_grid_handler IMPLEMENTATION.
I would like to separate the control by separator line please suggest me how to do the same.
CLASS cl_alv_grid_handler IMPLEMENTATION.
METHOD handle_toolbar.
PERFORM handle_toolbar
USING e_object.
ENDMETHOD.
FORM handle_toolbar
USING i_object TYPE REF TO cl_alv_event_toolbar_set.
DATA: ls_toolbar TYPE stb_button.
CLEAR : i_object->mt_toolbar.
CLEAR: ls_toolbar.
MOVE 'Add' TO ls_toolbar-function.
MOVE icon_create TO ls_toolbar-icon.
MOVE 'Add row' TO ls_toolbar-quickinfo.
MOVE ' ' TO ls_toolbar-disabled.
MOVE 'Add' TO ls_toolbar-text.
APPEND ls_toolbar TO i_object->mt_toolbar.
MOVE 'CHECK_DATA' TO ls_toolbar-function.
MOVE icon_check TO ls_toolbar-icon.
MOVE 'Check Entries' TO ls_toolbar-quickinfo.
MOVE ' ' TO ls_toolbar-disabled.
APPEND ls_toolbar TO i_object->mt_toolbar.
Endform.
Hi,
Refer to the link given.
https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a415907
Hope it helps.
Regards,
Rajesh Kumar
Similar Messages
-
How to Increase Line space between two lines in ALV Grid
hi,
I want to increase the line space between any two lines in ALV GRID. Can anybody has solution for this issue.
Regards,
MadanHi Madan
It's not possible
Regards
Gregory -
Color a line in ALV Grid Control
<<Do not ask for or offer points>>
Hi all,
How to color a line in ALV Grid Control using OOPs.
The appropriate replies will be rewarded.
regards,
S Philip
Edited by: Matt on Dec 22, 2008 11:05 AM<<Points unassigned - cut and paste not allowed. http://sgstocks.tripod.com/alvgrid_control.htm>>
Hi,
To color a line, the structure of the table must include a Char4 field for color properties
TYPES: BEGIN OF st_sflight.
INCLUDE STRUCTURE zsflight.
Field for line color
types: line_color(4) type c.
TYPES: END OF st_sflight.
TYPES: tt_sflight TYPE STANDARD TABLE OF st_sflight.
DATA: gi_sflight TYPE tt_sflight.
Loop trough the table to set the color properties of each line. The color properties field is
Char 4 and the characters is set as follows:
Char 1 = C = This is a color property
Char 2 = 6 = Color code (1 - 7)
Char 3 = Intensified on/of = 1 = on
Char 4 = Inverse display = 0 = of
LOOP AT gi_sflight INTO g_wa_sflight.
IF g_wa_sflight-paymentsum < 100000.
g_wa_sflight-line_color = 'C610'.
ENDIF.
MODIFY gi_sflight FROM g_wa_sflight.
ENDLOOP.
Name of the color field
gs_layout-info_fname = 'LINE_COLOR'.
Grid setup for first display
CALL METHOD go_grid->set_table_for_first_display
EXPORTING i_structure_name = 'SFLIGHT'
is_layout = gs_layout
CHANGING it_outtab = gi_sflight.
Regards,
John
Edited by: Matt on Dec 22, 2008 11:18 AM -
Alv grid control toolbar exclude generic functions
Hi,
I'm attempting to exclude certain functions from the toolbar of an (editable) alv grid (of class cl_gui_alv_grid).
The problem is that the buttons still show on the toolbar.
My program is based on the SAP example program 'BCALV_EDIT_03'. It would seem that even this example doesn't work as expected.
This is an extract of my code:
-[EXTRACT <b></b>BEGIN]--
*---Restrict generic functions to 'change only'.
* (i.e The user should not be able to add new lines).
DATA ls_exclude TYPE ui_func.
DATA: lt_exclude TYPE ui_functions.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_delete_row.
APPEND ls_exclude TO lt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_append_row.
APPEND ls_exclude TO lt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_insert_row.
APPEND ls_exclude TO lt_exclude.
*...initialize alv grid
CALL METHOD g_grid->set_table_for_first_display
EXPORTING
is_layout = ps_layout
it_toolbar_excluding = lt_exclude
CHANGING
it_fieldcatalog = pt_fieldcat
it_outtab = pt_outtab.
-[EX<b></b>TRACT END]--
Thank You In Advance,
NhlanhlaHi,
i've done similar one, i am able to exclude.
DATA: LT_EXCLUDE TYPE UI_FUNCTIONS.
PERFORM EXCLUDE_TB_FUNCTIONS CHANGING LT_EXCLUDE.
FORM EXCLUDE_TB_FUNCTIONS CHANGING PT_EXCLUDE TYPE UI_FUNCTIONS.
* Only allow to change data not to create new entries (exclude
* generic functions).
DATA LS_EXCLUDE TYPE UI_FUNC.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_COPY_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_DELETE_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_APPEND_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_INSERT_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_MOVE_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_COPY.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_CUT.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_PASTE.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_PASTE_NEW_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_UNDO.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
ENDFORM. " EXCLUDE_TB_FUNCTIONS
"can you check the LT_EXCLUDE in debug mode.
regards
vijay -
Appending a new line to ALV Grid
Hi,
I have created an editable ALV grid wherein the first 2 columns are key fields and hence non-editable and the rest are editable.
Now I try to append or create a row on the ALV Grid by using the standard toolbar buttons. By doing so, it adds a new line that has the first 2 columns (key fields) as non-editable and the rest as editable. I would like to open those key fields for edit mode when I try to append or insert a new row.
I overwrote the code for append and insert with my code like this
METHOD handle_toolbar.
DATA: ls_toolbar TYPE stb_button.
READ TABLE e_object->mt_toolbar INTO ls_toolbar
WITH KEY function = '&LOCAL&APPEND'.
IF sy-subrc = 0.
ls_toolbar-function = 'MY_APPEND'.
MODIFY e_object->mt_toolbar FROM ls_toolbar INDEX sy-tabix.
ENDIF.
ENDMETHOD.
METHOD handle_user_command.
DATA: ls_table TYPE ztable.
CASE e_ucomm.
WHEN 'MY_APPEND'.
APPEND ls_table TO gt_table. "append an initial line
PERFORM modify_alv TABLES gt_table.
CALL METHOD gref_alv->refresh_table_display.
ENDCASE.
ENDMETHOD.
FORM modify_alv TABLES xt_lt_table STRUCTURE ztable.
LOOP AT xt_lt_table INTO ls_table.
REFRESH lt_cell_style.
IF NOT ls_table IS INITIAL.
ls_cell_style-fieldname = 'FIELD1'.
ls_cell_style-style = cl_gui_alv_grid=>mc_style_disabled.
INSERT ls_cell_style INTO TABLE lt_cell_style.
ELSE.
ls_cell_style-fieldname = 'FIELD1'.
ls_cell_style-style = cl_gui_alv_grid=>mc_style_enabled.
INSERT ls_cell_style INTO TABLE lt_cell_style.
ENDIF.
INSERT LINES OF lt_cell_style
INTO TABLE ls_table-gt_cell_style .
MODIFY xt_lt_table FROM ls_table.
CLEAR: ls_cell_style.
ENDLOOP.
CALL METHOD gref_alv->set_ready_for_input
EXPORTING
i_ready_for_input = 1.
ENDFORM.
I used a field catalog to set my ALV for first display where I set the edit field to space for the first 2 columns. I used the modify_alv subroutine to overwrite the editability property of the fields inside the handle_user_command method.
But when I try to append a row, I don't see a switch to edit mode for the key fields.
I have tried searching through but couldn't find anything helpful. Please help me.
Edited by: Nitwick on Jul 13, 2010 4:46 PMHi,
Made a silly error in the code while populating the gs_layout.
My declaration had the cell style table to be 'GT_CELL_STYLE'. I have populated it with a local cell style table. So ideally it had to be
gs_layout-stylefname = 'GT_CELL_STYLE'. -
Regarding user interface in subtotal line of ALV grid, ensure points
Hi,
I have 3 fields,
A= vendor , B = freight , C = Cost PMT
When the vendor get changed, My Grid is showing subtotal of B i.e freight.
Now my requirement is, in the same subtotal line, I want average of C (Cost PMT) field.
So how we can interact with the subtotal line of the ALV grid.
Pleas reply!!!! & have ur points.
cheersRead the documentation of FM ICON_CREATE, the purpose of the Function module is entirely different from what you are using it for.
To print Icons in ALV (Using FMs ) all you need to do is to send the Icon name in the field.
Also parameters TEXT and INFO of FM ICON_CREATE seem to be flags, that are appended to the icon name so that when you set it on the screen the appropriate info or Text is shown. -
Displaying items in a single line in ALV grid using ALV_TOP_OF_PAGE.
Hello Guys,
I am having a problem in displaying items in a single line in the ALV Grid using event ALV_TOP_OF_PAGE.
My requirement is to group items on a single line i.e. in the example below, Vendor code and posting date are on the same line. The next line the prints Vendor Name and Document no.
Vendor Code: 123123 Posting Date : 01.01.2011
Vendor Name: ABCD Document No: 152246598.
Here is my code in subroutine 'ALV_TOP_OF_PAGE',
wa_list_comments-typ = 'S'.
wa_list_comments-key = ''.
wa_list_comments-info = 'Vendor Code'.
APPEND wa_list_comments TO it_list_comments.
wa_list_comments-typ = 'S'.
wa_list_comments-key = ''.
wa_list_comments-info = 'Posting Date'.
APPEND wa_list_comments TO it_list_comments.
The above code prints in the following format i.e one below the other,
Vendor Code: 123123
Posting Date : 01.01.2011.
I also tried using HTML_TOP_OF_PAGE, but it didn't work.
Can anybody please help me out with this.
Regards,
Danish.Hi Danish,
Your problem is with the alignment and you need some fix positions .
The solution i feel is u can use as below :
In CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
use
i_callback_html_top_of_page = 'HTML_TOP_OF_PAGE'.
Now on calling routine call use cl_dd_document class :
FORM html_top_of_page USING document TYPE REF TO cl_dd_document .
data : doctable TYPE REF TO cl_dd_table_element,
col1_t1 TYPE REF TO cl_dd_area,
col2_t1 TYPE REF TO cl_dd_area,
col1_t2 TYPE REF TO cl_dd_area,
col2_t2 TYPE REF TO cl_dd_area.
add quick table with five columns
CALL METHOD lw_document->add_table
EXPORTING
no_of_columns = 2
border = '0'
cell_background_transparent = ' '
width = '100%'
IMPORTING
table = doctable.
Filling columns in row
CALL METHOD doctable->add_column
EXPORTING
width = '40%'
IMPORTING
column = col1_t1.
Filling columns in row
CALL METHOD doctable->add_column
EXPORTING
width = '60%'
IMPORTING
column = col2_t1.* Filling columns in row
Call method doctable->new_row.
CALL METHOD doctable->add_column
EXPORTING
width = '40%'
IMPORTING
column = col1_t2.
Filling columns in row
CALL METHOD doctable->add_column
EXPORTING
width = '60%'
IMPORTING
column = col2_t2.
*Now adding the texts
lw_text1 = 'your first text'
CALL METHOD col1_t1->add_text
EXPORTING
text = lw_text.
*Similarly add text for other columns
*Adujust % in width to adjust the column as required
Endform.
Hope this will solve your problem . -
Total and non-total lines in ALV grid
Hi all,
Does anyone know if there is any standard SAP functionality for retrieving the non-total/raw item lines that lies beneath a total line in an ALV grid (after the user has selected the total line)?
All helpful answers will be rewarded!
Best regards,
MVTry the ALV event AFTER-LINE-OUTPUT may be it can help u to achieve ur requirement.
Append AFTER-LINE-OUTPUT event to the internal table T_EVENT.
CLEAR W_EVENT.
W_EVENT-FORM = SLIS_EV_AFTER_LINE_OUTPUT.
W_EVENT-NAME = SLIS_EV_AFTER_LINE_OUTPUT.u201CAFTER_LINE_OUTPUT event
APPEND W_EVENT TO T_EVENT.
FORM AFTER_LINE_OUTPUT
USING P_RS_LINEINFO TYPE SLIS_LINEINFO.
Here you have to write the logic to retrieve the 'total' line
ENDFROM.
Now call the alv FM
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = L_REPID "Program Name
IS_LAYOUT = W_LAYOUT "Layout of the Report
IT_FIELDCAT = T_FIELDCAT "Field Catalog for Report
IT_EVENTS = T_EVENT "For setting the events
TABLES
T_OUTTAB = T_OUTPUT "Report data Internal Table
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2. -
Hi,
Can I use a total line in an ALV grid and hide part of the columns, so that only the total line will be presented for some of the columns ?Hi,
Yes u can use a total column in the ALV Grid.
Check the code below:
AT LAST.
WA_ALV_CAT1-FIELDNAME = 'TOTAL'(004).
WA_ALV_CAT1-COL_POS = L_I.
WA_ALV_CAT1-COLTEXT = 'TOTAL'(004).
WA_ALV_CAT1-JUST = C_CENTER. " 'C'.
APPEND WA_ALV_CAT1 TO L_ALV_CAT1_TAB.
CLEAR WA_ALV_CAT1.
ENDAT.
Regards
Kannaiah -
Downloading format breaking line in ALV Grid display
Dear All,
When i am downloading data from from table or using spool request, why after few line item many data comes into one cell.
I have selected ALV Grid display and taking output in *.xls format.
Please find the attached screen shot for your reference
Regards
Sanjeet KumarHi,
Check these links for more details -
http://www.sapfans.com/forums/viewtopic.php?t=84933
http://www.sapfans.com/forums/viewtopic.php?t=69878
ashish -
Hi,
I want show few line item informations in bold in ALV grid output.
Please let me know your suggestions.You may check the below links.
some methods to achieve this is mentioned out there.
Re: BOLD cell in ALV.
Re: ALV Row should apper in BOLD when order type is "ZSTP1" in the cloumn
Regards,
Anil -
Add a New line to ALV Grid control
Hi experts,
My requirement is after filling ALV grid, user will select a + button from the menu, I need to add a new line next to the selected ALV line (Like in a table control). Does it posible to do this? If can any body tell me how I can do this.
Regards,
Venkat.Hi Venkat...
I have tried this and it worked...
Just copy paste this program...
Note : U will have to create a new PF status for this... and give the Function code as given in my program... then only it will work...
*& Report Z_ALV_TRAINING_LIST_EVENTS
REPORT Z_ALV_TRAINING_LIST_EVENTS.
Tables *************
TABLES : T001.
Type Pools Used **********
TYPE-POOLS : SLIS.
Types Declared **********
Internal Tables Declare ************
DATA : IT_company TYPE STANDARD TABLE OF T001 INITIAL SIZE 0 WITH HEADER LINE,
IT_FIELD_CAT TYPE SLIS_T_FIELDCAT_ALV,
it_alv_event type SLIS_T_EVENT.
Select Data ***********
start-of-selection.
SELECT * FROM T001 INTO TABLE IT_company.
Make Field Catalog ******
PERFORM MAKE_FIELD_CATALOG.
get evente *****
perform get_alv_events.
Display ALV *********
end-of-selection.
PERFORM DISPLAY_ALV_LIST.
*& Form make_field_catalog
text
--> p1 text
<-- p2 text
FORM MAKE_FIELD_CATALOG .
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME =
I_INTERNAL_TABNAME =
I_STRUCTURE_NAME = 'T001'
I_CLIENT_NEVER_DISPLAY = 'X'
I_INCLNAME =
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
CHANGING
CT_FIELDCAT = it_field_cat
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.
ENDFORM. " make_field_catalog
*& Form display_alv_list
text
--> p1 text
<-- p2 text
FORM DISPLAY_ALV_LIST .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = sy-repid
I_CALLBACK_PF_STATUS_SET = 'SET_MY_PF_STATUS'
I_CALLBACK_USER_COMMAND = ' '
I_STRUCTURE_NAME =
IS_LAYOUT = fl_layout
IT_FIELDCAT = it_field_cat[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = 'X'
IS_VARIANT = '/TEST_VV'
IT_EVENTS = it_alv_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
IR_SALV_LIST_ADAPTER =
IT_EXCEPT_QINFO =
I_SUPPRESS_EMPTY_DATA = ABAP_FALSE
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = it_company
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_list
*& Form get_alv_events
text
--> p1 text
<-- p2 text
FORM get_alv_events .
data : wa type slis_alv_event.
wa-name = 'USER_COMMAND'.
wa-form = 'SUB_MY_PF_EVENT'.
append wa to it_alv_event.
ENDFORM. " get_alv_events
*& Form sub_my_pf_event
text
--> p1 text
<-- p2 text
FORM sub_my_pf_event using p_comm type sy-ucomm p_sEL_FIELD TYPE SLIS_SELFIELD.
data : wa type t001.
case p_comm.
when 'BACK'.
leave program.
when 'EXIT'.
leave program.
when 'NEW'.
clear wa.
insert wa into it_company[] index p_sel_field-tabindex.
PERFORM DISPLAY_ALV_LIST.
endcase.
ENDFORM. " sub_my_pf_event
*& Form SET_MY_PF_STATUS
text
--> p1 text
<-- p2 text
FORM SET_MY_PF_STATUS USING p_rt_extab TYPE slis_t_extab.
SET PF-STATUS 'ZALV_STATUS'.
ENDFORM. " SET_MY_PF_STATUS
Plz award points if this was helpful.... -
Identify selection of sub-total line in ALV grid
Hi folks,
Is there a way to identify in the report if the user has selected any sub-total line in an ALV grid? Both for REUSE_ALV_GRID_DISPLAY and CL_GUI_ALV_GRID.
Thanks
SagarSagar,
1. I don't think its good design, if you want to process those three lines, you should ask the user to select those 3 rows and process them.
2. If you have no choice, tyr these methods, these might give you some info
GET_SORT_CRITERIA
GET_SUBTOTALS
These methods might give you the info you are looking for. Try it out.
regards,
Ravi -
I would like to bring the toolbar of my ALV grid to the bottom . Please help me.
hi
good
Check if your event is registered multiple times (in your PBO).
call the cl_gui_cfw=>flush after all the controls, and events are registered
thanks
mrutyun^ -
ALV grid container toolbar refresh problem
Hi All,
I use OO to display alv (set_table_for_first_display).
I use
it_toolbar_excluding = lt_exclude parameters to hide some buttons.
but when I tried to show up a button in toolbar (when screen comes CHANGE MODE From DISPLAY MODE)
I can not refresh the toolbar.
here is the code.
thanks in advance
IF r_container IS INITIAL .
**ALV Grid
CREATE OBJECT r_container
EXPORTING
container_name = 'CONTAINER'.
CREATE OBJECT r_grid
EXPORTING
i_parent = r_container.
CREATE OBJECT :
v_event_receiver.
CALL METHOD r_grid->set_ready_for_input
EXPORTING
i_ready_for_input = 1.
**ALV Grid
*passing the layout structure, fieldcatalog and output table for display
CALL FUNCTION 'API_RE_CN_GET_DETAIL'
EXPORTING
io_object = lo_busobj
IMPORTING
es_contract = ls_contract
et_object_rel = lt_object_rel
EXCEPTIONS
OTHERS = 0.
IF ld_activity NE '01'.
REFRESH t_itab.
SELECT * FROM zrecn_sp_cond INTO CORRESPONDING FIELDS OF TABLE t_itab
WHERE intreno = ls_contract-intreno.
ENDIF.
gs_fieldcat-fieldname = 'Z_DESC'.
gs_fieldcat-ref_table = 'ZRECN_SP_COND'.
gs_fieldcat-outputlen = '50'.
gs_fieldcat-key = 'X'.
gs_fieldcat-edit = edit_flag.
gs_fieldcat-auto_value = 'X'.
APPEND gs_fieldcat TO gt_fieldcat.
gs_fieldcat-fieldname = 'Z_VALIDFROM'.
gs_fieldcat-ref_table = 'ZRECN_SP_COND'.
gs_fieldcat-outputlen = '10'.
gs_fieldcat-key = 'X'.
gs_fieldcat-edit = edit_flag.
gs_fieldcat-auto_value = 'X'.
APPEND gs_fieldcat TO gt_fieldcat.
gs_fieldcat-fieldname = 'Z_VALIDTO'.
gs_fieldcat-ref_table = 'ZRECN_SP_COND'.
gs_fieldcat-outputlen = '10'.
gs_fieldcat-key = 'X'.
gs_fieldcat-edit = edit_flag.
gs_fieldcat-auto_value = 'X'.
APPEND gs_fieldcat TO gt_fieldcat.
gs_fieldcat-fieldname = 'INTRENO'.
gs_fieldcat-ref_table = 'ZRECN_SP_COND'.
gs_fieldcat-outputlen = '10'.
gs_fieldcat-key = 'X'.
gs_fieldcat-edit = edit_flag.
gs_fieldcat-auto_value = 'X'.
gs_fieldcat-no_out = 'X'.
APPEND gs_fieldcat TO gt_fieldcat.
REFRESH :lt_exclude.
PERFORM exclude_tb_functions USING 'LST1' activity CHANGING lt_exclude ."decde to hide or not
CALL METHOD r_grid->set_table_for_first_display
EXPORTING
i_structure_name = 'ZRECN_SP_COND_STR'
it_toolbar_excluding = lt_exclude
is_layout = fs_layout
CHANGING
it_fieldcatalog = gt_fieldcat
it_outtab = t_itab[].
SET HANDLER v_event_receiver->handle_user_command FOR r_grid.
SET HANDLER v_event_receiver->handle_data_changed FOR r_grid.
SET HANDLER v_event_receiver->handle_hotspot_click FOR r_grid.
SET HANDLER v_event_receiver->handle_toolbar FOR r_grid.
SET HANDLER v_event_receiver->handle_data_changed_finished FOR r_grid.
CALL METHOD r_grid->set_toolbar_interactive.
ELSE .
ls_stable-row = 'X' .
ls_stable-col = 'X' .
CALL METHOD r_grid->refresh_table_display
EXPORTING
is_stable = ls_stable.
ENDIF.Hi
Try this.
if o_grid is initial.
create object <container>
exporting
container_name = 'container1'.
create object o_grid
exporting
i_parent = container_name.
perform fieldcatalog.
CALL METHOD o_grid->set_table_for_first_display
EXPORTING
is_variant = gs_variant
i_save = 'A'
i_default = 'X'
it_toolbar_excluding = i_exclude
is_layout = wa_layout
CHANGING
it_fieldcatalog = i_fieldcat[]
it_outtab = i_final_act[].
( after that I think you need to call the method for selecting rows.
like what I did in my code is below:
create object event.
set handler event->handle_double_click for o_grid.
else.
call method o_grid->refresh_table_display. )
*Refreshing ALV Grid display
CALL METHOD o_grid->refresh_table_display
EXPORTING
i_soft_refresh = 'X'
EXCEPTIONS
finished = 1
OTHERS = 2.
IF sy-subrc 0.
--Exception handling
ENDIF.
endif.
In this code if your o_grid is intial then it will process all the coding before refresh method else if your o_grid is not intial it will refresh the table which is going to be displayed.
I hope this will work for you
Thanks
Lalit Guptaa
Maybe you are looking for
-
VHD Size is Maximum Size Allowed Without Using All Space in OS
Hello - I have a Hyper-V VM whose maximum size allowed is 700GB. Currently, the VHD file size is 700GB yet the OS is only using ~400GB (300GB free). Shouldn't the VHD size be about 400GB instead of 700? Every other VM I have checked matches the size
-
CS5 bridge Crashes Consistently
After the latest update to Windows XP Bridge in CS5 crashes consistently each and every time I move a number of files from one folder to the next. The files get moved all right, but then Bridge vanishes. The behavior is the same when I drag files and
-
Is there a way to shut off headers and footers when printing to a pdf file?
Files designed to exactly fill a page become too large when headers and footers are added and spill over onto two pages. I can't find a way to change these settings. I am working on an Apple with OS 10.4.11
-
Get first value and then remove remaining in query output
hi all, we have a query where we want to count the number of sales orders and show this count by created on month and salesperson. trick is that sales orders have multiple line items so the same order can show in multiple months. lets say order 100
-
MediaSource 5 - Track Sort Defau
I use MediaSource 5 to keep track of all my music, however, I can't seem to find a way of setting a default to sort the tracks alphabetically when I select an artist (or all artists even). I know it's just a couple of clicks to get them sorted into a