ALV detail user command?
Hi,
sorry, I'm notoriously curious:
On ALV Grid & List display we use user commands (like double-click) to branch to whatever we like.
But on the detail screen there is only Find and Enter.
It would be nice to have the same functions on the detail screen.
Usually we use the ALV functions, not the Objects.
Any ideas?
TIA,
C.
Get the OKcode for that detail and handle the sy-ucomm.
and instead of Standard pop up, give ur own pop up
and PF-status.
use this FM to show the popup REUSE_ALV_POPUP_TO_SELECT.
CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
EXPORTING
I_TITLE =
I_SELECTION = 'X'
I_ALLOW_NO_SELECTION =
I_ZEBRA = ' '
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_CHECKBOX_FIELDNAME =
I_LINEMARK_FIELDNAME =
I_SCROLL_TO_SEL_LINE = 'X'
I_TABNAME =
I_STRUCTURE_NAME =
IT_FIELDCAT =
IT_EXCLUDING =
I_CALLBACK_PROGRAM =
I_CALLBACK_USER_COMMAND =
IS_PRIVATE =
IMPORTING
ES_SELFIELD =
E_EXIT =
TABLES
T_OUTTAB =
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.
what ever pf status you want keep them and excllude rest using it_excluding.
this will solve ur problem
Similar Messages
-
I have a problem with ALV Grid User Command?
Hi Experts,
I have a problem with ALV GRID User Command.
I am calling TCODE IW33 (Order Display) from the ALV output at first time by selecting an order. But, User command is calling IW33 Initial screen with blank value of order. Even I checked in debugging the value what I selected is passing properly, but once that screen (IW33 Initial) displays, value doesn't appear. Then, Manually, I created another session and gone to TCODE IW33 and displayed an order. After that I came out from that order. Then again run my ALV program and selected another order, now order is displaying, but not what I selected current order instead of displaying previous order what I just displayed manually. If I selected any other order, system will display the same order what I dislayed manually.
Here is my code.
FORM user_command_alv USING u_ucomm TYPE sy-ucomm
us_self_field TYPE slis_selfield.
CASE u_ucomm.
WHEN '&IC1'.
READ TABLE it_final INDEX us_self_field-tabindex INTO wa_final.
WHEN 'ORDER'.
IF NOT wa_final-order IS INITIAL.
SET PARAMETER ID 'COK' FIELD wa_final-order.
CALL TRANSACTION 'IW33' AND SKIP FIRST SCREEN.
ENDIF.
endform.
PARAMETER ID 'COK' also the standard one.
Could you please help me out, Where I did wrong?
If I select any order, that order only should display.
Thanks in advance.
Regards,
Sarayu.
Code Formatted by: Alvaro Tejada Galindo on Jan 8, 2009 2:33 PMhi,
Please check it once the Paramater ID is 'ANR' for IW33 order number.
Hope this may help.
Regards,
Sravanthi -
ALV Grid user command handling
I am handling user command event of class cl_gui_alv_grid.
In this , on click of a button , a pop up for selection criterion comes after which
I have to append some data on alv.
But I want to append this data only on frontend not on global internal table of alv
as I want data change event to be called after this and doing some validations on this data.
How can I upload data only on frontend and how to trigger data_changed method in user command event.
I tried using check_changed_data of class cl_gui_alv_grid but some dump is coming for an attribute save_allowed of the class.Hi Suneel,
For you requirement, I dont see why you cant include the functionality for the pop up within the USER_COMMAND event itself.
Algorithm for the USER_COMMAND event:
Step 1: Check E_UCOMM is 'ADD' or 'DELT'.
Step 2: If yes, call FM for POPUP_TO_CONFIRM; else continue to other E_UCOMM
Step 3: If ans is 'No', exit Method - else continue with Add/ Delete as required
Cheers,
Aditya -
how to handle at user commads in alv's?
Hi Praveen
Interactive Reports
As the name suggests, the user can Interact with the report. We can have a drill down into the report data. For example, Column one of the report displays the material numbers, and the user feels that he needs some more specific data about the vendor for that material, he can HIDE that data under those material numbers.
And when the user clicks the material number, another report (actually sub report/secondary list) which displays the vendor details will be displayed.
We can have a basic list (number starts from 0) and 20 secondary lists (1 to 21).
Events associated with Interactive Reports are:
AT LINE-SELECTION
AT USER-COMMAND
AT PF<key>
TOP-OF-PAGE DURING LINE-SELECTION.
HIDE statement holds the data to be displayed in the secondary list.
sy-lisel : contains data of the selected line.
sy-lsind : contains the level of report (from 0 to 21)
<u><b>Interactive Report Events:</b></u>
AT LINE-SELECTION : This Event triggers when we double click a line on the list, when the event is triggered a new sublist is going to be generated. Under this event what ever the statements that are been return will be displayed on newly generated sublist.
AT PFn: For predefined function keys...
<u><b>AT USER-COMMAND :</b></u> It provides user functions keys.
TOP-OF-PAGE DURING LINE-SELECTION :top of page event for secondary list.
<b>check this sample code</b>
TYPE-POOLS: slis. " ALV Global Types
DATA :
gt_user LIKE uinfo OCCURS 0 WITH HEADER LINE. " User info in SM04
START-OF-SELECTION.
PERFORM f_read_data.
PERFORM f_display_data.
* Form F_LIRE_DATA
FORM f_read_data.
REFRESH gt_user.
* Get User's info
CALL FUNCTION 'THUSRINFO'
TABLES
usr_tabl = gt_user.
* Wait in a task
PERFORM f_call_rfc_wait.
ENDFORM. " F_READ_DATA
* Form F_DISPLAY_DATA
FORM f_display_data.
DEFINE m_sort.
add 1 to ls_sort-spos.
ls_sort-fieldname = &1.
append ls_sort to lt_sort.
END-OF-DEFINITION.
DEFINE m_event_exit.
clear ls_event_exit.
ls_event_exit-ucomm = &1.
ls_event_exit-after = 'X'.
append ls_event_exit to lt_event_exit.
END-OF-DEFINITION.
DATA :
ls_layout TYPE slis_layout_alv,
lt_sort TYPE slis_t_sortinfo_alv,
ls_sort TYPE slis_sortinfo_alv,
lt_event_exit TYPE slis_t_event_exit,
ls_event_exit TYPE slis_event_exit.
* Build Sort Table
m_sort 'ZEIT'.
* Build Event Exit Table
m_event_exit '&NTE'. " Refresh
ls_layout-zebra = 'X'.
ls_layout-colwidth_optimize = 'X'.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-cprog
i_callback_user_command = 'USER_COMMAND'
is_layout = ls_layout
i_structure_name = 'UINFO'
it_sort = lt_sort
it_event_exit = lt_event_exit
TABLES
t_outtab = gt_user.
ENDFORM. " F_DISPLAY_DATA
* FORM USER_COMMAND *
FORM user_command USING i_ucomm TYPE syucomm
is_selfield TYPE slis_selfield. "#EC CALLED
CASE i_ucomm.
WHEN '&NTE'.
PERFORM f_read_data.
is_selfield-refresh = 'X'.
SET USER-COMMAND '&OPT'. " Optimize columns width
ENDCASE.
ENDFORM. " USER_COMMAND
* Form F_CALL_RFC_WAIT
FORM f_call_rfc_wait.
DATA lv_mssg(80). "#EC NEEDED
* Wait in a task
CALL FUNCTION 'RFC_PING_AND_WAIT' STARTING NEW TASK '001'
PERFORMING f_task_end ON END OF TASK
EXPORTING
seconds = 5 " Refresh time
busy_waiting = space
EXCEPTIONS
RESOURCE_FAILURE = 1
communication_failure = 2 MESSAGE lv_mssg
system_failure = 3 MESSAGE lv_mssg
OTHERS = 4.
ENDFORM. " F_CALL_RFC_WAIT
* Form F_TASK_END
FORM f_task_end USING u_taskname.
DATA lv_mssg(80). "#EC NEEDED
* Receiving task results
RECEIVE RESULTS FROM FUNCTION 'RFC_PING_AND_WAIT'
EXCEPTIONS
RESOURCE_FAILURE = 1
communication_failure = 2 MESSAGE lv_mssg
system_failure = 3 MESSAGE lv_mssg
OTHERS = 4.
CHECK sy-subrc EQ 0.
SET USER-COMMAND '&NTE'. " Refresh
ENDFORM. " F_TASK_END
*************** END OF PROGRAM Z_ALV_AUTO_REFRESH *********************
check this link too
https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/abap-AddUsercommandfunctionalitytoALVgridreport&
Reward all helpfull answers
Regards
Pavan -
Call user command / PAI from ALV
Hello,
Is there a possibility to call a user command from within an ALV method? I want the PAI module of the ALV's screen to run.
best regards
RolandHi,
Yes you can make an ALV interactive which will execute is PAI (USER COMMAND) when user performs any action.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy_repid " report id
i_callback_pf_status_set = 'PF' " for PF-STATUS
i_callback_user_command = 'COMMAND' " for User-Command
is_layout = wa_layout " for layout
it_fieldcat = it_field " field catalog
TABLES
t_outtab = it_final " internal table
EXCEPTIONS
program_error = 1
OTHERS = 2.
When you double-click on any cell of alv grid, use this code to fetch the data of the line that you currently clicked, its working:-
When you double click on the ALV grid line, you will have sy-ucomm = '&IC1'.
So when you define a i_callback_user_command for the FM reuse_alv_grid_display, and create it as:-
FORM command USING ucomm LIKE sy-ucomm selfield TYPE slis_selfield.
DATA : ok_code TYPE sy-ucomm.
ok_code = ucomm.
CASE ok_code.
WHEN '&IC1'. "for double click on alv grid line
" your code
ENDCASE.
ENDFORM.
As you have used selfield TYPE slis_selfield, the field selfield will hold all the values.
To know on which row you have clicked and to retain that line, use code:-
Suppose you are currently displaying data from internal table itab and corresponding to it you have work area wa.
read table itab into wa index selfield-tabindex. "index value of line you clicked
" now you have the contents of line that you double clicked currently
Now to know the field name that you clicked, use:-
selfield-fieldname " will fetch you the name of field that you clicked
Now using the work-area and the name of field that you clicked, you can easily make out the details of the field i.e., field name and field value and you can code as per your requirement.
Also you can refer this wiki by me on:-
ALV Grid Display with checkbox to process selected records at runtime
https://www.sdn.sap.com/irj/scn/wiki?path=/display/snippets/alv%252bgrid%252bdisplay%252bwith%252bcheckbox%252bto%252bprocess%252bselected%252brecords%252bat%252bruntime
To have checkbox with each record in alv and display on those records on next display which were selected by the user on initial grid.
Hope this helps you.
Regards,
Tarun
Edited by: Tarun Gambhir on Mar 6, 2009 2:48 PM -
User command is not getting triggered in interactive ALV with LIST display
Hi experts,
I have developed an interactive ALV report with LIST display. Here, the issue is, when i double click a record in the primary ALV list, the control must go to the USER COMMAND event which i have written in my report. But the user command event is not getting triggered at all when i double click any record.
It gives the following information instead.
"Choose a valid function".
(My user command name and its respective form name are same.)
Here is my code..
START-OF-SELECTION.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_structure_name = p_table
i_callback_user_command = 'TST1'
i_callback_pf_status_set = 'SET_PF_STATUS'
TABLES
t_outtab = <dyn_table>
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
ENDIF.
FORM tst1 USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
* Local data declaration
DATA: li_tab TYPE REF TO data,
l_line TYPE REF TO data.
* Local field-symbols
FIELD-SYMBOLS:<l_tab> TYPE table,
<l_wa> TYPE ANY.
* Create table
CREATE DATA li_tab TYPE STANDARD TABLE OF (p_table).
ASSIGN li_tab->* TO <l_tab>.
* Create workarea
CREATE DATA l_line LIKE LINE OF <l_tab>.
ASSIGN l_line->* TO <l_wa>. CASE r_ucomm.
* When a record is selected
WHEN '&IC1'.
* Read the selected record
READ TABLE <dyn_table> ASSIGNING <dyn_wa> INDEX
rs_selfield-tabindex. IF sy-subrc = 0.
* Store the record in an internal table
APPEND <dyn_wa> TO <l_tab>.
* Fetch the field catalog info
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = 'Z_DEMO_PDF_JG'
i_structure_name = p_table
CHANGING
ct_fieldcat = i_fieldcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
Please advice what is the msitake i have done here..Read the following code:
pass the i_callback_user_command = g_user_command to the ALV function module and write the FORM user_command USING ucomm LIKE sy-ucomm
selfield TYPE slis_selfield.
as shown below.
thanx
Data for ALV display
DATA : gt_fieldcat TYPE slis_t_fieldcat_alv,
gt_events TYPE slis_t_event,
g_variant LIKE disvariant,
g_user_command TYPE slis_formname VALUE 'USER_COMMAND',
g_status TYPE slis_formname VALUE 'SET_PF_STATUS',
gt_list_top_of_page TYPE slis_t_listheader,
g_repid LIKE sy-repid,
gf_pos TYPE i
Data for ALV display
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = g_repid
i_callback_program = sy-repid
it_fieldcat = gt_fieldcat[]
it_events = gt_events[]
i_callback_user_command = g_user_command
i_save = 'A'
is_variant = g_variant
TABLES
t_outtab = it_print.
FORM user_command USING ucomm LIKE sy-ucomm
selfield TYPE slis_selfield.
CASE ucomm.
WHEN '&IC1'.
CASE selfield-sel_tab_field.
WHEN '1-KUNNR'.
READ TABLE it_print INTO wa_print INDEX selfield-tabindex.
IF sy-subrc = 0.
SET PARAMETER ID 'BPA' FIELD wa_print-kunnr.
CALL TRANSACTION 'BP'.
ENDIF.
WHEN '1-MATNR'.
READ TABLE it_print INTO wa_print INDEX selfield-tabindex.
IF sy-subrc = 0.
SET PARAMETER ID 'JP_ISS' FIELD wa_print-matnr.
CALL TRANSACTION 'JP29' AND SKIP FIRST SCREEN..
GET PARAMETER ID 'WRK' FIELD wa_zprint-werks.
SET PARAMETER ID 'VKO' FIELD wa_zprint-vkorg.
SET PARAMETER ID 'VTW' FIELD wa_zprint-vtweg.
CALL TRANSACTION 'JP29' AND SKIP FIRST SCREEN.
ENDIF.
Endcase.
Endform. -
Problem with User Command in alv report
Hi
I have developed a ALV grid report with drill down capability to transaction code for user command. I am having a trouble with this.
CASE ucomm.
WHEN '&IC1'.
CLEAR: wa_import.
IF selfield-fieldname EQ 'ANLN1'.
READ TABLE t_import INTO wa_import INDEX selfield-tabindex.
SET PARAMETER ID 'BUK' FIELD wa_import-bukrs.
SET PARAMETER ID 'ANl' FIELD wa_import-anln1.
CALL TRANSACTION 'AW01N'.
ENDIF.
here my parameter ids are showing the values but when i call the transaction i am not getting the actual asset numbers.
Can someone help me out this
ThanksHi,
add the AND SKIP FIRST SCREEN...addition..
CALL TRANSACTION 'AW01N' AND SKIP FIRST SCREEN.
Thanks
Naren -
User command for checkbox in alv grid output
Hi,
Does anyone knows the user command for checkbox in alv grid display. My requirement is to have a column for checkbox in alv output. When the user checks the checkbox, a pop-up dialog box will appear. This dialog box was created in screen painter. I can't find the user command for this. Please help.
Thanks in advance.Hi,
there r two ways for creating checkbox col on the ALV grid.
1.) take an extra field in your internal table i.e
data:
checkbox type c.
loop at internal_table into wa.
checkbox.
endloop.
or
the fieldcatalog attribute
2.) wa_fcat-checkbox = 'X'.
append wa_fcat to t_fcat.
clear wa_fcat.
if itab-checkbox = 'X'.
call screen <dialogbox screen number>.
endif.
regards
ravi -
How to handle user command method in module ALV Grid
HI Experts,
I have 3 containers grid.
GR_GRID TYPE REF TO CL_GUI_ALV_GRID,
GR_GRID1 TYPE REF TO CL_GUI_ALV_GRID,
GR_GRID2 TYPE REF TO CL_GUI_ALV_GRID.
Please advise me how can I insert, save, delete 3 Module ALV Grid in method user command. How can i get which grid button (save, insert, delete) is clicked and how can i control those grid.
Thks in advance.
CLASS LCL_EVENT_RECEIVER DEFINITION.
PUBLIC SECTION.
METHODS :
HANDLE_TOOLBAR
FOR EVENT TOOLBAR OF CL_GUI_ALV_GRID
IMPORTING E_OBJECT E_INTERACTIVE SENDER,
HANDLE_USER_COMMAND
FOR EVENT USER_COMMAND OF CL_GUI_ALV_GRID
IMPORTING E_UCOMM,
HANDLE_DATA_CHANGED
FOR EVENT DATA_CHANGED OF CL_GUI_ALV_GRID
IMPORTING ER_DATA_CHANGED
E_ONF4
E_ONF4_BEFORE
E_ONF4_AFTER,
HANDLE_DOUBLE_CLICK
FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID
IMPORTING E_ROW
E_COLUMN,
HANDLE_HOTSPOT_CLICK
FOR EVENT HOTSPOT_CLICK OF CL_GUI_ALV_GRID
IMPORTING E_ROW_ID
E_COLUMN_ID
ES_ROW_NO.
ENDCLASS. "(LCL_EVENT_RECEIVER DEFINITION)
METHOD HANDLE_USER_COMMAND.
CLEAR G_CODE.
G_CODE = E_UCOMM.
CASE G_CODE.
WHEN 'INSERT'.
MESSAGE 'insert' TYPE 'I'.
APPEND INITIAL LINE TO GT_MAIN.
WHEN 'SAVE'.
MODIFY ZTNBOOK FROM GT_MAIN.
MESSAGE 'save' TYPE 'I'.
WHEN 'DELETE'.
DELETE FROM ZTNBOOK WHERE B_ID EQ GT_ZTBOOK-B_ID.
MESSAGE 'delete' TYPE 'I'.
ENDCASE.
IF NOT G_CODE IS INITIAL.
PBO, PAI
CALL METHOD CL_GUI_CFW=>SET_NEW_OK_CODE
EXPORTING
NEW_CODE = G_CODE.
CLEAR G_CODE.
ENDIF.
ENDMETHOD.Hi,
Before posting, Search in SDN.
See the below tread it will help you.
Re: Get table for cl_gui_alv_grid -
how to handle user command in alv grid?
if we want to select only one row, but we get a table from calling method
get_selected_rows.
is there any method or way of getting a single row which is selected?Hi,
This method indeed returns the table but only with the selected rows. Therefore when you select only one row, it will contain only one entry. For this use second parameter of the method ET_ROW_NO as the first one is obsolete. It will contain indexes of the selected rows.
Note!
You must use one of the these selection modes (A, C, D) in this case. The default one is B, so you have to change it in layout structure.
layout_structure-sel_mode = 'A'. "i.e.
See possible selection modes [here|http://help.sap.com/saphelp_erp2004/helpdata/en/ef/a2e9eff88311d2b48d006094192fe3/frameset.htm]
Regards
Marcin -
Hi
I am displaying the output of a report in the ALV grid.
I have used REUSE_ALV_LIST_DISPLAY in my code as follows.
FORM DISPLAY_ALV_LIST.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SYREPID
IS_LAYOUT = FIELDLAYOUT
I_CALLBACK_USER_COMMAND = 'USER-COMMAND'
IT_FIELDCAT = FIELDCATALOG[]
I_SAVE = 'X'
IT_EVENTS = EVENTSTAB[]
TABLES
T_OUTTAB = ITAB_1
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
ENDFORM. " DISPLAY_ALV_LIST
When I try to call a transaction at the user command with sy-ucomm = &IC1 sys gives a message 'Not valid'.
FORM USER-COMMAND USING UCOMM LIKE SY-UCOMM
SELFIELD TYPE SLIS_SELFIELD.
READ TABLE ITAB_1 INDEX SELFIELD-TABINDEX.
CHECK SY-SUBRC = 0.
CASE UCOMM.
WHEN '&IC1'.
CASE SELFIELD-SEL_TAB_FIELD.
WHEN 'ITAB_1-VBELN'.
SET PARAMETER ID 'VF' FIELD ITAB_1-VBELN.
CALL TRANSACTION 'VF03' AND SKIP FIRST SCREEN.
WHEN 'ITAB_1-MATNR'.
SET PARAMETER ID 'MAT' FIELD ITAB_1-MATNR.
CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.
ENDCASE.
ENDCASE.
ENDFORM. "USER_COMMAND
Kindly let me know what am I missing in the above code. As this FORM USER-COMMAND is at all called during the user-command.
Regds
Priyathe Code what u are given is WRONG , check this one.
put like this , it will solve ur probs.
check r_ucomm = '&IC1'. "User Double Clicked on Some field
check not rs_selfield-value is initial.
case rs_selfield-fieldname.
when 'AUFNR'.
if rad4 ne 'X'.
read table itab_order index rs_selfield-tabindex.
else.
read table itab_order2 index rs_selfield-tabindex.
itab_order-aufnr = itab_order2-aufnr.
endif.
if sy-subrc eq 0.
set parameter id 'ANR' field itab_order-aufnr.
set parameter id 'VGN' field '10'.
call transaction 'CO14' and skip first screen.
endif. " IF SY-SUBRC EQ 0
endcase.
Regards
Prabhu
Message was edited by: Prabhu Peram -
USER COMMAND FOR INTERACTIVE ALV REPORT
Hi Frens
I am making an interactive alv report showing a cost center hierarchy. I could scuccessfully capture the first click event in the user command using '&IC1'. Now i want to capture the second click event for the third hierarchy.
When i try to do that, the program flow keeps hitting the same user command time n again. I want to put in a different code for the different click events. What is the way to achieve this?
I searched ....there is nothing like '&IC2'. It does not work.hi,
You can try this for the first click
READ TABLE IST_EVENTS INTO WA_EVENT WITH KEY NAME = 'USER_COMMAND'.
IF SY-SUBRC EQ 0.
WA_EVENT-FORM = 'USER_COMMAND'.
MODIFY IST_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME = WA_EVENT-NAME.
ENDIF.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = G_REPID
I_CALLBACK_PF_STATUS_SET = C_PF "'SET_PF_STATUS'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'
I_GRID_TITLE = G_TITLE
IS_LAYOUT = IST_LAYOUT
IT_FIELDCAT = IST_FIELDCAT[]
IT_SORT = IST_SORT
I_SAVE = 'A'
IT_EVENTS = IST_EVENTS
IS_PRINT = IST_PRNT
IMPORTING
E_EXIT_CAUSED_BY_CALLER = G_EXIT
ES_EXIT_CAUSED_BY_USER = IST_EXIT
TABLES
T_OUTTAB = IST_FINAL "sodtl
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
FORM USER_COMMAND USING R_UCOMM TYPE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
your code....
ENDFORM.
for second click
READ TABLE IST_EVENTS INTO WA_EVENT WITH KEY NAME = 'USER_COMMAND1'.
IF SY-SUBRC EQ 0.
WA_EVENT-FORM = 'USER_COMMAND1'.
MODIFY IST_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME = WA_EVENT-NAME.
ENDIF.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = G_REPID
I_CALLBACK_PF_STATUS_SET = C_PF "'SET_PF_STATUS'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND1'
I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'
I_GRID_TITLE = G_TITLE
IS_LAYOUT = IST_LAYOUT
IT_FIELDCAT = IST_FIELDCAT[]
I_SAVE = 'A'
TABLES
T_OUTTAB = IST_FINAL1.
hope this solves. -
ALV using LVC....User Commands
Hai All..
Can anyone explain how can we handle the user commands like single click or a double click in an ALV using LVC type-pool.
Thanks in Advance,
ramaHi,
Check the demo programs BCALV_TEST_GRID_EVENTS and BCALV_TEST_FULLSCREEN_EVENTS.
Regards,
Sesh -
ALV Grid Problem - User command Back Cancel Exit
Hi Guys,
I was trying to use the ALV grid and my problem is, on the grid display, when i try to hit the back button or exit or cancel, then a blank screen appears and i need to hit either back or other buttons one more time to go back to the selection screen.
Is there any thing I am missing here? Please suggest me the solution.
Thanks in advance,
Srinivas.hi srinivas,
we have 2 options in this case.
1) i think ur using EVENTS_GET function module. If u use sometimes we are facing this kind of problem. i think accroding to my knowliege its bug in SAP....
2) See in debug mode what is the user command for this back button everty time USERCOMMAND FOR BACK BUTTON not 'BACK' .If it ios correct plaese add the code for back button in user command event.
if u dont want to face that problem remove that events_get fm and write the code manually. i am not sure abt ur code.
i hope u got the point what i am saying.
Thanks,
Maheedhar -
AT USER-COMMAND IN NORMAL REPORT
Please do not have your subject in ALL CAPITALS
Hi Experts,
Please advice,
I am having three fields in output first one is directly fetched from table and other two are variables.
ITAB-MENGE = fetched data.
ITAB-UCOMM = user command.
AT SELECTION-SCREEN OUTPUT
when the user press ENTER
ITAB-SUM = ITAB-MENGE + ITAB-UCOMM.
For eq:
Suppose if:
ITAB-MENGE = 100
and if the user enters the value in ITAB-UCOMM = 200
and when the user press enter the sum should display on the other field ITAB-SUM
Note: I am using normal write statement ( not ALV ) & I am not using any parameters in selection screen all these has to fired on output screen
Thanks
R.Karthik
Edited by: Karthik R on Feb 28, 2009 3:34 PM
Edited by: Matt on Mar 1, 2009 7:18 PMHi,
Refer code:-
REPORT Z19TG7_1 NO STANDARD PAGE HEADING.
TABLES : LFA1.
TYPES : BEGIN OF VENDOR,
LIFNR LIKE LFA1-LIFNR,
NAME1 LIKE LFA1-NAME1,
END OF VENDOR,
BEGIN OF VENDOR1,
LIFNR LIKE LFA1-LIFNR,
NAME1 LIKE LFA1-NAME1,
ORT01 LIKE LFA1-ORT01,
LAND1 LIKE LFA1-LAND1,
BUKRS LIKE LFB1-BUKRS,
END OF VENDOR1.
DATA : VENDOR_TAB TYPE STANDARD TABLE OF VENDOR INITIAL SIZE 20 WITH HEADER LINE,
VENDOR1_TAB TYPE STANDARD TABLE OF VENDOR1 INITIAL SIZE 20 WITH HEADER LINE,
CB.
* WAS_USED.
TOP-OF-PAGE DURING LINE-SELECTION.
WRITE SY-LSIND.
START-OF-SELECTION.
SET PF-STATUS 'Z19TG7_1_PF'.
SELECT LIFNR NAME1
FROM LFA1
INTO TABLE VENDOR_TAB.
AT USER-COMMAND.
CASE SY-UCOMM.
WHEN 'VL'.
IF SY-LSIND = 1.
SET PF-STATUS SPACE.
DO.
CLEAR CB.
READ LINE SY-INDEX FIELD VALUE CB.
IF SY-SUBRC <> 0.
EXIT.
ELSE.
CHECK CB = 'X'.
MODIFY CURRENT LINE : FIELD VALUE CB FROM SPACE.
SELECT A~LIFNR A~NAME1 A~ORT01 A~LAND1 B~BUKRS
FROM LFA1 AS A
LEFT OUTER JOIN LFB1 AS B
ON A~LIFNR = B~LIFNR
INTO TABLE VENDOR1_TAB
WHERE A~LIFNR = VENDOR_TAB-LIFNR.
LOOP AT VENDOR1_TAB.
WRITE : / 'Vendor ID:' NO-GAP, VENDOR1_TAB-LIFNR,
/ 'Vendor Name :' NO-GAP, VENDOR1_TAB-NAME1,
/ 'City :' NO-GAP, VENDOR1_TAB-ORT01,
/ 'Land :' NO-GAP, VENDOR1_TAB-LAND1,
/ 'Country Code :' NO-GAP, VENDOR1_TAB-BUKRS.
ULINE.
ENDLOOP.
ENDIF.
ENDDO.
ENDIF.
ENDCASE.
END-OF-SELECTION.
WRITE : /1 'CB', 5 TEXT-001, 18 TEXT-002.
ULINE.
LOOP AT VENDOR_TAB.
WRITE : /1 CB AS CHECKBOX, 5 VENDOR_TAB-LIFNR, 18 VENDOR_TAB-NAME1.
HIDE : VENDOR_TAB-LIFNR.
ENDLOOP.
ULINE.
Hope this helps you.
Regards,
Tarun
Maybe you are looking for
-
I have uninstalled, reinstalled, scraped, redo.. and Adobe Flash is still not working on my 64 bit Win 7 system - where can I get an older version of flash it used to work - I have been fighting this for weeks and I have just about had it!!!
-
Envy 15 3205TX - Windows 8.1 Update Issues
Updated to Windows 8.1 1. Audio no longer works, even though drivers says everything is working and the sound volume bar shows flutuation onscreen. 2. Everything looks grainy and magnified, updated to newest Radeon Drivers, same results. 3. Beats Aud
-
How can i add an image to a caption in a slideshow?
So i have a slideshow with 3 images and 3 captions. i want to add a different image in each caption. how can i do this? thanks.
-
CPIC_MAX_CONV - ERROR max no of 100 conversations exceeded
I recvd the "ERROR max no of 100 conversations exceeded" and I could resolve it by setting the environment variable CPIC_MAX_CONV to a higher value for my <sid>adm per note 316877. What I want to know is where can i check to see if this environment
-
How do i get my uk mac to work in the USA?
Hi My relocation helpers are telling me that all of my UK electricals will need to be replaced when we move to the USA - does this also apply to my mac?