Disable F4 function on ALV grid row
Hello,
I have an ALV and I need to disable the F4 OR cancel event ONF4 for a cell, BUT ONLY in the last row.
Is it possible? I've searched a lot, but I didn't found anything that help me.
Could you help me?
Thanks,
Kleber
Hi ,
You cannot cancel the event for only a particular cell but
You can use the following Logic to get your requirement.
in the Implementation of onF4 event.
on_f4 for event onf4 of cl_gui_alv_grid
importing e_fieldname
es_row_no
" This Contains the row Number of Cell on which You clicked F4
er_event_data
et_bad_cells
e_display.
" in Implementation
method on_f4.
if es_row_no-row_id ne <last Row>.
"write your logic here
endif.
endmethod.
"You can get Last row from
"Select Query use sy-dbcnt
"or if you modified any records deleting,inserting
"at that time You can use read <itab> index 1 transporting no fields. then use sy-tfil
Hope this is useful for you
Regards,
Raghava Channooru
Similar Messages
-
Disable delete button in ALV grid
Hi Experts,
I have a functionality to disable some buttons in alv grid such as delete row,cut,print etc.
I know how to exclude them by using it_toolbar_excluding , but I need to disable them.
Can you please let me know how to handle this.
I am displaying the ALV grid by calling the method set_table_for_first_display.
Thanks in Advance
PrasanthHi,
By using below code you can disable any button in ALV display
data : tool_wa_exclude type ui_func.
tool_wa_exclude = cl_gui_alv_grid=>mc_fc_loc_delete_row.
append tool_wa_exclude to tool_it_exclude .
call method grid2->set_table_for_first_display
exporting
it_toolbar_excluding = tool_it_exclude
changing
it_outtab = it_ekpo
it_fieldcatalog = it_fcat
exceptions
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
others = 4.
U need to pass tool_it_exclude internal table to method for displaying -
How does the SORT function in ALV grid work?
Hi,
I have a report for which the o/p is displayed in ALV grid format.There is one column in the O/p strcuture which is "No of days".Based on certain conditions,i need to display the value for some of the days as Negative e.g. " - 45".Becasuse of this,I have declared the field for the "No of days" of the type "CHAR".
Now when i sort(using ALV grid SORT function) the list on basis of this column,it doesnt give me the correct o/p.
CAN anyone tell me how do i handle this?I want the list to be sorted correctly on basis of the "No of days" column.
Thanks!This is your Fourth Cross Posting in last three days on same issue!!
CHAR type column doesnt work for SORT function in ALV grid!
How to sort a column of type CHAR
I dont,ve link for your Fourth Thread on same,though i'm short memory loss. -
How can I call functionality of ALV Grid by event of button outside grid?
Hello,
How can I call functionality of ALV Grid by event of button located outside ALV Grid? For example how to fire printing of this ALV Grid by button click elsewhere on the screen (not in toolbar of ALV Grid).
Best regards,
Josef Motlhi Motl,
these are steps to create a button in ALV and trigger an event from it..
1.Use the parameter i_callback_pf_status_set in the function module REUSE_ALV_GRID_DISPLAY
i_callback_program = gd_repid
i_callback_pf_status_set = 'SET_PF_STATUS'
form set_pf_status using rt_extab type slis_t_extab.
set pf-status 'NEWALVSTATUS'.
endform.
You have to copy the standard ALV pf stauts to 'NEWALVSTATUS' and add your button.
2.You have to do the following to process the new button click.
i_callback_user_command = 'USER_COMMAND'
form user_command using i_ucomm like sy-ucomm
is_selfield type slis_selfield.
case i_ucomm.
3. to copy the standard pf status to a new one.go to the ALV screen and take the menu System -> Status. Then look for the standard pf status. Copy this to Z range and then add your new button.
reward points if helpful
regards
satesh -
How to read a alv grid row data from standard program
Hi All,
I am working on transaction LBK1. Actually when you will open this transaction in the left hand side it will show you the data in tree. When you click on a notification node it will show the relevant data in right side. In which there is a operation tab . In this tab the data comes in alv grid. If user selects a row then I have to get that selected row value. There is also a toolbar above on the tree side. There are some buttons which execute our implementation class where I can put the code.
Can anyone please help me out? How I can read that selected row in our class/method?
Thanks in advance.
Best Regards
RituSetting and getting selected rows (Columns) and read line contents
You can read which rows of the grid that has been selected, and dynamic select rows of the grid using methods get_selected_rows and set_selected_rows. There are similiar methods for columns.
Note that the grid table always has the rows in the same sequence as displayed in the grid, thus you can use the index of the selected row(s) to read the information in the rows fronm the table. In the examples below the grid table is named gi_sflight.
Data declaratrion:
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.
Example 1: Reading index of selected row(s) and using it to read the grid table
CALL METHOD go_grid->get_selected_rows
IMPORTING
et_index_rows = gi_index_rows.
DESCRIBE TABLE gi_index_rows LINES l_lines.
IF l_lines = 0.
CALL FUNCTION 'POPUP_TO_DISPLAY_TEXT'
EXPORTING
textline1 = 'You must choose a valid line'.
EXIT.
ENDIF.
LOOP AT gi_index_rows INTO g_selected_row.
READ TABLE gi_sflight INDEX g_selected_row-index INTO g_wa_sflight.
ENDIF.
ENDLOOP.
Example 2: Set selected row(s).
DESCRIBE TABLE gi_index_rows LINES l_lines.
IF l_lines > 0.
CALL METHOD go_grid->set_selected_rows
exporting
it_index_rows = gi_index_rows.
ENDIF. -
Disable editable field in ALV grid using OOPS
I have following requirements,
Displaying ALV grid output with most of the fields editable.
Validations on data entered for each fields,for error messages
Query :
I want to make all the fields except the field in ERROR in display only mode
similar to case when we do validation of fields in table controls.HI
check the below links lot of info and examples r there for OOPS
http://www.sapgenie.com/abap/OO/index.htm
http://www.geocities.com/victorav15/sapr3/abap_ood.html
http://www.brabandt.de/html/abap_oo.html
Check this cool weblog:
/people/thomas.jung3/blog/2004/12/08/abap-persistent-classes-coding-without-sql
/people/thomas.jung3/blog/2004/12/08/abap-persistent-classes-coding-without-sql
http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b6254f411d194a60000e8353423/frameset.htm
http://www.sapgenie.com/abap/OO/
http://www.sapgenie.com/abap/OO/index.htm
http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b5654f411d194a60000e8353423/content.htm
http://www.esnips.com/doc/375fff1b-5a62-444d-8ec1-55508c308b17/prefinalppt.ppt
http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
http://www.esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt
http://www.allsaplinks.com/
http://www.sap-img.com/
http://www.sapgenie.com/
http://help.sap.com
http://www.sapgenie.com/abap/OO/
http://www.sapgenie.com/abap/OO/index.htm
http://www.sapgenie.com/abap/controls/index.htm
http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
http://www.esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf
http://www.sapgenie.com/abap/OO/index.htm
http://help.sap.com/saphelp_erp2005/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
http://www.sapgenie.com/abap/OO/
these links
http://help.sap.com/saphelp_47x200/helpdata/en/ce/b518b6513611d194a50000e8353423/content.htm
For funtion module to class
http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b5954f411d194a60000e8353423/content.htm
for classes
http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b5c54f411d194a60000e8353423/content.htm
for methods
http://help.sap.com/saphelp_47x200/helpdata/en/08/d27c03b81011d194f60000e8353423/content.htm
for inheritance
http://help.sap.com/saphelp_47x200/helpdata/en/dd/4049c40f4611d3b9380000e8353423/content.htm
for interfaces
http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b6254f411d194a60000e8353423/content.htm
For Materials:
1) http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCABA/BCABA.pdf -- Page no: 1291
2) http://esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt
3) http://esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
4) http://esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf
5) http://esnips.com/doc/92be4457-1b6e-4061-92e5-8e4b3a6e3239/Object-Oriented-ABAP.ppt
6) http://esnips.com/doc/448e8302-68b1-4046-9fef-8fa8808caee0/abap-objects-by-helen.pdf
7) http://esnips.com/doc/39fdc647-1aed-4b40-a476-4d3042b6ec28/class_builder.ppt
8) http://www.amazon.com/gp/explorer/0201750805/2/ref=pd_lpo_ase/102-9378020-8749710?ie=UTF8
1) http://www.erpgenie.com/sap/abap/OO/index.htm
2) http://help.sap.com/saphelp_nw04/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
Check these sample code
data : begin of it_mara occurs 0,
mark type flag,
matnr type matnr,
mtart type mtart,
meins type meins,
end of it_mara.
data : begin of it_mara1 occurs 0,
mark type flag,
matnr type matnr,
mtart type mtart,
meins type meins,
end of it_mara1.
data : begin of it_mara2 occurs 0,
mark type flag,
matnr type matnr,
mtart type mtart,
meins type meins,
end of it_mara2.
data : t_fieldcat type lvc_t_fcat,
t_fieldcat1 type lvc_t_fcat,
s_fieldcat like line of t_fieldcat.
data : s_layout type lvc_s_layo.
data : control type ref to cl_gui_custom_container,
grid type ref to cl_gui_alv_grid.
data: begin of wa ,
mark type flag,
matnr type matnr,
mtart type mtart,
meins type meins,
end of wa.
class lcl_events_box definition.
public section.
methods :
*Handler_Data_Changed for event Data_Changed of cl_gui_alv_grid
*imporTing er_data_changed,
Handler_User_Command for event User_Command of cl_gui_alv_grid
imporTing e_ucomm,
Handler_ToolBar for event ToolBar of cl_gui_alv_grid
importing E_object E_interactive.
endclass.
class lcl_events_box implementation.
method Handler_user_command.
PERFORM FORM_USERCOMMAND CHANGING E_UCOMM.
endmethod.
method Handler_ToolBar.
PERFORM FORM_TOOLBAR CHANGING E_OBJECT E_INTERACTIVE
E_OBJECT->MT_TOOLBAR.
endmethod.
ENDCLASS.
start-of-selection.
data : w_events type ref to lcl_events_box.
select matnr mtart meins from mara into corresponding fields of table
it_mara.
call screen 100.
*& Module pbo_module OUTPUT
text
MODULE pbo_module OUTPUT.
if GRID is initial.
CREATE OBJECT CONTROL
EXPORTING
CONTAINER_NAME = 'CUST_CTRL'.
CREATE OBJECT GRID
EXPORTING
I_PARENT = CONTROL.
PERFORM BUILD_CATALOG.
PERFORM BUILD_CATALOG1.
PERFORM BUILD_LAYOUT.
CALL METHOD GRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
IS_LAYOUT = s_layout
CHANGING
IT_OUTTAB = it_mara[]
IT_FIELDCATALOG = t_fieldcat.
CREATE OBJECT W_EVENTS.
SET HANDLER : W_EVENTS->HANDLER_TOOLBAR FOR GRID,
W_EVENTS->HANDLER_USER_COMMAND FOR GRID.
CALL METHOD GRID->SET_TOOLBAR_INTERACTIVE.
ELSE.
call method grid->refresh_table_display.
ENDIF.
ENDMODULE. " pbo_module OUTPUT
*& Form BUILD_CATALOG
FORM BUILD_CATALOG .
S_FIELDCAT-COL_POS = '1'.
S_FIELDCAT-FIELDNAME = 'MARK'.
S_FIELDCAT-CHECKBOX = 'X'.
S_FIELDCAT-eDIT = 'X'.
APPEND S_FIELDCAT TO T_FIELDCAT.
CLEAR S_FIELDCAT.
S_FIELDCAT-COL_POS = '2'.
S_FIELDCAT-FIELDNAME = 'MATNR'.
S_FIELDCAT-SCRTEXT_M = 'MATERIAL'.
APPEND S_FIELDCAT TO T_FIELDCAT.
S_FIELDCAT-COL_POS = '3'.
S_FIELDCAT-FIELDNAME = 'MTART'.
S_FIELDCAT-SCRTEXT_M = 'MATERL TYPE'.
APPEND S_FIELDCAT TO T_FIELDCAT.
S_FIELDCAT-COL_POS = '4'.
S_FIELDCAT-FIELDNAME = 'MEINS'.
S_FIELDCAT-SCRTEXT_M = 'UOM'.
APPEND S_FIELDCAT TO T_FIELDCAT.
ENDFORM. " BUILD_CATALOG
*& Form BUILD_LAYOUT
text
--> p1 text
<-- p2 text
FORM BUILD_LAYOUT .
S_LAYOUT-ZEBRA = 'X'.
S_LAYOUT-CWIDTH_OPT = 'X'.
S_LAYOUT-GRID_TITLE = 'Material Details'.
ENDFORM.
" BUILD_LAYOUT////////////////////////////////////
" USER_COMMAND_0100 INPUT
*& Form FORM_USERCOMMAND
text
<--P_E_UCOMM text
form FORM_USERCOMMAND changing p_e_ucomm.
CASE P_E_UCOMM.
WHEN 'INT1'.
DO.
READ TABLE IT_MARA INDEX SY-INDEX TRANSPORTING MARK MATNR.
IF SY-SUBRC <> 0.
EXIT.
ENDIF.
IF IT_MARA-MARK = 'X'.
read table it_mara into wa TRANSPORTING MATNR MTART MEINS .
MOVE-CORRESPONDING WA TO IT_MARA1.
READ TABLE IT_MARA1 TRANSPORTING MATNR MTART MEINS .
MOVE-CORRESPONDING IT_MARA1 TO IT_MARA2.
APPEND IT_MARA2.
CALL METHOD GRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
IS_LAYOUT = s_layout
CHANGING
IT_OUTTAB = it_mara2[]
IT_FIELDCATALOG = t_fieldcat1.
SET PARAMETER ID 'MAT' FIELD IT_MARA-MATNR.
CALL TRANSACTION 'MM02'.
. ENDIF.
ENDIF.
ENDDO.
ENDCASE.
endform. " FORM_USERCOMMAND
*& Form FORM_TOOLBAR
text
<--P_E_OBJECT text
<--P_E_INTERACTIVE text
<--P_E_OBJECT_>MT_TOOLBAR text
FORM FORM_TOOLBAR CHANGING P_E_OBJECT TYPE REF TO
CL_ALV_EVENT_TOOLBAR_SET
P_E_INTERACTIVE
MT_TOOLBAR TYPE TTB_BUTTON.
DATA WAL_BUTTON TYPE STB_BUTTON.
*WAL_BUTTON-ICON = ICON_status_reverse.
WAL_BUTTON-TEXT = 'GO'.
WAL_BUTTON-QUICKINFO = 'PROCEED'.
waL_button-FUNCTION = 'INT1'.
WAL_BUTTON-BUTN_TYPE = 0.
WAL_BUTTON-DISABLED = SPACE.
insert WAL_BUTTON INTO P_E_OBJECT->MT_TOOLBAR index 1.
endform. " FORM_TOOLBAR
*& Module PF-STATUS OUTPUT
text
module PF-STATUS output.
set pf-status 'Z7PSTAT'.
endmodule. " PF-STATUS OUTPUT
*& Module USER_COMMAND_0100 INPUT
text
module USER_COMMAND_0100 input.
CASE SY-UCOMM.
WHEN 'BACK'.
LEAVE PROGRAM.
WHEN 'CANCEL'.
LEAVE PROGRAM.
ENDCASE.
endmodule. " USER_COMMAND_0100 INPUT
*& Form BUILD_CATALOG1
text
--> p1 text
<-- p2 text
form BUILD_CATALOG1 .
S_FIELDCAT-COL_POS = '1'.
S_FIELDCAT-FIELDNAME = 'MATNR'.
S_FIELDCAT-SCRTEXT_M = 'MATERIAL'.
APPEND S_FIELDCAT TO T_FIELDCAT1.
S_FIELDCAT-COL_POS = '2'.
S_FIELDCAT-FIELDNAME = 'MTART'.
S_FIELDCAT-SCRTEXT_M = 'MATERL TYPE'.
APPEND S_FIELDCAT TO T_FIELDCAT1.
S_FIELDCAT-COL_POS = '3'.
S_FIELDCAT-FIELDNAME = 'MEINS'.
S_FIELDCAT-SCRTEXT_M = 'UOM'.
APPEND S_FIELDCAT TO T_FIELDCAT1.
endform. " BUILD_CATALOG1
check the below link may be useful for you
http://www.sapdevelopment.co.uk/reporting/alvhome.htm
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVALV/BCSRVALV.pdf
Simple ALV report
http://www.sapgenie.com/abap/controls/alvgrid.htm
http://wiki.ittoolbox.com/index.php/Code:Ultimate_ALV_table_toolbox
ALV
1. Please give me general info on ALV.
http://www.sapfans.com/forums/viewtopic.php?t=58286
http://www.sapfans.com/forums/viewtopic.php?t=76490
http://www.sapfans.com/forums/viewtopic.php?t=20591
http://www.sapfans.com/forums/viewtopic.php?t=66305 - this one discusses which way should you use - ABAP Objects calls or simple function modules.
2. How do I program double click in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=11601
http://www.sapfans.com/forums/viewtopic.php?t=23010
3. How do I add subtotals (I have problem to add them)...
http://www.sapfans.com/forums/viewtopic.php?t=20386
http://www.sapfans.com/forums/viewtopic.php?t=85191
http://www.sapfans.com/forums/viewtopic.php?t=88401
http://www.sapfans.com/forums/viewtopic.php?t=17335
4. How to add list heading like top-of-page in ABAP lists?
http://www.sapfans.com/forums/viewtopic.php?t=58775
http://www.sapfans.com/forums/viewtopic.php?t=60550
http://www.sapfans.com/forums/viewtopic.php?t=16629
5. How to print page number / total number of pages X/XX in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=29597 (no direct solution)
6. ALV printing problems. The favourite is: The first page shows the number of records selected but I don't need this.
http://www.sapfans.com/forums/viewtopic.php?t=64320
http://www.sapfans.com/forums/viewtopic.php?t=44477
7. How can I set the cell color in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=52107
8. How do I print a logo/graphics in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=81149
http://www.sapfans.com/forums/viewtopic.php?t=35498
http://www.sapfans.com/forums/viewtopic.php?t=5013
9. How do I create and use input-enabled fields in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=84933
http://www.sapfans.com/forums/viewtopic.php?t=69878
10. How can I use ALV for reports that are going to be run in background?
http://www.sapfans.com/forums/viewtopic.php?t=83243
http://www.sapfans.com/forums/viewtopic.php?t=19224
11. How can I display an icon in ALV? (Common requirement is traffic light icon).
http://www.sapfans.com/forums/viewtopic.php?t=79424
http://www.sapfans.com/forums/viewtopic.php?t=24512
12. How can I display a checkbox in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=88376
http://www.sapfans.com/forums/viewtopic.php?t=40968
http://www.sapfans.com/forums/viewtopic.php?t=6919
Go thru these programs they may help u to try on some hands on
ALV Demo program
BCALV_DEMO_HTML
BCALV_FULLSCREEN_DEMO ALV Demo: Fullscreen Mode
BCALV_FULLSCREEN_DEMO_CLASSIC ALV demo: Fullscreen mode
BCALV_GRID_DEMO Simple ALV Control Call Demo Program
BCALV_TREE_DEMO Demo for ALV tree control
BCALV_TREE_SIMPLE_DEMO
BC_ALV_DEMO_HTML_D0100
<b>Reward all helpfull answers</b>
Regards -
REFRESH FUNCTIONALITy in ALV GRID
Hi Experts,
I have added two custom buttons (CO40 and REFRESH) in ALV GRID .
WHEN CO40 button is clicked it will go the CO40 transaction.
here the problem is when clicking the REFRESH , the REFRESH fuctionality is not working.
(here i went to CO40 transaction by clicking CO40 button and deleted one planned order and come back and clicked REFRESH button but the planned order still showing in the output but the planned oreder is deleted in the table ) please help me rgarding this
pls see my code and pls send me the code with modifications
Thanks
Nagendra
REPORT zpp_plannedorder_conv LINE-SIZE 200.
TYPE-POOLS: slis.
TABLES: plaf, vbak.
PLANNED ORDER TABLE
CONSTANTS: c_e TYPE c LENGTH 01 VALUE 'E'.
TYPES: BEGIN OF ty_plaf,
kdauf TYPE kdauf,
kdpos TYPE kdpos,
plnum TYPE plnum,
dispo TYPE dispo,
matnr TYPE matnr,
maktx TYPE maktx,
pwwrk TYPE pwwrk,
paart TYPE paart,
beskz TYPE beskz,
gsmng TYPE gsmng,
END OF ty_plaf.
SALES FIELDS
TYPES: BEGIN OF ty_vbak,
vbeln TYPE vbeln,
posnr TYPE posnr,
kunnr TYPE kunnr,
grkor TYPE grkor,
autlf TYPE autlf,
mvgr2 TYPE mvgr2,
fixmg TYPE fixmg,
bstdk TYPE bstdk,
edatu TYPE edatu,
posex TYPE posex,
END OF ty_vbak.
output table.
TYPES: BEGIN OF ty_out,
plnum TYPE plnum,
dispo TYPE dispo,
matnr TYPE matnr,
maktx TYPE maktx,
pwwrk TYPE pwwrk,
paart TYPE paart,
beskz TYPE beskz,
gsmng TYPE gsmng,
kdauf TYPE kdauf,
kdpos TYPE kdpos,
kunnr TYPE kunnr,
grkor TYPE grkor,
autlf TYPE autlf,
mvgr2 TYPE mvgr2,
fixmg TYPE fixmg,
bstdk TYPE bstdk,
edatu TYPE edatu,
posex TYPE posex,
END OF ty_out.
DATA: tb_plaf TYPE STANDARD TABLE OF ty_plaf,
tb_vbak TYPE STANDARD TABLE OF ty_vbak,
tb_out TYPE STANDARD TABLE OF ty_out.
DATA: lv_plaf TYPE ty_plaf,
lv_vbak TYPE ty_vbak,
lv_out TYPE ty_out.
TYPES: BEGIN OF ty_vbep,
vbeln TYPE vbeln,
posnr TYPE posnr,
etenr TYPE etenr,
edatu TYPE edatu,
END OF ty_vbep.
DATA: tb_vbep TYPE STANDARD TABLE OF ty_vbep.
DATA: lv_flag(1) TYPE c.
**Start changes RFS: SANN - 0856
DATA: w_repid TYPE sy-repid.
DATA: it_fieldcat TYPE slis_t_fieldcat_alv, "field catalog table
gs_layout TYPE slis_layout_alv, "struct data type
it_sort TYPE slis_t_sortinfo_alv,
it_events TYPE slis_t_event,
gt_event_exit TYPE slis_t_event_exit.
**End changes RFS: SANN - 0856
SELECT OPTIONS.
SELECTION-SCREEN BEGIN OF BLOCK a1 WITH FRAME TITLE text-t01.
SELECT-OPTIONS: sel_pln FOR plaf-plnum,
sel_pww FOR plaf-pwwrk OBLIGATORY,
sel_dis FOR plaf-dispo,
sel_kun FOR vbak-kunnr,
sel_paa FOR plaf-paart,
sel_kda FOR plaf-kdauf.
SELECTION-SCREEN END OF BLOCK a1.
START-OF-SELECTION.
REFRESH: tb_plaf ,tb_vbak.
SELECT pkdauf pkdpos pplnum pdispo pmatnr mmaktx
ppwwrk ppaart pbeskz pgsmng INTO TABLE tb_plaf
FROM plaf AS p JOIN makt AS m
ON pmatnr EQ mmatnr
WHERE p~plnum IN sel_pln
AND p~pwwrk IN sel_pww
AND p~dispo IN sel_dis
AND p~paart IN sel_paa
AND p~kdauf IN sel_kda
AND m~spras EQ c_e.
IF NOT tb_plaf[] IS INITIAL.
SORT tb_plaf BY kdauf DESCENDING.
SELECT kvbeln pposnr kkunnr pgrkor kautlf pmvgr2 p~fixmg
kbstdk vedatu p~posex INTO TABLE tb_vbak
FROM vbak AS k JOIN vbap AS p
ON kvbeln EQ pvbeln
INNER JOIN vbep AS v
ON pvbeln EQ vvbeln
AND pposnr EQ vposnr
FOR ALL ENTRIES IN tb_plaf
WHERE k~vbeln EQ tb_plaf-kdauf
AND p~posnr EQ tb_plaf-kdpos
AND k~kunnr IN sel_kun
AND v~etenr EQ '0001'.
IF NOT tb_vbak[] IS INITIAL.
LOOP AT tb_plaf INTO lv_plaf.
CLEAR lv_out.
MOVE-CORRESPONDING lv_plaf TO lv_out.
IF NOT lv_plaf-kdauf IS INITIAL.
READ TABLE tb_vbak INTO lv_vbak WITH KEY vbeln = lv_plaf-kdauf
posnr = lv_plaf-kdpos.
MOVE-CORRESPONDING lv_vbak TO lv_out.
ENDIF.
APPEND lv_out TO tb_out.
ENDLOOP.
ENDIF.
ENDIF.
END-OF-SELECTION.
PERFORM f_build_fcat.
PERFORM f_get_display.
*& Form F_BUILD_FCAT
FORM f_build_fcat .
CLEAR: w_repid.
PERFORM fill_fieldcat " TABLES it_fieldcat
USING:
text-f01 'TB_OUT' text-k01 text-k01 '10' ,
text-f02 'TB_OUT' text-k02 text-k02 '10' ,
text-f03 'TB_OUT' text-k03 text-k03 '06' ,
text-f04 'TB_OUT' text-k04 text-k04 '18' ,
text-f05 'TB_OUT' text-k05 text-k05 '06' ,
text-f06 'TB_OUT' text-k06 text-k06 '08' ,
text-f07 'TB_OUT' text-k07 text-k07 '05' ,
text-f08 'TB_OUT' text-k08 text-k08 '05' ,
text-f09 'TB_OUT' text-k09 text-k09 '15' ,
text-f10 'TB_OUT' text-k10 text-k10 '05' ,
text-f11 'TB_OUT' text-k11 text-k11 '05' ,
text-f12 'TB_OUT' text-k12 text-k12 '10' ,
text-f13 'TB_OUT' text-k13 text-k13 '10' ,
text-f14 'TB_OUT' text-k14 text-k14 '10' ,
text-f15 'TB_OUT' text-t15 text-k15 '10' ,
text-f16 'TB_OUT' text-k16 text-k16 '10' ,
text-f17 'TB_OUT' text-k17 text-k17 '10' .
ENDFORM. " F_BUILD_FCAT
*& Form fill_fieldcat
FORM fill_fieldcat " TABLES l_catalog TYPE slis_t_fieldcat_alv "#EC *
USING p_field "#EC *
p_table "#EC *
p_desc "#EC *
p_desc_l "#EC *
p_len. "#EC *
DATA: ls_fieldcat TYPE slis_fieldcat_alv.
ls_fieldcat-fieldname = p_field.
ls_fieldcat-tabname = p_table.
ls_fieldcat-seltext_l = p_desc_l.
ls_fieldcat-reptext_ddic = p_desc.
ls_fieldcat-outputlen = p_len.
APPEND ls_fieldcat TO it_fieldcat.
CLEAR ls_fieldcat.
ENDFORM. " fill_fieldcat
*& FORM F_GET_DISPLAY
text
FORM f_get_display .
CLEAR w_repid.
MOVE sy-repid TO w_repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = w_repid
i_callback_pf_status_set = 'PF_STATUS'
i_callback_user_command = 'USER_COMMAND'
is_layout = gs_layout
it_fieldcat = it_fieldcat
it_sort = it_sort
i_save = 'X'
TABLES
t_outtab = tb_out
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc EQ 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " F_GET_DISPLAY
*& Form PF_STATUS
text
FORM pf_status USING rt_extab TYPE slis_t_extab.
DATA: wa_extab LIKE LINE OF rt_extab.
REFRESH: rt_extab.
wa_extab-fcode = '&REFRESH'.
APPEND wa_extab TO rt_extab.
SET PF-STATUS '0001' EXCLUDING rt_extab.
ENDFORM. "PF_STATUS
-->COMMAND text
-->SELFIELD text
FORM user_command USING command LIKE sy-ucomm selfield TYPE slis_selfield."#EC CALLED
CLEAR : lv_out-plnum,lv_out-kdauf,lv_out-paart,lv_out-kdauf.
CASE command.
WHEN '&IC1'. "doubleclick
CASE selfield-fieldname.
WHEN 'PLNUM'.
READ TABLE tb_out INTO lv_out INDEX selfield-tabindex.
IF sy-subrc EQ 0.
SET PARAMETER ID 'PAF' FIELD lv_out-plnum.
CALL TRANSACTION 'MD12' AND SKIP FIRST SCREEN.
ENDIF.
WHEN 'KDAUF'.
READ TABLE tb_out INTO lv_out INDEX selfield-tabindex.
IF sy-subrc EQ 0.
SET PARAMETER ID 'AUN' FIELD lv_out-kdauf.
CALL TRANSACTION 'VA02' AND SKIP FIRST SCREEN.
ENDIF.
ENDCASE.
WHEN 'CO40'.
READ TABLE tb_out INTO lv_out INDEX selfield-tabindex.
IF sy-subrc EQ 0.
SET PARAMETER ID 'PAF' FIELD lv_out-plnum.
CALL TRANSACTION 'CO40' AND SKIP FIRST SCREEN.
ENDIF.
WHEN 'REFRESH'.
PERFORM select_data.
ENDCASE.
ENDFORM. "user_command
*End changes RFS: SANN - 0856
*& Form SELECT_DATA
text
--> p1 text
<-- p2 text
FORM select_data .
commit work and wait.
REFRESH:tb_plaf[],tb_vbak[],tb_out[].
SELECT pkdauf pkdpos pplnum pdispo pmatnr mmaktx
ppwwrk ppaart pbeskz pgsmng INTO TABLE tb_plaf
FROM plaf AS p JOIN makt AS m
ON pmatnr EQ mmatnr
WHERE p~plnum IN sel_pln
AND p~pwwrk IN sel_pww
AND p~dispo IN sel_dis
AND p~paart IN sel_paa
AND p~kdauf IN sel_kda
AND m~spras EQ c_e.
IF NOT tb_plaf[] IS INITIAL.
SORT tb_plaf BY kdauf DESCENDING.
SELECT kvbeln pposnr kkunnr pgrkor kautlf pmvgr2 p~fixmg
kbstdk vedatu p~posex INTO TABLE tb_vbak
FROM vbak AS k JOIN vbap AS p
ON kvbeln EQ pvbeln
INNER JOIN vbep AS v
ON pvbeln EQ vvbeln
AND pposnr EQ vposnr
FOR ALL ENTRIES IN tb_plaf
WHERE k~vbeln EQ tb_plaf-kdauf
AND p~posnr EQ tb_plaf-kdpos
AND k~kunnr IN sel_kun
AND v~etenr EQ '0001'.
IF NOT tb_vbak[] IS INITIAL.
LOOP AT tb_plaf INTO lv_plaf.
CLEAR lv_out.
MOVE-CORRESPONDING lv_plaf TO lv_out.
IF NOT lv_plaf-kdauf IS INITIAL.
READ TABLE tb_vbak INTO lv_vbak WITH KEY vbeln = lv_plaf-kdauf
posnr = lv_plaf-kdpos.
MOVE-CORRESPONDING lv_vbak TO lv_out.
ENDIF.
APPEND lv_out TO tb_out.
ENDLOOP.
ENDIF.
ENDIF.
ENDFORM. " SELECT_DATAHi,
Gothrough the following link,
Handle Refresh button on ALV
Regards,
Harish -
Generic function displaying alv grid for undefined structure
Hi experts,
I'm doing my first steps on abap development (Totally noob).
I'm writing some little reports based on simple selections (1 or 2 tables).
In every report, I've defined a structure (internal table) that i'm displaying with an ALV Grid.
In every report, I need to create a catalog for my structure in order to make the alv grid working.
What I would like to do is :
Create a function that receives a undefined structure (for all my reports) as a parameter.
This function sould create the catalog for the coresponding structure and call the alv grid function to display the data's contained in this structure.
The goal is : In every report, I would like to use this function to show the selected data's without taking care of catalogs, alv grid, etc...
Is it possible ?
I really don't see how I can do that... Does anybody already tried something like that ?
Thank you for your help
Regards
QuentinHi,
In this method Pass the structure name-
CALL METHOD gh_grid->set_table_for_first_display
EXPORTING
I_BUFFER_ACTIVE =
I_BYPASSING_BUFFER =
I_CONSISTENCY_CHECK =
I_STRUCTURE_NAME = "<- here pass the structure
IS_VARIANT =
I_SAVE =
I_DEFAULT = 'X'
IS_LAYOUT = "<-Layout variable if using layout
IS_PRINT =
IT_SPECIAL_GROUPS =
IT_TOOLBAR_EXCLUDING =
IT_HYPERLINK =
IT_ALV_GRAPHICS =
IT_EXCEPT_QINFO =
CHANGING
it_outtab = gt_line[]
it_fieldcatalog = gt_fieldcat
IT_SORT =
IT_FILTER =
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4 -
Hi,
I have alv grid using cl_gui_alv_grid. I want to capture the row selection event and display the detail below the table.
how do I capture the row selection.? I want to display the details below as and when the row selection changed.
Regards
PanneerMore detail example, also works with multiple selections:
data go_alv type ref to cl_gui_alv_grid.
data go_handler type ref to lcl_event_receiver.
* CLASS lcl_event_receiver DEFINITION
class lcl_event_receiver definition.
public section.
methods delayed_change_select
for event delayed_changed_sel_callback of cl_gui_alv_grid.
endclass. "lcl_event_receiver DEFINITION
* CLASS lcl_event_receiver IMPLEMENTATION
class lcl_event_receiver implementation.
method delayed_change_select.
message 'Selection changed' type 'S'.
endmethod. "delayed_change_selection
endclass. "lcl_event_receiver IMPLEMENTATION
*& Module STATUS_0100 OUTPUT
module status_0100 output.
data lt_fcat_lvc type lvc_t_fcat.
data lt_fcat_alv type slis_t_fieldcat_alv.
data ls_layo type lvc_s_layo.
set pf-status 'MAIN'.
if go_alv is initial.
ls_layo-sel_mode = 'A'.
* ls_layo-sel_mode = 'B'. "Also works
* ls_layo-sel_mode = 'C'. "Also works
* ls_layo-sel_mode = 'D'. "Also works
call method go_alv->set_table_for_first_display
exporting
is_layout = ls_layo
changing
it_fieldcatalog = lt_fcat_lvc
it_outtab = gt_data[].
create object go_handler.
set handler go_handler->delayed_change_select for go_alv.
call method go_alv->register_delayed_event
exporting
i_event_id = cl_gui_alv_grid=>mc_evt_delayed_change_select.
endif.
endmodule. " STATUS_0100 OUTPUT -
Hey,
How to know number of rows and columns in alv grid are used.Hi,
You can count the number of rows , by using describe statemet,
describe table itab lines v_lines.
itab is table used to display in ALV
Thanks & Regards,
Navneeth K. -
ALV Grid row selection possible options
Hello Experts,
I have an ALV Grid output with rows color codes based on certain status for each rows.Now when the user selects one or more lines to do the next process, what happens now as sap standard is the selected lines becomes highlighted ( kind of yellowish) and the selection button gets pressed.
But what the user is requesting is ,lets say he selects one blue and another red line, then both becomes yellow (because of the SAP standard highlighting) ...he would like those line colors to be still red and blue and only the selection button pressed.
Is there a way to do that is ALV grid? I'm trying to convince him to look at the status colum if he gets confused with what colors he selected or I will have to use a checkbox field as the first column and and hide the ALV selection option.
But was curious to find if this is possible in ALV?Or any other suggestions to handle this requirement is welcome.
MatHi Mat,
I am curious if your user is so arogant when he buys a car too. Does he say to dealer "Sorry I don't want this gear lever to be placed here and here, I want it a litte bit higher. Can you please fix that?". This sounds like you are struggling with dumb user. I have never heard of someone complaining that the standard highlight is in wrong color. You already provided to him row colors, right? I think most of the users would be hugging you for such facilities.
I think in your case as the user is inalterable you should go for the checkboxes as you say. This way maybe you will somehow satisfy his needs (as the row colors will be kept even during selection). Personally I wouldn't bother such requirements. As long as the program reports correct data, he should not complain at all.
Good luck then
Marcin -
Eable indivadule cells editable by selected ALV Grid rows.
Now i encounter the case that in an ALV Grid list, the value column A can be entered by user if cell is blank in some rows.
.user will click on an EDIT button to make these cells editble for input value. is it possible to implenment the case?
BTW, I used the FM 'REUSE_ALV_GRID_DISPLAY' to generated the ALV list.Hi,
First set the field catalog's EDIT field to 'X'.
Please try this links:
<<Linkfarm deleted>>
Thank you.
Thanks,
AMS
Edited by: kishan P on Aug 26, 2010 5:21 PM -
"Control + F5" standard filter functionality for ALV Grids
Hi all,
After an ALV Grid is displayed on screen there is a standard functionality to filter a selected column.
You can select a column (click on the head) of the ALV, then "Control + F5" and a pop-up appears to insert a value or a range by which the filtration is going to be done.
But a I have problem with a concrete field. It doesn`t seem different on comparison with other fields (CHAR30), but I don`t know why it doesn`t work correctly as others.
Have you had any situation like this ??
Thanks & sorry for my bad english,
RubèHi Frank,
When you are entering 89012 and pressing enter the additional zeros are adding up because of the data type of VBELN We have standard conversion routine attached with this .So when ever u wrtie any text that routine will works.
Can you please check what data type are you using in the internal table that you are binding to the node?
Thanks and Regards,
NSingh
Edited by: Nsingh on Feb 17, 2012 4:52 AM -
Disable sort option in ALV GRID DISPLAY
Hi Experts,
I have an Alv output with fixed layout, means user should not be allowed to edit/sort/toggle any of the columns, particularly sort functionality should be removed.
I have already tried the function code logic with excluding table. That only makes the sort option disappear. Still when you select a particular column and right click, you will find that the Sort in Ascending order' and 'Sort in descending order' functions are still enabled. This was already raised as a thread but not answered.
[alv sort option]
Please help.
Note: Disabling the icon doesnt help in disabling the functionality.Try by excluding the entire Sort group. Like:
Data:
t_toolbar_excld1 type ui_functions, "buttons to exclude
wa_toolbar_excld&1 like line of t_toolbar_excld1.
wa_toolbar_excld1 = cl_gui_alv_grid=>MC_FG_SORT. " <<
APPEND wa_toolbar_excld1 TO t_toolbar_excld1.
CALL METHOD r_alv_grid1->set_table_for_first_display
EXPORTING is_variant = w_is_variant1
is_layout = w_is_layout1
i_save = c_alv_save_cd
it_toolbar_excluding = t_toolbar_excld1
CHANGING it_outtab = my_table
it_fieldcatalog = t_fieldcat1.
Regards,
Naimesh Patel -
How to disable a button on ALV grid that was enabled per user action?
In an editable ALV grid, per entry in one of the fields , a button is eanbled in a field next to it.
This is written in the event onF4. (not all the lines are shown here).
ls_f4-fieldname = 'TEXT1''.
ls_f4-row_id = es_row_no-row_id.
ls_f4-value = icon_create_text.
ls_f4-error = space.
ls_f4-tabix = space.
IF ls_return-fieldval EQ 'AB'.
ls_f4-style = cl_gui_alv_grid=>mc_style_button.
ELSE.
*Now when Field1 = 'CD'.
*the button in field2 should disappear.
ls_f4-value = space.
ls_f4-style = space.
ENDIF.
ls_f4-style2 = space.
ls_f4-style3 = space.
ls_f4-style4 = space.
APPEND ls_f4 TO <t_f4>.
This is not happening.
Please advise.
Thanks,
Venexample
wa_celltab-fieldname = 'VBELN'.
wa_celltab-style = cl_gui_alv_grid=>mc_style_disabled.
INSERT wa_celltab INTO TABLE itab-celltab.
Maybe you are looking for
-
How to get called from R3 on a Sales Order creation
Hi, I'm completely new on SAP NetWeaver technology. My domain is SAP Business One SDK development and .NET Technologies. What I'm trying to do is some kind of integration between B1 and R3 and for that I need to get called in my .NET application by a
-
An album I recently downloaded is missing most of the first track. How can I download it again without being charged?
-
Copy text from allocation table to purchase order
I am unable to get header/item text to be copied to follow-on Purchase order. I am unable to link AK1, AP1 to purchase order text types. Help please. Thanks.
-
Is there a solution to the problem of IE rendering?
Hello I am constantly being tormented by Internet Explorer. I have a commercial mail order website http://www.thelittlethings.info that I built myself using iweb but I can never be sure whether it is rendering correctly on IE - obviously I am losing
-
hai abap gurus.. i am a java developer. i recently changed to abap. in my project i would develop ABAP sync Service. which is consumed by J2me client by using DOE. so post the links which are help to me. thanks in advance. lakshman. <removed_by_moder