How to add the REFRESH button in OOPs ALV grid
how to add the REFRESH button in OOPs ALV grid
Hi Naidu.
Check the below code:
Local Class Definition and implementation For events handeling
CLASS LCL_EVENT DEFINITION .
PUBLIC SECTION.
METHODS :TOOLBAR FOR EVENT TOOLBAR OF CL_GUI_ALV_GRID
IMPORTING E_OBJECT,
USER_COMMAND FOR EVENT USER_COMMAND OF CL_GUI_ALV_GRID
IMPORTING E_UCOMM.
ENDCLASS.
CLASS LCL_EVENT IMPLEMENTATION.
METHOD TOOLBAR.
WA_TOOL-FUNCTION = 'ZFC1'.
WA_TOOL-TEXT = 'TEST'.
WA_TOOL-ICON = '@EA@'.
APPEND WA_TOOL TO E_OBJECT->MT_TOOLBAR.
ENDMETHOD. "DISPLAY
METHOD USER_COMMAND.
IF E_UCOMM = 'ZFC1'.
ENDIF.
ENDMETHOD. "USER_COMMAND
ENDCLASS. "LCL_EVENT IMPLEMENTATION
MODULE STATUS_0200 OUTPUT.
SET PF-STATUS 'ZALV_BTON'.
SELECT * FROM VBAK INTO TABLE GT_VBAK
UP TO 30 ROWS.
**** CREATE CONTAINER OBJECT
CREATE OBJECT MY_CONTAINER
EXPORTING
CONTAINER_NAME = 'CC1'
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
CREATE_ERROR = 3
LIFETIME_ERROR = 4
LIFETIME_DYNPRO_DYNPRO_LINK = 5
OTHERS = 6 .
****** GRID TO CONTAINER
CREATE OBJECT ALV
EXPORTING
I_PARENT = MY_CONTAINER
EXCEPTIONS
ERROR_CNTL_CREATE = 1
ERROR_CNTL_INIT = 2
ERROR_CNTL_LINK = 3
ERROR_DP_CREATE = 4
OTHERS = 5.
CREATE OBJECT OBJ.
SET HANDLER : OBJ->TOOLBAR FOR ALV.
SET HANDLER : OBJ->USER_COMMAND FOR ALV.
****** ALV DISPLAY
CALL METHOD ALV->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
I_STRUCTURE_NAME = 'VBAK'
CHANGING
IT_OUTTAB = GT_VBAK[]
EXCEPTIONS
INVALID_PARAMETER_COMBINATION = 1
PROGRAM_ERROR = 2
TOO_MANY_LINES = 3
OTHERS = 4.
ENDMODULE. " STATUS_0200 OUTPUT
*& Module USER_COMMAND_0200 INPUT
* text
MODULE USER_COMMAND_0200 INPUT.
IF SY-UCOMM EQ 'BACK'.
LEAVE PROGRAM.
ENDIF.
ENDMODULE. " USER_COMMAND_0200 INPUT
Regards
Kumar M
Similar Messages
-
How to add a push button on an ALV grid ?
Hi,
How to add a push button on an ALV grid, using ON_TOOLBAR, ON_USERCOMMAND Methods. Clicking on that push button, a new screen has to be displayed.Hi,
Assuming that you want to have a "push-button" column, i.e. push-buttons within an ALV grid then you need to implement the following steps:
(1) Set the style of the column as button
ls_fcat-style = CL_GUI_ALV_GRID => MC_STYLE_BUTTON.
(2) When the user pushes the button event BUTTON_CLICK is triggered. Thus, define an appropriate event handler method.
<b>Reward points</b>
Regards -
How to add the push button on the apllication tollbar of IL02 tcode
Hi Friends,
I have to add the push button on the application tool bar of the IL02.when that push button is pressed then some operation to be performed.Could you please suggest how to add.Is there any screen exit if yes what is that.
With out screen exits if there is any way ?
Thanks and regards,
shylaHI Vicky ,
if u want an interactive ALV report , there are lot of forums already having the solution for that , but let me give u the solution anyway.
In the function module "REUSE_ALV_GRID_DISPLAY" , import parameters
I_CALLBACK_PF_STATUS_SET = 'FLIGHT'
I_CALLBACK_USER_COMMAND = 'BUTTON_CLICK'
has to be supplied to this function module . The PF status is where u hav created the two buttons , that PF status has to be given here .If the user clicks on the button then it is handled by the form routines . Inside the sub-routine based on the button the user has selected u could perform the action.
FORM FLIGHT USING RT_EXTAB TYPE SLIS_T_EXTAB.
SET PF-STATUS 'FLIGHT' EXCLUDING RT_EXTAB.
ENDFORM.
Here the "Flight" is the PF_status .
FORM BUTTON_CLICK USING UCOMM type SY-UCOMM
SELFIELD type SLIS_SELFIELD.
CASE UCOMM.
WHEN 'BUTTON!' .
write ur code for button 1.
WHEN "BUTTON"
*Write ur code for button2 .
end case.
endform.
for any queries reply back.
regards -
Hello Guru's and Experts.
I am working on a change request , the change request is as follows
Once a cost simulation is run for a maintenance item and the data transferred to BI, it cannot be deleted from BI, only overwritten with an updated cost simulation. In the instance where the such items are no longer required to be included in the simulation, it must be made possible to delete the simulation costs in BI.
The current design in my project significantly increases the effort required to identify unwanted cost simulations and greatly increases the potential for incorrect data to be used in Budgeting and forecasting.
My question is how to add the delete functionality in the report. is it acheavable through the portal or WAD,
iam new to SAP BI , if possible can anyone kindly suggest me the steps to do this functionality.
Appreciate your quick response..
Thanks
Ravi.Hi Guru
Thanks for your valuable information.
We got the requirment changed now from the users , the delete button should display in the report, i mean in protal, Now the user wants to delete with the selection criteria, for example, once the user hits the row in the report, that means if he selects the Main work center, and selects the delete button , he wants all the data related to that main work center to be deleted. and another senario is what ever row the user selects the characteristics in the row, for example, if the user select for any row, i mean it can be any cost center or fiscal year, maintaiance item, cost elements, ..etc.
Once the user selects the row and hit the delete button, and he wants to hit the save save button in the report to make sure it deleted, the other way around , if the dont want to hit save, then he wants the data to be in the report.
In the above scenario's can you please suggest me with the steps how can we acheive it.
Please reply back if you need any other info., Apprieciate your quick response. its very urgent requirment which we have to start...
sorry to bother u..
Thanks
Ravi. -
How to add an editable checkbox to an alv grid
Hi..
I need to add an editable checkbox to a alv grid.
I wouls appreciatet it if anyone could provide some sample code.
The standard example BCALV_EDIT_05 is an oops example... I need a simple example
Please help
thanks
Karenhi
after you pass a field as checkbox in fieldcat
then in layout populate edit
ex wa_layout-edit = 'X'.
try the following code
REPORT ZALV5.
TYPE-POOLS: slis.
tables: mara.
DATA: begin of it_mara OCCURS 0,
matnr like mara-matnr,
mbrsh like mara-mbrsh,
matkl like mara-matkl,
meins like mara-meins,
ersda like mara-ersda,
ernam like mara-ernam,
W_CHK type c ,
END OF it_mara.
*data: it_mara like mara occurs 0 with header line.
data:it_feildtab type slis_t_fieldcat_alv,
wa_fieldcat type slis_fieldcat_alv.
*DATA: i_private TYPE slis_data_caller_exit,
data: i_selfield TYPE slis_selfield,
W_exit(1) TYPE c.
PARAMETERS: p_title TYPE sy-title default 'ALV'.
START-OF-SELECTION.
SELECT matnr mbrsh matkl meins ersda ernam FROM mara
INTO corresponding fields of table it_mara.
wa_fieldcat-col_pos = '1'.
wa_fieldcat-fieldname = 'W_CHK'.
*wa_FIELDCAT-KEY = 'X'.
*wa_fieldcat-tabname = 'IT_MARA'.
*wa_fieldcat-seltext_s = 'units of measure'.
wa_fieldcat-checkbox = 'X'.
APPEND wa_fieldcat TO it_feildtab.
CLEAR wa_fieldcat .
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = '2'.
wa_fieldcat-tabname = 'IT_MARA'.
wa_fieldcat-fieldname = 'MATNR'.
wa_fieldcat-key = 'X'.
wa_fieldcat-hotspot = 'X'.
wa_fieldcat-seltext_s = 'no'.
APPEND wa_fieldcat TO it_feildtab.
CLEAR wa_fieldcat .
wa_fieldcat-col_pos = '3'.
wa_fieldcat-fieldname = 'MBRSH'.
*wa_FIELDCAT-KEY = 'X'.
wa_fieldcat-tabname = 'IT_MARA'.
wa_fieldcat-seltext_s = 'Ind.sec'.
APPEND wa_fieldcat TO it_feildtab.
CLEAR wa_fieldcat .
wa_fieldcat-col_pos = '4'.
wa_fieldcat-fieldname = 'MATKL'.
*wa_FIELDCAT-KEY = 'X'.
wa_fieldcat-tabname = 'IT_MARA'.
wa_fieldcat-seltext_s = 'Description'.
APPEND wa_fieldcat TO it_feildtab.
CLEAR wa_fieldcat .
wa_fieldcat-col_pos = '5'.
wa_fieldcat-fieldname = 'MEINS'.
*wa_FIELDCAT-KEY = 'X'.
wa_fieldcat-tabname = 'IT_MARA'.
wa_fieldcat-edit = 'X'.
wa_fieldcat-seltext_s = 'units of measure'.
APPEND wa_fieldcat TO it_feildtab.
CLEAR wa_fieldcat .
CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
EXPORTING
i_title = p_title
i_selection = 'X'
i_zebra = 'X'
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
i_checkbox_fieldname = 'W_CHK'
I_LINEMARK_FIELDNAME =
I_SCROLL_TO_SEL_LINE = 'X'
i_tabname = 'IT_MARA'
i_structure_name = 'IT_MARA'
IT_FIELDCAT = it_feildtab
IT_EXCLUDING =
I_CALLBACK_PROGRAM =
I_CALLBACK_USER_COMMAND =
IS_PRIVATE = I_PRIVATE
IMPORTING
es_selfield = i_selfield
e_exit = w_exit
TABLES
t_outtab = it_mara
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE i000(0k) WITH sy-subrc.
ENDIF.
LOOP AT it_mara WHERE W_CHK = 'X'.
WRITE: / it_mara-ersda, it_mara-ernam.
ENDLOOP.
reward if helpful
prasanth -
HT2492 how to add the close button icon on the internet tabs
i dont know what happened but if i want to close the new tab i entered from the safari i still have to do the long process instead of just clicking the "x" button to close it,., it disappeared last night and i dont know how to put it back,., prolly i accidentally press an icon to detached it from the tool. how will i restore it?
Since your posting in the swing project forum, I assume your talking about JDialog. If so, use JDialog.setDefaultCloseOperation( DO_NOTHING_ON_CLOSE ). Same method exists in JFrame as well, but not in JWindow.
-
How to add the dril down functionality in alv report.
Hi All,
I have a ALV report and now i want to add drill down functionality in this ALV report.
See my code below:
FORM f0002_build_field_catalog.
Build the field catalog
CLEAR ws_layout.
ws_layout-colwidth_optimize = 'X'.
ws_layout-edit = ' '.
ws_field_catalog-col_pos = '1'.
ws_field_catalog-fieldname = 'BUKRS'.
ws_field_catalog-tabname = 'I_OUTPUT'.
ws_field_catalog-seltext_l = 'Company Code'.
ws_field_catalog-seltext_m = 'CCode'.
ws_field_catalog-seltext_s = 'CCode'.
ws_field_catalog-fix_column = 'X'.
ws_field_catalog = 'X'.
ws_fieldcat-ref_tabname = 'VBKPF'.
APPEND ws_field_catalog TO lt_fieldcat.
CLEAR: ws_field_catalog.
ws_field_catalog-col_pos = '2'.
ws_field_catalog-fieldname = 'BELNR'.
ws_field_catalog-tabname = 'I_OUTPUT'.
ws_field_catalog-seltext_l = 'Document no.'.
ws_field_catalog-hotspot = 'V'.
ws_field_catalog-seltext_m = 'Doc.no.'.
ws_field_catalog-seltext_s = 'Doc.no.'.
APPEND ws_field_catalog TO lt_fieldcat.
CLEAR: ws_field_catalog.
ws_field_catalog-col_pos = '3'.
ws_field_catalog-fieldname = 'GJAHR'.
ws_field_catalog-tabname = 'I_OUTPUT'.
ws_field_catalog-seltext_l = 'Year'.
ws_field_catalog-seltext_m = 'Year'.
ws_field_catalog-seltext_s = 'Year'.
APPEND ws_field_catalog TO lt_fieldcat.
CLEAR: ws_field_catalog.
ws_field_catalog-col_pos = '4'.
ws_field_catalog-fieldname = 'BSTAT'.
ws_field_catalog-tabname = 'I_OUTPUT'.
ws_field_catalog-seltext_l = 'Status'.
ws_field_catalog-seltext_m = 'Status'.
ws_field_catalog-seltext_s = 'Status'.
APPEND ws_field_catalog TO lt_fieldcat.
CLEAR: ws_field_catalog.
ws_field_catalog-col_pos = '5'.
ws_field_catalog-fieldname = 'FLAG'.
ws_field_catalog-tabname = 'I_OUTPUT'.
ws_field_catalog-seltext_l = 'Open/Cleared'.
ws_field_catalog-seltext_m = 'Open/Cleared'.
ws_field_catalog-seltext_s = 'Open/Cleared'.
APPEND ws_field_catalog TO lt_fieldcat.
CLEAR: ws_field_catalog.
ws_field_catalog-col_pos = '6'.
ws_field_catalog-fieldname = 'BLART'.
ws_field_catalog-tabname = 'I_OUTPUT'.
ws_field_catalog-seltext_l = 'Doc.Type.'.
ws_field_catalog-seltext_m = 'Doc.Type'.
ws_field_catalog-seltext_s = 'Doc.Type'.
APPEND ws_field_catalog TO lt_fieldcat.
CLEAR: ws_field_catalog.
ws_field_catalog-col_pos = '7'.
ws_field_catalog-fieldname = 'WRBTR'.
ws_field_catalog-tabname = 'I_OUTPUT'.
ws_field_catalog-seltext_l = 'Total Amount'.
ws_field_catalog-seltext_m = 'Total Amount'.
ws_field_catalog-seltext_s = 'Total Amount'.
APPEND ws_field_catalog TO lt_fieldcat.
CLEAR: ws_field_catalog.
ws_field_catalog-col_pos = '8'.
ws_field_catalog-fieldname = 'WAERS'.
ws_field_catalog-tabname = 'I_OUTPUT'.
ws_field_catalog-seltext_l = 'Currency.'.
ws_field_catalog-seltext_m = 'Currency'.
ws_field_catalog-seltext_s = 'Currency'.
APPEND ws_field_catalog TO lt_fieldcat.
CLEAR: ws_field_catalog.
ws_field_catalog-col_pos = '9'.
ws_field_catalog-fieldname = 'LIFNR'.
ws_field_catalog-tabname = 'I_OUTPUT'.
ws_field_catalog-seltext_l = 'Vendor'.
ws_field_catalog-seltext_m = 'Vendor'.
ws_field_catalog-seltext_s = 'Vendor'.
APPEND ws_field_catalog TO lt_fieldcat.
CLEAR: ws_field_catalog.
ws_field_catalog-col_pos = '10'.
ws_field_catalog-fieldname = 'NAME1'.
ws_field_catalog-tabname = 'I_OUTPUT'.
ws_field_catalog-seltext_l = 'Vendor Name'.
ws_field_catalog-seltext_m = 'Name 1'.
ws_field_catalog-seltext_s = 'Name 1'.
APPEND ws_field_catalog TO lt_fieldcat.
CLEAR: ws_field_catalog.
ws_field_catalog-col_pos = '11'.
ws_field_catalog-fieldname = 'UZAWE'.
ws_field_catalog-tabname = 'I_OUTPUT'.
ws_field_catalog-seltext_l = 'Payment Method Supplement'.
ws_field_catalog-seltext_m = 'PmtMthSuppl'.
ws_field_catalog-seltext_s = 'PmtMthSuppl'.
APPEND ws_field_catalog TO lt_fieldcat.
CLEAR: ws_field_catalog.
ws_field_catalog-col_pos = '12'.
ws_field_catalog-fieldname = 'XBLNR'.
ws_field_catalog-tabname = 'I_OUTPUT'.
ws_field_catalog-seltext_l = 'Reference'.
ws_field_catalog-seltext_m = 'Ref. No.'.
ws_field_catalog-seltext_s = 'Ref. No.'.
APPEND ws_field_catalog TO lt_fieldcat.
CLEAR: ws_field_catalog.
g_variant-report = sy-repid.
CLEAR struct_extab.
MOVE '&XPA' TO struct_extab-fcode.
APPEND struct_extab TO i_extab.
MOVE '&OMP' TO struct_extab-fcode.
APPEND struct_extab TO i_extab.
Display the list
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = ws_repid
i_callback_user_command = 'HANDLE_USER_COMMAND'
is_layout = ws_layout
it_fieldcat = lt_fieldcat[]
it_excluding = i_extab[]
i_default = 'X'
i_save = 'U' "For user variants
is_variant = g_variant
TABLES
t_outtab = i_output.
ENDFORM. "f0002_build_field_catalog
*& Form f0038_pf_status
text
-->I_EXTAB text
FORM f0038_pf_status USING i_extab TYPE slis_t_extab. "#EC CALLED
CLEAR struct_extab.
MOVE '&XPA' TO struct_extab-fcode.
APPEND struct_extab TO i_extab.
MOVE '&OMP' TO struct_extab-fcode.
APPEND struct_extab TO i_extab.
SET PF-STATUS 'Z_PFSTATUS2' EXCLUDING i_extab.
ENDFORM. "f0038_pf_status
Pls tell me how i use this below dril down ability functionality in my code.
See the requirement below.
The Document Number, aka Accounting Document Number (BELNR) of each row will take the user to the appropriate document to edit as follows:
For Parked documents:-
If VBKPF-AWTYP (Reference Procedure) = RMRP, then the drilldown functionality should be to MIR4 using the Object ID in VBKPF- AWKEY. In this scenario the Object ID represents a Invoice Document Number, not an Accounting Document Number. Not the Object ID is a combination of Invoice Document Number and Fiscal Year
If VBKPF-AWTYP = Any other value, then the drilldown functionality should be to FBV2 using the Object ID in VBKPF-AWKEY. In this scenario the Object ID represents a true Accounting Document Number. Note the Object ID is a combination of Company Code (VBKPF-BUKRS), Accounting Document Number (VBKPF-BELNR) and Fiscal Year (VBKPF-GJAHR)
For Posted, not Cleared documents:-
Drilldown ability should be to FB02. The combination of Company Code (BSIK-BUKRS), Accounting Document Number (BSIK-BELNR) and Fiscal Year (BSIK-GJAHR) will be used to open/drilldown to the correct document in FB02.
For Cleared documents:-
Drilldown ability should be to FB03. The combination of Company Code (BSIK-BUKRS), Accounting Document Number (BSIK-BELNR) and Fiscal Year (BSIK-GJAHR) will be used to open/drilldown to the correct document in FB03.
Its very urgent, pls help on this.
Thanks!
VipinPls refer :
https://wiki.sdn.sap.com/wiki/display/Snippets/ABAPInteractiveALVwithCallTransaction%28usingParameterID%29
https://wiki.sdn.sap.com/wiki/display/Snippets/ABAPInteractiveALV+Program
Regards,
Anish Thomas
Pls reward all useful answers -
How to add a new button in an ALV using factory method
im using factory method to creat an ALV
The reason why I'm doing this is because I want the ALV and the selection screen in the same screen like exemplified here http://help-abap.blogspot.com/2008/10/dispaly-alv-report-output-in-same.html
CALL METHOD cl_salv_table=>factory
EXPORTING
list_display = if_salv_c_bool_sap=>false
r_container = lo_cont
container_name = 'DOCK_CONT'
IMPORTING
r_salv_table = lo_alv
CHANGING
t_table = me->t_data.
The above code already uses every parameter that method as to offer.
Is it possible to add extra buttons to an ALV using that method?Hi Ann,
The reason you are not able to see any of the new columns as a option to select in your web service block is because when you have published that block, they were not present. Add these two new objects in your block and publish it again. You will be prompted for duplication content. Select the highlighted block for duplicate and now you can see the new added objects in the filter option. Update and this will overwrite your published block. Please note, web services do appear to behave weirdly when used with dashboards so I request you to please try it in a separate test report first.
Hope that helps.
Regards,
Tanisha -
How can I hide the marker button in an ALV GRID line?
Hi all,
I am switching an old program from ALV LIST to ALV GRID. In the old list, I put a checkbox on each line to abilify the user to mark some lines. However, there are some lines that I don't want the user to select. In the list, I set the field for the box name to "*" (asterisk) and in the list, the checkbox is not input enabled.
Now in the grid, this does not function any more. all lines are markable. How can I deactivate the marker function for some lines?
Greetings
JörgHi,
use the below snippet in your code
DATA: ls_celltab TYPE lvc_s_styl.
REFRESH pt_celltab.
IF p_mode EQ text-103.
*§2a.Use attribute CL_GUI_ALV_GRID=>MC_STYLE_ENABLED to set a cell
to status "editable".
ls_celltab-fieldname = c_character1.
ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
ls_celltab-style2 = cl_gui_alv_grid=>mc_style_f4.
INSERT ls_celltab INTO TABLE pt_celltab.
ls_celltab-fieldname = c_character2.
ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
ls_celltab-style2 = cl_gui_alv_grid=>mc_style_f4.
INSERT ls_celltab INTO TABLE pt_celltab.
ls_celltab-fieldname = c_character3.
ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
ls_celltab-style2 = cl_gui_alv_grid=>mc_style_f4.
INSERT ls_celltab INTO TABLE pt_celltab.
ls_celltab-fieldname = text-107.
ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
ls_celltab-style2 = cl_gui_alv_grid=>mc_style_f4.
INSERT ls_celltab INTO TABLE pt_celltab.
ls_celltab-fieldname = c_selectionid.
ls_celltab-style = cl_gui_alv_grid=>mc_style_disabled.
INSERT ls_celltab INTO TABLE pt_celltab.
Regards -
How to suppress the protocol dialog screen in ALV grid ?
To check the values in the ALV grid we make use of the method add_protocol_entry from the class interface CL_ALV_CHANGED_DATA_PROTOCOL. The coloring of the wrong cells in the ALV grid is a nice feature but the popup screen that appears on every entry that is incorrect is not so nice. Is there a possibility to suppress this dialog screen without stopping the coloring feature? Or is there an other way to get this coloring feature in the specific cells of the ALV grid. We have already tried the emphasize option in the field catalog but in this case the coloring of a cell disappears when the cursor is set on the colored field in the ALV grid.
I hope somebody can help us.
Thanks and greetings,
Ad Pegels
Suiker Unie
NetherlandsAs I understand by adding the PROTOCOL you are trying to validate some fields and display those with a different color.
Instead, if you can validate and can change the color manually I think the pop ups can be avoided. All you have to do is to add a nested internal table to the main internal table that has the display data. This nested table will be of type LVC_T_STYLE. You can add rows, one for each field that you want to display in a different color and also spcify the style in which you want to display.
Once you do that those fields should be displayed with different colors.
Regards,
Ravi
Note : Please allocate points if you find this useful. -
How to disable the first row of an ALV Grid?
Hi All,
I am working on a module pool programme. I am displaying ALV grid. I have to give some default values in the first row and disable it. I have to disable the third column and fourth row value. How can i achieve this?
Help will be appreciated.
Thanks,
Ibrahim.here is the code i have written....but its not working...
TYPES : BEGIN OF tp_grid,
fname(25) TYPE c,
reqd,
seqno TYPE n,
tl_styl TYPE lvc_t_styl,
edit,
END OF tp_grid.
DATA : wl_styl TYPE lvc_s_styl.
DATA : wl_layout TYPE lvc_s_layo.
DATA : lt_celltab TYPE lvc_t_styl.
READ TABLE tl_grid INTO wl_grid INDEX 1.
wl_styl-fieldname = 'TAG NUMBER'.
wl_styl-style = cl_gui_alv_grid=>mc_style_disabled.
INSERT wl_styl INTO TABLE lt_celltab.
INSERT LINES OF lt_celltab INTO wl_grid-tl_styl index 1.
MODIFY tl_grid INDEX 1 FROM wl_grid.
wl_layout-stylefname = 'TL_STYL'.
CALL METHOD l_initgrid->set_table_for_first_display
EXPORTING
is_layout = wl_layout
CHANGING
it_outtab = tl_grid
it_fieldcatalog = tl_init_fcat
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
ENDFORM. " display_initgrid
Help will be appreciated....
Thanks,
Ibrahim -
How to devide the top of page in alv grid display
hi all
in the alv grid display am getting the page number and total number of pages in the left hand side
but what i need is i need in the right hand side
how to get thatHi,
PLease refer to the code below:
*& Report ZDEMO_ALVGRID *
*& Example of a simple ALV Grid Report *
*& The basic requirement for this demo is to display a number of *
*& fields from the EKKO table. *
REPORT zdemo_alvgrid .
TABLES: ekko.
type-pools: slis. "ALV Declarations
*Data Declaration
TYPES: BEGIN OF t_ekko,
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 = 'EBELN'.
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 = 'EBELP'.
fieldcatalog-seltext_m = 'PO Item'.
fieldcatalog-col_pos = 1.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'STATU'.
fieldcatalog-seltext_m = 'Status'.
fieldcatalog-col_pos = 2.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'AEDAT'.
fieldcatalog-seltext_m = 'Item change date'.
fieldcatalog-col_pos = 3.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MATNR'.
fieldcatalog-seltext_m = 'Material Number'.
fieldcatalog-col_pos = 4.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MENGE'.
fieldcatalog-seltext_m = 'PO quantity'.
fieldcatalog-col_pos = 5.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MEINS'.
fieldcatalog-seltext_m = 'Order Unit'.
fieldcatalog-col_pos = 6.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'NETPR'.
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 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 = 'EBELN'.
* 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-ebeln.
* Sxecute transaction ME23N, and skip initial data entry screen
CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
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.
Thanks,
Sriram Ponna. -
How to get the SAVE Layout ICON on ALV Grid display report
Hi,
I am using the standard ALV Layout, and I do not get the SAVE LAYOUT Icon on the Menubar, where I could save the report Layout.I am using the layout routine as,
FORM layout_build USING u_lf_layout TYPE slis_layout_alv.
u_lf_layout-box_fieldname = 'SELK'. " Checkbox
u_lf_layout-zebra = 'X'.
u_lf_layout-colwidth_optimize = 'X'.
u_lf_layout-confirmation_prompt = 'X'.
u_lf_layout-get_selinfos = 'X'.
u_lf_layout-f2code = '&ETA' .
u_lf_layout-detail_titlebar = 'Delivery Due List'.
u_lf_layout-key_hotspot = 'X'.
u_lf_layout-info_fieldname = 'COL'.
ENDFORM. " layout_build
Is there anything that I am missing. Please suggest.Many thanks for your help.
Regards,
MiraHi,
i think you've forgotten param. <b>i_save</b>
x_save = 'X'.
gs_variant-report = sy-repid.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_STRUCTURE_NAME = 'ZTAB01'
IS_VARIANT = gs_variant
IS_layout = lay
I_SAVE = x_save
TABLES
T_OUTTAB = gridtab
EXCEPTIONS
OTHERS = 1.
regards Andreas -
Problem with 'PRINT' button in OOPs ALV
Hi All,
I have developed a OOPs based ALV report. When ever we create an ALV we also have to create Menu bar I did that providing fuctionality for 'BACK' and 'CANCEL' buttons in main toolbar. But user wants funtionality for 'SAVE' and 'PRINT'.
How do I do this ? Is there any stadard code which I can paste in PAI and use it. Classic ALVs handle this by default and OOPs doesn't do this it handles only a table level. But in my report I have a header information also. If user uses the standard 'PRINT' button at table level, only table contents are printed not the header information.
Please let me know how to handle 'PRINT' & 'SAVE' button in OOPs ALV.
Thanks in advance.Hi Ravindar,
This programe BCALV_TEST_GRID_PRINT has used the normal class cl_gui_alv_grid where as I have used CL_GUI_ALV_TREE class.
Regards,
Deepthi. -
It happened after Mozilla Firefox's plugin crashed. Whenever I tried right clicking the refresh button or a page in History, it no longer prompted me to "open in a new page." Instead, the box showing the menu bar, navigation bar, etc. showed up. How do I change it back?
Hello,
'''Try Firefox Safe Mode''' to see if the problem goes away. Safe Mode is a troubleshooting mode, which disables most add-ons.
''(If you're not using it, switch to the Default theme.)''
* You can open Firefox 4.0+ in Safe Mode by holding the '''Shift''' key when you open the Firefox desktop or Start menu shortcut.
* Or open the Help menu and click on the '''Restart with Add-ons Disabled...''' menu item while Firefox is running.
''Once you get the pop-up, just select "'Start in Safe Mode"''
'''''If the issue is not present in Firefox Safe Mode''''', your problem is probably caused by an extension, and you need to figure out which one. Please follow the [[Troubleshooting extensions and themes]] article for that.
''To exit the Firefox Safe Mode, just close Firefox and wait a few seconds before opening Firefox for normal use again.''
''When you figure out what's causing your issues, please let us know. It might help other users who have the same problem.''
Thank you.
Maybe you are looking for
-
ORA-01403: no data found while querying View
Hello, I have a problem with querying a View which includes XML-Types. If the View is empty I get a white website with the following error-message: ORA-01403: no data found How can I implement my own error-website if no data was found?? This is the w
-
Package for DVC80 USB Video Interface
Gents; Some info sources say that a linux app can be provided which will permit the DVC80 to respond to NTSC video camera input. The DVC80 operates well in windows, permitting capture in Irfanview and a program called Dazzle. The following data desc
-
Which table in SRM give the date of confirmations and invoices done in R/3
Hi all, I'm loocking on SRM to find a table (or smthg else) which is updated when a PO has a confirmation or an invoice MADE IN R/3. I'm sure it's existing as in the web we can see in the document history, but I can't find a table in SRM that can tel
-
How to achieve a roundtrip with Photoshop
Is there a method to re-import a PS file in Captivate? The problem with existing roundtrip with PS is that it is limited to layers that exist in PS during import. So after importing PS file (either as Flattened Image or as Multi Layer) and making som
-
Hello, I am going to run F.5G. While I am going to run this Tcode, I am getting error- The error is *Transactn KDF: No valuation acct has been specified for acct 1120300800* Please tell me the Required Correction. Thanks